Revert "Replace legacy Evaluator with IntegerExpressions."

This reverts commit cd0898236d.
This commit is contained in:
Paul Chote
2017-07-07 21:47:16 +01:00
committed by reaperrr
parent f7c57cfc6f
commit 4f16b0d464
3 changed files with 120 additions and 11 deletions

View File

@@ -196,10 +196,10 @@ namespace OpenRA.Widgets
// Info defined in YAML
public string Id = null;
public IntegerExpression X;
public IntegerExpression Y;
public IntegerExpression Width;
public IntegerExpression Height;
public string X = "0";
public string Y = "0";
public string Width = "0";
public string Height = "0";
public string[] Logic = { };
public ChromeLogic[] LogicObjects { get; private set; }
public bool Visible = true;
@@ -275,17 +275,16 @@ namespace OpenRA.Widgets
substitutions.Add("PARENT_LEFT", parentBounds.Left);
substitutions.Add("PARENT_TOP", parentBounds.Top);
substitutions.Add("PARENT_BOTTOM", parentBounds.Height);
var readOnlySubstitutions = new ReadOnlyDictionary<string, int>(substitutions);
var width = Width != null ? Width.Evaluate(readOnlySubstitutions) : 0;
var height = Height != null ? Height.Evaluate(readOnlySubstitutions) : 0;
var width = Evaluator.Evaluate(Width, substitutions);
var height = Evaluator.Evaluate(Height, substitutions);
substitutions.Add("WIDTH", width);
substitutions.Add("HEIGHT", height);
var x = X != null ? X.Evaluate(readOnlySubstitutions) : 0;
var y = Y != null ? Y.Evaluate(readOnlySubstitutions) : 0;
Bounds = new Rectangle(x, y, width, height);
Bounds = new Rectangle(Evaluator.Evaluate(X, substitutions),
Evaluator.Evaluate(Y, substitutions),
width,
height);
}
public void PostInit(WidgetArgs args)