added theme loading for party screens (there is still a lot to do)
This commit is contained in:
1 parent
41f8f9ce72
commit
9ec4c31401
33 files changed
+412
-85
No files matched your search
@@ -24,6 +24,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
private List<CInteraction> _Interactions;
|
||||
private int _Selection = 0;
|
||||
private string _ThemePath = String.Empty;
|
||||
|
||||
private List<CBackground> _Backgrounds;
|
||||
private List<CButton> _Buttons;
|
||||
@@ -158,9 +159,9 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
|
||||
#region ThemeHandler
|
||||
public virtual void LoadTheme()
|
||||
public virtual void LoadTheme(string XmlPath)
|
||||
{
|
||||
string file = Path.Combine(_Base.Theme.GetThemeScreensPath(), _ThemeName + ".xml");
|
||||
string file = Path.Combine(XmlPath, _ThemeName + ".xml");
|
||||
|
||||
XPathDocument xPathDoc = null;
|
||||
XPathNavigator navigator = null;
|
||||
@@ -192,6 +193,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (loaded && VersionCheck && SkinIndex != -1)
|
||||
{
|
||||
_ThemePath = XmlPath;
|
||||
LoadThemeBasics(navigator, SkinIndex);
|
||||
|
||||
if (_ThemeBackgrounds != null)
|
||||
@@ -378,12 +380,15 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public virtual void SaveTheme()
|
||||
{
|
||||
if (_ThemePath == String.Empty)
|
||||
return;
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = true;
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
|
||||
string file = Path.Combine(_Base.Theme.GetThemeScreensPath(), _ThemeName + ".xml");
|
||||
string file = Path.Combine(_ThemePath, _ThemeName + ".xml");
|
||||
XmlWriter writer = XmlWriter.Create(file, settings);
|
||||
|
||||
writer.WriteStartDocument();
|
||||
@@ -584,9 +589,12 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public virtual void ReloadTheme()
|
||||
{
|
||||
if (_ThemePath == String.Empty)
|
||||
return;
|
||||
|
||||
UnloadTextures();
|
||||
Init();
|
||||
LoadTheme();
|
||||
Init();
|
||||
LoadTheme(_ThemePath);
|
||||
}
|
||||
#endregion ThemeHandler
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Vocaluxe.Menu
|
||||
private bool _ArrowRightSelected;
|
||||
|
||||
private List<string> _ValueNames;
|
||||
private List<int> _ValuePartyModeIDs;
|
||||
private List<STexture> _Textures;
|
||||
private List<int> _ValueIndexes;
|
||||
|
||||
@@ -164,6 +165,7 @@ namespace Vocaluxe.Menu
|
||||
_Textures = new List<STexture>();
|
||||
_ValueIndexes = new List<int>();
|
||||
_ValueNames = new List<string>();
|
||||
_ValuePartyModeIDs = new List<int>();
|
||||
}
|
||||
|
||||
public CSelectSlide(CSelectSlide slide)
|
||||
@@ -217,6 +219,7 @@ namespace Vocaluxe.Menu
|
||||
_ValueIndexes = new List<int>(slide._ValueIndexes);
|
||||
_ValueNames = new List<string>(slide._ValueNames);
|
||||
_ValueBounds = new List<SRectF>(slide._ValueBounds);
|
||||
_ValuePartyModeIDs = new List<int>(slide._ValuePartyModeIDs);
|
||||
_Selection = slide._Selection;
|
||||
_NumVisible = slide._NumVisible;
|
||||
|
||||
@@ -540,7 +543,11 @@ namespace Vocaluxe.Menu
|
||||
public void AddValue(string value)
|
||||
{
|
||||
AddValue(value, new STexture(-1));
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
|
||||
public void AddValue(string value, int PartyModeID)
|
||||
{
|
||||
AddValue(value, new STexture(-1), _ValueIndexes.Count, PartyModeID);
|
||||
}
|
||||
|
||||
public void AddValue(string value, STexture texture)
|
||||
@@ -549,10 +556,16 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
|
||||
public void AddValue(string value, STexture texture, int valueIndex)
|
||||
{
|
||||
AddValue(value, texture, valueIndex, -1);
|
||||
}
|
||||
|
||||
public void AddValue(string value, STexture texture, int valueIndex, int PartyModeID)
|
||||
{
|
||||
_ValueNames.Add(value);
|
||||
_Textures.Add(texture);
|
||||
_ValueIndexes.Add(valueIndex);
|
||||
_ValuePartyModeIDs.Add(PartyModeID);
|
||||
|
||||
if (Selection == -1)
|
||||
Selection = 0;
|
||||
@@ -763,7 +776,10 @@ namespace Vocaluxe.Menu
|
||||
_ValueBounds.Clear();
|
||||
for (int i = 0; i < numvis; i++)
|
||||
{
|
||||
CText Text = new CText(_Base, 0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset]);
|
||||
CText Text = new CText(_Base, 0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, String.Empty);
|
||||
Text.PartyModeID = _ValuePartyModeIDs[i + offset];
|
||||
Text.Text = _ValueNames[i + offset];
|
||||
|
||||
SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f);
|
||||
if (i + offset == _Selection)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Vocaluxe.Menu
|
||||
private Basic _Base;
|
||||
private SThemeText _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
private int _PartyModeID;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
@@ -203,7 +204,7 @@ namespace Vocaluxe.Menu
|
||||
get { return _Theme.Text; }
|
||||
set
|
||||
{
|
||||
string translation = _Base.Language.Translate(value);
|
||||
string translation = _Base.Language.Translate(value, _PartyModeID);
|
||||
if (_Theme.Text != value || translation != _Text)
|
||||
{
|
||||
_Theme.Text = value;
|
||||
@@ -213,6 +214,17 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public int PartyModeID
|
||||
{
|
||||
get { return _PartyModeID; }
|
||||
set
|
||||
{
|
||||
_Text = _Base.Language.Translate(_Text, value);
|
||||
_PositionNeedsUpdate = true;
|
||||
_PartyModeID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
public bool EditMode = false;
|
||||
@@ -225,6 +237,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = -1;
|
||||
|
||||
X = 0f;
|
||||
Y = 0f;
|
||||
@@ -255,6 +268,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = text._PartyModeID;
|
||||
|
||||
X = text._X;
|
||||
Y = text._Y;
|
||||
@@ -287,6 +301,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = -1;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
@@ -325,6 +340,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = -1;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
@@ -361,6 +377,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = -1;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
@@ -399,6 +416,7 @@ namespace Vocaluxe.Menu
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
_PartyModeID = -1;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
void Initialize(Basic Base);
|
||||
|
||||
void LoadTheme();
|
||||
void LoadTheme(string XmlPath);
|
||||
void SaveTheme();
|
||||
void ReloadTextures();
|
||||
void UnloadTextures();
|
||||
@@ -176,6 +176,7 @@ namespace Vocaluxe.Menu
|
||||
public interface ILanguage
|
||||
{
|
||||
string Translate(string KeyWord);
|
||||
string Translate(string KeyWord, int PartyModeID);
|
||||
bool TranslationExists(string KeyWord);
|
||||
}
|
||||
|
||||
@@ -799,6 +800,15 @@ namespace Vocaluxe.Menu
|
||||
TR_GAMEMODE_SHORTSONG
|
||||
}
|
||||
|
||||
public struct SPartyModeInfos
|
||||
{
|
||||
public int PartyModeID;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public string Author;
|
||||
public bool Playable;
|
||||
}
|
||||
|
||||
public enum EScreens
|
||||
{
|
||||
ScreenTest = 0,
|
||||
|
||||
Reference in new issue
Block a user