Better distinction between Widgets using the mod's DefaultRules or the map's Rules
This commit is contained in:
@@ -55,12 +55,12 @@ namespace OpenRA.Widgets
|
||||
public Action OnDoubleClick = () => {};
|
||||
public Action<KeyInput> OnKeyPress = _ => {};
|
||||
|
||||
readonly Ruleset rules;
|
||||
readonly Ruleset modRules;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ButtonWidget(Ruleset rules)
|
||||
public ButtonWidget(Ruleset modRules)
|
||||
{
|
||||
this.rules = rules;
|
||||
this.modRules = modRules;
|
||||
|
||||
GetText = () => { return Text; };
|
||||
GetColor = () => TextColor;
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Widgets
|
||||
protected ButtonWidget(ButtonWidget other)
|
||||
: base(other)
|
||||
{
|
||||
this.rules = other.rules;
|
||||
this.modRules = other.modRules;
|
||||
|
||||
Text = other.Text;
|
||||
Font = other.Font;
|
||||
@@ -122,10 +122,10 @@ namespace OpenRA.Widgets
|
||||
if (!IsDisabled())
|
||||
{
|
||||
OnKeyPress(e);
|
||||
Sound.PlayNotification(rules, null, "Sounds", "ClickSound", null);
|
||||
Sound.PlayNotification(modRules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
else
|
||||
Sound.PlayNotification(rules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Sound.PlayNotification(modRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -162,12 +162,12 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
OnMouseDown(mi);
|
||||
Depressed = true;
|
||||
Sound.PlayNotification(rules, null, "Sounds", "ClickSound", null);
|
||||
Sound.PlayNotification(modRules, null, "Sounds", "ClickSound", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
YieldMouseFocus(mi);
|
||||
Sound.PlayNotification(rules, null, "Sounds", "ClickDisabledSound", null);
|
||||
Sound.PlayNotification(modRules, null, "Sounds", "ClickDisabledSound", null);
|
||||
}
|
||||
}
|
||||
else if (mi.Event == MouseInputEvent.Move && HasMouseFocus)
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace OpenRA.Widgets
|
||||
public bool HasPressedState = ChromeMetrics.Get<bool>("CheckboxPressedState");
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CheckboxWidget(Ruleset rules)
|
||||
: base(rules)
|
||||
public CheckboxWidget(Ruleset modRules)
|
||||
: base(modRules)
|
||||
{
|
||||
GetCheckType = () => CheckType;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Widgets
|
||||
MaskWidget fullscreenMask;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public DropDownButtonWidget(Ruleset rules)
|
||||
: base(rules) { }
|
||||
public DropDownButtonWidget(Ruleset modRules)
|
||||
: base(modRules) { }
|
||||
|
||||
protected DropDownButtonWidget(DropDownButtonWidget widget) : base(widget) { }
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Widgets
|
||||
public string BaseName = "scrollitem";
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ScrollItemWidget(Ruleset rules)
|
||||
: base(rules)
|
||||
public ScrollItemWidget(Ruleset modRules)
|
||||
: base(modRules)
|
||||
{
|
||||
IsVisible = () => false;
|
||||
VisualHeight = 0;
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace OpenRA
|
||||
if (child.Key != "Children")
|
||||
FieldLoader.LoadField(widget, child.Key, child.Value.Value);
|
||||
|
||||
if (!args.ContainsKey("rules"))
|
||||
args = new WidgetArgs(args) { { "rules", modData.DefaultRules } };
|
||||
if (!args.ContainsKey("modRules"))
|
||||
args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
|
||||
widget.Initialize(args);
|
||||
|
||||
foreach (var child in node.Value.Nodes)
|
||||
|
||||
Reference in New Issue
Block a user