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
@@ -86,10 +86,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
_Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(CTheme.Cursor.SkinName, -1));
|
||||
_Cursor = CDraw.CopyTexture(CTheme.GetSkinTexture(CTheme.Cursor.SkinName, -1));
|
||||
|
||||
_Cursor.Color = !String.IsNullOrEmpty(CTheme.Cursor.Color)
|
||||
? CTheme.GetColor(CTheme.Cursor.Color, -1) : new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A);
|
||||
CTheme.Cursor.Color.Get(-1, out _Cursor.Color);
|
||||
_Cursor.Rect.W = CTheme.Cursor.W;
|
||||
_Cursor.Rect.H = CTheme.Cursor.H;
|
||||
_Cursor.Rect.Z = CSettings.ZNear;
|
||||
|
||||
+4
-19
@@ -282,29 +282,14 @@ namespace Vocaluxe.Base
|
||||
return CTheme.GetSkinTexture(textureName, partyModeID);
|
||||
}
|
||||
|
||||
public CTextureRef GetSkinVideoTexture(string videoName, int partyModeID)
|
||||
public int GetSkinVideo(string videoName, int partyModeID, bool loop)
|
||||
{
|
||||
return CTheme.GetSkinVideoTexture(videoName, partyModeID);
|
||||
return CTheme.GetSkinVideo(videoName, partyModeID, loop);
|
||||
}
|
||||
|
||||
public void SkinVideoResume(string videoName, int partyModeID)
|
||||
public bool GetColor(string colorName, int partyModeID, out SColorF color)
|
||||
{
|
||||
CTheme.SkinVideoResume(videoName, partyModeID);
|
||||
}
|
||||
|
||||
public void SkinVideoPause(string videoName, int partyModeID)
|
||||
{
|
||||
CTheme.SkinVideoPause(videoName, partyModeID);
|
||||
}
|
||||
|
||||
public SColorF GetColor(string colorName, int partyModeID)
|
||||
{
|
||||
return CTheme.GetColor(colorName, partyModeID);
|
||||
}
|
||||
|
||||
public bool GetColor(string colorName, int skinIndex, out SColorF color)
|
||||
{
|
||||
return CTheme.GetColor(colorName, skinIndex, out color);
|
||||
return CTheme.GetColor(colorName, partyModeID, out color);
|
||||
}
|
||||
|
||||
public SColorF GetPlayerColor(int playerNr)
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Draw;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
class CSkinElement
|
||||
{
|
||||
public string Value;
|
||||
public CTextureRef Texture;
|
||||
}
|
||||
|
||||
class CVideoSkinElement : CSkinElement
|
||||
{
|
||||
public int VideoStream = -1;
|
||||
}
|
||||
|
||||
class CSkin
|
||||
{
|
||||
private const int _SkinSystemVersion = 3;
|
||||
|
||||
private readonly string _Folder;
|
||||
private readonly string _FileName;
|
||||
public readonly int PartyModeID;
|
||||
|
||||
public string Name;
|
||||
private string _Author;
|
||||
private int _SkinVersionMajor;
|
||||
private int _SkinVersionMinor;
|
||||
|
||||
public readonly Dictionary<string, CSkinElement> SkinList = new Dictionary<string, CSkinElement>();
|
||||
public readonly Dictionary<string, CVideoSkinElement> VideoList = new Dictionary<string, CVideoSkinElement>();
|
||||
|
||||
private readonly Dictionary<string, SColorF> _ColorSchemes = new Dictionary<string, SColorF>();
|
||||
private SColorF?[] _PlayerColors;
|
||||
|
||||
public CSkin(string folder, string file, int partyModeId)
|
||||
{
|
||||
_Folder = folder;
|
||||
_FileName = file;
|
||||
PartyModeID = partyModeId;
|
||||
}
|
||||
|
||||
#region Load/Save
|
||||
public bool Init()
|
||||
{
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName));
|
||||
if (xmlReader == null)
|
||||
return false;
|
||||
|
||||
int version = 0;
|
||||
if (!xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version) || version != _SkinSystemVersion)
|
||||
{
|
||||
string msg = "Can't load Skin \"" + _FileName + "\", ";
|
||||
if (version < _SkinSystemVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current SkinSystemVersion is " + _SkinSystemVersion;
|
||||
CLog.LogError(msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok = xmlReader.GetValue("//root/Info/Name", out Name);
|
||||
ok &= xmlReader.GetValue("//root/Info/Author", out _Author, String.Empty);
|
||||
ok &= xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref _SkinVersionMajor);
|
||||
ok &= xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref _SkinVersionMinor);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
CLog.LogError("Can't load skin \"" + _FileName + "\". Invalid file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
Debug.Assert(SkinList.Count == 0 && VideoList.Count == 0);
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName));
|
||||
if (xmlReader == null)
|
||||
return false;
|
||||
|
||||
// load skins/textures
|
||||
List<string> names = xmlReader.GetNames("//root/Skins/*");
|
||||
foreach (string name in names)
|
||||
{
|
||||
CSkinElement sk = new CSkinElement();
|
||||
xmlReader.GetValue("//root/Skins/" + name, out sk.Value);
|
||||
sk.Texture = CDraw.AddTexture(Path.Combine(_Folder, sk.Value));
|
||||
if (sk.Texture == null)
|
||||
{
|
||||
CLog.LogError("Error on loading texture \"" + name + "\": " + sk.Value, true);
|
||||
return false;
|
||||
}
|
||||
SkinList.Add(name, sk);
|
||||
}
|
||||
|
||||
// load videos
|
||||
names = xmlReader.GetNames("//root/Videos/*");
|
||||
foreach (string name in names)
|
||||
{
|
||||
CVideoSkinElement sk = new CVideoSkinElement();
|
||||
xmlReader.GetValue("//root/Videos/" + name, out sk.Value);
|
||||
VideoList.Add(name, sk);
|
||||
}
|
||||
|
||||
// load colors
|
||||
_LoadColors(xmlReader);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
foreach (CSkinElement sk in SkinList.Values)
|
||||
CDraw.RemoveTexture(ref sk.Texture);
|
||||
|
||||
foreach (CVideoSkinElement vsk in VideoList.Values)
|
||||
{
|
||||
CVideo.Close(vsk.VideoStream);
|
||||
CDraw.RemoveTexture(ref vsk.Texture);
|
||||
}
|
||||
SkinList.Clear();
|
||||
VideoList.Clear();
|
||||
_PlayerColors = null;
|
||||
_ColorSchemes.Clear();
|
||||
}
|
||||
|
||||
private void _LoadColors(CXMLReader xmlReader)
|
||||
{
|
||||
if (PartyModeID == -1)
|
||||
{
|
||||
_PlayerColors = new SColorF?[CSettings.MaxNumPlayer];
|
||||
|
||||
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
|
||||
{
|
||||
SColorF color;
|
||||
if (xmlReader.TryGetColorFromRGBA("//root/Colors/Player" + (i + 1), out color))
|
||||
_PlayerColors[i] = color;
|
||||
else
|
||||
_PlayerColors[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<string> names = xmlReader.GetNames("//root/ColorSchemes/*");
|
||||
foreach (string str in names)
|
||||
{
|
||||
SColorF color;
|
||||
if (xmlReader.TryGetColorFromRGBA("//root/ColorSchemes/" + str, out color))
|
||||
_ColorSchemes.Add(str, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveSkin()
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Folder, _FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
// ThemeSystemVersion
|
||||
writer.WriteElementString("SkinSystemVersion", _SkinSystemVersion.ToString());
|
||||
|
||||
writer.WriteStartElement("Info");
|
||||
|
||||
writer.WriteElementString("Name", Name);
|
||||
writer.WriteElementString("Author", _Author);
|
||||
writer.WriteElementString("SkinVersionMajor", _SkinVersionMajor.ToString());
|
||||
writer.WriteElementString("SkinVersionMinor", _SkinVersionMinor.ToString());
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
// save colors
|
||||
_SaveColors(writer);
|
||||
|
||||
writer.WriteStartElement("Skins");
|
||||
|
||||
foreach (KeyValuePair<string, CSkinElement> element in SkinList)
|
||||
writer.WriteElementString(element.Key, element.Value.Value);
|
||||
writer.WriteEndElement();
|
||||
|
||||
writer.WriteStartElement("Videos");
|
||||
|
||||
foreach (KeyValuePair<string, CVideoSkinElement> element in VideoList)
|
||||
writer.WriteElementString(element.Key, element.Value.Value);
|
||||
writer.WriteEndElement();
|
||||
|
||||
// End of File
|
||||
writer.WriteEndElement(); //end of root
|
||||
writer.WriteEndDocument();
|
||||
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
private void _SaveColors(XmlWriter writer)
|
||||
{
|
||||
if (PartyModeID == -1)
|
||||
{
|
||||
writer.WriteStartElement("Colors");
|
||||
for (int i = 0; i < _PlayerColors.Length; i++)
|
||||
{
|
||||
SColorF? color = _PlayerColors[i];
|
||||
if (color == null)
|
||||
continue;
|
||||
writer.WriteStartElement("Player" + (i + 1));
|
||||
|
||||
writer.WriteElementString("R", color.Value.R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", color.Value.G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", color.Value.B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", color.Value.A.ToString("#0.000"));
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
writer.WriteStartElement("ColorSchemes");
|
||||
foreach (KeyValuePair<string, SColorF> kvp in _ColorSchemes)
|
||||
{
|
||||
writer.WriteStartElement(kvp.Key);
|
||||
|
||||
writer.WriteElementString("R", kvp.Value.R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", kvp.Value.G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", kvp.Value.B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", kvp.Value.A.ToString("#0.000"));
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
#endregion Load/Save
|
||||
|
||||
public bool GetColor(string colorName, out SColorF color)
|
||||
{
|
||||
return _ColorSchemes.TryGetValue(colorName, out color) || GetPlayerColor(colorName, out color);
|
||||
}
|
||||
|
||||
public bool GetPlayerColor(string playerNrString, out SColorF color)
|
||||
{
|
||||
color = new SColorF();
|
||||
if (playerNrString == null)
|
||||
return false;
|
||||
if (playerNrString.StartsWith("Player"))
|
||||
playerNrString = playerNrString.Substring(6);
|
||||
int playerNr;
|
||||
if (!int.TryParse(playerNrString, out playerNr))
|
||||
return false;
|
||||
|
||||
return GetPlayerColor(playerNr, out color);
|
||||
}
|
||||
|
||||
public bool GetPlayerColor(int playerNr, out SColorF color)
|
||||
{
|
||||
if (_PlayerColors != null && playerNr >= 1 && playerNr <= _PlayerColors.Length)
|
||||
{
|
||||
SColorF? colorTmp = _PlayerColors[playerNr - 1];
|
||||
if (colorTmp != null)
|
||||
{
|
||||
color = colorTmp.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
color = new SColorF();
|
||||
return false;
|
||||
}
|
||||
|
||||
public int GetVideo(string videoName, bool loop = true)
|
||||
{
|
||||
CVideoSkinElement sk;
|
||||
if (VideoList.TryGetValue(videoName, out sk))
|
||||
{
|
||||
if (sk.VideoStream == -1)
|
||||
{
|
||||
sk.VideoStream = CVideo.Load(Path.Combine(_Folder, sk.Value));
|
||||
CVideo.SetLoop(sk.VideoStream, loop);
|
||||
}
|
||||
return sk.VideoStream;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+71
-444
@@ -18,7 +18,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Vocaluxe.Base.Fonts;
|
||||
using VocaluxeLib;
|
||||
@@ -41,46 +41,6 @@ namespace Vocaluxe.Base
|
||||
public int PartyModeID;
|
||||
}
|
||||
|
||||
class CSkinElement
|
||||
{
|
||||
public string Value;
|
||||
public CTextureRef Texture;
|
||||
}
|
||||
|
||||
class CVideoSkinElement : CSkinElement
|
||||
{
|
||||
public int VideoIndex = -1;
|
||||
}
|
||||
|
||||
struct SSkin
|
||||
{
|
||||
public string Name;
|
||||
public string Author;
|
||||
public int SkinVersionMajor;
|
||||
public int SkinVersionMinor;
|
||||
|
||||
public string Path;
|
||||
public string FileName;
|
||||
public int PartyModeID;
|
||||
|
||||
public Dictionary<string, CSkinElement> SkinList;
|
||||
public Dictionary<string, CVideoSkinElement> VideoList;
|
||||
|
||||
public SColors ThemeColors;
|
||||
}
|
||||
|
||||
struct SColors
|
||||
{
|
||||
public SColorF[] Player;
|
||||
public SColorScheme[] ColorSchemes;
|
||||
}
|
||||
|
||||
struct SColorScheme
|
||||
{
|
||||
public string Name;
|
||||
public SColorF Color;
|
||||
}
|
||||
|
||||
struct SCursor
|
||||
{
|
||||
public string SkinName;
|
||||
@@ -88,12 +48,7 @@ namespace Vocaluxe.Base
|
||||
public float W;
|
||||
public float H;
|
||||
|
||||
public float R;
|
||||
public float G;
|
||||
public float B;
|
||||
public float A;
|
||||
|
||||
public string Color;
|
||||
public SThemeColor Color;
|
||||
}
|
||||
#endregion Structs
|
||||
|
||||
@@ -101,41 +56,18 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
// Version number for main theme and skin files. Increment it, if you've changed something on the theme files!
|
||||
private const int _ThemeSystemVersion = 5;
|
||||
private const int _SkinSystemVersion = 3;
|
||||
|
||||
#region Vars
|
||||
private static readonly List<STheme> _Themes = new List<STheme>();
|
||||
public static string[] ThemeNames
|
||||
{
|
||||
get
|
||||
{
|
||||
var names = new List<string>();
|
||||
// ReSharper disable LoopCanBeConvertedToQuery
|
||||
foreach (STheme th in _Themes)
|
||||
// ReSharper restore LoopCanBeConvertedToQuery
|
||||
{
|
||||
if (th.PartyModeID == -1)
|
||||
names.Add(th.Name);
|
||||
}
|
||||
return names.ToArray();
|
||||
}
|
||||
get { return _Themes.Where(th => th.PartyModeID == -1).Select(th => th.Name).ToArray(); }
|
||||
}
|
||||
|
||||
private static readonly List<SSkin> _Skins = new List<SSkin>();
|
||||
private static readonly List<CSkin> _Skins = new List<CSkin>();
|
||||
public static string[] SkinNames
|
||||
{
|
||||
get
|
||||
{
|
||||
var names = new List<string>();
|
||||
// ReSharper disable LoopCanBeConvertedToQuery
|
||||
foreach (SSkin sk in _Skins)
|
||||
// ReSharper restore LoopCanBeConvertedToQuery
|
||||
{
|
||||
if (sk.PartyModeID == -1)
|
||||
names.Add(sk.Name);
|
||||
}
|
||||
return names.ToArray();
|
||||
}
|
||||
get { return _Skins.Where(ak => ak.PartyModeID == -1).Select(ak => ak.Name).ToArray(); }
|
||||
}
|
||||
|
||||
public static SCursor Cursor;
|
||||
@@ -170,64 +102,16 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static bool LoadSkin(int skinIndex)
|
||||
{
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName));
|
||||
if (xmlReader == null)
|
||||
return false;
|
||||
|
||||
// load skins/textures
|
||||
foreach (KeyValuePair<string, CSkinElement> valuePair in _Skins[skinIndex].SkinList)
|
||||
{
|
||||
CSkinElement sk = valuePair.Value;
|
||||
try
|
||||
{
|
||||
xmlReader.GetValue("//root/Skins/" + valuePair.Key, out sk.Value, String.Empty);
|
||||
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[skinIndex].Path, sk.Value));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||
CLog.LogError("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// load videos
|
||||
foreach (KeyValuePair<string, CVideoSkinElement> valuePair in _Skins[skinIndex].VideoList)
|
||||
{
|
||||
try
|
||||
{
|
||||
xmlReader.GetValue("//root/Videos/" + valuePair.Key, out valuePair.Value.Value, String.Empty);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||
CLog.LogError("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
// load colors
|
||||
_LoadColors(xmlReader, skinIndex);
|
||||
return true;
|
||||
return _Skins[skinIndex].Load();
|
||||
}
|
||||
|
||||
public static void UnloadSkins()
|
||||
{
|
||||
for (int i = 0; i < _Skins.Count; i++)
|
||||
{
|
||||
foreach (CSkinElement sk in _Skins[i].SkinList.Values)
|
||||
CDraw.RemoveTexture(ref sk.Texture);
|
||||
|
||||
foreach (CVideoSkinElement vsk in _Skins[i].VideoList.Values)
|
||||
{
|
||||
CVideo.Close(vsk.VideoIndex);
|
||||
CDraw.RemoveTexture(ref vsk.Texture);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Skins.Count; i++)
|
||||
{
|
||||
if (_Skins[i].PartyModeID != -1)
|
||||
continue;
|
||||
_Skins[i].Unload();
|
||||
_Skins.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
@@ -255,18 +139,16 @@ namespace Vocaluxe.Base
|
||||
if (xmlReader == null)
|
||||
return false;
|
||||
|
||||
int skinIndex = GetSkinIndex(_Themes[themeIndex].PartyModeID);
|
||||
|
||||
// Load Cursor
|
||||
if (_Themes[themeIndex].PartyModeID == -1)
|
||||
_LoadCursor(xmlReader, skinIndex);
|
||||
_LoadCursor(xmlReader);
|
||||
|
||||
// load fonts
|
||||
if (_Themes[themeIndex].PartyModeID == -1)
|
||||
{
|
||||
CFonts.LoadThemeFonts(
|
||||
_Themes[themeIndex].Name,
|
||||
Path.Combine(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder), CSettings.FolderNameThemeFonts),
|
||||
Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder, CSettings.FolderNameThemeFonts),
|
||||
xmlReader);
|
||||
}
|
||||
else
|
||||
@@ -332,53 +214,8 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void SaveSkin()
|
||||
{
|
||||
for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++)
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), CConfig.XMLSettings))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("root");
|
||||
|
||||
// ThemeSystemVersion
|
||||
writer.WriteElementString("SkinSystemVersion", _SkinSystemVersion.ToString());
|
||||
|
||||
#region Info
|
||||
writer.WriteStartElement("Info");
|
||||
|
||||
writer.WriteElementString("Name", _Skins[skinIndex].Name);
|
||||
writer.WriteElementString("Author", _Skins[skinIndex].Author);
|
||||
writer.WriteElementString("SkinVersionMajor", _Skins[skinIndex].SkinVersionMajor.ToString());
|
||||
writer.WriteElementString("SkinVersionMinor", _Skins[skinIndex].SkinVersionMinor.ToString());
|
||||
|
||||
writer.WriteEndElement();
|
||||
#endregion Info
|
||||
|
||||
// save colors
|
||||
_SaveColors(writer, skinIndex);
|
||||
|
||||
#region Skins
|
||||
writer.WriteStartElement("Skins");
|
||||
|
||||
foreach (KeyValuePair<string, CSkinElement> element in _Skins[skinIndex].SkinList)
|
||||
writer.WriteElementString(element.Key, element.Value.Value);
|
||||
writer.WriteEndElement();
|
||||
#endregion Skins
|
||||
|
||||
#region Videos
|
||||
writer.WriteStartElement("Videos");
|
||||
|
||||
foreach (KeyValuePair<string, CVideoSkinElement> element in _Skins[skinIndex].VideoList)
|
||||
writer.WriteElementString(element.Key, element.Value.Value);
|
||||
writer.WriteEndElement();
|
||||
#endregion Videos
|
||||
|
||||
// End of File
|
||||
writer.WriteEndElement(); //end of root
|
||||
writer.WriteEndDocument();
|
||||
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
foreach (CSkin skin in _Skins)
|
||||
skin.SaveSkin();
|
||||
}
|
||||
|
||||
private static void _ListThemes()
|
||||
@@ -461,52 +298,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(path, file));
|
||||
if (xmlReader == null)
|
||||
continue;
|
||||
|
||||
var skin = new SSkin();
|
||||
|
||||
int version = 0;
|
||||
xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version);
|
||||
|
||||
if (version == _SkinSystemVersion)
|
||||
{
|
||||
xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty);
|
||||
if (skin.Name != "")
|
||||
{
|
||||
xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty);
|
||||
xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor);
|
||||
xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref skin.SkinVersionMinor);
|
||||
|
||||
|
||||
skin.Path = path;
|
||||
skin.FileName = file;
|
||||
skin.PartyModeID = theme.PartyModeID;
|
||||
|
||||
skin.SkinList = new Dictionary<string, CSkinElement>();
|
||||
List<string> names = xmlReader.GetNames("//root/Skins/*");
|
||||
foreach (string str in names)
|
||||
skin.SkinList[str] = new CSkinElement();
|
||||
|
||||
skin.VideoList = new Dictionary<string, CVideoSkinElement>();
|
||||
names = xmlReader.GetNames("//root/Videos/*");
|
||||
foreach (string str in names)
|
||||
skin.VideoList[str] = new CVideoSkinElement();
|
||||
_Skins.Add(skin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "Can't load Skin \"" + file + "\", ";
|
||||
if (version < _SkinSystemVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current SkinSystemVersion is " + _SkinSystemVersion;
|
||||
CLog.LogError(msg);
|
||||
}
|
||||
CSkin skin = new CSkin(path, file, theme.PartyModeID);
|
||||
if (skin.Init())
|
||||
_Skins.Add(skin);
|
||||
}
|
||||
}
|
||||
#endregion Theme and Skin loading and writing
|
||||
@@ -516,25 +310,51 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
for (int i = 0; i < _Skins.Count; i++)
|
||||
{
|
||||
if (partyModeID != -1 && _Skins[i].PartyModeID == partyModeID)
|
||||
if (_Skins[i].PartyModeID == partyModeID && _Skins[i].Name == CConfig.Skin)
|
||||
return i;
|
||||
if (partyModeID == -1 && _Skins[i].Name == CConfig.Skin)
|
||||
}
|
||||
if (partyModeID >= 0)
|
||||
{
|
||||
for (int i = 0; i < _Skins.Count; i++)
|
||||
{
|
||||
if (_Skins[i].PartyModeID == partyModeID)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < _Skins.Count; i++)
|
||||
{
|
||||
if (_Skins[i].PartyModeID < 0 && _Skins[i].Name == CConfig.Skin)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static CSkin _GetSkin(int partyModeID)
|
||||
{
|
||||
int index = GetSkinIndex(partyModeID);
|
||||
return index < 0 ? null : _Skins[index];
|
||||
}
|
||||
|
||||
public static int GetThemeIndex(int partyModeID)
|
||||
{
|
||||
for (int i = 0; i < _Themes.Count; i++)
|
||||
{
|
||||
if (partyModeID != -1 && _Themes[i].PartyModeID == partyModeID)
|
||||
if (_Themes[i].PartyModeID == partyModeID && _Themes[i].Name == CConfig.Theme)
|
||||
return i;
|
||||
if (partyModeID == -1 && _Themes[i].Name == CConfig.Theme)
|
||||
}
|
||||
if (partyModeID >= 0)
|
||||
{
|
||||
for (int i = 0; i < _Themes.Count; i++)
|
||||
{
|
||||
if (_Themes[i].PartyModeID == partyModeID)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < _Themes.Count; i++)
|
||||
{
|
||||
if (_Themes[i].PartyModeID < 0 && _Themes[i].Name == CConfig.Theme)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -544,10 +364,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
int themeIndex = GetThemeIndex(partyModeID);
|
||||
if (themeIndex != -1)
|
||||
{
|
||||
path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder);
|
||||
path = Path.Combine(path, CSettings.FolderNameScreens);
|
||||
}
|
||||
path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder, CSettings.FolderNameScreens);
|
||||
else
|
||||
CLog.LogError("Can't find current Theme");
|
||||
|
||||
@@ -563,126 +380,15 @@ namespace Vocaluxe.Base
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetSkinFilePath(string skinName, int partyModeID)
|
||||
public static int GetSkinVideo(string videoName, int partyModeID, bool loop = true)
|
||||
{
|
||||
return _GetSkinFileName(skinName, GetSkinIndex(partyModeID), true);
|
||||
}
|
||||
|
||||
private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath = false)
|
||||
{
|
||||
CSkinElement sk;
|
||||
if (_Skins[skinIndex].SkinList.TryGetValue(skinName, out sk))
|
||||
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
||||
|
||||
CLog.LogError("Can't find Skin Element \"" + skinName);
|
||||
return skinName;
|
||||
}
|
||||
|
||||
public static CVideoSkinElement GetSkinVideo(string videoName, int partyModeID, bool load = true)
|
||||
{
|
||||
int skinIndex = GetSkinIndex(partyModeID);
|
||||
if (skinIndex != -1)
|
||||
{
|
||||
CVideoSkinElement sk;
|
||||
if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk))
|
||||
{
|
||||
if (sk.VideoIndex == -1 && load)
|
||||
{
|
||||
sk.VideoIndex = CVideo.Load(GetVideoFilePath(videoName, partyModeID));
|
||||
CVideo.SetLoop(sk.VideoIndex, true);
|
||||
}
|
||||
return sk;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CTextureRef GetSkinVideoTexture(string videoName, int partyModeID)
|
||||
{
|
||||
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID);
|
||||
if (sk == null)
|
||||
return null;
|
||||
float time = 0f;
|
||||
CVideo.GetFrame(sk.VideoIndex, ref sk.Texture, time, out time);
|
||||
return sk.Texture;
|
||||
}
|
||||
|
||||
public static void SkinVideoPause(string videoName, int partyModeID)
|
||||
{
|
||||
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID, false);
|
||||
if (sk == null)
|
||||
return;
|
||||
CVideo.Pause(sk.VideoIndex);
|
||||
}
|
||||
|
||||
public static void SkinVideoResume(string videoName, int partyModeID)
|
||||
{
|
||||
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID);
|
||||
if (sk == null)
|
||||
return;
|
||||
CVideo.Resume(sk.VideoIndex);
|
||||
}
|
||||
|
||||
public static string GetVideoFilePath(string videoName, int partyModeID)
|
||||
{
|
||||
return _GetVideoFileName(videoName, GetSkinIndex(partyModeID), true);
|
||||
}
|
||||
|
||||
private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath = false)
|
||||
{
|
||||
CVideoSkinElement sk;
|
||||
if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk))
|
||||
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
||||
|
||||
CLog.LogError("Can't find Video Element \"" + videoName);
|
||||
return videoName;
|
||||
CSkin skin = _GetSkin(partyModeID);
|
||||
return skin == null ? -1 : skin.GetVideo(videoName, loop);
|
||||
}
|
||||
#endregion Theme and Skin index handling
|
||||
|
||||
#region Element loading
|
||||
private static void _LoadColors(CXMLReader xmlReader, int skinIndex)
|
||||
{
|
||||
SSkin skin = _Skins[skinIndex];
|
||||
|
||||
if (_Skins[skinIndex].PartyModeID == -1)
|
||||
{
|
||||
var playerColors = new List<SColorF>();
|
||||
float value = 0f;
|
||||
|
||||
int i = 1;
|
||||
while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value))
|
||||
{
|
||||
var color = new SColorF {R = value};
|
||||
|
||||
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G);
|
||||
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B);
|
||||
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A);
|
||||
|
||||
playerColors.Add(color);
|
||||
i++;
|
||||
}
|
||||
skin.ThemeColors.Player = playerColors.ToArray();
|
||||
}
|
||||
|
||||
var colorScheme = new List<SColorScheme>();
|
||||
List<string> names = xmlReader.GetNames("//root/ColorSchemes/*");
|
||||
foreach (string str in names)
|
||||
{
|
||||
var scheme = new SColorScheme {Name = str};
|
||||
|
||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R);
|
||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G);
|
||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/B", ref scheme.Color.B);
|
||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/A", ref scheme.Color.A);
|
||||
|
||||
colorScheme.Add(scheme);
|
||||
}
|
||||
skin.ThemeColors.ColorSchemes = colorScheme.ToArray();
|
||||
|
||||
_Skins[skinIndex] = skin;
|
||||
}
|
||||
|
||||
private static void _LoadCursor(CXMLReader xmlReader, int skinIndex)
|
||||
#region Cursor save/load
|
||||
private static void _LoadCursor(CXMLReader xmlReader)
|
||||
{
|
||||
string value = String.Empty;
|
||||
xmlReader.GetValue("//root/Cursor/Skin", out Cursor.SkinName, value);
|
||||
@@ -691,59 +397,13 @@ namespace Vocaluxe.Base
|
||||
xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H);
|
||||
|
||||
if (xmlReader.GetValue("//root/Cursor/Color", out value, value))
|
||||
{
|
||||
SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID);
|
||||
Cursor.R = color.R;
|
||||
Cursor.G = color.G;
|
||||
Cursor.B = color.B;
|
||||
Cursor.A = color.A;
|
||||
Cursor.Color = value;
|
||||
}
|
||||
Cursor.Color.Name = value;
|
||||
else
|
||||
{
|
||||
Cursor.Color = String.Empty;
|
||||
xmlReader.TryGetFloatValue("//root/Cursor/R", ref Cursor.R);
|
||||
xmlReader.TryGetFloatValue("//root/Cursor/G", ref Cursor.G);
|
||||
xmlReader.TryGetFloatValue("//root/Cursor/B", ref Cursor.B);
|
||||
xmlReader.TryGetFloatValue("//root/Cursor/A", ref Cursor.A);
|
||||
Cursor.Color.Name = null;
|
||||
xmlReader.TryGetColorFromRGBA("//root/Cursor", out Cursor.Color.Color);
|
||||
}
|
||||
}
|
||||
#endregion Element loading
|
||||
|
||||
#region Element Writing
|
||||
private static void _SaveColors(XmlWriter writer, int skinIndex)
|
||||
{
|
||||
if (_Skins[skinIndex].PartyModeID == -1)
|
||||
{
|
||||
writer.WriteStartElement("Colors");
|
||||
for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++)
|
||||
{
|
||||
writer.WriteStartElement("Player" + (i + 1));
|
||||
|
||||
writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", _Skins[skinIndex].ThemeColors.Player[i].B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", _Skins[skinIndex].ThemeColors.Player[i].A.ToString("#0.000"));
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
writer.WriteStartElement("ColorSchemes");
|
||||
foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
||||
{
|
||||
writer.WriteStartElement(scheme.Name);
|
||||
|
||||
writer.WriteElementString("R", scheme.Color.R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", scheme.Color.G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", scheme.Color.B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", scheme.Color.A.ToString("#0.000"));
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private static void _SaveCursor(XmlWriter writer)
|
||||
{
|
||||
@@ -754,45 +414,31 @@ namespace Vocaluxe.Base
|
||||
writer.WriteElementString("W", Cursor.W.ToString("#0.000"));
|
||||
writer.WriteElementString("H", Cursor.H.ToString("#0.000"));
|
||||
|
||||
if (!String.IsNullOrEmpty(Cursor.Color))
|
||||
writer.WriteElementString("Color", Cursor.Color);
|
||||
if (!String.IsNullOrEmpty(Cursor.Color.Name))
|
||||
writer.WriteElementString("Color", Cursor.Color.Name);
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Cursor.R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", Cursor.G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", Cursor.B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", Cursor.A.ToString("#0.000"));
|
||||
writer.WriteElementString("R", Cursor.Color.Color.R.ToString("#0.000"));
|
||||
writer.WriteElementString("G", Cursor.Color.Color.G.ToString("#0.000"));
|
||||
writer.WriteElementString("B", Cursor.Color.Color.B.ToString("#0.000"));
|
||||
writer.WriteElementString("A", Cursor.Color.Color.A.ToString("#0.000"));
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
#endregion ElementWriting
|
||||
#endregion Cursor save/load
|
||||
|
||||
#region Color Handling
|
||||
public static SColorF GetColor(string colorName, int partyModeID)
|
||||
public static bool GetColor(string colorName, int partyModeID, out SColorF color)
|
||||
{
|
||||
SColorF color;
|
||||
|
||||
int skinIndex = GetSkinIndex(partyModeID);
|
||||
|
||||
GetColor(colorName, skinIndex, out color);
|
||||
return color;
|
||||
}
|
||||
if (_Skins[skinIndex].GetColor(colorName, out color))
|
||||
return true;
|
||||
|
||||
public static bool GetColor(string colorName, int skinIndex, out SColorF color)
|
||||
{
|
||||
foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
||||
{
|
||||
if (scheme.Name == colorName)
|
||||
{
|
||||
color = new SColorF(scheme.Color);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool success;
|
||||
color = GetPlayerColor(colorName, GetSkinIndex(-1), out success);
|
||||
return success;
|
||||
if (partyModeID < 0)
|
||||
return false;
|
||||
return GetColor(colorName, -1, out color);
|
||||
}
|
||||
|
||||
public static SColorF GetPlayerColor(int playerNr)
|
||||
@@ -801,21 +447,6 @@ namespace Vocaluxe.Base
|
||||
return GetPlayerColor(playerNr, out dummy);
|
||||
}
|
||||
|
||||
public static SColorF GetPlayerColor(string playerNrString)
|
||||
{
|
||||
bool dummy;
|
||||
return GetPlayerColor(playerNrString, GetSkinIndex(-1), out dummy);
|
||||
}
|
||||
|
||||
public static SColorF GetPlayerColor(string playerNrString, int skinIndex, out bool success)
|
||||
{
|
||||
int selection = 0;
|
||||
if (playerNrString != null && playerNrString.StartsWith("Player"))
|
||||
int.TryParse(playerNrString.Substring(6), out selection);
|
||||
|
||||
return GetPlayerColor(selection, skinIndex, out success);
|
||||
}
|
||||
|
||||
public static SColorF GetPlayerColor(int playerNr, out bool success)
|
||||
{
|
||||
return GetPlayerColor(playerNr, GetSkinIndex(-1), out success);
|
||||
@@ -823,13 +454,9 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static SColorF GetPlayerColor(int playerNr, int skinIndex, out bool success)
|
||||
{
|
||||
success = false;
|
||||
|
||||
if (_Skins[skinIndex].ThemeColors.Player.Length < playerNr || playerNr < 1)
|
||||
return new SColorF(1f, 1f, 1f, 1f);
|
||||
|
||||
success = true;
|
||||
return _Skins[skinIndex].ThemeColors.Player[playerNr - 1];
|
||||
SColorF color;
|
||||
success = _Skins[skinIndex].GetPlayerColor(playerNr, out color);
|
||||
return color;
|
||||
}
|
||||
#endregion Color Handling
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public void Load(string videoName)
|
||||
{
|
||||
_VideoStream = CVideo.Load(CTheme.GetVideoFilePath(videoName, -1));
|
||||
_VideoStream = CTheme.GetSkinVideo(videoName, -1, false);
|
||||
_Loaded = true;
|
||||
CVideo.Pause(_VideoStream);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace Vocaluxe.Screens
|
||||
private int _OldTheme;
|
||||
private int _OldSkin;
|
||||
|
||||
private int _TempSkin;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -145,7 +143,6 @@ namespace Vocaluxe.Screens
|
||||
_OldCoverTheme = CCover.GetCoverThemeIndex();
|
||||
_OldTheme = CTheme.GetThemeIndex(-1);
|
||||
_OldSkin = CTheme.GetSkinIndex(-1);
|
||||
_TempSkin = _OldSkin;
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
@@ -191,7 +188,6 @@ namespace Vocaluxe.Screens
|
||||
CTheme.ListSkins();
|
||||
CConfig.Skin = CTheme.SkinNames[0];
|
||||
_OldSkin = 0;
|
||||
_TempSkin = _OldSkin;
|
||||
|
||||
CConfig.SaveConfig();
|
||||
|
||||
@@ -213,7 +209,6 @@ namespace Vocaluxe.Screens
|
||||
CTheme.ListSkins();
|
||||
CConfig.Skin = CTheme.SkinNames[0];
|
||||
_OldSkin = 0;
|
||||
_TempSkin = _OldSkin;
|
||||
|
||||
CConfig.SaveConfig();
|
||||
|
||||
@@ -226,12 +221,12 @@ namespace Vocaluxe.Screens
|
||||
return;
|
||||
}
|
||||
|
||||
if (_TempSkin != _SelectSlides[_SelectSlideSkin].Selection)
|
||||
if (_OldSkin != _SelectSlides[_SelectSlideSkin].Selection)
|
||||
{
|
||||
_TempSkin = _SelectSlides[_SelectSlideSkin].Selection;
|
||||
_OldSkin = _SelectSlides[_SelectSlideSkin].Selection;
|
||||
|
||||
_PauseBG();
|
||||
CConfig.Skin = CTheme.SkinNames[_TempSkin];
|
||||
CConfig.Skin = CTheme.SkinNames[_OldSkin];
|
||||
CGraphics.ReloadSkin();
|
||||
_ResumeBG();
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
<Compile Include="Base\CPlaylistElement.cs" />
|
||||
<Compile Include="Base\CRecord.cs" />
|
||||
<Compile Include="Base\CVideoPlayer.cs" />
|
||||
<Compile Include="Base\CSkin.cs" />
|
||||
<Compile Include="COSFunctions.cs" />
|
||||
<Compile Include="Lib\Database\CCoverDB.cs" />
|
||||
<Compile Include="Lib\Database\CDatabaseBase.cs" />
|
||||
|
||||
@@ -88,8 +88,9 @@ namespace VocaluxeLib
|
||||
return GetValue(xPath, out val, value.ToString()) && CHelper.TryParse(val, out value);
|
||||
}
|
||||
|
||||
public bool TryGetColorFromRGBA(string xPath, ref SColorF value)
|
||||
public bool TryGetColorFromRGBA(string xPath, out SColorF value)
|
||||
{
|
||||
value = new SColorF();
|
||||
bool result = true;
|
||||
result &= TryGetFloatValue(xPath + "/R", ref value.R);
|
||||
result &= TryGetFloatValue(xPath + "/G", ref value.G);
|
||||
|
||||
@@ -103,13 +103,9 @@ namespace VocaluxeLib
|
||||
string GetThemeScreensPath(int partyModeID);
|
||||
int GetSkinIndex(int partyModeID);
|
||||
CTextureRef GetSkinTexture(string textureName, int partyModeID);
|
||||
CTextureRef GetSkinVideoTexture(string videoName, int partyModeID);
|
||||
int GetSkinVideo(string videoName, int partyModeID, bool loop);
|
||||
|
||||
void SkinVideoResume(string videoName, int partyModeID);
|
||||
void SkinVideoPause(string videoName, int partyModeID);
|
||||
|
||||
SColorF GetColor(string colorName, int partyModeID);
|
||||
bool GetColor(string colorName, int skinIndex, out SColorF color);
|
||||
bool GetColor(string colorName, int partyModeID, out SColorF color);
|
||||
SColorF GetPlayerColor(int playerNr);
|
||||
|
||||
void UnloadSkins();
|
||||
|
||||
@@ -54,6 +54,9 @@ namespace VocaluxeLib.Menu
|
||||
private readonly Stopwatch _SlideShowTimer = new Stopwatch();
|
||||
private readonly List<CTextureRef> _SlideShowTextures = new List<CTextureRef>();
|
||||
|
||||
private int _VideoStream = -1;
|
||||
private CTextureRef _VidTex;
|
||||
|
||||
public SColorF Color;
|
||||
public bool ThemeLoaded
|
||||
{
|
||||
@@ -97,7 +100,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
bool success = true;
|
||||
@@ -133,14 +136,14 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
if (_Theme.Type == EBackgroundTypes.Video && !String.IsNullOrEmpty(_Theme.VideoName) && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
|
||||
CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID);
|
||||
if (_VideoStream != -1)
|
||||
CBase.Video.Resume(_VideoStream);
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.VideoName))
|
||||
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
|
||||
if (_VideoStream != -1)
|
||||
CBase.Video.Pause(_VideoStream);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -173,15 +176,20 @@ namespace VocaluxeLib.Menu
|
||||
public void UnloadTextures()
|
||||
{
|
||||
_SlideShowTextures.Clear();
|
||||
CBase.Video.Close(_VideoStream);
|
||||
_VideoStream = -1;
|
||||
CBase.Drawing.RemoveTexture(ref _VidTex);
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
|
||||
foreach (string s in _Theme.SlideShowTextures)
|
||||
_SlideShowTextures.Add(CBase.Theme.GetSkinTexture(s, _PartyModeID));
|
||||
|
||||
if (_Theme.Type == EBackgroundTypes.Video)
|
||||
_VideoStream = CBase.Theme.GetSkinVideo(_Theme.VideoName, _PartyModeID, true);
|
||||
}
|
||||
|
||||
public void AddSlideShowTexture(string image)
|
||||
@@ -291,10 +299,11 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private bool _DrawVideo()
|
||||
{
|
||||
CTextureRef videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
|
||||
if (videoTexture != null)
|
||||
float time;
|
||||
CBase.Video.GetFrame(_VideoStream, ref _VidTex, 0, out time);
|
||||
if (_VidTex != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop);
|
||||
CBase.Drawing.DrawTexture(_VidTex, _GetDrawRect(), EAspect.Crop);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+13
-30
@@ -25,27 +25,18 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Button")]
|
||||
public struct SThemeButton
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("Skin")]
|
||||
public string TextureName;
|
||||
[XmlElement("SkinSelected")]
|
||||
public string SelTextureName;
|
||||
[XmlElement("Skin")] public string TextureName;
|
||||
[XmlElement("SkinSelected")] public string SelTextureName;
|
||||
public SRectF Rect;
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("SelColor")]
|
||||
public SThemeColor SelColor;
|
||||
[XmlElement("Text")]
|
||||
public SThemeText Text;
|
||||
[XmlElement("SText")]
|
||||
public SThemeText SText;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
[XmlElement("SelColor")] public SThemeColor SelColor;
|
||||
[XmlElement("Text")] public SThemeText Text;
|
||||
[XmlElement("SText")] public SThemeText SText;
|
||||
public bool STextSpecified;
|
||||
[XmlElement("Reflection")]
|
||||
public SReflection Reflection;
|
||||
[XmlElement("SelReflection")]
|
||||
public SReflection SelReflection;
|
||||
[XmlElement("Reflection")] public SReflection Reflection;
|
||||
[XmlElement("SelReflection")] public SReflection SelReflection;
|
||||
}
|
||||
|
||||
public class CButton : IMenuElement
|
||||
@@ -185,7 +176,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -195,7 +186,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColor.Name, skinIndex, out SelColor);
|
||||
_ThemeLoaded &= _Theme.SelColor.Get(_PartyModeID, out SelColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R);
|
||||
@@ -257,7 +248,6 @@ namespace VocaluxeLib.Menu
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
|
||||
public void Draw(bool forceDraw = false)
|
||||
{
|
||||
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme && !forceDraw)
|
||||
@@ -330,15 +320,8 @@ namespace VocaluxeLib.Menu
|
||||
_SelText.LoadTextures();
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = _Theme.Color.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.SelColor.Name))
|
||||
SelColor = CBase.Theme.GetColor(_Theme.SelColor.Name, _PartyModeID);
|
||||
else
|
||||
SelColor = _Theme.SelColor.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
_Theme.SelColor.Get(_PartyModeID, out SelColor);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
|
||||
|
||||
@@ -29,30 +29,20 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Equalizer")]
|
||||
public struct SThemeEqualizer
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("Skin")]
|
||||
public string TextureName;
|
||||
[XmlElement("Skin")] public string TextureName;
|
||||
|
||||
[XmlElement("Rect")]
|
||||
public SRectF Rect;
|
||||
[XmlElement("Rect")] public SRectF Rect;
|
||||
|
||||
[XmlElement("NumBars")]
|
||||
public int NumBars;
|
||||
[XmlElement("Space")]
|
||||
public float Space;
|
||||
[XmlElement("Style")]
|
||||
public EEqualizerStyle Style;
|
||||
[XmlElement("DrawNegative")]
|
||||
public EOffOn DrawNegative;
|
||||
[XmlElement("NumBars")] public int NumBars;
|
||||
[XmlElement("Space")] public float Space;
|
||||
[XmlElement("Style")] public EEqualizerStyle Style;
|
||||
[XmlElement("DrawNegative")] public EOffOn DrawNegative;
|
||||
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("MaxColor")]
|
||||
public SThemeColor MaxColor;
|
||||
[XmlElement("Reflection")]
|
||||
public SReflection Reflection;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
[XmlElement("MaxColor")] public SThemeColor MaxColor;
|
||||
[XmlElement("Reflection")] public SReflection Reflection;
|
||||
}
|
||||
|
||||
public class CEqualizer : IMenuElement
|
||||
@@ -140,7 +130,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -150,7 +140,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.MaxColor.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.MaxColor.Get(_PartyModeID, out MaxColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxR", ref MaxColor.R);
|
||||
@@ -260,20 +250,13 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = _Theme.Color.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.MaxColor.Name))
|
||||
MaxColor = CBase.Theme.GetColor(_Theme.MaxColor.Name, _PartyModeID);
|
||||
else
|
||||
MaxColor = _Theme.MaxColor.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
_Theme.MaxColor.Get(_PartyModeID, out MaxColor);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
Space = _Theme.Space;
|
||||
Reflection = _Theme.Reflection.Enabled;
|
||||
if(Reflection)
|
||||
if (Reflection)
|
||||
{
|
||||
ReflectionHeight = _Theme.Reflection.Height;
|
||||
ReflectionSpace = _Theme.Reflection.Space;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
@@ -25,16 +24,12 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Lyric")]
|
||||
public struct SThemeLyrics
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("Rect")]
|
||||
public SRectF Rect;
|
||||
[XmlElement("Rect")] public SRectF Rect;
|
||||
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("SColor")]
|
||||
public SThemeColor SColor;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
[XmlElement("SColor")] public SThemeColor SColor;
|
||||
}
|
||||
|
||||
public class CLyric : IMenuElement
|
||||
@@ -146,7 +141,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out _Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
|
||||
@@ -156,7 +151,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out _ColorProcessed);
|
||||
_ThemeLoaded &= _Theme.SColor.Get(_PartyModeID, out _ColorProcessed);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R);
|
||||
@@ -454,15 +449,8 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
_Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
_Color = _Theme.Color.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
|
||||
_ColorProcessed = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
|
||||
else
|
||||
_ColorProcessed = _Theme.SColor.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out _Color);
|
||||
_Theme.SColor.Get(_PartyModeID, out _ColorProcessed);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -27,21 +27,14 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("ParticleEffect")]
|
||||
public struct SThemeParticleEffect
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("Skin")]
|
||||
public string TextureName;
|
||||
[XmlElement("Rect")]
|
||||
public SRectF Rect;
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("Type")]
|
||||
public EParticleType Type;
|
||||
[XmlElement("Size")]
|
||||
public float Size;
|
||||
[XmlElement("MaxNumber")]
|
||||
public int MaxNumber;
|
||||
[XmlElement("Skin")] public string TextureName;
|
||||
[XmlElement("Rect")] public SRectF Rect;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
[XmlElement("Type")] public EParticleType Type;
|
||||
[XmlElement("Size")] public float Size;
|
||||
[XmlElement("MaxNumber")] public int MaxNumber;
|
||||
}
|
||||
|
||||
public enum EParticleType
|
||||
@@ -159,8 +152,6 @@ namespace VocaluxeLib.Menu
|
||||
_MaxAge = maxage;
|
||||
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
|
||||
}
|
||||
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
public void Update()
|
||||
@@ -413,7 +404,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -585,10 +576,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = _Theme.Color.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.TextureName))
|
||||
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
@@ -57,48 +56,31 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Playlist")]
|
||||
public struct SThemePlaylist
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("Rect")]
|
||||
public SRectF Rect;
|
||||
[XmlElement("Rect")] public SRectF Rect;
|
||||
|
||||
[XmlElement("EntryHeight")]
|
||||
public float EntryHeight;
|
||||
[XmlElement("EntryHeight")] public float EntryHeight;
|
||||
|
||||
[XmlElement("SkinBackground")]
|
||||
public string TextureBackgroundName;
|
||||
[XmlElement("SkinBackgroundSelected")]
|
||||
public string SelTextureBackgroundName;
|
||||
[XmlElement("SkinBackground")] public string TextureBackgroundName;
|
||||
[XmlElement("SkinBackgroundSelected")] public string SelTextureBackgroundName;
|
||||
|
||||
[XmlElement("ColorBackground")]
|
||||
public SThemeColor ColorBackground;
|
||||
[XmlElement("SColorBackground")]
|
||||
public SThemeColor SelColorBackground;
|
||||
[XmlElement("ColorBackground")] public SThemeColor ColorBackground;
|
||||
[XmlElement("SColorBackground")] public SThemeColor SelColorBackground;
|
||||
|
||||
[XmlElement("Text1")]
|
||||
public SThemeText SText1;
|
||||
[XmlElement("Text1")] public SThemeText SText1;
|
||||
|
||||
[XmlElement("StaticCover")]
|
||||
public SThemeStatic SStaticCover;
|
||||
[XmlElement("StaticPlaylistHeader")]
|
||||
public SThemeStatic SStaticPlaylistHeader;
|
||||
[XmlElement("StaticPlaylistFooter")]
|
||||
public SThemeStatic SStaticPlaylistFooter;
|
||||
[XmlElement("StaticCover")] public SThemeStatic SStaticCover;
|
||||
[XmlElement("StaticPlaylistHeader")] public SThemeStatic SStaticPlaylistHeader;
|
||||
[XmlElement("StaticPlaylistFooter")] public SThemeStatic SStaticPlaylistFooter;
|
||||
|
||||
[XmlElement("ButtonPlaylistName")]
|
||||
public SThemeButton SButtonPlaylistName;
|
||||
[XmlElement("ButtonPlaylistClose")]
|
||||
public SThemeButton SButtonPlaylistClose;
|
||||
[XmlElement("ButtonPlaylistSave")]
|
||||
public SThemeButton SButtonPlaylistSave;
|
||||
[XmlElement("ButtonPlaylistDelete")]
|
||||
public SThemeButton SButtonPlaylistDelete;
|
||||
[XmlElement("ButtonPlaylistSing")]
|
||||
public SThemeButton SButtonPlaylistSing;
|
||||
[XmlElement("ButtonPlaylistName")] public SThemeButton SButtonPlaylistName;
|
||||
[XmlElement("ButtonPlaylistClose")] public SThemeButton SButtonPlaylistClose;
|
||||
[XmlElement("ButtonPlaylistSave")] public SThemeButton SButtonPlaylistSave;
|
||||
[XmlElement("ButtonPlaylistDelete")] public SThemeButton SButtonPlaylistDelete;
|
||||
[XmlElement("ButtonPlaylistSing")] public SThemeButton SButtonPlaylistSing;
|
||||
|
||||
[XmlElement("SelectSlideGameMode")]
|
||||
public SThemeSelectSlide SSelectSlideGameMode;
|
||||
[XmlElement("SelectSlideGameMode")] public SThemeSelectSlide SSelectSlideGameMode;
|
||||
}
|
||||
|
||||
public class CPlaylist : IMenuElement
|
||||
@@ -187,7 +169,7 @@ namespace VocaluxeLib.Menu
|
||||
public SColorF BackgroundSelColor;
|
||||
|
||||
public CButton ButtonPlaylistName;
|
||||
public CButton ButtonPlaylistClose;
|
||||
public CButton ButtonPlaylistClose;
|
||||
public CButton ButtonPlaylistSave;
|
||||
public CButton ButtonPlaylistDelete;
|
||||
public CButton ButtonPlaylistSing;
|
||||
@@ -323,7 +305,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackground.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackground.Name, skinIndex, out BackgroundColor);
|
||||
_ThemeLoaded &= _Theme.ColorBackground.Get(_PartyModeID, out BackgroundColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R);
|
||||
@@ -332,7 +314,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
|
||||
}
|
||||
if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackground.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackground.Name, skinIndex, out BackgroundSelColor);
|
||||
_ThemeLoaded &= _Theme.SelColorBackground.Get(_PartyModeID, out BackgroundSelColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref BackgroundSelColor.R);
|
||||
@@ -353,7 +335,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex);
|
||||
_ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex);
|
||||
|
||||
_ThemeLoaded &=SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex);
|
||||
_ThemeLoaded &= SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight);
|
||||
if (_ThemeLoaded)
|
||||
@@ -366,11 +348,11 @@ namespace VocaluxeLib.Menu
|
||||
_Theme.SStaticCover = StaticCover.GetTheme();
|
||||
_Theme.SStaticPlaylistFooter = StaticPlaylistFooter.GetTheme();
|
||||
_Theme.SStaticPlaylistHeader = StaticPlaylistHeader.GetTheme();
|
||||
_Theme.SButtonPlaylistName =ButtonPlaylistName.GetTheme();
|
||||
_Theme.SButtonPlaylistSing =ButtonPlaylistSing.GetTheme();
|
||||
_Theme.SButtonPlaylistClose =ButtonPlaylistClose.GetTheme();
|
||||
_Theme.SButtonPlaylistSave =ButtonPlaylistSave.GetTheme();
|
||||
_Theme.SButtonPlaylistDelete =ButtonPlaylistDelete.GetTheme();
|
||||
_Theme.SButtonPlaylistName = ButtonPlaylistName.GetTheme();
|
||||
_Theme.SButtonPlaylistSing = ButtonPlaylistSing.GetTheme();
|
||||
_Theme.SButtonPlaylistClose = ButtonPlaylistClose.GetTheme();
|
||||
_Theme.SButtonPlaylistSave = ButtonPlaylistSave.GetTheme();
|
||||
_Theme.SButtonPlaylistDelete = ButtonPlaylistDelete.GetTheme();
|
||||
|
||||
LoadTextures();
|
||||
}
|
||||
@@ -426,15 +408,8 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.ColorBackground.Name))
|
||||
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackground.Name, _PartyModeID);
|
||||
else
|
||||
BackgroundColor = _Theme.ColorBackground.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.SelColorBackground.Name))
|
||||
BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackground.Name, _PartyModeID);
|
||||
else
|
||||
BackgroundSelColor = _Theme.SelColorBackground.Color;
|
||||
_Theme.ColorBackground.Get(_PartyModeID, out BackgroundColor);
|
||||
_Theme.SelColorBackground.Get(_PartyModeID, out BackgroundSelColor);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
|
||||
|
||||
@@ -33,12 +33,9 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("ScreenSetting")]
|
||||
public struct SScreenSetting
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlElement("Value")]
|
||||
public string Value;
|
||||
[XmlElement("Type")]
|
||||
public ESettingType Type;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlElement("Value")] public string Value;
|
||||
[XmlElement("Type")] public ESettingType Type;
|
||||
}
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
@@ -138,7 +135,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private SColorF _GetColorValue(string value)
|
||||
{
|
||||
return CBase.Theme.GetColor(value, _PartyModeID);
|
||||
SColorF color;
|
||||
CBase.Theme.GetColor(value, _PartyModeID, out color);
|
||||
return color;
|
||||
}
|
||||
#endregion Private
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -302,7 +302,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out SelColor);
|
||||
_ThemeLoaded &= _Theme.SColor.Get(_PartyModeID, out SelColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R);
|
||||
@@ -312,7 +312,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/HColor", out _Theme.HColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColor.Name, skinIndex, out HighlightColor);
|
||||
_ThemeLoaded &= _Theme.HColor.Get(_PartyModeID, out HighlightColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HighlightColor.R);
|
||||
@@ -334,7 +334,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColor.Name, skinIndex, out ColorArrow);
|
||||
_ThemeLoaded &= _Theme.ArrowColor.Get(_PartyModeID, out ColorArrow);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R);
|
||||
@@ -344,7 +344,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.ArrowSColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowSColor.Name, skinIndex, out SelColorArrow);
|
||||
_ThemeLoaded &= _Theme.ArrowSColor.Get(_PartyModeID, out SelColorArrow);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SelColorArrow.R);
|
||||
@@ -354,7 +354,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColor.Name, skinIndex, out TextColor);
|
||||
_ThemeLoaded &= _Theme.TextColor.Get(_PartyModeID, out TextColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R);
|
||||
@@ -364,7 +364,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextSColor", out _Theme.TextSColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextSColor.Name, skinIndex, out SelTextColor);
|
||||
_ThemeLoaded &= _Theme.TextSColor.Get(_PartyModeID, out SelTextColor);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref SelTextColor.R);
|
||||
@@ -702,40 +702,13 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = _Theme.Color.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
|
||||
SelColor = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
|
||||
else
|
||||
SelColor = _Theme.SColor.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.HColor.Name))
|
||||
HighlightColor = CBase.Theme.GetColor(_Theme.HColor.Name, _PartyModeID);
|
||||
else
|
||||
HighlightColor = _Theme.HColor.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.ArrowColor.Name))
|
||||
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColor.Name, _PartyModeID);
|
||||
else
|
||||
ColorArrow = _Theme.ArrowColor.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.ArrowSColor.Name))
|
||||
SelColorArrow = CBase.Theme.GetColor(_Theme.ArrowSColor.Name, _PartyModeID);
|
||||
else
|
||||
SelColorArrow = _Theme.ArrowSColor.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.TextColor.Name))
|
||||
TextColor = CBase.Theme.GetColor(_Theme.TextColor.Name, _PartyModeID);
|
||||
else
|
||||
TextColor = _Theme.TextColor.Color;
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.TextSColor.Name))
|
||||
SelTextColor = CBase.Theme.GetColor(_Theme.TextSColor.Name, _PartyModeID);
|
||||
else
|
||||
SelTextColor = _Theme.TextSColor.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
_Theme.SColor.Get(_PartyModeID, out SelColor);
|
||||
_Theme.HColor.Get(_PartyModeID, out HighlightColor);
|
||||
_Theme.ArrowColor.Get(_PartyModeID, out ColorArrow);
|
||||
_Theme.ArrowSColor.Get(_PartyModeID, out SelColorArrow);
|
||||
_Theme.TextColor.Get(_PartyModeID, out TextColor);
|
||||
_Theme.TextSColor.Get(_PartyModeID, out SelTextColor);
|
||||
|
||||
Rect = _Theme.Rect;
|
||||
RectArrowLeft = _Theme.RectArrowLeft;
|
||||
|
||||
@@ -25,10 +25,8 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Static")]
|
||||
public struct SThemeStatic
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlElement("Skin")]
|
||||
public string TextureName;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlElement("Skin")] public string TextureName;
|
||||
public SThemeColor Color;
|
||||
public SRectF Rect;
|
||||
public SReflection Reflection;
|
||||
@@ -73,10 +71,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public EAspect Aspect = EAspect.Stretch;
|
||||
|
||||
public CStatic()
|
||||
{
|
||||
|
||||
}
|
||||
public CStatic() {}
|
||||
|
||||
public CStatic(int partyModeID)
|
||||
{
|
||||
@@ -140,7 +135,7 @@ namespace VocaluxeLib.Menu
|
||||
_Theme.Rect = new SRectF(Rect);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -204,10 +199,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = _Theme.Color.Color;
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
|
||||
Rect = new SRectF(_Theme.Rect);
|
||||
Reflection = _Theme.Reflection.Enabled;
|
||||
|
||||
+15
-34
@@ -25,31 +25,20 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Text")]
|
||||
public struct SThemeText
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("X")]
|
||||
public float X;
|
||||
[XmlElement("Y")]
|
||||
public float Y;
|
||||
[XmlElement("Z")]
|
||||
public float Z;
|
||||
[XmlElement("H")]
|
||||
public float Height;
|
||||
[XmlElement("MaxW")]
|
||||
public float MaxWidth;
|
||||
[XmlElement("X")] public float X;
|
||||
[XmlElement("Y")] public float Y;
|
||||
[XmlElement("Z")] public float Z;
|
||||
[XmlElement("H")] public float Height;
|
||||
[XmlElement("MaxW")] public float MaxWidth;
|
||||
public SThemeColor Color;
|
||||
public SThemeColor SColor; //for Buttons
|
||||
[XmlElement("Align")]
|
||||
public EAlignment Align;
|
||||
[XmlElement("ResizeAlign")]
|
||||
public EHAlignment ResizeAlign;
|
||||
[XmlElement("Style")]
|
||||
public EStyle Style;
|
||||
[XmlElement("Font")]
|
||||
public string Font;
|
||||
[XmlElement("Text")]
|
||||
public string Text;
|
||||
[XmlElement("Align")] public EAlignment Align;
|
||||
[XmlElement("ResizeAlign")] public EHAlignment ResizeAlign;
|
||||
[XmlElement("Style")] public EStyle Style;
|
||||
[XmlElement("Font")] public string Font;
|
||||
[XmlElement("Text")] public string Text;
|
||||
public SReflection Reflection;
|
||||
}
|
||||
|
||||
@@ -366,7 +355,7 @@ namespace VocaluxeLib.Menu
|
||||
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
@@ -376,7 +365,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out SelColor);
|
||||
_ThemeLoaded &= _Theme.SColor.Get(_PartyModeID, out SelColor);
|
||||
else
|
||||
{
|
||||
if (xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R))
|
||||
@@ -425,7 +414,6 @@ namespace VocaluxeLib.Menu
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
|
||||
public void Draw(bool forceDraw = false)
|
||||
{
|
||||
if (!forceDraw && !Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
|
||||
@@ -492,15 +480,8 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
Color = new SColorF(_Theme.Color.Color);
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
|
||||
SelColor = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
|
||||
else
|
||||
SelColor = new SColorF(_Theme.SColor.Color);
|
||||
_Theme.Color.Get(_PartyModeID, out Color);
|
||||
_Theme.SColor.Get(_PartyModeID, out SelColor);
|
||||
|
||||
_X = _Theme.X;
|
||||
_Y = _Theme.Y;
|
||||
|
||||
@@ -29,29 +29,20 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
[XmlType("SongMenu")]
|
||||
public struct SThemeSongMenu
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
|
||||
[XmlElement("CoverBackground")]
|
||||
public string CoverBackgroundName;
|
||||
[XmlElement("CoverBigBackground")]
|
||||
public string CoverBigBackgroundName;
|
||||
[XmlElement("DuetIcon")]
|
||||
public string DuetIconName;
|
||||
[XmlElement("VideoIcon")]
|
||||
public string VideoIconName;
|
||||
[XmlElement("MedleyCalcIcon")]
|
||||
public string MedleyCalcIcon;
|
||||
[XmlElement("MedleyTagIcon")]
|
||||
public string MedleyTagIcon;
|
||||
[XmlElement("Color")]
|
||||
public SThemeColor Color;
|
||||
[XmlElement("CoverBackground")] public string CoverBackgroundName;
|
||||
[XmlElement("CoverBigBackground")] public string CoverBigBackgroundName;
|
||||
[XmlElement("DuetIcon")] public string DuetIconName;
|
||||
[XmlElement("VideoIcon")] public string VideoIconName;
|
||||
[XmlElement("MedleyCalcIcon")] public string MedleyCalcIcon;
|
||||
[XmlElement("MedleyTagIcon")] public string MedleyTagIcon;
|
||||
[XmlElement("Color")] public SThemeColor Color;
|
||||
|
||||
//public SThemeSongMenuBook songMenuBook;
|
||||
//public SThemeSongMenuDreidel songMenuDreidel;
|
||||
//public SThemeSongMenuList songMenuList;
|
||||
[XmlElement("SongMenuTileBoard")]
|
||||
public SThemeSongMenuTileBoard SongMenuTileBoard;
|
||||
[XmlElement("SongMenuTileBoard")] public SThemeSongMenuTileBoard SongMenuTileBoard;
|
||||
|
||||
public SThemeSongMenu(SThemeSongMenu theme)
|
||||
{
|
||||
@@ -69,66 +60,49 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public struct SThemeSongMenuTileBoard
|
||||
{
|
||||
[XmlElement("NumW")]
|
||||
/// <summary>
|
||||
[XmlElement("NumW")] /// <summary>
|
||||
/// Number of tiles horizontal
|
||||
/// </summary>
|
||||
public int NumW;
|
||||
|
||||
[XmlElement("NumH")]
|
||||
/// <summary>
|
||||
[XmlElement("NumH")] /// <summary>
|
||||
/// Number of tiles vertical
|
||||
/// </summary>
|
||||
public int NumH;
|
||||
|
||||
[XmlElement("NumWsmall")]
|
||||
/// <summary>
|
||||
[XmlElement("NumWsmall")] /// <summary>
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// </summary>
|
||||
public int NumWsmall;
|
||||
|
||||
[XmlElement("NumHsmall")]
|
||||
/// <summary>
|
||||
|
||||
[XmlElement("NumHsmall")] /// <summary>
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// </summary>
|
||||
public int NumHsmall;
|
||||
|
||||
[XmlElement("SpaceW")]
|
||||
/// <summary>
|
||||
[XmlElement("SpaceW")] /// <summary>
|
||||
/// Space between tiles horizontal
|
||||
/// </summary>
|
||||
public float SpaceW;
|
||||
|
||||
[XmlElement("SpaceH")]
|
||||
/// <summary>
|
||||
[XmlElement("SpaceH")] /// <summary>
|
||||
/// Space between tiles vertical
|
||||
/// </summary>
|
||||
public float SpaceH;
|
||||
|
||||
[XmlElement("TileRect")]
|
||||
public SRectF TileRect;
|
||||
[XmlElement("TileRectSmall")]
|
||||
public SRectF TileRectSmall;
|
||||
[XmlElement("TileRect")] public SRectF TileRect;
|
||||
[XmlElement("TileRectSmall")] public SRectF TileRectSmall;
|
||||
|
||||
[XmlElement("TextArtist")]
|
||||
public SThemeText TextArtist;
|
||||
[XmlElement("TextTitle")]
|
||||
public SThemeText TextTitle;
|
||||
[XmlElement("TextSongLength")]
|
||||
public SThemeText TextSongLength;
|
||||
[XmlElement("TextArtist")] public SThemeText TextArtist;
|
||||
[XmlElement("TextTitle")] public SThemeText TextTitle;
|
||||
[XmlElement("TextSongLength")] public SThemeText TextSongLength;
|
||||
|
||||
[XmlElement("StaticCoverBig")]
|
||||
public SThemeStatic StaticCoverBig;
|
||||
[XmlElement("StaticTextBG")]
|
||||
public SThemeStatic StaticTextBG;
|
||||
[XmlElement("StaticDuetIcon")]
|
||||
public SThemeStatic StaticDuetIcon;
|
||||
[XmlElement("StaticVideoIcon")]
|
||||
public SThemeStatic StaticVideoIcon;
|
||||
[XmlElement("StaticMedleyCalcIcon")]
|
||||
public SThemeStatic StaticMedleyCalcIcon;
|
||||
[XmlElement("StaticMedleyTagIcon")]
|
||||
public SThemeStatic StaticMedleyTagIcon;
|
||||
[XmlElement("StaticCoverBig")] public SThemeStatic StaticCoverBig;
|
||||
[XmlElement("StaticTextBG")] public SThemeStatic StaticTextBG;
|
||||
[XmlElement("StaticDuetIcon")] public SThemeStatic StaticDuetIcon;
|
||||
[XmlElement("StaticVideoIcon")] public SThemeStatic StaticVideoIcon;
|
||||
[XmlElement("StaticMedleyCalcIcon")] public SThemeStatic StaticMedleyCalcIcon;
|
||||
[XmlElement("StaticMedleyTagIcon")] public SThemeStatic StaticMedleyTagIcon;
|
||||
}
|
||||
|
||||
abstract class CSongMenuFramework : ISongMenu
|
||||
@@ -236,7 +210,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", out _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out _ColorInternal);
|
||||
_ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _ColorInternal);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _ColorInternal.R);
|
||||
@@ -278,7 +252,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
#endregion Theme
|
||||
|
||||
public virtual void Init()
|
||||
@@ -294,10 +267,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
public virtual void OnShow() {}
|
||||
|
||||
|
||||
public virtual void OnHide()
|
||||
{
|
||||
if(CBase.Graphics.GetNextScreen() != EScreens.ScreenNames)
|
||||
if (CBase.Graphics.GetNextScreen() != EScreens.ScreenNames)
|
||||
_ResetPreview();
|
||||
}
|
||||
|
||||
@@ -369,11 +342,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
Init();
|
||||
|
||||
if (!String.IsNullOrEmpty(_Theme.Color.Name))
|
||||
_ColorInternal = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
|
||||
else
|
||||
_ColorInternal = _Theme.Color.Color;
|
||||
|
||||
_Theme.Color.Get(_PartyModeID, out _ColorInternal);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
|
||||
@@ -82,6 +82,16 @@ namespace VocaluxeLib
|
||||
Color = new SColorF(theme.Color);
|
||||
Name = theme.Name;
|
||||
}
|
||||
|
||||
public bool Get(int partyModeId, out SColorF color)
|
||||
{
|
||||
if (String.IsNullOrEmpty(Name))
|
||||
{
|
||||
color = Color;
|
||||
return true;
|
||||
}
|
||||
return CBase.Theme.GetColor(Name, partyModeId, out color);
|
||||
}
|
||||
}
|
||||
|
||||
public struct SRectF
|
||||
|
||||
Reference in new issue
Block a user