From fea7b42fba2a0e27d9e22865b5c3208108565913 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Mon, 17 Dec 2012 21:34:23 +0100 Subject: [PATCH] added handling for song selection and fade to sing screen --- PartyModeChallenge/PartyModeChallenge.cs | 31 +++++++++++++++++++++++- Vocaluxe/Base/CMain.cs | 5 ++++ Vocaluxe/Base/CParty.cs | 5 ++++ Vocaluxe/Screens/CScreenSong.cs | 24 +++++++++--------- VocaluxeLib/Menu/IMenu.cs | 1 + VocaluxeLib/PartyModes/CPartyMode.cs | 4 +++ VocaluxeLib/PartyModes/IPartyMode.cs | 1 + 7 files changed, 59 insertions(+), 12 deletions(-) diff --git a/PartyModeChallenge/PartyModeChallenge.cs b/PartyModeChallenge/PartyModeChallenge.cs index e123546e..f93b3898 100644 --- a/PartyModeChallenge/PartyModeChallenge.cs +++ b/PartyModeChallenge/PartyModeChallenge.cs @@ -314,6 +314,35 @@ namespace Vocaluxe.PartyModes } + public override void SongSelected(int SongID) + { + + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + + _Base.Game.Reset(); + _Base.Game.ClearSongs(); + _Base.Game.AddSong(SongID, gm); + _Base.Game.SetNumPlayer(GameData.NumPlayerAtOnce); + + SPlayer[] player = _Base.Game.GetPlayer(); + if (player == null) + return; + + if (player.Length < GameData.NumPlayerAtOnce) + return; + + //TODO: set the right data + SProfile[] profiles = _Base.Profiles.GetProfiles(); + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) + { + player[i].Name = _ScreenSongOptions.Selection.TeamNames[i]; + player[i].Difficulty = profiles[GameData.ProfileIDs[i]].Difficulty; + player[i].ProfileID = GameData.ProfileIDs[i]; + } + + _Base.Graphics.FadeTo(EScreens.ScreenSing); + } + private void StartNextRound() { _ScreenSongOptions.Selection.RandomOnly = false; @@ -371,7 +400,7 @@ namespace Vocaluxe.PartyModes _ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" }; return; } - + //TODO: set the right data _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumPlayerAtOnce; i++) diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 699b4af3..430c66e3 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -473,6 +473,11 @@ namespace Vocaluxe.Base return CGame.NumPlayer; } + public void SetNumPlayer(int NumPlayer) + { + CGame.NumPlayer = NumPlayer; + } + public SPlayer[] GetPlayer() { return CGame.Player; diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 9d14f34f..4d80b57f 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -171,6 +171,11 @@ namespace Vocaluxe.Base { _CurrentPartyMode.PartyMode.JokerUsed(TeamNr); } + + public static void SongSelected(int SongID) + { + _CurrentPartyMode.PartyMode.SongSelected(SongID); + } #endregion Interface #region private stuff diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 559a2cf6..94fa4dbc 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -212,15 +212,12 @@ namespace Vocaluxe.Screens HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); } } - if (CSongs.NumVisibleSongs > 0) + if (CSongs.NumVisibleSongs > 0 && !_sso.Selection.PartyMode) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { if (!_sso.Selection.PartyMode) ToggleSongOptions(ESongOptionsView.Song); - else - //Is this still needed? - HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); } } break; @@ -552,7 +549,7 @@ namespace Vocaluxe.Screens if (_sso.Selection.RandomOnly && _sso.Selection.NumJokers != null) { - if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + if (Buttons[htButtons(ButtonStart)].Selected) { HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); return true; @@ -571,16 +568,14 @@ namespace Vocaluxe.Screens } } } - - if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) + + if (CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1 && !_sso.Selection.PartyMode) { if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) { if (!_sso.Selection.PartyMode) ToggleSongOptions(ESongOptionsView.Song); - else - //Is this still needed? - HandlePartySongSelection(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + return true; } else @@ -771,7 +766,14 @@ namespace Vocaluxe.Screens private void HandlePartySongSelection(int SongNr) { - CGraphics.FadeTo(EScreens.ScreenPartyDummy); + if ((CSongs.Category >= 0) && (SongNr >= 0)) + { + CSong song = CSongs.VisibleSongs[SongNr]; + if (song != null) + { + CParty.SongSelected(song.ID); + } + } } private void StartSong(int SongNr) diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 150ef735..19156cf6 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -196,6 +196,7 @@ namespace Vocaluxe.Menu public interface IGame { int GetNumPlayer(); + void SetNumPlayer(int NumPlayer); SPlayer[] GetPlayer(); float GetMidBeatD(); int GetCurrentBeatD(); diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index 80797cfe..feacf6f4 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -107,6 +107,10 @@ namespace Vocaluxe.PartyModes if (_ScreenSongOptions.Selection.NumJokers[TeamNr] > 0) _ScreenSongOptions.Selection.NumJokers[TeamNr]--; } + + public virtual void SongSelected(int SongID) + { + } #endregion Implementation } } diff --git a/VocaluxeLib/PartyModes/IPartyMode.cs b/VocaluxeLib/PartyModes/IPartyMode.cs index 7dc4719d..d06cdf81 100644 --- a/VocaluxeLib/PartyModes/IPartyMode.cs +++ b/VocaluxeLib/PartyModes/IPartyMode.cs @@ -77,5 +77,6 @@ namespace Vocaluxe.PartyModes void SetSearchString(string SearchString, bool Visible); void JokerUsed(int TeamNr); + void SongSelected(int SongID); } }