Better distinction between Widgets using the mod's DefaultRules or the map's Rules

This commit is contained in:
Pavlos Touboulidis
2014-05-11 01:26:11 +03:00
parent 3eefcc69f8
commit 49ec533481
8 changed files with 34 additions and 34 deletions

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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) { }

View File

@@ -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;

View File

@@ -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)