remove type-specific functions for ChromeMetrics.Get; use FieldLoader
This commit is contained in:
@@ -20,8 +20,8 @@ namespace OpenRA.Widgets
|
|||||||
public string Key = null;
|
public string Key = null;
|
||||||
public string Text = "";
|
public string Text = "";
|
||||||
public bool Depressed = false;
|
public bool Depressed = false;
|
||||||
public int VisualHeight = ChromeMetrics.GetInt("ButtonDepth");
|
public int VisualHeight = ChromeMetrics.Get<int>("ButtonDepth");
|
||||||
public string Font = ChromeMetrics.GetString("ButtonFont");
|
public string Font = ChromeMetrics.Get<string>("ButtonFont");
|
||||||
public Func<string> GetText;
|
public Func<string> GetText;
|
||||||
public Func<bool> IsDisabled = () => false;
|
public Func<bool> IsDisabled = () => false;
|
||||||
public Action OnClick = () => {};
|
public Action OnClick = () => {};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public Func<bool> IsChecked = () => false;
|
public Func<bool> IsChecked = () => false;
|
||||||
public int BaseLine = 1;
|
public int BaseLine = 1;
|
||||||
public bool HasPressedState = ChromeMetrics.GetBool("CheckboxPressedState");
|
public bool HasPressedState = ChromeMetrics.Get<bool>("CheckboxPressedState");
|
||||||
|
|
||||||
public CheckboxWidget()
|
public CheckboxWidget()
|
||||||
: base()
|
: base()
|
||||||
|
|||||||
@@ -30,19 +30,9 @@ namespace OpenRA.Widgets
|
|||||||
data[n.Key] = n.Value.Value;
|
data[n.Key] = n.Value.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetString(string key)
|
public static T Get<T>(string key)
|
||||||
{
|
{
|
||||||
return data[key];
|
return (T)FieldLoader.GetValue( key, typeof(T), data[key] );
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetInt(string key)
|
|
||||||
{
|
|
||||||
return int.Parse(data[key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool GetBool(string key)
|
|
||||||
{
|
|
||||||
return bool.Parse(data[key]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Widgets
|
|||||||
public int ScrollbarWidth = 24;
|
public int ScrollbarWidth = 24;
|
||||||
public float ScrollVelocity = 4f;
|
public float ScrollVelocity = 4f;
|
||||||
public int ItemSpacing = 2;
|
public int ItemSpacing = 2;
|
||||||
public int ButtonDepth = ChromeMetrics.GetInt("ButtonDepth");
|
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
||||||
public string Background = "scrollpanel-bg";
|
public string Background = "scrollpanel-bg";
|
||||||
public int ContentHeight = 0;
|
public int ContentHeight = 0;
|
||||||
protected float ListOffset = 0;
|
protected float ListOffset = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user