From cbc32231141ede14303d4fc410647d4040ddd911 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 10 Aug 2014 14:30:18 +0200 Subject: [PATCH 01/11] Remove loading of Covers from xml --- Vocaluxe/Base/CCover.cs | 45 ++++++----------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index ac9cc10c..24e25e3e 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -177,62 +177,29 @@ namespace Vocaluxe.Base if (String.IsNullOrEmpty(coverTheme.Name)) return; - var ignoreList = new List(); - string coverPath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder); List 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 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"]; } } /// /// Ads a cover with the given name if it does not exist yet - /// MUST HOLD _Covers lock at this point /// /// Name of the cover /// Filename of image file 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)); } } } From 8f60d5dae52702f94adc850c39309da214b8a53e Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 10 Aug 2014 14:35:02 +0200 Subject: [PATCH 02/11] Rename LoadCover function --- Vocaluxe/Base/CCover.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 24e25e3e..61692ce7 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -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,7 +170,7 @@ namespace Vocaluxe.Base /// /// Loads all cover which are defined in the cover config file. /// - private static void _LoadCover(string coverThemeName) + private static void _LoadCovers(string coverThemeName) { SCoverTheme coverTheme = _CoverTheme(coverThemeName); From 43fff7f52fe32a72ce7ba41ffb2d0dda9ea0041e Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 14 Aug 2014 16:03:09 +0200 Subject: [PATCH 03/11] Rename FileName to FilePath --- Vocaluxe/Base/CLanguage.cs | 2 +- VocaluxeLib/CXMLReader.cs | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index a86faf0f..fb452747 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -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; } } diff --git a/VocaluxeLib/CXMLReader.cs b/VocaluxeLib/CXMLReader.cs index 1603af81..4b06b922 100644 --- a/VocaluxeLib/CXMLReader.cs +++ b/VocaluxeLib/CXMLReader.cs @@ -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; From d20c31ef714ad15c75155a9af817f7d8cb224420 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 14 Aug 2014 16:06:43 +0200 Subject: [PATCH 04/11] Add additional logging functionality --- Vocaluxe/Base/CMain.cs | 4 ++-- VocaluxeLib/IBasic.cs | 2 +- VocaluxeLib/Menu/CStatic.cs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index c52a77a3..5856bab5 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -434,9 +434,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) diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index 404e55a2..ef14e905 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -152,7 +152,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); } diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 327dfc14..6d4c2e35 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -16,7 +16,6 @@ #endregion using System; -using System.Drawing; using System.Xml; using VocaluxeLib.Draw; From 388bd6310f143349577f3b59c1f37a71302ee2cb Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 14 Aug 2014 16:07:06 +0200 Subject: [PATCH 05/11] Add GetSong to Categories --- VocaluxeLib/Songs/CCategory.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/VocaluxeLib/Songs/CCategory.cs b/VocaluxeLib/Songs/CCategory.cs index 43fc78fb..79f5087c 100644 --- a/VocaluxeLib/Songs/CCategory.cs +++ b/VocaluxeLib/Songs/CCategory.cs @@ -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; } } } \ No newline at end of file From d27cbcd7d0ba6747290831a6cfe139e7c57abcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Wed, 27 Aug 2014 09:05:04 +0200 Subject: [PATCH 06/11] Another fix for bg-music. --- Vocaluxe/Base/CBackgroundMusic.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index dc922b6a..d34d5432 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -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() From e66d108df094669510c4862fcf50052f1a682072 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 7 Sep 2014 11:11:16 +0200 Subject: [PATCH 07/11] Handle errors in profile files --- VocaluxeLib/Profile/CProfile.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs index 24c9de70..cf03f5b0 100644 --- a/VocaluxeLib/Profile/CProfile.cs +++ b/VocaluxeLib/Profile/CProfile.cs @@ -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); From 774035e886f2b226b6037f245c7db68d992db3cd Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 7 Sep 2014 12:11:42 +0200 Subject: [PATCH 08/11] Make GetProfiles return an empty array in case of no profiles --- .../PartyModeChallengeMedley/CPartyModeChallengeMedley.cs | 8 +------- Vocaluxe/Base/CConfig.cs | 2 +- Vocaluxe/Base/CProfiles.cs | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index c6f0d619..623681b6 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -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"}; diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 5b42d5aa..d7aee117 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -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) diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 8c5c9887..5c05719f 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -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(_Profiles.Values); list.Sort(_CompareByPlayerName); From d327f2274199b2589d10c0150401e59cd208e0b7 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 7 Sep 2014 19:30:52 +0200 Subject: [PATCH 09/11] Fix wrong colors --- Output/Themes/Ambient/Skin Blue.xml | 8 ++++---- Output/Themes/Ambient/Skin Green.xml | 8 ++++---- Output/Themes/Ambient/Skin Red.xml | 8 ++++---- Output/Themes/Ambient/Skin Yellow.xml | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 34cff336..bba00650 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -140,7 +140,7 @@ 0,675 0,890 0,969 - 1,000 + 0,600 0,675 @@ -227,9 +227,9 @@ 1,000 - 0,000 - 0,000 - 0,000 + 1,000 + 1,000 + 1,000 1,000 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 868a0b0f..5b1b4d5f 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -140,7 +140,7 @@ 0,709 0,968 0,674 - 1,000 + 0,600 0,709 @@ -221,9 +221,9 @@ 1,000 - 0,000 - 0,000 - 0,000 + 1,000 + 1,000 + 1,000 1,000 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index a0929c67..50f1eecc 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -140,7 +140,7 @@ 0,968 0,674 0,674 - 1,000 + 0,600 0,968 @@ -221,9 +221,9 @@ 1,000 - 0,000 - 0,000 - 0,000 + 1,000 + 1,000 + 1,000 1,000 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 141050a2..9dd57a3b 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -140,7 +140,7 @@ 0,968 0,956 0,674 - 1,000 + 0,600 0,968 @@ -221,9 +221,9 @@ 1,000 - 0,000 - 0,000 - 0,000 + 1,000 + 1,000 + 1,000 1,000 From 64c142345bb444d1b689a86a89af4f847b2c3eaa Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 7 Sep 2014 19:31:57 +0200 Subject: [PATCH 10/11] Disable Buttons also deselects it --- VocaluxeLib/Menu/CButton.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 1a9a8a49..09ebdf86 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -79,7 +79,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() { @@ -116,7 +127,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; @@ -281,7 +292,7 @@ namespace VocaluxeLib.Menu CTexture texture; - if (!Selected && !Pressed || !Enabled) + if (!Selected && !Pressed || !_Enabled) { texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); From e9b584d84cafa9409d991b3c34af884c3044d43c Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 7 Sep 2014 19:33:28 +0200 Subject: [PATCH 11/11] Show an error if no profiles found and disable gaming --- Output/Languages/English.xml | 1 + Output/Languages/German.xml | 1 + Output/Themes/Ambient/Screens/ScreenMain.xml | 76 ++++++++++++++++++- .../Themes/Changelog/Changelog_ScreenMain.txt | 10 +++ Vocaluxe/Screens/CScreenMain.cs | 30 +++++--- 5 files changed, 106 insertions(+), 12 deletions(-) create mode 100644 Output/Themes/Changelog/Changelog_ScreenMain.txt diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 6554f2dc..c0ece78c 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -93,6 +93,7 @@ Party Options Profiles + No profiles found! Party Mode Selection Party Mode Description diff --git a/Output/Languages/German.xml b/Output/Languages/German.xml index 50ffef0a..4ded8f3f 100644 --- a/Output/Languages/German.xml +++ b/Output/Languages/German.xml @@ -92,6 +92,7 @@ Party Optionen Profile + Keine Profile gefunden! Party-Modus Auswahl Party-Modus Beschreibung diff --git a/Output/Themes/Ambient/Screens/ScreenMain.xml b/Output/Themes/Ambient/Screens/ScreenMain.xml index 0d256cd2..50e3a04c 100644 --- a/Output/Themes/Ambient/Screens/ScreenMain.xml +++ b/Output/Themes/Ambient/Screens/ScreenMain.xml @@ -1,7 +1,7 @@  - 1 + 2 Video @@ -314,5 +314,79 @@ 26 + + + 10 + 690 + + -1 + + 15 + + + TextWhite + + + TextWhite + + Left + + Center + + + + Normal + + + + + + + + + TextBG + + 150 + 610 + -1,90 + 355 + 30 + + + StaticWarningColor + + + + + + + 320 + 612 + + -2,00 + + 27 + + 355 + + + TextWarningColor + + + TextWarningColor + + Center + + Center + + + + Outline + + TR_SCREENMAIN_TEXT_NOPROFILES + + + + diff --git a/Output/Themes/Changelog/Changelog_ScreenMain.txt b/Output/Themes/Changelog/Changelog_ScreenMain.txt new file mode 100644 index 00000000..b3eb3bb7 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenMain.txt @@ -0,0 +1,10 @@ +SceenMain + +++++++++++ +Version 2: + +Add: + + + + diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index 6cd878bc..cc4e3c4c 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -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; }