Factor out CSkin class
Replace usages of GetColor and remove GetColor(..., skinIndex,...)
This commit is contained in:
1 parent
1c884f3acb
commit
89e528c2a6
22 files changed
+584
-861
No files matched your search
@@ -28,50 +28,32 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("NameSelection")]
|
||||
public struct SThemeNameSelection
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlElement("Rect")]
|
||||
public SRectF Rect;
|
||||
[XmlElement("SkinEmptyTile")]
|
||||
public string TextureEmptyTileName;
|
||||
[XmlElement("ColorEmptyTile")]
|
||||
public SThemeColor ColorEmptyTile;
|
||||
[XmlElement("SkinTileSelected")]
|
||||
public string TextureTileSelectedName;
|
||||
[XmlElement("Tiles")]
|
||||
public SThemeNameSelectionTiles Tiles;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlElement("Rect")] public SRectF Rect;
|
||||
[XmlElement("SkinEmptyTile")] public string TextureEmptyTileName;
|
||||
[XmlElement("ColorEmptyTile")] public SThemeColor ColorEmptyTile;
|
||||
[XmlElement("SkinTileSelected")] public string TextureTileSelectedName;
|
||||
[XmlElement("Tiles")] public SThemeNameSelectionTiles Tiles;
|
||||
}
|
||||
|
||||
public struct SThemeNameSelectionTiles
|
||||
{
|
||||
[XmlElement("W")]
|
||||
public int W;
|
||||
[XmlElement("H")]
|
||||
public int H;
|
||||
[XmlElement("NumW")]
|
||||
public int NumW;
|
||||
[XmlElement("NumH")]
|
||||
public int NumH;
|
||||
[XmlElement("SpaceW")]
|
||||
public float SpaceW;
|
||||
[XmlElement("SpaceH")]
|
||||
public float SpaceH;
|
||||
[XmlElement("Name")]
|
||||
public SThemeNameSelectionName Name;
|
||||
[XmlElement("W")] public int W;
|
||||
[XmlElement("H")] public int H;
|
||||
[XmlElement("NumW")] public int NumW;
|
||||
[XmlElement("NumH")] public int NumH;
|
||||
[XmlElement("SpaceW")] public float SpaceW;
|
||||
[XmlElement("SpaceH")] public float SpaceH;
|
||||
[XmlElement("Name")] public SThemeNameSelectionName Name;
|
||||
}
|
||||
|
||||
public struct SThemeNameSelectionName
|
||||
{
|
||||
[XmlElement("Space")]
|
||||
public float Space;
|
||||
[XmlElement("H")]
|
||||
public float Height;
|
||||
[XmlElement("Font")]
|
||||
public string Font;
|
||||
[XmlElement("Style")]
|
||||
public EStyle Style;
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("Space")] public float Space;
|
||||
[XmlElement("H")] public float Height;
|
||||
[XmlElement("Font")] public string Font;
|
||||
[XmlElement("Style")] public EStyle Style;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
}
|
||||
|
||||
public class CNameSelection : IMenuElement
|
||||
@@ -117,8 +99,8 @@ namespace VocaluxeLib.Menu
|
||||
get { return _TextureEmptyTile; }
|
||||
}
|
||||
|
||||
public SColorF ColorEmptyTile;
|
||||
|
||||
private SColorF _ColorEmptyTile;
|
||||
private SColorF _ColorNameTile;
|
||||
|
||||
public int Offset;
|
||||
private int _ActualSelection = -1;
|
||||
@@ -185,13 +167,13 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.TextureEmptyTileName, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTile.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTile.Name, skinIndex, out ColorEmptyTile);
|
||||
_ThemeLoaded &= _Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref ColorEmptyTile.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref ColorEmptyTile.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref ColorEmptyTile.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref ColorEmptyTile.A);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _ColorEmptyTile.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _ColorEmptyTile.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _ColorEmptyTile.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _ColorEmptyTile.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty);
|
||||
@@ -207,7 +189,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.Tiles.Name.Font, "Normal");
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.Tiles.Name.Style);
|
||||
if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.Tiles.Name.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Tiles.Name.Color.Name, skinIndex, out _Theme.Tiles.Name.Color.Color);
|
||||
_ThemeLoaded &= _Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile);
|
||||
else
|
||||
{
|
||||
if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.Tiles.Name.Color.Color.R))
|
||||
@@ -224,7 +206,7 @@ namespace VocaluxeLib.Menu
|
||||
_Theme.Name = elementName;
|
||||
|
||||
_Theme.Rect = new SRectF(Rect);
|
||||
_Theme.ColorEmptyTile.Color = new SColorF(ColorEmptyTile);
|
||||
_Theme.ColorEmptyTile.Color = new SColorF(_ColorEmptyTile);
|
||||
|
||||
LoadTextures();
|
||||
}
|
||||
@@ -401,7 +383,7 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
{
|
||||
_Tiles[i].Avatar.Texture = _TextureEmptyTile;
|
||||
_Tiles[i].Avatar.Color = ColorEmptyTile;
|
||||
_Tiles[i].Avatar.Color = _ColorEmptyTile;
|
||||
_Tiles[i].Name.Text = "";
|
||||
_Tiles[i].ProfileID = -1;
|
||||
}
|
||||
@@ -449,13 +431,8 @@ namespace VocaluxeLib.Menu
|
||||
_TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID);
|
||||
_TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID);
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTile.Name))
|
||||
ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTile.Name, _PartyModeID);
|
||||
else
|
||||
ColorEmptyTile = _Theme.ColorEmptyTile.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.Tiles.Name.Color.Name))
|
||||
_Theme.Tiles.Name.Color.Color = CBase.Theme.GetColor(_Theme.Tiles.Name.Color.Name, _PartyModeID);
|
||||
_Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile);
|
||||
_Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
}
|
||||
@@ -517,9 +494,11 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
for (int j = 0; j < _Theme.Tiles.NumW; j++)
|
||||
{
|
||||
var rect = new SRectF(Rect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), Rect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH), _Theme.Tiles.W, _Theme.Tiles.H, Rect.Z);
|
||||
var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop};
|
||||
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.Tiles.Name.Space, rect.Z, _Theme.Tiles.Name.Height, rect.W, EAlignment.Center, _Theme.Tiles.Name.Style,
|
||||
var rect = new SRectF(Rect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), Rect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH), _Theme.Tiles.W, _Theme.Tiles.H,
|
||||
Rect.Z);
|
||||
var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, _ColorEmptyTile, rect) {Aspect = EAspect.Crop};
|
||||
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.Tiles.Name.Space, rect.Z, _Theme.Tiles.Name.Height, rect.W, EAlignment.Center,
|
||||
_Theme.Tiles.Name.Style,
|
||||
_Theme.Tiles.Name.Font, _Theme.Tiles.Name.Color.Color, "");
|
||||
_Tiles.Add(new CTile(tileStatic, tileText, -1));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user