Could load particle-effects from theme now.
This commit is contained in:
1 parent
8e51252284
commit
ea5774eff3
5 files changed
+313
-47
No files matched your search
@@ -342,9 +342,7 @@ namespace Vocaluxe.Screens
|
||||
CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0));
|
||||
|
||||
//Draw stars
|
||||
starsBlue.Update();
|
||||
starsBlue.Draw();
|
||||
starsRed.Update();
|
||||
starsRed.Draw();
|
||||
|
||||
logo.Draw();
|
||||
@@ -355,7 +353,6 @@ namespace Vocaluxe.Screens
|
||||
if (_CreditNames[i].active)
|
||||
{
|
||||
_CreditNames[i].image.Draw();
|
||||
_CreditNames[i].particle.Update();
|
||||
_CreditNames[i].particle.Draw();
|
||||
}
|
||||
}
|
||||
@@ -380,8 +377,8 @@ namespace Vocaluxe.Screens
|
||||
|
||||
logo.Rect.Y = -270 + (270f / 3000f) * LogoTimer.ElapsedMilliseconds;
|
||||
SRectF rect = new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1);
|
||||
starsRed.Area = rect;
|
||||
starsBlue.Area = rect;
|
||||
starsRed.Rect = rect;
|
||||
starsBlue.Rect = rect;
|
||||
if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning)
|
||||
{
|
||||
CreditsTimer.Start();
|
||||
@@ -409,7 +406,7 @@ namespace Vocaluxe.Screens
|
||||
float xOld = _CreditNames[i].image.Rect.X;
|
||||
_CreditNames[i].image.Rect.X = -450 + (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2)/3000f) * (CreditsTimer.ElapsedMilliseconds-(i*4000f));
|
||||
_CreditNames[i].particleRect.X += (_CreditNames[i].image.Rect.X - xOld);
|
||||
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
|
||||
_CreditNames[i].particle.Rect = _CreditNames[i].particleRect;
|
||||
|
||||
//Check if name is in middle of screen and should go up
|
||||
if (_CreditNames[i].image.Rect.X >= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2)
|
||||
@@ -427,7 +424,7 @@ namespace Vocaluxe.Screens
|
||||
float xOld = _CreditNames[i].image.Rect.X;
|
||||
_CreditNames[i].image.Rect.X = CSettings.iRenderW - (((CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2) / 3000f) * (CreditsTimer.ElapsedMilliseconds - (i * 4000f));
|
||||
_CreditNames[i].particleRect.X -= (xOld - _CreditNames[i].image.Rect.X);
|
||||
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
|
||||
_CreditNames[i].particle.Rect = _CreditNames[i].particleRect;
|
||||
|
||||
//Check if name is in middle of screen and should go up
|
||||
if (_CreditNames[i].image.Rect.X <= (CSettings.iRenderW - _CreditNames[i].image.Rect.W) / 2 )
|
||||
@@ -443,7 +440,7 @@ namespace Vocaluxe.Screens
|
||||
float yOld = _CreditNames[i].image.Rect.Y;
|
||||
_CreditNames[i].image.Rect.Y = 580 - (430f / 3000f) * (CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp);
|
||||
_CreditNames[i].particleRect.Y -= (yOld - _CreditNames[i].image.Rect.Y);
|
||||
_CreditNames[i].particle.Area = _CreditNames[i].particleRect;
|
||||
_CreditNames[i].particle.Rect = _CreditNames[i].particleRect;
|
||||
|
||||
//Fade names out
|
||||
if (_CreditNames[i].image.Rect.Y <= 350f)
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace Vocaluxe.Menu
|
||||
TSingNote,
|
||||
TNameSelection,
|
||||
TEqualizer,
|
||||
TPlaylist
|
||||
TPlaylist,
|
||||
TParticleEffect
|
||||
}
|
||||
|
||||
class CInteraction
|
||||
|
||||
+126
-1
@@ -38,6 +38,7 @@ namespace Vocaluxe.Menu
|
||||
private List<CNameSelection> _NameSelections;
|
||||
private List<CEqualizer> _Equalizers;
|
||||
private List<CPlaylist> _Playlists;
|
||||
private List<CParticleEffect> _ParticleEffects;
|
||||
|
||||
private Hashtable _htBackgrounds;
|
||||
private Hashtable _htStatics;
|
||||
@@ -50,6 +51,7 @@ namespace Vocaluxe.Menu
|
||||
private Hashtable _htNameSelections;
|
||||
private Hashtable _htEqualizers;
|
||||
private Hashtable _htPlaylists;
|
||||
private Hashtable _htParticleEffects;
|
||||
|
||||
|
||||
private int _PrevMouseX;
|
||||
@@ -73,6 +75,7 @@ namespace Vocaluxe.Menu
|
||||
protected string[] _ThemeNameSelections;
|
||||
protected string[] _ThemeEqualizers;
|
||||
protected string[] _ThemePlaylists;
|
||||
protected string[] _ThemeParticleEffects;
|
||||
|
||||
protected SRectF _ScreenArea;
|
||||
protected Basic _Base;
|
||||
@@ -118,6 +121,7 @@ namespace Vocaluxe.Menu
|
||||
_NameSelections = new List<CNameSelection>();
|
||||
_Equalizers = new List<CEqualizer>();
|
||||
_Playlists = new List<CPlaylist>();
|
||||
_ParticleEffects = new List<CParticleEffect>();
|
||||
|
||||
_htBackgrounds = new Hashtable();
|
||||
_htStatics = new Hashtable();
|
||||
@@ -130,6 +134,7 @@ namespace Vocaluxe.Menu
|
||||
_htNameSelections = new Hashtable();
|
||||
_htEqualizers = new Hashtable();
|
||||
_htPlaylists = new Hashtable();
|
||||
_htParticleEffects = new Hashtable();
|
||||
|
||||
_PrevMouseX = 0;
|
||||
_PrevMouseY = 0;
|
||||
@@ -152,6 +157,7 @@ namespace Vocaluxe.Menu
|
||||
_ThemeNameSelections = null;
|
||||
_ThemeEqualizers = null;
|
||||
_ThemePlaylists = null;
|
||||
_ThemeParticleEffects = null;
|
||||
}
|
||||
|
||||
protected void FadeTo(EScreens NextScreen)
|
||||
@@ -372,6 +378,22 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_ThemeParticleEffects != null)
|
||||
{
|
||||
for (int i = 0; i < _ThemeParticleEffects.Length; i++)
|
||||
{
|
||||
CParticleEffect pe = new CParticleEffect(_Base, _PartyModeID);
|
||||
if (pe.LoadTheme("//root/" + _ThemeName, _ThemeParticleEffects[i], navigator, SkinIndex))
|
||||
{
|
||||
_htParticleEffects.Add(_ThemeParticleEffects[i], AddParticleEffect(pe));
|
||||
}
|
||||
else
|
||||
{
|
||||
_Base.Log.LogError("Can't load ParticleEffect \"" + _ThemeParticleEffects[i] + "\" in screen " + _ThemeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -462,6 +484,12 @@ namespace Vocaluxe.Menu
|
||||
_Playlists[i].SaveTheme(writer);
|
||||
}
|
||||
|
||||
//ParticleEffects
|
||||
for (int i = 0; i < _ParticleEffects.Count; i++)
|
||||
{
|
||||
_ParticleEffects[i].SaveTheme(writer);
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
// End of File
|
||||
@@ -528,6 +556,11 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
pls.ReloadTextures();
|
||||
}
|
||||
|
||||
foreach (CParticleEffect pe in _ParticleEffects)
|
||||
{
|
||||
pe.ReloadTextures();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UnloadTextures()
|
||||
@@ -586,6 +619,10 @@ namespace Vocaluxe.Menu
|
||||
eq.UnloadTextures();
|
||||
}
|
||||
|
||||
foreach (CParticleEffect pe in _ParticleEffects)
|
||||
{
|
||||
pe.UnloadTextures();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ReloadTheme()
|
||||
@@ -654,6 +691,11 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
return _Playlists;
|
||||
}
|
||||
|
||||
public List<CParticleEffect> GetParticleEffects()
|
||||
{
|
||||
return _ParticleEffects;
|
||||
}
|
||||
#endregion GetLists
|
||||
|
||||
#region ElementHandler
|
||||
@@ -838,6 +880,14 @@ namespace Vocaluxe.Menu
|
||||
return _Playlists.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public CParticleEffect[] ParticleEffects
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ParticleEffects.ToArray();
|
||||
}
|
||||
}
|
||||
#endregion Get Arrays
|
||||
|
||||
#region Hashtables
|
||||
@@ -983,6 +1033,19 @@ namespace Vocaluxe.Menu
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public int htParticleEffects(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (int)_htParticleEffects[key];
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_Base.Log.LogError("Can't find ParticleEffect Element \"" + key + "\" in Screen " + _ThemeName);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion Hashtables
|
||||
#endregion ElementHandler
|
||||
|
||||
@@ -1267,7 +1330,8 @@ namespace Vocaluxe.Menu
|
||||
_Interactions[i].Type == EType.TText ||
|
||||
_Interactions[i].Type == EType.TSongMenu ||
|
||||
_Interactions[i].Type == EType.TEqualizer ||
|
||||
_Interactions[i].Type == EType.TPlaylist))
|
||||
_Interactions[i].Type == EType.TPlaylist ||
|
||||
_Interactions[i].Type == EType.TParticleEffect))
|
||||
{
|
||||
ZSort zs = new ZSort();
|
||||
zs.ID = i;
|
||||
@@ -1367,6 +1431,13 @@ namespace Vocaluxe.Menu
|
||||
_AddInteraction(_Playlists.Count - 1, EType.TPlaylist);
|
||||
return _Playlists.Count - 1;
|
||||
}
|
||||
|
||||
public int AddParticleEffect(CParticleEffect pe)
|
||||
{
|
||||
_ParticleEffects.Add(pe);
|
||||
_AddInteraction(_ParticleEffects.Count - 1, EType.TParticleEffect);
|
||||
return _ParticleEffects.Count - 1;
|
||||
}
|
||||
#endregion Elements
|
||||
|
||||
#region InteractionHandling
|
||||
@@ -1541,6 +1612,10 @@ namespace Vocaluxe.Menu
|
||||
if (CHelper.IsInBounds(_Playlists[interact.Num].Rect, x, y))
|
||||
return true;
|
||||
break;
|
||||
case EType.TParticleEffect:
|
||||
if (CHelper.IsInBounds(_ParticleEffects[interact.Num].Rect, x, y))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1567,6 +1642,8 @@ namespace Vocaluxe.Menu
|
||||
return _Equalizers[interact.Num].Rect.Z;
|
||||
case EType.TPlaylist:
|
||||
return _Playlists[interact.Num].Rect.Z;
|
||||
case EType.TParticleEffect:
|
||||
return _ParticleEffects[interact.Num].Rect.Z;
|
||||
}
|
||||
return _Base.Settings.GetZFar();
|
||||
}
|
||||
@@ -1601,6 +1678,9 @@ namespace Vocaluxe.Menu
|
||||
|
||||
case EType.TPlaylist:
|
||||
return _Playlists[_Interactions[interaction].Num].Rect.Z;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
return _ParticleEffects[_Interactions[interaction].Num].Rect.Z;
|
||||
}
|
||||
|
||||
return _Base.Settings.GetZFar();
|
||||
@@ -1951,6 +2031,9 @@ namespace Vocaluxe.Menu
|
||||
case EType.TPlaylist:
|
||||
_Playlists[_Interactions[_Selection].Num].Selected = true;
|
||||
break;
|
||||
case EType.TParticleEffect:
|
||||
_ParticleEffects[_Interactions[_Selection].Num].Selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1985,6 +2068,9 @@ namespace Vocaluxe.Menu
|
||||
case EType.TPlaylist:
|
||||
_Playlists[_Interactions[_Selection].Num].Selected = false;
|
||||
break;
|
||||
case EType.TParticleEffect:
|
||||
_ParticleEffects[_Interactions[_Selection].Num].Selected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2111,6 +2197,9 @@ namespace Vocaluxe.Menu
|
||||
|
||||
case EType.TPlaylist:
|
||||
return _Playlists[_Interactions[interaction].Num].Visible;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
return _ParticleEffects[_Interactions[interaction].Num].Visible;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2149,6 +2238,9 @@ namespace Vocaluxe.Menu
|
||||
|
||||
case EType.TPlaylist:
|
||||
return _Playlists[_Interactions[interaction].Num].Visible;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
return false; //_ParticleEffects[_Interactions[interaction].Num].Visible;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2185,6 +2277,9 @@ namespace Vocaluxe.Menu
|
||||
|
||||
case EType.TPlaylist:
|
||||
return _Playlists[_Interactions[interaction].Num].Rect;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
return _ParticleEffects[_Interactions[interaction].Num].Rect;
|
||||
}
|
||||
|
||||
return Result;
|
||||
@@ -2239,6 +2334,10 @@ namespace Vocaluxe.Menu
|
||||
case EType.TPlaylist:
|
||||
_Playlists[_Interactions[interaction].Num].Draw();
|
||||
break;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
_ParticleEffects[_Interactions[interaction].Num].Draw();
|
||||
break;
|
||||
|
||||
//TODO:
|
||||
//case EType.TLyric:
|
||||
@@ -2284,9 +2383,17 @@ namespace Vocaluxe.Menu
|
||||
_NameSelections[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
|
||||
break;
|
||||
|
||||
case EType.TEqualizer:
|
||||
_Equalizers[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
|
||||
break;
|
||||
|
||||
case EType.TPlaylist:
|
||||
_Playlists[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
|
||||
break;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
_ParticleEffects[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2325,9 +2432,17 @@ namespace Vocaluxe.Menu
|
||||
_NameSelections[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
|
||||
break;
|
||||
|
||||
case EType.TEqualizer:
|
||||
_Equalizers[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
|
||||
break;
|
||||
|
||||
case EType.TPlaylist:
|
||||
_Playlists[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
|
||||
break;
|
||||
|
||||
case EType.TParticleEffect:
|
||||
_ParticleEffects[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2385,6 +2500,16 @@ namespace Vocaluxe.Menu
|
||||
AddText(text);
|
||||
text = new CText(_Base, _PartyModeID);
|
||||
i++;
|
||||
}
|
||||
|
||||
// ParticleEffects
|
||||
CParticleEffect partef = new CParticleEffect(_Base, _PartyModeID);
|
||||
i = 1;
|
||||
while (partef.LoadTheme("//root/" + _ThemeName, "ParticleEffect" + i.ToString(), navigator, SkinIndex))
|
||||
{
|
||||
AddParticleEffect(partef);
|
||||
partef = new CParticleEffect(_Base, _PartyModeID);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+180
-32
@@ -2,9 +2,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeParticleEffect
|
||||
{
|
||||
public string Name;
|
||||
public string TextureName;
|
||||
public string ColorName;
|
||||
}
|
||||
|
||||
public enum EParticeType
|
||||
{
|
||||
Twinkle,
|
||||
@@ -289,16 +298,22 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public class CParticleEffect
|
||||
public class CParticleEffect : IMenuElement
|
||||
{
|
||||
private int _PartyModeID;
|
||||
private Basic _Base;
|
||||
private SThemeParticleEffect _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public STexture Texture;
|
||||
public SColorF Color;
|
||||
public SRectF Rect;
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible;
|
||||
|
||||
private List<CParticle> _Stars;
|
||||
private string _TextureName;
|
||||
private STexture _Texture;
|
||||
private int _MaxNumber;
|
||||
private SRectF _Area;
|
||||
private SColorF _Color;
|
||||
private float _Size;
|
||||
private EParticeType _Type;
|
||||
private Stopwatch _SpawnTimer;
|
||||
@@ -306,6 +321,11 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public float Alpha = 1f;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool IsAlive
|
||||
{
|
||||
get
|
||||
@@ -314,42 +334,131 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public SRectF Area
|
||||
{
|
||||
get { return _Area; }
|
||||
set { _Area = value; }
|
||||
}
|
||||
|
||||
public CParticleEffect(Basic Base, int PartyModeID, int MaxNumber, SColorF Color, SRectF Area, string TextureName, float Size, EParticeType Type)
|
||||
public CParticleEffect(Basic Base, int PartyModeID)
|
||||
{
|
||||
_PartyModeID = PartyModeID;
|
||||
_Base = Base;
|
||||
_Theme = new SThemeParticleEffect();
|
||||
_Stars = new List<CParticle>();
|
||||
_Area = Area;
|
||||
_Color = Color;
|
||||
_TextureName = TextureName;
|
||||
_Texture = new STexture(-1);
|
||||
_SpawnTimer = new Stopwatch();
|
||||
_NextSpawnTime = 0f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public CParticleEffect(Basic Base, int PartyModeID, int MaxNumber, SColorF Color, SRectF Rect, string TextureName, float Size, EParticeType Type)
|
||||
{
|
||||
_PartyModeID = PartyModeID;
|
||||
_Base = Base;
|
||||
_Theme = new SThemeParticleEffect();
|
||||
_Stars = new List<CParticle>();
|
||||
this.Rect = Rect;
|
||||
this.Color = Color;
|
||||
_Theme.TextureName = TextureName;
|
||||
Texture = new STexture(-1);
|
||||
_MaxNumber = MaxNumber;
|
||||
_Size = Size;
|
||||
_Type = Type;
|
||||
_SpawnTimer = new Stopwatch();
|
||||
_NextSpawnTime = 0f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public CParticleEffect(Basic Base, int PartyModeID, int MaxNumber, SColorF Color, SRectF Area, STexture texture, float Size, EParticeType Type)
|
||||
public CParticleEffect(Basic Base, int PartyModeID, int MaxNumber, SColorF Color, SRectF Rect, STexture Texture, float Size, EParticeType Type)
|
||||
{
|
||||
_PartyModeID = PartyModeID;
|
||||
_Base = Base;
|
||||
_Theme = new SThemeParticleEffect();
|
||||
_Stars = new List<CParticle>();
|
||||
_Area = Area;
|
||||
_Color = Color;
|
||||
_TextureName = String.Empty;
|
||||
_Texture = texture;
|
||||
this.Rect = Rect;
|
||||
this.Color = Color;
|
||||
_Theme.TextureName = String.Empty;
|
||||
this.Texture = Texture;
|
||||
_MaxNumber = MaxNumber;
|
||||
_Size = Size;
|
||||
_Type = Type;
|
||||
_SpawnTimer = new Stopwatch();
|
||||
_NextSpawnTime = 0f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EParticeType>(item + "/Type", navigator, ref _Type);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Size", navigator, ref _Size);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/MaxNumber", navigator, ref _MaxNumber);
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
}
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
public bool SaveTheme(XmlWriter writer)
|
||||
{
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
writer.WriteStartElement(_Theme.Name);
|
||||
|
||||
writer.WriteComment("<Skin>: Texture name");
|
||||
writer.WriteElementString("Skin", _Theme.TextureName);
|
||||
|
||||
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height");
|
||||
writer.WriteElementString("X", Rect.X.ToString("#0"));
|
||||
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
|
||||
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
|
||||
writer.WriteElementString("W", Rect.W.ToString("#0"));
|
||||
writer.WriteElementString("H", Rect.H.ToString("#0"));
|
||||
|
||||
writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<Type>: Type of ParticleEffect: " + CHelper.ListStrings(Enum.GetNames(typeof(EType))));
|
||||
writer.WriteElementString("Type", Enum.GetName(typeof(EType), _Type);
|
||||
writer.WriteComment("<Size>: Size of particle");
|
||||
writer.WriteElementString("Size", _Size.ToString("#0.00"));
|
||||
writer.WriteComment("<MaxNumber>: Max number of drawn particles");
|
||||
writer.WriteElementString("MaxNumber", _MaxNumber.ToString("#0"));
|
||||
|
||||
writer.WriteEndElement();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
@@ -433,8 +542,8 @@ namespace Vocaluxe.Menu
|
||||
break;
|
||||
}
|
||||
|
||||
int w = (int)(_Area.W - size / 4f);
|
||||
int h = (int)(_Area.H - size / 4f);
|
||||
int w = (int)(Rect.W - size / 4f);
|
||||
int h = (int)(Rect.H - size / 4f);
|
||||
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
@@ -443,19 +552,19 @@ namespace Vocaluxe.Menu
|
||||
h = 0;
|
||||
|
||||
CParticle star;
|
||||
if (_TextureName != String.Empty)
|
||||
if (_Theme.TextureName != String.Empty)
|
||||
{
|
||||
star = new CParticle(_Base, _PartyModeID, _TextureName, _Color,
|
||||
_Base.Game.GetRandom(w) + _Area.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + _Area.Y - size / 4f,
|
||||
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type);
|
||||
star = new CParticle(_Base, _PartyModeID, _Theme.TextureName, Color,
|
||||
_Base.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
star = new CParticle(_Base, _PartyModeID, _Texture, _Color,
|
||||
_Base.Game.GetRandom(w) + _Area.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + _Area.Y - size / 4f,
|
||||
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type);
|
||||
star = new CParticle(_Base, _PartyModeID, Texture, Color,
|
||||
_Base.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
|
||||
_Stars.Add(star);
|
||||
@@ -495,11 +604,50 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
Update();
|
||||
foreach (CParticle star in _Stars)
|
||||
{
|
||||
star.Alpha2 = Alpha;
|
||||
star.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
Texture = new STexture();
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
if(_Theme.TextureName != String.Empty)
|
||||
Texture = _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,6 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
int i = 0;
|
||||
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
|
||||
{
|
||||
_PlayerNotes[n].PerfectLineTwinkle[i].Update();
|
||||
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
|
||||
@@ -373,7 +372,6 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
{
|
||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||
{
|
||||
stars.Update();
|
||||
stars.Alpha = _PlayerNotes[n].Alpha;
|
||||
stars.Draw();
|
||||
}
|
||||
@@ -431,7 +429,6 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
i = 0;
|
||||
while (i < _PlayerNotes[n].Flares.Count)
|
||||
{
|
||||
_PlayerNotes[n].Flares[i].Update();
|
||||
if (!_PlayerNotes[n].Flares[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].Flares.RemoveAt(i);
|
||||
@@ -443,7 +440,6 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
i = 0;
|
||||
while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
|
||||
{
|
||||
_PlayerNotes[n].PerfectNoteEffect[i].Update();
|
||||
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
|
||||
@@ -457,7 +453,6 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
|
||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||
{
|
||||
stars.Update();
|
||||
stars.Alpha = _PlayerNotes[n].Alpha;
|
||||
stars.Draw();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user