diff --git a/Output/PartyModes/Challenge.xml b/Output/PartyModes/Challenge.xml index d7c33562..964a589e 100644 --- a/Output/PartyModes/Challenge.xml +++ b/Output/PartyModes/Challenge.xml @@ -8,7 +8,7 @@ Challenge CPartyModeChallenge 0 - 1 + 3 TR_PARTYMODE_AUDIENCE diff --git a/Output/PartyModes/Challenge/Languages/English.xml b/Output/PartyModes/Challenge/Languages/English.xml index b343b452..3907bf70 100644 --- a/Output/PartyModes/Challenge/Languages/English.xml +++ b/Output/PartyModes/Challenge/Languages/English.xml @@ -15,6 +15,8 @@ Number of players Number of mics Number of rounds + Number of jokers + Refill jokers every round Challenge Mode: Choose Player Select random Challenge Mode: Overview diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml index 5dfbf453..64e3adad 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml @@ -2,7 +2,7 @@ PartyScreenChallengeConfig - 1 + 3 @@ -82,6 +82,34 @@ Outline TR_SCREENCONFIG_NUMROUNDS + + + 75 + 285 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMJOKERS + + + 75 + 345 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_REFILLJOKERS @@ -284,6 +312,90 @@ Outline Bold 10 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 205.33 + Outline + Bold + 10 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 50 + 0 + 205.33 + Outline + Bold + 2 diff --git a/Output/RequiredSkinElements.xml b/Output/RequiredSkinElements.xml index 7899e53d..a9ac470c 100644 --- a/Output/RequiredSkinElements.xml +++ b/Output/RequiredSkinElements.xml @@ -18,9 +18,7 @@ Minus RepeatIcon - - BG_Video - + Player1 Player2 diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index d00a1f5b..f92f2dea 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -113,6 +113,9 @@ namespace VocaluxeLib.PartyModes.Challenge public int NumPlayer; public int NumPlayerAtOnce; public int NumRounds; + public int NumJokers; + public bool RefillJokers; + public int[] Jokers; public List ProfileIDs; public CChallengeRounds Rounds; @@ -147,7 +150,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Sorting.SearchActive = false; _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets; - GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; + GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; } public override bool Init() @@ -213,6 +216,7 @@ namespace VocaluxeLib.PartyModes.Challenge GameData.ResultTable = new List(); GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); GameData.CurrentRoundNr = 1; + GameData.Jokers = null; break; case EStage.Main: _Stage = EStage.Singing; @@ -320,6 +324,11 @@ namespace VocaluxeLib.PartyModes.Challenge if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length) return; + if (!GameData.RefillJokers) + { + CRound round = GameData.Rounds[GameData.CurrentRoundNr - 1]; + GameData.Jokers[round.Players[teamNr]]--; + } _ScreenSongOptions.Selection.NumJokers[teamNr]--; _ScreenSongOptions.Selection.RandomOnly = true; _ScreenSongOptions.Selection.CategoryChangeAllowed = false; @@ -373,35 +382,29 @@ namespace VocaluxeLib.PartyModes.Challenge private void _SetNumJokers() { - switch (GameData.NumPlayerAtOnce) - { - case 1: - _ScreenSongOptions.Selection.NumJokers = new int[] {10}; - break; - - case 2: - _ScreenSongOptions.Selection.NumJokers = new int[] {5, 5}; - break; - - case 3: - _ScreenSongOptions.Selection.NumJokers = new int[] {4, 4, 4}; - break; - - case 4: - _ScreenSongOptions.Selection.NumJokers = new int[] {3, 3, 3, 3}; - break; - - case 5: - _ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2}; - break; - - case 6: - _ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2, 2}; - break; - default: - _ScreenSongOptions.Selection.NumJokers = new int[] {5, 5}; - break; + int[] jokers = new int[GameData.NumPlayerAtOnce]; + if (GameData.RefillJokers) + { + for (int i = 0; i < jokers.Length; i++) + jokers[i] = GameData.NumJokers; } + else + { + if (GameData.Jokers == null) + { + GameData.Jokers = new int[GameData.NumPlayer]; + for (int i = 0; i < GameData.ProfileIDs.Count; i++) + { + GameData.Jokers[i] = GameData.NumJokers; + } + } + CRound round = GameData.Rounds[GameData.CurrentRoundNr - 1]; + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + { + jokers[i] = GameData.Jokers[round.Players[i]]; + } + } + _ScreenSongOptions.Selection.NumJokers = jokers; } private void _SetTeamNames() diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index d1a4747b..99cfae4d 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -27,12 +27,14 @@ namespace VocaluxeLib.PartyModes.Challenge // 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 3; } } private const string _SelectSlideNumPlayers = "SelectSlideNumPlayers"; private const string _SelectSlideNumMics = "SelectSlideNumMics"; private const string _SelectSlideNumRounds = "SelectSlideNumRounds"; + private const string _SelectSlideNumJokers = "SelectSlideNumJokers"; + private const string _SelectSlideRefillJokers = "SelectSlideRefillJokers"; private const string _ButtonNext = "ButtonNext"; private const string _ButtonBack = "ButtonBack"; @@ -43,7 +45,7 @@ namespace VocaluxeLib.PartyModes.Challenge { base.Init(); - _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds}; + _ThemeSelectSlides = new string[] { _SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds, _SelectSlideNumJokers, _SelectSlideRefillJokers }; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; } @@ -123,6 +125,20 @@ namespace VocaluxeLib.PartyModes.Challenge _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString(); + // build num joker slide 1 to 10 + _SelectSlides[_SelectSlideNumJokers].Clear(); + for (int i = 1; i <= 10; i++) + { + _SelectSlides[_SelectSlideNumJokers].AddValue(i.ToString()); + } + _SelectSlides[_SelectSlideNumJokers].SelectedValue = "5"; + + //build joker config slide + _SelectSlides[_SelectSlideRefillJokers].Clear(); + _SelectSlides[_SelectSlideRefillJokers].AddValue(CBase.Language.Translate("TR_BUTTON_NO", PartyModeID)); + _SelectSlides[_SelectSlideRefillJokers].AddValue(CBase.Language.Translate("TR_BUTTON_YES", PartyModeID)); + _SelectSlides[_SelectSlideRefillJokers].SelectLastValue(); + _UpdateMicsAtOnce(); _SetRoundSteps(); _UpdateSlideRounds(); @@ -135,6 +151,8 @@ namespace VocaluxeLib.PartyModes.Challenge _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers; _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers; _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; + _PartyMode.GameData.NumJokers = _SelectSlides[_SelectSlideNumJokers].Selection + 1; + _PartyMode.GameData.RefillJokers = (_SelectSlides[_SelectSlideRefillJokers].Selection == 1) ? true : false; _UpdateMicsAtOnce(); _SetRoundSteps(); diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 86e8537b..3e0762f6 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -41,6 +41,10 @@ namespace Vocaluxe.Base public void Load(string videoName) { _VideoStream = CThemes.GetSkinVideo(videoName, -1, false); + if (_VideoStream == null) + { + return; + } _Loaded = true; CVideo.Pause(_VideoStream); } @@ -68,6 +72,11 @@ namespace Vocaluxe.Base public void Draw() { + if (!_Loaded) + { + return; + } + if (!_Finished) { float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; @@ -83,6 +92,10 @@ namespace Vocaluxe.Base public void PreLoad() { + if (!_Loaded) + { + return; + } bool paused = _VideoTimer.IsRunning; if (paused) CVideo.Resume(_VideoStream); diff --git a/Vocaluxe/Base/ThemeSystem/CSkin.cs b/Vocaluxe/Base/ThemeSystem/CSkin.cs index 5474177e..6e04b079 100644 --- a/Vocaluxe/Base/ThemeSystem/CSkin.cs +++ b/Vocaluxe/Base/ThemeSystem/CSkin.cs @@ -178,8 +178,8 @@ namespace Vocaluxe.Base.ThemeSystem CVideoSkinElement sk = new CVideoSkinElement {FileName = kvp.Value}; if (!File.Exists(Path.Combine(_Folder, sk.FileName))) { - CLog.LogError("Video \"" + kvp.Key + "\": (" + sk.FileName + ") not found!", true); - return false; + CLog.LogError("Video \"" + kvp.Key + "\": (" + sk.FileName + ") not found!"); + continue; } _Videos.Add(kvp.Key, sk); } diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 548d10fa..611aa382 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -318,11 +318,15 @@ namespace VocaluxeLib.Menu private bool _DrawVideo() { - CBase.Video.GetFrame(_VideoStream, _VideoStream.VideoTime); - if (_VideoStream.Texture != null) + if (_VideoStream != null) { - CBase.Drawing.DrawTexture(_VideoStream.Texture, Rect, EAspect.Crop); - return true; + CBase.Video.GetFrame(_VideoStream, _VideoStream.VideoTime); + if (_VideoStream.Texture != null) + { + CBase.Drawing.DrawTexture(_VideoStream.Texture, Rect, EAspect.Crop); + return true; + } + return false; } return false; }