diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index ae909a92..d8403a9f 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; -using Vocaluxe.GameModes; +using Vocaluxe.SongQueue; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SingNotes; using VocaluxeLib.Menu.SongMenu; @@ -28,7 +28,7 @@ namespace Vocaluxe.Base { static class CGame { - private static IGameMode _GameMode; + private static ISongQueue _SongQueue; private static int _NumPlayer = CConfig.NumPlayer; private static int _OldBeatD; @@ -64,103 +64,97 @@ namespace Vocaluxe.Base public static void Init() { - _GameMode = new CGameModeNormal(); - _GameMode.Init(); + _SongQueue = new CSongQueue(); + _SongQueue.Init(); Players = new SPlayer[CSettings.MaxNumPlayer]; ResetPlayer(); CConfig.UsePlayers(); } - public static void EnterNormalGame() - { - _GameMode = new CGameModeNormal(); - _GameMode.Init(); - } - public static EGameMode GameMode { - get { return _GameMode.GetCurrentGameMode(); } + get { return _SongQueue.GetCurrentGameMode(); } } public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode) { - return _GameMode.AddVisibleSong(visibleIndex, gameMode); + return _SongQueue.AddVisibleSong(visibleIndex, gameMode); } public static bool AddSong(int absoluteIndex, EGameMode gameMode) { - return _GameMode.AddSong(absoluteIndex, gameMode); + return _SongQueue.AddSong(absoluteIndex, gameMode); } public static bool RemoveVisibleSong(int visibleIndex) { - return _GameMode.RemoveVisibleSong(visibleIndex); + return _SongQueue.RemoveVisibleSong(visibleIndex); } public static bool RemoveSong(int absoluteIndex) { - return _GameMode.RemoveSong(absoluteIndex); + return _SongQueue.RemoveSong(absoluteIndex); } public static void ClearSongs() { - _GameMode.ClearSongs(); + _SongQueue.ClearSongs(); } public static void Reset() { - _GameMode.Reset(); + _SongQueue.Reset(); } public static void Start() { - _GameMode.Start(Players); + _SongQueue.Start(Players); } public static void NextRound() { - _GameMode.NextRound(Players); + _SongQueue.NextRound(Players); } public static bool IsFinished() { - return _GameMode.IsFinished(); + return _SongQueue.IsFinished(); } public static int RoundNr { - get { return _GameMode.GetCurrentRoundNr(); } + get { return _SongQueue.GetCurrentRoundNr(); } } public static CSong GetSong() { - return _GameMode.GetSong(); + return _SongQueue.GetSong(); } public static CSong GetSong(int num) { - return _GameMode.GetSong(num); + return _SongQueue.GetSong(num); } public static EGameMode GetGameMode(int num) { - return _GameMode.GetGameMode(num); + return _SongQueue.GetGameMode(num); } public static int GetNumSongs() { - return _GameMode.GetNumSongs(); + return _SongQueue.GetNumSongs(); } public static CPoints GetPoints() { - return _GameMode.GetPoints(); + return _SongQueue.GetPoints(); } public static int NumRounds { - get { return _GameMode.GetNumSongs(); } + get { return _SongQueue.GetNumSongs(); } } public static int NumPlayer @@ -200,7 +194,7 @@ namespace Vocaluxe.Base public static void UpdatePoints(float time) { - CSong song = _GameMode.GetSong(); + CSong song = _SongQueue.GetSong(); if (song == null) return; @@ -225,8 +219,8 @@ namespace Vocaluxe.Base { for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++) { - if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || - (_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) + if ((_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || + (_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) Players[p].SongFinished = true; CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines; diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs deleted file mode 100644 index e728a923..00000000 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ /dev/null @@ -1,24 +0,0 @@ -#region license -// /* -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -// */ -#endregion - -namespace Vocaluxe.GameModes -{ - // Nomal singing - class CGameModeNormal : CGameMode {} -} \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 054fddf3..852e6ebb 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -612,7 +612,7 @@ namespace Vocaluxe.Screens _SearchActive = _Sso.Sorting.SearchActive; _SearchText = _Sso.Sorting.SearchString; - CGame.EnterNormalGame(); + CGame.Reset(); _SongMenus[_SongMenu].OnShow(); if (_Sso.Selection.PartyMode) diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/SongQueue/CSongQueue.cs similarity index 92% rename from Vocaluxe/GameModes/CGameMode.cs rename to Vocaluxe/SongQueue/CSongQueue.cs index 2d6f2527..e8ad77f2 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/SongQueue/CSongQueue.cs @@ -22,30 +22,30 @@ using Vocaluxe.Base; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; -namespace Vocaluxe.GameModes +namespace Vocaluxe.SongQueue { - struct SSongQueque + struct SSongQueueEntry { public readonly int SongID; public readonly EGameMode GameMode; - public SSongQueque(int songID, EGameMode gameMode) + public SSongQueueEntry(int songID, EGameMode gameMode) { SongID = songID; GameMode = gameMode; } } - abstract class CGameMode : IGameMode + class CSongQueue : ISongQueue { - private List _SongQueque; + private List _SongQueque; private int _CurrentSong; private CPoints _Points; #region Implementation public virtual void Init() { - _SongQueque = new List(); + _SongQueque = new List(); Reset(); } @@ -64,7 +64,7 @@ namespace Vocaluxe.GameModes if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) return false; - _SongQueque.Add(new SSongQueque(songID, gameMode)); + _SongQueque.Add(new SSongQueueEntry(songID, gameMode)); return true; } return false; @@ -78,7 +78,7 @@ namespace Vocaluxe.GameModes if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) return false; - _SongQueque.Add(new SSongQueque(songID, gameMode)); + _SongQueque.Add(new SSongQueueEntry(songID, gameMode)); return true; } return false; @@ -215,7 +215,7 @@ namespace Vocaluxe.GameModes public virtual CSong GetSong(int num) { - if (num - 1 < _SongQueque.Count && num - 1 > -1) + if (num - 1 < _SongQueque.Count && num > 0) return CSongs.GetSong(_SongQueque[num - 1].SongID); return null; @@ -223,8 +223,8 @@ namespace Vocaluxe.GameModes public virtual EGameMode GetGameMode(int num) { - if (num - 1 < _SongQueque.Count && num > -1) - return _SongQueque[num].GameMode; + if (num - 1 < _SongQueque.Count && num > 0) + return _SongQueque[num - 1].GameMode; return EGameMode.TR_GAMEMODE_NORMAL; } diff --git a/Vocaluxe/GameModes/IGameMode.cs b/Vocaluxe/SongQueue/ISongQueue.cs similarity index 96% rename from Vocaluxe/GameModes/IGameMode.cs rename to Vocaluxe/SongQueue/ISongQueue.cs index b9732b15..40bf808d 100644 --- a/Vocaluxe/GameModes/IGameMode.cs +++ b/Vocaluxe/SongQueue/ISongQueue.cs @@ -20,9 +20,9 @@ using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; -namespace Vocaluxe.GameModes +namespace Vocaluxe.SongQueue { - interface IGameMode + interface ISongQueue { void Init(); diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 58fa7a40..1e170ebb 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -198,9 +198,8 @@ Form - - - + + Form