Make SelText a nullable

This commit is contained in:
Flamefire committed 2014-10-24 23:00:29 +02:00
1 parent eca0dd68ca
commit 8ed9f56d30
2 files changed
+12 -8

No files matched your search

+11 -8
View File
@@ -34,8 +34,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color; public SThemeColor Color;
public SThemeColor SelColor; public SThemeColor SelColor;
public SThemeText Text; public SThemeText Text;
public SThemeText SelText; public SThemeText? SelText;
[XmlIgnore] public bool SelTextSpecified;
public SReflection? Reflection; public SReflection? Reflection;
public SReflection? SelReflection; public SReflection? SelReflection;
} }
@@ -121,7 +120,7 @@ namespace VocaluxeLib.Menu
_Theme = theme; _Theme = theme;
Text = new CText(_Theme.Text, _PartyModeID, buttonText); Text = new CText(_Theme.Text, _PartyModeID, buttonText);
_SelText = _Theme.SelTextSpecified ? new CText(_Theme.SelText, _PartyModeID, buttonText) : null; _SelText = _Theme.SelText.HasValue ? new CText(_Theme.SelText.Value, _PartyModeID, buttonText) : null;
Selected = false; Selected = false;
EditMode = false; EditMode = false;
@@ -197,10 +196,11 @@ namespace VocaluxeLib.Menu
Text.Z = Rect.Z; Text.Z = Rect.Z;
if (xmlReader.ItemExists(item + "/SText")) if (xmlReader.ItemExists(item + "/SText"))
{ {
_Theme.SelTextSpecified = true;
_ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, true); _ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, true);
_SelText.Z = Rect.Z; _SelText.Z = Rect.Z;
} }
else
_SelText = null;
//Reflections //Reflections
@@ -238,7 +238,10 @@ namespace VocaluxeLib.Menu
_Theme.Color.Color = Color; _Theme.Color.Color = Color;
_Theme.SelColor.Color = SelColor; _Theme.SelColor.Color = SelColor;
_Theme.Text = Text.GetTheme(); _Theme.Text = Text.GetTheme();
_Theme.SelText = _SelText.GetTheme(); if (_SelText == null)
_Theme.SelText = null;
else
_Theme.SelText = _SelText.GetTheme();
LoadSkin(); LoadSkin();
} }
@@ -266,7 +269,7 @@ namespace VocaluxeLib.Menu
else else
Text.DrawRelative(Rect.X, Rect.Y); Text.DrawRelative(Rect.X, Rect.Y);
} }
else if (!_Theme.SelTextSpecified) else if (_SelText == null)
{ {
texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID); texture = SelTexture ?? CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID);
@@ -311,9 +314,9 @@ namespace VocaluxeLib.Menu
Text = new CText(_Theme.Text, _PartyModeID); Text = new CText(_Theme.Text, _PartyModeID);
Text.LoadSkin(); Text.LoadSkin();
if (_Theme.SelTextSpecified) if (_Theme.SelText.HasValue)
{ {
_SelText = new CText(_Theme.SelText, _PartyModeID); _SelText = new CText(_Theme.SelText.Value, _PartyModeID);
_SelText.LoadSkin(); _SelText.LoadSkin();
} }
+1
View File
@@ -18,6 +18,7 @@ namespace VocaluxeLib.Xml
{ {
public string Name; public string Name;
public FieldInfo Info; public FieldInfo Info;
public FieldInfo SpecifiedField;
public bool IsList; //List with child elements (<List><El/><El/></List>) public bool IsList; //List with child elements (<List><El/><El/></List>)
public bool IsEmbeddedList; //List w/o child elements(<List/><List/>) public bool IsEmbeddedList; //List w/o child elements(<List/><List/>)
public bool IsNullable; public bool IsNullable;