Added ScreenSetting as new Theme-Element.
This commit is contained in:
1 parent
ef12559b28
commit
3eda104c81
3 files changed
+216
No files matched your search
@@ -39,6 +39,7 @@ namespace Vocaluxe.Menu
|
|||||||
private List<CEqualizer> _Equalizers;
|
private List<CEqualizer> _Equalizers;
|
||||||
private List<CPlaylist> _Playlists;
|
private List<CPlaylist> _Playlists;
|
||||||
private List<CParticleEffect> _ParticleEffects;
|
private List<CParticleEffect> _ParticleEffects;
|
||||||
|
private List<CScreenSetting> _ScreenSettings;
|
||||||
|
|
||||||
private Hashtable _htBackgrounds;
|
private Hashtable _htBackgrounds;
|
||||||
private Hashtable _htStatics;
|
private Hashtable _htStatics;
|
||||||
@@ -52,6 +53,7 @@ namespace Vocaluxe.Menu
|
|||||||
private Hashtable _htEqualizers;
|
private Hashtable _htEqualizers;
|
||||||
private Hashtable _htPlaylists;
|
private Hashtable _htPlaylists;
|
||||||
private Hashtable _htParticleEffects;
|
private Hashtable _htParticleEffects;
|
||||||
|
private Hashtable _htScreenSettings;
|
||||||
|
|
||||||
|
|
||||||
private int _PrevMouseX;
|
private int _PrevMouseX;
|
||||||
@@ -76,6 +78,7 @@ namespace Vocaluxe.Menu
|
|||||||
protected string[] _ThemeEqualizers;
|
protected string[] _ThemeEqualizers;
|
||||||
protected string[] _ThemePlaylists;
|
protected string[] _ThemePlaylists;
|
||||||
protected string[] _ThemeParticleEffects;
|
protected string[] _ThemeParticleEffects;
|
||||||
|
protected string[] _ThemeScreenSettings;
|
||||||
|
|
||||||
protected SRectF _ScreenArea;
|
protected SRectF _ScreenArea;
|
||||||
protected Basic _Base;
|
protected Basic _Base;
|
||||||
@@ -122,6 +125,7 @@ namespace Vocaluxe.Menu
|
|||||||
_Equalizers = new List<CEqualizer>();
|
_Equalizers = new List<CEqualizer>();
|
||||||
_Playlists = new List<CPlaylist>();
|
_Playlists = new List<CPlaylist>();
|
||||||
_ParticleEffects = new List<CParticleEffect>();
|
_ParticleEffects = new List<CParticleEffect>();
|
||||||
|
_ScreenSettings = new List<CScreenSetting>();
|
||||||
|
|
||||||
_htBackgrounds = new Hashtable();
|
_htBackgrounds = new Hashtable();
|
||||||
_htStatics = new Hashtable();
|
_htStatics = new Hashtable();
|
||||||
@@ -135,6 +139,7 @@ namespace Vocaluxe.Menu
|
|||||||
_htEqualizers = new Hashtable();
|
_htEqualizers = new Hashtable();
|
||||||
_htPlaylists = new Hashtable();
|
_htPlaylists = new Hashtable();
|
||||||
_htParticleEffects = new Hashtable();
|
_htParticleEffects = new Hashtable();
|
||||||
|
_htScreenSettings = new Hashtable();
|
||||||
|
|
||||||
_PrevMouseX = 0;
|
_PrevMouseX = 0;
|
||||||
_PrevMouseY = 0;
|
_PrevMouseY = 0;
|
||||||
@@ -158,6 +163,7 @@ namespace Vocaluxe.Menu
|
|||||||
_ThemeEqualizers = null;
|
_ThemeEqualizers = null;
|
||||||
_ThemePlaylists = null;
|
_ThemePlaylists = null;
|
||||||
_ThemeParticleEffects = null;
|
_ThemeParticleEffects = null;
|
||||||
|
_ThemeScreenSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void FadeTo(EScreens NextScreen)
|
protected void FadeTo(EScreens NextScreen)
|
||||||
@@ -394,6 +400,22 @@ namespace Vocaluxe.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_ThemeScreenSettings != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _ThemeScreenSettings.Length; i++)
|
||||||
|
{
|
||||||
|
CParticleEffect pe = new CParticleEffect(_Base, _PartyModeID);
|
||||||
|
if (pe.LoadTheme("//root/" + _ThemeName, _ThemeScreenSettings[i], navigator, SkinIndex))
|
||||||
|
{
|
||||||
|
_htScreenSettings.Add(_ThemeScreenSettings[i], AddParticleEffect(pe));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_Base.Log.LogError("Can't load ThemeSetting \"" + _ThemeScreenSettings[i] + "\" in screen " + _ThemeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -490,6 +512,12 @@ namespace Vocaluxe.Menu
|
|||||||
_ParticleEffects[i].SaveTheme(writer);
|
_ParticleEffects[i].SaveTheme(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ScreenSettings
|
||||||
|
for (int i = 0; i < _ScreenSettings.Count; i++)
|
||||||
|
{
|
||||||
|
_ScreenSettings[i].SaveTheme(writer);
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
// End of File
|
// End of File
|
||||||
@@ -561,6 +589,11 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
pe.ReloadTextures();
|
pe.ReloadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (CScreenSetting se in _ScreenSettings)
|
||||||
|
{
|
||||||
|
se.ReloadTextures();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void UnloadTextures()
|
public virtual void UnloadTextures()
|
||||||
@@ -623,6 +656,11 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
pe.UnloadTextures();
|
pe.UnloadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (CScreenSetting se in _ScreenSettings)
|
||||||
|
{
|
||||||
|
se.UnloadTextures();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ReloadTheme()
|
public virtual void ReloadTheme()
|
||||||
@@ -696,6 +734,11 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
return _ParticleEffects;
|
return _ParticleEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CScreenSetting> GetScreenSettings()
|
||||||
|
{
|
||||||
|
return _ScreenSettings;
|
||||||
|
}
|
||||||
#endregion GetLists
|
#endregion GetLists
|
||||||
|
|
||||||
#region ElementHandler
|
#region ElementHandler
|
||||||
@@ -888,6 +931,14 @@ namespace Vocaluxe.Menu
|
|||||||
return _ParticleEffects.ToArray();
|
return _ParticleEffects.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CScreenSetting[] ScreenSettings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _ScreenSettings.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion Get Arrays
|
#endregion Get Arrays
|
||||||
|
|
||||||
#region Hashtables
|
#region Hashtables
|
||||||
@@ -1046,6 +1097,19 @@ namespace Vocaluxe.Menu
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int htScreenSettings(string key)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (int)_htScreenSettings[key];
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_Base.Log.LogError("Can't find ScreenSetting Element \"" + key + "\" in Screen " + _ThemeName);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion Hashtables
|
#endregion Hashtables
|
||||||
#endregion ElementHandler
|
#endregion ElementHandler
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.XPath;
|
||||||
|
|
||||||
|
namespace Vocaluxe.Menu
|
||||||
|
{
|
||||||
|
enum ESettingType
|
||||||
|
{
|
||||||
|
Int,
|
||||||
|
String,
|
||||||
|
Color,
|
||||||
|
Texture
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SScreenSetting
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public string Value;
|
||||||
|
public ESettingType Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CScreenSetting : IMenuElement
|
||||||
|
{
|
||||||
|
private int _PartyModeID;
|
||||||
|
private Basic _Base;
|
||||||
|
|
||||||
|
private SScreenSetting _Theme;
|
||||||
|
private bool _ThemeLoaded;
|
||||||
|
|
||||||
|
public string GetThemeName()
|
||||||
|
{
|
||||||
|
return _Theme.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CScreenSetting(Basic Base, int PartyModeID)
|
||||||
|
{
|
||||||
|
_PartyModeID = PartyModeID;
|
||||||
|
_Base = Base;
|
||||||
|
_Theme = new SScreenSetting();
|
||||||
|
_ThemeLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CScreenSetting(CScreenSetting ts)
|
||||||
|
{
|
||||||
|
_PartyModeID = ts._PartyModeID;
|
||||||
|
_Base = ts._Base;
|
||||||
|
_Theme = ts._Theme;
|
||||||
|
_ThemeLoaded = ts._ThemeLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||||
|
{
|
||||||
|
string item = XmlPath + "/" + ElementName;
|
||||||
|
_ThemeLoaded = true;
|
||||||
|
|
||||||
|
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Value", navigator, ref _Theme.Value, String.Empty);
|
||||||
|
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<ESettingType>(item + "/Type", navigator, ref _Theme.Type);
|
||||||
|
|
||||||
|
if (_ThemeLoaded)
|
||||||
|
{
|
||||||
|
_Theme.Name = ElementName;
|
||||||
|
}
|
||||||
|
return _ThemeLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SaveTheme(XmlWriter writer)
|
||||||
|
{
|
||||||
|
if (_ThemeLoaded)
|
||||||
|
{
|
||||||
|
writer.WriteStartElement(_Theme.Name);
|
||||||
|
|
||||||
|
writer.WriteComment("<Type>: Type of theme-setting-value: "+ CHelper.ListStrings(Enum.GetNames(typeof(ESettingType))));
|
||||||
|
writer.WriteElementString("Type", Enum.GetName(typeof(ESettingType), _Theme.Type));
|
||||||
|
writer.WriteComment("<Value>: Value of theme-setting");
|
||||||
|
writer.WriteElementString("Value", _Theme.Value);
|
||||||
|
writer.WriteEndElement();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object GetValue()
|
||||||
|
{
|
||||||
|
switch (_Theme.Type)
|
||||||
|
{
|
||||||
|
case ESettingType.Int:
|
||||||
|
return GetIntValue(_Theme.Value);
|
||||||
|
|
||||||
|
case ESettingType.String:
|
||||||
|
return _Theme.Value;
|
||||||
|
|
||||||
|
case ESettingType.Color:
|
||||||
|
return GetColorValue(_Theme.Value);
|
||||||
|
|
||||||
|
case ESettingType.Texture:
|
||||||
|
return GetTextureValue(_Theme.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnloadTextures()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadTextures()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadTextures()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Private
|
||||||
|
private int GetIntValue(string _string)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Convert.ToInt32(_string);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private STexture GetTextureValue(string _string)
|
||||||
|
{
|
||||||
|
return _Base.Theme.GetSkinTexture(_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SColorF GetColorValue(string _string)
|
||||||
|
{
|
||||||
|
return _Base.Theme.GetColor(_string);
|
||||||
|
}
|
||||||
|
#endregion Private
|
||||||
|
|
||||||
|
#region ThemeEdit
|
||||||
|
public void MoveElement(int stepX, int stepY)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResizeElement(int stepW, int stepH)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endregion ThemeEdit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -125,6 +125,7 @@
|
|||||||
<Compile Include="Menu\CSelectSlide.cs" />
|
<Compile Include="Menu\CSelectSlide.cs" />
|
||||||
<Compile Include="Menu\CStatic.cs" />
|
<Compile Include="Menu\CStatic.cs" />
|
||||||
<Compile Include="Menu\CText.cs" />
|
<Compile Include="Menu\CText.cs" />
|
||||||
|
<Compile Include="Menu\CScreenSetting.cs" />
|
||||||
<Compile Include="Menu\IMenu.cs" />
|
<Compile Include="Menu\IMenu.cs" />
|
||||||
<Compile Include="Menu\IMenuElement.cs" />
|
<Compile Include="Menu\IMenuElement.cs" />
|
||||||
<Compile Include="Menu\SingNotes\CNotes.cs" />
|
<Compile Include="Menu\SingNotes\CNotes.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user