Merge branch 'develop' of github.com:Flamefire/Vocaluxe into theme

This commit is contained in:
Florian Küpper committed 2014-09-08 21:22:57 +02:00
commit a55d724620
21 files changed
+192 -111

No files matched your search

+1
View File
@@ -93,6 +93,7 @@
<string name="TR_SCREENMAIN_BUTTON_PARTY">Party</string>
<string name="TR_SCREENMAIN_BUTTON_OPTIONS">Options</string>
<string name="TR_SCREENMAIN_BUTTON_PROFILES">Profiles</string>
<string name="TR_SCREENMAIN_TEXT_NOPROFILES">No profiles found!</string>
<string name="TR_SCREENPARTY_TITLE">Party Mode Selection</string>
<string name="TR_SCREENPARTY_MODES">Party Mode</string>
<string name="TR_SCREENPARTY_DESCRIPTION">Description</string>
+1
View File
@@ -92,6 +92,7 @@
<string name="TR_SCREENMAIN_BUTTON_PARTY">Party</string>
<string name="TR_SCREENMAIN_BUTTON_OPTIONS">Optionen</string>
<string name="TR_SCREENMAIN_BUTTON_PROFILES">Profile</string>
<string name="TR_SCREENMAIN_TEXT_NOPROFILES">Keine Profile gefunden!</string>
<string name="TR_SCREENPARTY_TITLE">Party-Modus Auswahl</string>
<string name="TR_SCREENPARTY_MODES">Party-Modus</string>
<string name="TR_SCREENPARTY_DESCRIPTION">Beschreibung</string>
+75 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<ScreenMain>
<ScreenVersion>1</ScreenVersion>
<ScreenVersion>2</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type>
@@ -314,5 +314,79 @@
<Height>26</Height>
</SReflection>
</ButtonExit>
<TextRelease>
<!--<X>, <Y>: Text position-->
<X>10</X>
<Y>690</Y>
<!--<Z>: Text position-->
<Z>-1</Z>
<!--<H>: Text height-->
<H>15</H>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>TextWhite</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextWhite</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Left</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Normal</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Nothing or translation tag-->
<Text />
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextRelease>
<StaticWarningProfiles>
<!--<Skin>: Texture name-->
<Skin>TextBG</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>150</X>
<Y>610</Y>
<Z>-1,90</Z>
<W>355</W>
<H>30</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticWarningColor</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticWarningProfiles>
<TextWarningProfiles>
<!--<X>, <Y>: Text position-->
<X>320</X>
<Y>612</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>27</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>355</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>TextWarningColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextWarningColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TEXT_NOPROFILES</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextWarningProfiles>
</ScreenMain>
</root>
+4 -4
View File
@@ -140,7 +140,7 @@
<R>0,675</R>
<G>0,890</G>
<B>0,969</B>
<A>1,000</A>
<A>0,600</A>
</StaticWarningColor>
<ButtonColor>
<R>0,675</R>
@@ -227,9 +227,9 @@
<A>1,000</A>
</TextBlack>
<TextWhite>
<R>0,000</R>
<G>0,000</G>
<B>0,000</B>
<R>1,000</R>
<G>1,000</G>
<B>1,000</B>
<A>1,000</A>
</TextWhite>
<Visible>
+4 -4
View File
@@ -140,7 +140,7 @@
<R>0,709</R>
<G>0,968</G>
<B>0,674</B>
<A>1,000</A>
<A>0,600</A>
</StaticWarningColor>
<ButtonColor>
<R>0,709</R>
@@ -221,9 +221,9 @@
<A>1,000</A>
</TextBlack>
<TextWhite>
<R>0,000</R>
<G>0,000</G>
<B>0,000</B>
<R>1,000</R>
<G>1,000</G>
<B>1,000</B>
<A>1,000</A>
</TextWhite>
<Visible>
+4 -4
View File
@@ -140,7 +140,7 @@
<R>0,968</R>
<G>0,674</G>
<B>0,674</B>
<A>1,000</A>
<A>0,600</A>
</StaticWarningColor>
<ButtonColor>
<R>0,968</R>
@@ -221,9 +221,9 @@
<A>1,000</A>
</TextBlack>
<TextWhite>
<R>0,000</R>
<G>0,000</G>
<B>0,000</B>
<R>1,000</R>
<G>1,000</G>
<B>1,000</B>
<A>1,000</A>
</TextWhite>
<Visible>
+4 -4
View File
@@ -140,7 +140,7 @@
<R>0,968</R>
<G>0,956</G>
<B>0,674</B>
<A>1,000</A>
<A>0,600</A>
</StaticWarningColor>
<ButtonColor>
<R>0,968</R>
@@ -221,9 +221,9 @@
<A>1,000</A>
</TextBlack>
<TextWhite>
<R>0,000</R>
<G>0,000</G>
<B>0,000</B>
<R>1,000</R>
<G>1,000</G>
<B>1,000</B>
<A>1,000</A>
</TextWhite>
<Visible>
@@ -0,0 +1,10 @@
SceenMain
++++++++++
Version 2:
Add:
<StaticWarningProfiles>
<TextWarningProfiles>
<TextRelease>
@@ -457,7 +457,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override void LeavingHighscore()
{
for (int i = 0; i < CBase.Game.GetNumSongs();i++ )
for (int i = 0; i < CBase.Game.GetNumSongs(); i++)
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).ID);
_GameData.CurrentRoundNr++;
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
@@ -588,12 +588,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{
CProfile[] profiles = CBase.Profiles.GetProfiles();
if (profiles == null)
{
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
+4 -2
View File
@@ -184,7 +184,7 @@ namespace Vocaluxe.Base
if (_PlaysPreview)
_PreviewPlayer.Play();
else
else if(CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
if (_SongPlayer.SongLoaded)
//Resume
_SongPlayer.TogglePause();
@@ -218,11 +218,13 @@ namespace Vocaluxe.Base
return;
_PreviewPlayer.TogglePause();
}
else
else if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
{
if (!_SongPlayer.SongLoaded)
Next();
else
_SongPlayer.TogglePause();
}
}
public static void Next()
+1 -1
View File
@@ -888,7 +888,7 @@ namespace Vocaluxe.Base
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
{
CGame.Players[j].ProfileID = -1;
if (Players[j] == "" || profiles == null)
if (Players[j] == "")
continue;
foreach (CProfile profile in profiles)
+9 -42
View File
@@ -40,7 +40,7 @@ namespace Vocaluxe.Base
public static void Init()
{
_LoadCoverThemes();
_LoadCover(CConfig.CoverTheme);
_LoadCovers(CConfig.CoverTheme);
}
public static void Close()
@@ -107,7 +107,7 @@ namespace Vocaluxe.Base
public static void ReloadCovers()
{
_UnloadCovers();
_LoadCover(CConfig.CoverTheme);
_LoadCovers(CConfig.CoverTheme);
}
private static void _UnloadCovers()
@@ -170,69 +170,36 @@ namespace Vocaluxe.Base
/// <summary>
/// Loads all cover which are defined in the cover config file.
/// </summary>
private static void _LoadCover(string coverThemeName)
private static void _LoadCovers(string coverThemeName)
{
SCoverTheme coverTheme = _CoverTheme(coverThemeName);
if (String.IsNullOrEmpty(coverTheme.Name))
return;
var ignoreList = new List<string>();
string coverPath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder);
List<string> files = CHelper.ListImageFiles(coverPath, true, true);
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.File));
lock (_Covers)
{
if (xmlReader != null)
{
_Covers.Clear();
List<string> cover = xmlReader.GetNames("//root/Cover/*");
foreach (string coverName in cover)
{
string name;
string filePath;
xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty);
xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out filePath, String.Empty);
string coverFilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder, filePath);
if (!File.Exists(coverFilePath))
continue;
_AddCover(name, coverFilePath);
ignoreList.Add(Path.GetFileName(coverFilePath));
if (name == "NoCover")
NoCover = _Covers[name];
}
}
foreach (string file in files)
{
if (!ignoreList.Contains(Path.GetFileName(file)))
_AddCover(Path.GetFileNameWithoutExtension(file), file);
}
_AddCover(Path.GetFileNameWithoutExtension(file), file);
if (_CoverExists("No Cover"))
NoCover = _Covers["No Cover"];
}
}
/// <summary>
/// Ads a cover with the given name if it does not exist yet
/// MUST HOLD _Covers lock at this point
/// </summary>
/// <param name="name">Name of the cover</param>
/// <param name="file">Filename of image file</param>
private static void _AddCover(string name, string file)
{
CTexture texture = CDraw.AddTexture(file);
if (!_CoverExists(name))
_Covers.Add(name, texture);
else
lock (_Covers)
{
CTexture tex = _Covers[name];
CDraw.RemoveTexture(ref tex);
_Covers[name] = texture;
if (!_CoverExists(name))
_Covers.Add(name, CDraw.AddTexture(file));
}
}
}
+1 -1
View File
@@ -180,7 +180,7 @@ namespace Vocaluxe.Base
}
catch (Exception e)
{
CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message);
CLog.LogError("Error reading language file " + xmlReader.FilePath + ": " + e.Message);
return false;
}
}
+2 -2
View File
@@ -479,9 +479,9 @@ namespace Vocaluxe.Base
class CBlog : ILog
{
public void LogError(string errorText)
public void LogError(string errorText, bool showMsg = false, bool exit = false)
{
CLog.LogError(errorText);
CLog.LogError(errorText, showMsg, exit);
}
public void LogDebug(string text)
+1 -1
View File
@@ -297,7 +297,7 @@ namespace Vocaluxe.Base
public static CProfile[] GetProfiles()
{
if (_Profiles.Count == 0)
return null;
return new CProfile[0];
var list = new List<CProfile>(_Profiles.Values);
list.Sort(_CompareByPlayerName);
+19 -11
View File
@@ -27,7 +27,7 @@ namespace Vocaluxe.Screens
// Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion
{
get { return 1; }
get { return 2; }
}
private const string _ButtonSing = "ButtonSing";
@@ -35,23 +35,30 @@ namespace Vocaluxe.Screens
private const string _ButtonOptions = "ButtonOptions";
private const string _ButtonProfiles = "ButtonProfiles";
private const string _ButtonExit = "ButtonExit";
private CText _ReleaseText;
private const string _StaticWarningProfiles = "StaticWarningProfiles";
private const string _TextWarningProfiles = "TextWarningProfiles";
private const string _TextRelease = "TextRelease";
//CParticleEffect Snowflakes;
public override void Init()
{
base.Init();
_ThemeStatics = new string[] {"StaticMenuBar"};
_ThemeStatics = new string[] {"StaticMenuBar", _StaticWarningProfiles};
_ThemeButtons = new string[] {_ButtonSing, _ButtonParty, _ButtonOptions, _ButtonProfiles, _ButtonExit};
_ThemeTexts = new string[] {_TextRelease, _TextWarningProfiles};
}
public override void LoadTheme(string xmlPath)
{
base.LoadTheme(xmlPath);
_ReleaseText = GetNewText(10, 690, -1, 15, -1, EAlignment.Left, EStyle.Normal, "Normal", new SColorF(1f, 1f, 1f, 1f), CSettings.GetFullVersionText());
_Texts[_TextRelease].Text = CSettings.GetFullVersionText();
// ReSharper disable ConditionIsAlwaysTrueOrFalse
_Texts[_TextRelease].Visible = CSettings.VersionRevision != ERevision.Release;
// ReSharper restore ConditionIsAlwaysTrueOrFalse
_Statics[_StaticWarningProfiles].Visible = false;
_Texts[_TextWarningProfiles].Visible = false;
}
public override bool HandleInput(SKeyEvent keyEvent)
@@ -68,7 +75,8 @@ namespace Vocaluxe.Screens
break;
case Keys.S:
CGraphics.FadeTo(EScreens.ScreenSong);
if (CProfiles.NumProfiles > 0)
CGraphics.FadeTo(EScreens.ScreenSong);
break;
case Keys.C:
@@ -145,6 +153,11 @@ namespace Vocaluxe.Screens
public override bool UpdateGame()
{
bool profileOK = CProfiles.NumProfiles > 0;
_Statics[_StaticWarningProfiles].Visible = !profileOK;
_Texts[_TextWarningProfiles].Visible = !profileOK;
_Buttons[_ButtonSing].Enabled = profileOK;
_Buttons[_ButtonParty].Enabled = profileOK;
return true;
}
@@ -159,11 +172,6 @@ namespace Vocaluxe.Screens
//Snowflakes.Draw();
_DrawFG();
// ReSharper disable ConditionIsAlwaysTrueOrFalse
if (CSettings.VersionRevision != ERevision.Release)
// ReSharper restore ConditionIsAlwaysTrueOrFalse
_ReleaseText.Draw();
return true;
}
+22 -5
View File
@@ -24,17 +24,17 @@ namespace VocaluxeLib
public class CXMLReader
{
private readonly XPathNavigator _Navigator;
private readonly String _FileName;
private readonly String _FilePath;
public string FileName
public string FilePath
{
get { return _FileName; }
get { return _FilePath; }
}
//Private method. Use OpenFile factory method to get an instance
private CXMLReader(string uri)
{
_FileName = uri;
_FilePath = uri;
var xmlDoc = new XPathDocument(uri);
_Navigator = xmlDoc.CreateNavigator();
}
@@ -88,7 +88,24 @@ namespace VocaluxeLib
return GetValue(xPath, out val, value.ToString()) && CHelper.TryParse(val, out value);
}
public bool GetValue(string xPath, out string value, string defaultValue)
public bool TryGetColorFromRGBA(string xPath, ref SColorF value)
{
bool result = true;
result &= TryGetFloatValue(xPath + "/R", ref value.R);
result &= TryGetFloatValue(xPath + "/G", ref value.G);
result &= TryGetFloatValue(xPath + "/B", ref value.B);
result &= TryGetFloatValue(xPath + "/A", ref value.A);
if (result)
{
value.R = value.R.Clamp(0f, 1f);
value.G = value.G.Clamp(0f, 1f);
value.B = value.B.Clamp(0f, 1f);
value.A = value.A.Clamp(0f, 1f);
}
return result;
}
public bool GetValue(string xPath, out string value, string defaultValue = "")
{
int resultCt = 0;
string val = string.Empty;
+1 -1
View File
@@ -166,7 +166,7 @@ namespace VocaluxeLib
public interface ILog
{
void LogError(string errorText);
void LogError(string errorText, bool showMsg = false, bool exit = false);
void LogDebug(string text);
void LogSongInfo(string text);
}
+14 -3
View File
@@ -96,7 +96,18 @@ namespace VocaluxeLib.Menu
}
}
public bool Visible = true;
public bool Enabled = true;
private bool _Enabled = true;
public bool Enabled
{
get { return _Enabled; }
set
{
_Enabled = value;
if (!_Enabled)
_Selected = false;
}
}
public string GetThemeName()
{
@@ -138,7 +149,7 @@ namespace VocaluxeLib.Menu
_SelText = new CText(button._SelText);
Selected = false;
EditMode = false;
Enabled = button.Enabled;
_Enabled = button._Enabled;
_Reflection = button._Reflection;
_ReflectionHeight = button._ReflectionHeight;
@@ -318,7 +329,7 @@ namespace VocaluxeLib.Menu
CTexture texture;
if (!Selected && !Pressed || !Enabled)
if (!Selected && !Pressed || !_Enabled)
{
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
+10 -7
View File
@@ -84,18 +84,21 @@ namespace VocaluxeLib.Profile
{
PlayerName = value;
string avatarFileName;
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref Difficulty);
xmlReader.GetValue("//root/Info/Avatar", out avatarFileName, String.Empty);
bool ok = xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref Difficulty);
ok &= xmlReader.GetValue("//root/Info/Avatar", out avatarFileName);
Avatar = CBase.Profiles.GetAvatarByFilename(avatarFileName);
xmlReader.TryGetEnumValue("//root/Info/UserRole", ref UserRole);
xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
ok &= Avatar != null;
ok &= xmlReader.TryGetEnumValue("//root/Info/UserRole", ref UserRole);
ok &= xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
string passwordHash;
xmlReader.GetValue("//root/Info/PasswordHash", out passwordHash, "");
xmlReader.GetValue("//root/Info/PasswordHash", out passwordHash);
PasswordHash = !string.IsNullOrEmpty(passwordHash) ? Convert.FromBase64String(passwordHash) : null;
string passwordSalt;
xmlReader.GetValue("//root/Info/PasswordSalt", out passwordSalt, "");
xmlReader.GetValue("//root/Info/PasswordSalt", out passwordSalt);
PasswordSalt = !string.IsNullOrEmpty(passwordSalt) ? Convert.FromBase64String(passwordSalt) : null;
return true;
if (!ok)
CBase.Log.LogError("Error loading profile file: " + FileName);
return ok;
}
CBase.Log.LogError("Can't find PlayerName in Profile File: " + FileName);
+4 -11
View File
@@ -56,18 +56,11 @@ namespace VocaluxeLib.Songs
return Songs.Count(sp => !sp.IsSung);
}
public CCategory(string name, CTexture coverSmall, CTexture coverBig)
public CSong GetSong(int numInCategory)
{
Name = name;
CoverTextureSmall = coverSmall;
CoverTextureBig = coverBig;
}
public CCategory(CCategory cat)
{
Name = cat.Name;
CoverTextureSmall = cat.CoverTextureSmall;
CoverTextureBig = cat.CoverTextureBig;
if (numInCategory >= 0 && numInCategory < Songs.Count)
return CBase.Songs.GetSongByID(Songs[numInCategory].SongID);
return null;
}
}
}