Merge branch 'develop' of git://github.com/flokuep/Vocaluxe into develop

This commit is contained in:
Alexander Eckart committed 2012-12-22 21:05:20 +01:00
commit 0433393c33
9 files changed
+601 -59

No files matched your search

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<ScreenHighscore> <ScreenHighscore>
<ScreenVersion>1</ScreenVersion> <ScreenVersion>2</ScreenVersion>
<Background1> <Background1>
<!--<Type>: Background type: None, Color, Texture, Video--> <!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type> <Type>Video</Type>
@@ -1292,5 +1292,195 @@
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</TextDate10> </TextDate10>
<ParticleEffectNew1>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>100</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew1>
<ParticleEffectNew2>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>160</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew2>
<ParticleEffectNew3>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>220</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew3>
<ParticleEffectNew4>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>280</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew4>
<ParticleEffectNew5>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>340</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew5>
<ParticleEffectNew6>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>400</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew6>
<ParticleEffectNew7>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>460</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew7>
<ParticleEffectNew8>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>520</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew8>
<ParticleEffectNew9>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>580</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew9>
<ParticleEffectNew10>
<!--<Skin>: Texture name-->
<Skin>Star</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height-->
<X>80</X>
<Y>640</Y>
<Z>1,00</Z>
<W>1080</W>
<H>42</H>
<!--<Color>: ParticleEffect color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<Type>: Type of ParticleEffect: TBackground, TButton, TSelectSlide, TText, TStatic, TSongMenu, TLyric, TSingNote, TNameSelection, TEqualizer, TPlaylist, TParticleEffect-->
<Type>TButton</Type>
<!--<Size>: Size of particle-->
<Size>25,00</Size>
<!--<MaxNumber>: Max number of drawn particles-->
<MaxNumber>250</MaxNumber>
</ParticleEffectNew10>
</ScreenHighscore> </ScreenHighscore>
</root> </root>
@@ -0,0 +1,7 @@
ScreenHighscore
++++++++++
Version 2:
Add: ParticleEffectsNew[1..6] (one for each player!)
++++++++++
+78 -2
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
@@ -44,6 +45,22 @@ namespace Vocaluxe.Base
public static void Init() public static void Init()
{ {
LoadPlaylists(); LoadPlaylists();
ConvertUSDXPlaylists();
SortPlaylistsByName();
}
public static void ConvertUSDXPlaylists()
{
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
foreach (string file in files)
{
CPlaylistFile playlist = ConvertUSDXPlaylist(file);
playlist.SavePlaylist();
_Playlists.Add(playlist);
}
} }
public static void LoadPlaylists() public static void LoadPlaylists()
@@ -57,8 +74,6 @@ namespace Vocaluxe.Base
CPlaylistFile playlist = new CPlaylistFile(file); CPlaylistFile playlist = new CPlaylistFile(file);
_Playlists.Add(playlist); _Playlists.Add(playlist);
} }
SortPlaylistsByName();
} }
public static string GetPlaylistName(int PlaylistID) public static string GetPlaylistName(int PlaylistID)
@@ -197,6 +212,67 @@ namespace Vocaluxe.Base
{ {
return String.Compare(a.PlaylistName, b.PlaylistName); return String.Compare(a.PlaylistName, b.PlaylistName);
} }
private static CPlaylistFile ConvertUSDXPlaylist(string file)
{
CPlaylistFile pl = new CPlaylistFile();
CSong[] AllSongs = CSongs.AllSongs;
if (!File.Exists(file))
return null;
StreamReader sr;
try
{
sr = new StreamReader(file, Encoding.Default, true);
int pos = -1;
string line;
while((line = sr.ReadLine()) != null)
{
pos = line.IndexOf(":");
if (pos > 0)
{
//Name or comment
if (line[0] == '#')
{
string Identifier = line.Substring(1, pos - 1).Trim();
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (Identifier.ToUpper() == "NAME")
{
pl.PlaylistName = Value;
}
}
//Song
else
{
string Artist = line.Substring(0, pos - 1).Trim();
string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < AllSongs.Length; s++)
{
if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
{
pl.AddSong(AllSongs[s].ID);
found = true;
break;
}
}
if (!found)
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
}
}
}
sr.Close();
File.Delete(file);
}
catch
{
return null;
}
return pl;
}
#endregion #endregion
} }
} }
+5 -8
View File
@@ -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)); CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, 0));
//Draw stars //Draw stars
starsBlue.Update();
starsBlue.Draw(); starsBlue.Draw();
starsRed.Update();
starsRed.Draw(); starsRed.Draw();
logo.Draw(); logo.Draw();
@@ -355,7 +353,6 @@ namespace Vocaluxe.Screens
if (_CreditNames[i].active) if (_CreditNames[i].active)
{ {
_CreditNames[i].image.Draw(); _CreditNames[i].image.Draw();
_CreditNames[i].particle.Update();
_CreditNames[i].particle.Draw(); _CreditNames[i].particle.Draw();
} }
} }
@@ -380,8 +377,8 @@ namespace Vocaluxe.Screens
logo.Rect.Y = -270 + (270f / 3000f) * LogoTimer.ElapsedMilliseconds; 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); SRectF rect = new SRectF(logo.Rect.X, logo.Rect.Y, logo.Rect.W, logo.Rect.H, -1);
starsRed.Area = rect; starsRed.Rect = rect;
starsBlue.Area = rect; starsBlue.Rect = rect;
if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning) if (LogoTimer.ElapsedMilliseconds >= 2000 && !CreditsTimer.IsRunning)
{ {
CreditsTimer.Start(); CreditsTimer.Start();
@@ -409,7 +406,7 @@ namespace Vocaluxe.Screens
float xOld = _CreditNames[i].image.Rect.X; 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].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].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 //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) 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; 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].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].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 //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 ) 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; float yOld = _CreditNames[i].image.Rect.Y;
_CreditNames[i].image.Rect.Y = 580 - (430f / 3000f) * (CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); _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].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 //Fade names out
if (_CreditNames[i].image.Rect.Y <= 350f) if (_CreditNames[i].image.Rect.Y <= 350f)
+12 -9
View File
@@ -13,7 +13,7 @@ namespace Vocaluxe.Screens
class CScreenHighscore : CMenu class CScreenHighscore : CMenu
{ {
// Version number for theme files. Increment it, if you've changed something on the theme files! // Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1; const int ScreenVersion = 2;
private const int NumEntrys = 10; private const int NumEntrys = 10;
private const string TextSongName = "TextSongName"; private const string TextSongName = "TextSongName";
@@ -22,6 +22,7 @@ namespace Vocaluxe.Screens
private string[] TextName; private string[] TextName;
private string[] TextScore; private string[] TextScore;
private string[] TextDate; private string[] TextDate;
private string[] ParticleEffectNew;
private List<SScores>[] _Scores; private List<SScores>[] _Scores;
private List<int> _NewEntryIDs; private List<int> _NewEntryIDs;
@@ -72,7 +73,14 @@ namespace Vocaluxe.Screens
texts.Add(TextDate[i]); texts.Add(TextDate[i]);
} }
ParticleEffectNew = new string[NumEntrys];
for (int i = 0; i < NumEntrys; i++)
{
ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1).ToString();
}
_ThemeTexts = texts.ToArray(); _ThemeTexts = texts.ToArray();
_ThemeParticleEffects = ParticleEffectNew;
_NewEntryIDs = new List<int>(); _NewEntryIDs = new List<int>();
} }
@@ -170,17 +178,11 @@ namespace Vocaluxe.Screens
if (isNewEntry(_Scores[_Round][_Pos + p].ID) == true) if (isNewEntry(_Scores[_Round][_Pos + p].ID) == true)
{ {
Texts[htTexts(TextNumber[p])].Style = EStyle.BoldItalic; ParticleEffects[htParticleEffects(ParticleEffectNew[p])].Visible = true;
Texts[htTexts(TextName[p])].Style = EStyle.BoldItalic;
Texts[htTexts(TextScore[p])].Style = EStyle.BoldItalic;
Texts[htTexts(TextDate[p])].Style = EStyle.BoldItalic;
} }
else else
{ {
Texts[htTexts(TextNumber[p])].Style = EStyle.Bold; ParticleEffects[htParticleEffects(ParticleEffectNew[p])].Visible = false;
Texts[htTexts(TextName[p])].Style = EStyle.Bold;
Texts[htTexts(TextScore[p])].Style = EStyle.Bold;
Texts[htTexts(TextDate[p])].Style = EStyle.Bold;
} }
} }
else else
@@ -189,6 +191,7 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextName[p])].Visible = false; Texts[htTexts(TextName[p])].Visible = false;
Texts[htTexts(TextScore[p])].Visible = false; Texts[htTexts(TextScore[p])].Visible = false;
Texts[htTexts(TextDate[p])].Visible = false; Texts[htTexts(TextDate[p])].Visible = false;
ParticleEffects[htParticleEffects(ParticleEffectNew[p])].Visible = false;
} }
} }
return true; return true;
+2 -1
View File
@@ -16,7 +16,8 @@ namespace Vocaluxe.Menu
TSingNote, TSingNote,
TNameSelection, TNameSelection,
TEqualizer, TEqualizer,
TPlaylist TPlaylist,
TParticleEffect
} }
class CInteraction class CInteraction
+126 -1
View File
@@ -38,6 +38,7 @@ namespace Vocaluxe.Menu
private List<CNameSelection> _NameSelections; private List<CNameSelection> _NameSelections;
private List<CEqualizer> _Equalizers; private List<CEqualizer> _Equalizers;
private List<CPlaylist> _Playlists; private List<CPlaylist> _Playlists;
private List<CParticleEffect> _ParticleEffects;
private Hashtable _htBackgrounds; private Hashtable _htBackgrounds;
private Hashtable _htStatics; private Hashtable _htStatics;
@@ -50,6 +51,7 @@ namespace Vocaluxe.Menu
private Hashtable _htNameSelections; private Hashtable _htNameSelections;
private Hashtable _htEqualizers; private Hashtable _htEqualizers;
private Hashtable _htPlaylists; private Hashtable _htPlaylists;
private Hashtable _htParticleEffects;
private int _PrevMouseX; private int _PrevMouseX;
@@ -73,6 +75,7 @@ namespace Vocaluxe.Menu
protected string[] _ThemeNameSelections; protected string[] _ThemeNameSelections;
protected string[] _ThemeEqualizers; protected string[] _ThemeEqualizers;
protected string[] _ThemePlaylists; protected string[] _ThemePlaylists;
protected string[] _ThemeParticleEffects;
protected SRectF _ScreenArea; protected SRectF _ScreenArea;
protected Basic _Base; protected Basic _Base;
@@ -118,6 +121,7 @@ namespace Vocaluxe.Menu
_NameSelections = new List<CNameSelection>(); _NameSelections = new List<CNameSelection>();
_Equalizers = new List<CEqualizer>(); _Equalizers = new List<CEqualizer>();
_Playlists = new List<CPlaylist>(); _Playlists = new List<CPlaylist>();
_ParticleEffects = new List<CParticleEffect>();
_htBackgrounds = new Hashtable(); _htBackgrounds = new Hashtable();
_htStatics = new Hashtable(); _htStatics = new Hashtable();
@@ -130,6 +134,7 @@ namespace Vocaluxe.Menu
_htNameSelections = new Hashtable(); _htNameSelections = new Hashtable();
_htEqualizers = new Hashtable(); _htEqualizers = new Hashtable();
_htPlaylists = new Hashtable(); _htPlaylists = new Hashtable();
_htParticleEffects = new Hashtable();
_PrevMouseX = 0; _PrevMouseX = 0;
_PrevMouseY = 0; _PrevMouseY = 0;
@@ -152,6 +157,7 @@ namespace Vocaluxe.Menu
_ThemeNameSelections = null; _ThemeNameSelections = null;
_ThemeEqualizers = null; _ThemeEqualizers = null;
_ThemePlaylists = null; _ThemePlaylists = null;
_ThemeParticleEffects = null;
} }
protected void FadeTo(EScreens NextScreen) 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 else
{ {
@@ -462,6 +484,12 @@ namespace Vocaluxe.Menu
_Playlists[i].SaveTheme(writer); _Playlists[i].SaveTheme(writer);
} }
//ParticleEffects
for (int i = 0; i < _ParticleEffects.Count; i++)
{
_ParticleEffects[i].SaveTheme(writer);
}
writer.WriteEndElement(); writer.WriteEndElement();
// End of File // End of File
@@ -528,6 +556,11 @@ namespace Vocaluxe.Menu
{ {
pls.ReloadTextures(); pls.ReloadTextures();
} }
foreach (CParticleEffect pe in _ParticleEffects)
{
pe.ReloadTextures();
}
} }
public virtual void UnloadTextures() public virtual void UnloadTextures()
@@ -586,6 +619,10 @@ namespace Vocaluxe.Menu
eq.UnloadTextures(); eq.UnloadTextures();
} }
foreach (CParticleEffect pe in _ParticleEffects)
{
pe.UnloadTextures();
}
} }
public virtual void ReloadTheme() public virtual void ReloadTheme()
@@ -654,6 +691,11 @@ namespace Vocaluxe.Menu
{ {
return _Playlists; return _Playlists;
} }
public List<CParticleEffect> GetParticleEffects()
{
return _ParticleEffects;
}
#endregion GetLists #endregion GetLists
#region ElementHandler #region ElementHandler
@@ -838,6 +880,14 @@ namespace Vocaluxe.Menu
return _Playlists.ToArray(); return _Playlists.ToArray();
} }
} }
public CParticleEffect[] ParticleEffects
{
get
{
return _ParticleEffects.ToArray();
}
}
#endregion Get Arrays #endregion Get Arrays
#region Hashtables #region Hashtables
@@ -983,6 +1033,19 @@ namespace Vocaluxe.Menu
throw; 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 Hashtables
#endregion ElementHandler #endregion ElementHandler
@@ -1267,7 +1330,8 @@ namespace Vocaluxe.Menu
_Interactions[i].Type == EType.TText || _Interactions[i].Type == EType.TText ||
_Interactions[i].Type == EType.TSongMenu || _Interactions[i].Type == EType.TSongMenu ||
_Interactions[i].Type == EType.TEqualizer || _Interactions[i].Type == EType.TEqualizer ||
_Interactions[i].Type == EType.TPlaylist)) _Interactions[i].Type == EType.TPlaylist ||
_Interactions[i].Type == EType.TParticleEffect))
{ {
ZSort zs = new ZSort(); ZSort zs = new ZSort();
zs.ID = i; zs.ID = i;
@@ -1367,6 +1431,13 @@ namespace Vocaluxe.Menu
_AddInteraction(_Playlists.Count - 1, EType.TPlaylist); _AddInteraction(_Playlists.Count - 1, EType.TPlaylist);
return _Playlists.Count - 1; return _Playlists.Count - 1;
} }
public int AddParticleEffect(CParticleEffect pe)
{
_ParticleEffects.Add(pe);
_AddInteraction(_ParticleEffects.Count - 1, EType.TParticleEffect);
return _ParticleEffects.Count - 1;
}
#endregion Elements #endregion Elements
#region InteractionHandling #region InteractionHandling
@@ -1541,6 +1612,10 @@ namespace Vocaluxe.Menu
if (CHelper.IsInBounds(_Playlists[interact.Num].Rect, x, y)) if (CHelper.IsInBounds(_Playlists[interact.Num].Rect, x, y))
return true; return true;
break; break;
case EType.TParticleEffect:
if (CHelper.IsInBounds(_ParticleEffects[interact.Num].Rect, x, y))
return true;
break;
} }
return false; return false;
} }
@@ -1567,6 +1642,8 @@ namespace Vocaluxe.Menu
return _Equalizers[interact.Num].Rect.Z; return _Equalizers[interact.Num].Rect.Z;
case EType.TPlaylist: case EType.TPlaylist:
return _Playlists[interact.Num].Rect.Z; return _Playlists[interact.Num].Rect.Z;
case EType.TParticleEffect:
return _ParticleEffects[interact.Num].Rect.Z;
} }
return _Base.Settings.GetZFar(); return _Base.Settings.GetZFar();
} }
@@ -1601,6 +1678,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
return _Playlists[_Interactions[interaction].Num].Rect.Z; return _Playlists[_Interactions[interaction].Num].Rect.Z;
case EType.TParticleEffect:
return _ParticleEffects[_Interactions[interaction].Num].Rect.Z;
} }
return _Base.Settings.GetZFar(); return _Base.Settings.GetZFar();
@@ -1951,6 +2031,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
_Playlists[_Interactions[_Selection].Num].Selected = true; _Playlists[_Interactions[_Selection].Num].Selected = true;
break; break;
case EType.TParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].Selected = true;
break;
} }
} }
@@ -1985,6 +2068,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
_Playlists[_Interactions[_Selection].Num].Selected = false; _Playlists[_Interactions[_Selection].Num].Selected = false;
break; break;
case EType.TParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].Selected = false;
break;
} }
} }
@@ -2111,6 +2197,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
return _Playlists[_Interactions[interaction].Num].Visible; return _Playlists[_Interactions[interaction].Num].Visible;
case EType.TParticleEffect:
return _ParticleEffects[_Interactions[interaction].Num].Visible;
} }
return false; return false;
@@ -2149,6 +2238,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
return _Playlists[_Interactions[interaction].Num].Visible; return _Playlists[_Interactions[interaction].Num].Visible;
case EType.TParticleEffect:
return false; //_ParticleEffects[_Interactions[interaction].Num].Visible;
} }
return false; return false;
@@ -2185,6 +2277,9 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
return _Playlists[_Interactions[interaction].Num].Rect; return _Playlists[_Interactions[interaction].Num].Rect;
case EType.TParticleEffect:
return _ParticleEffects[_Interactions[interaction].Num].Rect;
} }
return Result; return Result;
@@ -2239,6 +2334,10 @@ namespace Vocaluxe.Menu
case EType.TPlaylist: case EType.TPlaylist:
_Playlists[_Interactions[interaction].Num].Draw(); _Playlists[_Interactions[interaction].Num].Draw();
break; break;
case EType.TParticleEffect:
_ParticleEffects[_Interactions[interaction].Num].Draw();
break;
//TODO: //TODO:
//case EType.TLyric: //case EType.TLyric:
@@ -2284,9 +2383,17 @@ namespace Vocaluxe.Menu
_NameSelections[_Interactions[_Selection].Num].MoveElement(stepX, stepY); _NameSelections[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break; break;
case EType.TEqualizer:
_Equalizers[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break;
case EType.TPlaylist: case EType.TPlaylist:
_Playlists[_Interactions[_Selection].Num].MoveElement(stepX, stepY); _Playlists[_Interactions[_Selection].Num].MoveElement(stepX, stepY);
break; 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); _NameSelections[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break; break;
case EType.TEqualizer:
_Equalizers[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
case EType.TPlaylist: case EType.TPlaylist:
_Playlists[_Interactions[_Selection].Num].ResizeElement(stepW, stepH); _Playlists[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break; break;
case EType.TParticleEffect:
_ParticleEffects[_Interactions[_Selection].Num].ResizeElement(stepW, stepH);
break;
} }
} }
} }
@@ -2385,6 +2500,16 @@ namespace Vocaluxe.Menu
AddText(text); AddText(text);
text = new CText(_Base, _PartyModeID); text = new CText(_Base, _PartyModeID);
i++; 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
View File
@@ -2,9 +2,18 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Xml;
using System.Xml.XPath;
namespace Vocaluxe.Menu namespace Vocaluxe.Menu
{ {
struct SThemeParticleEffect
{
public string Name;
public string TextureName;
public string ColorName;
}
public enum EParticeType public enum EParticeType
{ {
Twinkle, Twinkle,
@@ -289,16 +298,22 @@ namespace Vocaluxe.Menu
} }
} }
public class CParticleEffect public class CParticleEffect : IMenuElement
{ {
private int _PartyModeID; private int _PartyModeID;
private Basic _Base; 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 List<CParticle> _Stars;
private string _TextureName;
private STexture _Texture;
private int _MaxNumber; private int _MaxNumber;
private SRectF _Area;
private SColorF _Color;
private float _Size; private float _Size;
private EParticeType _Type; private EParticeType _Type;
private Stopwatch _SpawnTimer; private Stopwatch _SpawnTimer;
@@ -306,6 +321,11 @@ namespace Vocaluxe.Menu
public float Alpha = 1f; public float Alpha = 1f;
public string GetThemeName()
{
return _Theme.Name;
}
public bool IsAlive public bool IsAlive
{ {
get get
@@ -314,42 +334,131 @@ namespace Vocaluxe.Menu
} }
} }
public SRectF Area public CParticleEffect(Basic Base, int PartyModeID)
{
get { return _Area; }
set { _Area = value; }
}
public CParticleEffect(Basic Base, int PartyModeID, int MaxNumber, SColorF Color, SRectF Area, string TextureName, float Size, EParticeType Type)
{ {
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
_Base = Base; _Base = Base;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>(); _Stars = new List<CParticle>();
_Area = Area; _SpawnTimer = new Stopwatch();
_Color = Color; _NextSpawnTime = 0f;
_TextureName = TextureName; Visible = true;
_Texture = new STexture(-1); }
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; _MaxNumber = MaxNumber;
_Size = Size; _Size = Size;
_Type = Type; _Type = Type;
_SpawnTimer = new Stopwatch(); _SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f; _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; _PartyModeID = PartyModeID;
_Base = Base; _Base = Base;
_Theme = new SThemeParticleEffect();
_Stars = new List<CParticle>(); _Stars = new List<CParticle>();
_Area = Area; this.Rect = Rect;
_Color = Color; this.Color = Color;
_TextureName = String.Empty; _Theme.TextureName = String.Empty;
_Texture = texture; this.Texture = Texture;
_MaxNumber = MaxNumber; _MaxNumber = MaxNumber;
_Size = Size; _Size = Size;
_Type = Type; _Type = Type;
_SpawnTimer = new Stopwatch(); _SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f; _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() public void Update()
@@ -433,8 +542,8 @@ namespace Vocaluxe.Menu
break; break;
} }
int w = (int)(_Area.W - size / 4f); int w = (int)(Rect.W - size / 4f);
int h = (int)(_Area.H - size / 4f); int h = (int)(Rect.H - size / 4f);
if (w < 0) if (w < 0)
w = 0; w = 0;
@@ -443,19 +552,19 @@ namespace Vocaluxe.Menu
h = 0; h = 0;
CParticle star; CParticle star;
if (_TextureName != String.Empty) if (_Theme.TextureName != String.Empty)
{ {
star = new CParticle(_Base, _PartyModeID, _TextureName, _Color, star = new CParticle(_Base, _PartyModeID, _Theme.TextureName, Color,
_Base.Game.GetRandom(w) + _Area.X - size / 4f, _Base.Game.GetRandom(w) + Rect.X - size / 4f,
_Base.Game.GetRandom(h) + _Area.Y - size / 4f, _Base.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type); size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
} }
else else
{ {
star = new CParticle(_Base, _PartyModeID, _Texture, _Color, star = new CParticle(_Base, _PartyModeID, Texture, Color,
_Base.Game.GetRandom(w) + _Area.X - size / 4f, _Base.Game.GetRandom(w) + Rect.X - size / 4f,
_Base.Game.GetRandom(h) + _Area.Y - size / 4f, _Base.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type); size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
} }
_Stars.Add(star); _Stars.Add(star);
@@ -495,11 +604,50 @@ namespace Vocaluxe.Menu
public void Draw() public void Draw()
{ {
Update();
foreach (CParticle star in _Stars) foreach (CParticle star in _Stars)
{ {
star.Alpha2 = Alpha; star.Alpha2 = Alpha;
star.Draw(); 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
} }
} }
-5
View File
@@ -355,7 +355,6 @@ namespace Vocaluxe.Menu.SingNotes
int i = 0; int i = 0;
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count) while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
{ {
_PlayerNotes[n].PerfectLineTwinkle[i].Update();
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive) if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
{ {
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i); _PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
@@ -373,7 +372,6 @@ namespace Vocaluxe.Menu.SingNotes
{ {
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{ {
stars.Update();
stars.Alpha = _PlayerNotes[n].Alpha; stars.Alpha = _PlayerNotes[n].Alpha;
stars.Draw(); stars.Draw();
} }
@@ -431,7 +429,6 @@ namespace Vocaluxe.Menu.SingNotes
i = 0; i = 0;
while (i < _PlayerNotes[n].Flares.Count) while (i < _PlayerNotes[n].Flares.Count)
{ {
_PlayerNotes[n].Flares[i].Update();
if (!_PlayerNotes[n].Flares[i].IsAlive) if (!_PlayerNotes[n].Flares[i].IsAlive)
{ {
_PlayerNotes[n].Flares.RemoveAt(i); _PlayerNotes[n].Flares.RemoveAt(i);
@@ -443,7 +440,6 @@ namespace Vocaluxe.Menu.SingNotes
i = 0; i = 0;
while (i < _PlayerNotes[n].PerfectNoteEffect.Count) while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
{ {
_PlayerNotes[n].PerfectNoteEffect[i].Update();
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive) if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
{ {
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i); _PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
@@ -457,7 +453,6 @@ namespace Vocaluxe.Menu.SingNotes
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{ {
stars.Update();
stars.Alpha = _PlayerNotes[n].Alpha; stars.Alpha = _PlayerNotes[n].Alpha;
stars.Draw(); stars.Draw();
} }