From b71437ee83ac3c4babe285cd0ed8bc3f158e8083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 19 Nov 2017 13:39:42 +0100 Subject: [PATCH] More dynamically statics and texts loading for pause screen --- Vocaluxe/Screens/CScreenSing.cs | 36 +++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index a7508f67..07c8ceb6 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -50,12 +50,12 @@ namespace Vocaluxe.Screens private const string _TextSongName = "TextSongName"; private const string _TextTime = "TextTime"; - private const string _TextPause = "TextPause"; private const string _TextDuetName1 = "TextDuetName1"; private const string _TextDuetName2 = "TextDuetName2"; private const string _TextMedleyCountdown = "TextMedleyCountdown"; private string[,,] _TextScores; private string[,,] _TextNames; + private List _TextsPause; private const string _StaticSongText = "StaticSongText"; private const string _StaticLyrics = "StaticLyrics"; @@ -69,7 +69,7 @@ namespace Vocaluxe.Screens private const string _StaticLyricHelper = "StaticLyricHelper"; private const string _StaticLyricHelperDuet = "StaticLyricHelperDuet"; private const string _StaticLyricHelperTop = "StaticLyricHelperTop"; - private const string _StaticPauseBG = "StaticPauseBG"; + private List _StaticsPause; private string[,,] _StaticScores; private string[,,] _StaticAvatars; @@ -139,7 +139,7 @@ namespace Vocaluxe.Screens { base.Init(); - var texts = new List { _TextSongName, _TextTime, _TextPause, _TextDuetName1, _TextDuetName2, _TextMedleyCountdown }; + var texts = new List { _TextSongName, _TextTime, _TextDuetName1, _TextDuetName2, _TextMedleyCountdown }; _BuildTextStrings(texts); _ThemeTexts = texts.ToArray(); @@ -156,9 +156,8 @@ namespace Vocaluxe.Screens _StaticTimePointer, _StaticLyricHelper, _StaticLyricHelperDuet, - _StaticLyricHelperTop, - _StaticPauseBG - }; + _StaticLyricHelperTop + }; _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); @@ -181,6 +180,21 @@ namespace Vocaluxe.Screens _TimerDuetText2 = new Stopwatch(); } + public override void LoadTheme(string xmlPath) + { + base.LoadTheme(xmlPath); + + _StaticsPause = new List(); + _TextsPause = new List(); + + //Automatically find statics and texts with pause prefix + foreach (CStatic s in _Statics.Where(s => s.ThemeLoaded && s.GetThemeName().StartsWith("StaticPause"))) + _StaticsPause.Add(s.GetThemeName()); + + foreach (CText t in _Texts.Where(s => s.ThemeLoaded && s.GetThemeName().StartsWith("TextPause"))) + _TextsPause.Add(t.GetThemeName()); + } + public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -826,11 +840,17 @@ namespace Vocaluxe.Screens private void _SetPause(bool paused) { _Pause = paused; - _Statics[_StaticPauseBG].Visible = _Pause; - _Texts[_TextPause].Visible = _Pause; + + foreach(String s in _StaticsPause) + _Statics[s].Visible = _Pause; + + foreach(String s in _TextsPause) + _Texts[s].Visible = _Pause; + _Buttons[_ButtonCancel].Visible = _Pause; _Buttons[_ButtonContinue].Visible = _Pause; _Buttons[_ButtonSkip].Visible = _Pause && CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1; + if (_Pause) CSound.Pause(_CurrentStream); else