Rewrite Theme Engine

This commit is contained in:
Flamefire committed 2014-10-08 22:29:02 +02:00
1 parent 9e5011374f
commit defb2ca6c7
116 files changed
+1034 -1020

No files matched your search

+1 -6
View File
@@ -101,17 +101,12 @@ namespace VocaluxeLib
public interface IThemes
{
string GetThemeScreensPath(int partyModeID);
int GetSkinIndex(int partyModeID);
CTextureRef GetSkinTexture(string textureName, int partyModeID);
CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop);
bool GetColor(string colorName, int partyModeID, out SColorF color);
SColorF GetPlayerColor(int playerNr);
void UnloadSkins();
void ListSkins();
void LoadSkins();
void LoadTheme();
void Reload();
}
public interface IBackgroundMusic
+1 -1
View File
@@ -87,7 +87,7 @@ namespace VocaluxeLib.Menu
#endregion Constructors
#region public
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+3 -3
View File
@@ -162,7 +162,7 @@ namespace VocaluxeLib.Menu
_SelReflectionSpace = button._SelReflectionSpace;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
@@ -196,12 +196,12 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
}
_ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, skinIndex, true);
_ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, true);
Text.Z = Rect.Z;
if (xmlReader.ItemExists(item + "/SText"))
{
_Theme.STextSpecified = true;
_ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true);
_ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, true);
_SelText.Z = Rect.Z;
}
+1 -1
View File
@@ -109,7 +109,7 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+1 -1
View File
@@ -130,7 +130,7 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+60 -65
View File
@@ -65,7 +65,6 @@ namespace VocaluxeLib.Menu
private List<CInteraction> _Interactions;
private int _Selection;
public string ThemePath { get; private set; }
protected int _PartyModeID = -1;
private int _PrevMouseX;
private int _PrevMouseY;
@@ -76,6 +75,7 @@ namespace VocaluxeLib.Menu
protected bool _Active;
protected abstract int _ScreenVersion { get; }
public int PartyModeID { get; protected set; }
public string ThemeName { get; set; }
public STheme Theme;
@@ -121,6 +121,7 @@ namespace VocaluxeLib.Menu
if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1]))
ThemeName = ThemeName.Remove(0, 1);
PartyModeID = -1;
_Interactions = new List<CInteraction>();
_Selection = 0;
@@ -170,14 +171,14 @@ namespace VocaluxeLib.Menu
#region ThemeHandler
private delegate void AddElementHandler<in T>(T element, String key);
private void _LoadThemeElement<T>(IEnumerable<string> elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement
private void _LoadThemeElement<T>(IEnumerable<string> elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader) where T : IMenuElement
{
if (elements != null)
{
foreach (string elName in elements)
{
var element = (T)Activator.CreateInstance(typeof(T), _PartyModeID);
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex))
var element = (T)Activator.CreateInstance(typeof(T), PartyModeID);
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader))
addElementHandler(element, elName);
else
CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName);
@@ -196,7 +197,6 @@ namespace VocaluxeLib.Menu
ThemePath = xmlPath;
string file = Path.Combine(xmlPath, ThemeName + ".xml");
int skinIndex = CBase.Themes.GetSkinIndex(_PartyModeID);
Theme.ScreenInformation = new SScreenInformation();
Theme.Backgrounds = new List<SThemeBackground>();
@@ -220,43 +220,43 @@ namespace VocaluxeLib.Menu
Theme = (STheme)deserializer.Deserialize(textReader);
foreach (SThemeBackground bg in Theme.Backgrounds)
_AddBackground(new CBackground(bg, _PartyModeID), bg.Name);
_AddBackground(new CBackground(bg, PartyModeID), bg.Name);
foreach (SThemeButton bt in Theme.Buttons)
_AddButton(new CButton(bt, _PartyModeID), bt.Name);
_AddButton(new CButton(bt, PartyModeID), bt.Name);
foreach (SThemeEqualizer eq in Theme.Equalizers)
_AddEqualizer(new CEqualizer(eq, _PartyModeID), eq.Name);
_AddEqualizer(new CEqualizer(eq, PartyModeID), eq.Name);
foreach (SThemeLyrics ly in Theme.Lyrics)
_AddLyric(new CLyric(ly, _PartyModeID), ly.Name);
_AddLyric(new CLyric(ly, PartyModeID), ly.Name);
foreach (SThemeNameSelection ns in Theme.NameSelections)
_AddNameSelection(new CNameSelection(ns, _PartyModeID), ns.Name);
_AddNameSelection(new CNameSelection(ns, PartyModeID), ns.Name);
foreach (SThemeParticleEffect pe in Theme.ParticleEffects)
_AddParticleEffect(new CParticleEffect(pe, _PartyModeID), pe.Name);
_AddParticleEffect(new CParticleEffect(pe, PartyModeID), pe.Name);
foreach (SThemePlaylist pl in Theme.Playlists)
_AddPlaylist(new CPlaylist(pl, _PartyModeID), pl.Name);
_AddPlaylist(new CPlaylist(pl, PartyModeID), pl.Name);
foreach (SScreenSetting ss in Theme.ScreenSettings)
_AddScreenSetting(new CScreenSetting(ss, _PartyModeID), ss.Name);
_AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name);
foreach (SThemeSelectSlide sl in Theme.SelectSlides)
_AddSelectSlide(new CSelectSlide(sl, _PartyModeID), sl.Name);
_AddSelectSlide(new CSelectSlide(sl, PartyModeID), sl.Name);
foreach (SThemeSingBar sb in Theme.SingNotes)
_AddSingNote(new CSingNotesClassic(sb, _PartyModeID), sb.Name);
_AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name);
foreach (SThemeSongMenu sm in Theme.SongMenus)
_AddSongMenu(new CSongMenu(sm, _PartyModeID), sm.Name);
_AddSongMenu(new CSongMenu(sm, PartyModeID), sm.Name);
foreach (SThemeStatic st in Theme.Statics)
_AddStatic(new CStatic(st, _PartyModeID), st.Name);
_AddStatic(new CStatic(st, PartyModeID), st.Name);
foreach (SThemeText te in Theme.Texts)
_AddText(new CText(te, _PartyModeID), te.Name);
_AddText(new CText(te, PartyModeID), te.Name);
}
catch (InvalidOperationException e)
{
@@ -278,26 +278,24 @@ namespace VocaluxeLib.Menu
bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
int skinIndex = CBase.Themes.GetSkinIndex(_PartyModeID);
if (versionCheck && skinIndex != -1)
if (versionCheck)
{
ThemePath = xmlPath;
_LoadThemeBasics(xmlReader, skinIndex);
_LoadThemeBasics(xmlReader);
_LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex);
_LoadThemeElement<CStatic>(_ThemeStatics, _AddStatic, xmlReader, skinIndex);
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader, skinIndex);
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader, skinIndex);
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader, skinIndex);
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader, skinIndex);
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader, skinIndex);
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader, skinIndex);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader, skinIndex);
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader, skinIndex);
_LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader, skinIndex);
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex);
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex);
_LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader);
_LoadThemeElement<CStatic>(_ThemeStatics, _AddStatic, xmlReader);
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader);
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader);
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader);
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader);
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader);
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader);
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader);
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader);
_LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader);
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader);
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader);
}
Theme.ScreenInformation.ScreenName = ThemeName;
@@ -537,7 +535,7 @@ namespace VocaluxeLib.Menu
// ReSharper disable MemberCanBeProtected.Global
public CButton GetNewButton()
{
return new CButton(_PartyModeID);
return new CButton(PartyModeID);
}
public static CButton GetNewButton(CButton button)
@@ -547,7 +545,7 @@ namespace VocaluxeLib.Menu
public CText GetNewText()
{
return new CText(_PartyModeID);
return new CText(PartyModeID);
}
public static CText GetNewText(CText text)
@@ -562,12 +560,12 @@ namespace VocaluxeLib.Menu
public CBackground GetNewBackground()
{
return new CBackground(_PartyModeID);
return new CBackground(PartyModeID);
}
public CStatic GetNewStatic()
{
return new CStatic(_PartyModeID);
return new CStatic(PartyModeID);
}
public static CStatic GetNewStatic(CStatic oldStatic)
@@ -577,12 +575,12 @@ namespace VocaluxeLib.Menu
public CStatic GetNewStatic(CTextureRef texture, SColorF color, SRectF rect)
{
return new CStatic(_PartyModeID, texture, color, rect);
return new CStatic(PartyModeID, texture, color, rect);
}
public CSelectSlide GetNewSelectSlide()
{
return new CSelectSlide(_PartyModeID);
return new CSelectSlide(PartyModeID);
}
public static CSelectSlide GetNewSelectSlide(CSelectSlide slide)
@@ -592,37 +590,37 @@ namespace VocaluxeLib.Menu
public CSongMenu GetNewSongMenu()
{
return new CSongMenu(_PartyModeID);
return new CSongMenu(PartyModeID);
}
public CLyric GetNewLyric()
{
return new CLyric(_PartyModeID);
return new CLyric(PartyModeID);
}
public CSingNotes GetNewSingNotes()
{
return new CSingNotesClassic(_PartyModeID);
return new CSingNotesClassic(PartyModeID);
}
public CNameSelection GetNewNameSelection()
{
return new CNameSelection(_PartyModeID);
return new CNameSelection(PartyModeID);
}
public CEqualizer GetNewEqualizer()
{
return new CEqualizer(_PartyModeID);
return new CEqualizer(PartyModeID);
}
public CPlaylist GetNewPlaylist()
{
return new CPlaylist(_PartyModeID);
return new CPlaylist(PartyModeID);
}
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTextureRef texture, float size, EParticleType type)
{
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
return new CParticleEffect(PartyModeID, maxNumber, color, area, texture, size, type);
}
// ReSharper restore MemberCanBeProtected.Global
@@ -1901,55 +1899,52 @@ namespace VocaluxeLib.Menu
return false;
}
private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex)
private void _LoadThemeBasics(CXMLReader xmlReader)
{
// Backgrounds
var background = new CBackground(_PartyModeID);
var background = new CBackground(PartyModeID);
int i = 1;
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex))
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader))
{
_AddBackground(background);
background = new CBackground(_PartyModeID);
background = new CBackground(PartyModeID);
i++;
}
// Statics
var stat = new CStatic(_PartyModeID);
var stat = new CStatic(PartyModeID);
i = 1;
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex))
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader))
{
_AddStatic(stat);
stat = new CStatic(_PartyModeID);
stat = new CStatic(PartyModeID);
i++;
}
// Texts
var text = new CText(_PartyModeID);
var text = new CText(PartyModeID);
i = 1;
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex))
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader))
{
_AddText(text);
text = new CText(_PartyModeID);
text = new CText(PartyModeID);
i++;
}
// ParticleEffects
var partef = new CParticleEffect(_PartyModeID);
var partef = new CParticleEffect(PartyModeID);
i = 1;
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex))
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader))
{
_AddParticleEffect(partef);
partef = new CParticleEffect(_PartyModeID);
partef = new CParticleEffect(PartyModeID);
i++;
}
}
private void _ReloadThemeEditMode()
{
CBase.Themes.UnloadSkins();
CBase.Themes.ListSkins();
CBase.Themes.LoadSkins();
CBase.Themes.LoadTheme();
CBase.Themes.Reload();
CBase.Graphics.ReloadTheme();
OnShow();
+1 -1
View File
@@ -31,7 +31,7 @@ namespace VocaluxeLib.Menu
public void SetPartyModeID(int partyModeID)
{
_PartyModeID = partyModeID;
PartyModeID = partyModeID;
}
public void AssignPartyMode(IPartyMode partyMode)
+1 -1
View File
@@ -154,7 +154,7 @@ namespace VocaluxeLib.Menu
UpdateList(0);
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+1 -1
View File
@@ -391,7 +391,7 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+11 -11
View File
@@ -292,7 +292,7 @@ namespace VocaluxeLib.Menu
_Interactions.AddButton(ButtonPlaylistSing);
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
@@ -324,19 +324,19 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundA", ref BackgroundSelColor.A);
}
_ThemeLoaded &= Text1.LoadTheme(item, "TextPart1", xmlReader, skinIndex);
_ThemeLoaded &= Text1.LoadTheme(item, "TextPart1", xmlReader);
_ThemeLoaded &= StaticCover.LoadTheme(item, "StaticCover", xmlReader, skinIndex);
_ThemeLoaded &= StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, skinIndex);
_ThemeLoaded &= StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, skinIndex);
_ThemeLoaded &= StaticCover.LoadTheme(item, "StaticCover", xmlReader);
_ThemeLoaded &= StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader);
_ThemeLoaded &= StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader);
_ThemeLoaded &= ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader);
_ThemeLoaded &= ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader);
_ThemeLoaded &= ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader);
_ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader);
_ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader);
_ThemeLoaded &= SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex);
_ThemeLoaded &= SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight);
if (_ThemeLoaded)
+1 -1
View File
@@ -72,7 +72,7 @@ namespace VocaluxeLib.Menu
_Theme = theme;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+7 -6
View File
@@ -140,11 +140,12 @@ namespace VocaluxeLib.Menu
public int Selection
{
get { return _Selection; }
set
{
if (value >= 0 && value < _ValueNames.Count)
_Selection = value;
}
set { _Selection = value.Clamp(0, _ValueNames.Count - 1, false); }
}
public string Value
{
get { return (_Selection >= 0 && _Selection < _ValueNames.Count) ? _ValueNames[_Selection] : null; }
}
public int ValueIndex
@@ -271,7 +272,7 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+1 -1
View File
@@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+4 -4
View File
@@ -312,12 +312,12 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
return LoadTheme(xmlPath, elementName, xmlReader, skinIndex, false);
return LoadTheme(xmlPath, elementName, xmlReader, false);
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex, bool buttonText)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, bool buttonText)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
@@ -553,6 +553,6 @@ namespace VocaluxeLib.Menu
public void FontChanged()
{
_PositionNeedsUpdate = true;
}
}
}
}
+2
View File
@@ -19,6 +19,8 @@ namespace VocaluxeLib.Menu
{
public interface IMenu
{
int PartyModeID { get; }
void Init();
void LoadTheme(string xmlPath);
+1 -1
View File
@@ -24,7 +24,7 @@ namespace VocaluxeLib.Menu
{
string GetThemeName();
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex);
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader);
void UnloadTextures();
void LoadTextures();
+1 -1
View File
@@ -119,7 +119,7 @@ namespace VocaluxeLib.Menu.SingNotes
get { return _ThemeLoaded; }
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+2 -2
View File
@@ -157,9 +157,9 @@ namespace VocaluxeLib.Menu.SongMenu
return _SongMenu.GetThemeName();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader, skinIndex);
return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader);
}
public void UnloadTextures()
@@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu.SongMenu
return new SThemeSongMenu(_Theme);
}
public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
+11 -11
View File
@@ -121,24 +121,24 @@ namespace VocaluxeLib.Menu.SongMenu
}
}
public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader)
{
string item = xmlPath + "/" + elementName;
bool themeLoaded = true;
themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader, skinIndex);
themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader);
themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex);
themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex);
themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex);
themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader);
themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader);
themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader);
themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex);
themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex);
themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex);
themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex);
themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex);
themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex);
themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader);
themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader);
themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader);
themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader);
themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader);
themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader);
if (themeLoaded)
{
+8
View File
@@ -65,6 +65,14 @@ namespace VocaluxeLib
public bool ShowFirstCover;
}
public struct SInfo
{
public string Name;
public string Author;
public int VersionMajor;
public int VersionMinor;
}
#region Drawing
public struct SColorF
{
+1 -1
View File
@@ -26,7 +26,7 @@ namespace VocaluxeLib.Xml
private readonly XPathNavigator _Navigator;
private readonly String _FilePath;
public string FilePath
public override string FilePath
{
get { return _FilePath; }
}
+29
View File
@@ -4,6 +4,8 @@ namespace VocaluxeLib.Xml
{
public abstract class CXmlDeserializer : CXmlReaderBase
{
public abstract string FilePath { get; }
public bool Read(string xPath, out SThemeFont el)
{
el = new SThemeFont();
@@ -64,5 +66,32 @@ namespace VocaluxeLib.Xml
TryGetBoolValue(xPath + "/ShowFirstCover", out el.ShowFirstCover);
return ok;
}
public bool Read(string xPath, out SInfo el)
{
el=new SInfo();
bool ok = GetValue(xPath+"/Name", out el.Name);
ok &= GetValue(xPath + "/Author", out el.Author);
ok &= TryGetIntValue(xPath + "/VersionMajor", ref el.VersionMajor);
ok &= TryGetIntValue(xPath + "/VersionMinor", ref el.VersionMinor);
return ok;
}
public bool CheckVersion(string xPath, int reqVersion)
{
int version=0;
string errorMsg;
if (!TryGetIntValue(xPath, ref version))
errorMsg = "Version missing";
else if (version != reqVersion)
{
errorMsg = version < reqVersion ? "the file ist outdated!" : "the file is for newer program versions!";
errorMsg += " Current Version is " + reqVersion;
}
else
return true;
CBase.Log.LogError("Cannot load "+FilePath+": "+errorMsg);
return false;
}
}
}