Renamed CGameMode to CSongQueue as this is what it actually is

This commit is contained in:
Flamefire committed 2013-04-26 18:13:22 +02:00
1 parent f43817efd0
commit 124ed1c3d3
6 files changed
+40 -71

No files matched your search

+24 -30
View File
@@ -19,7 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Vocaluxe.GameModes; using Vocaluxe.SongQueue;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes; using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Menu.SongMenu;
@@ -28,7 +28,7 @@ namespace Vocaluxe.Base
{ {
static class CGame static class CGame
{ {
private static IGameMode _GameMode; private static ISongQueue _SongQueue;
private static int _NumPlayer = CConfig.NumPlayer; private static int _NumPlayer = CConfig.NumPlayer;
private static int _OldBeatD; private static int _OldBeatD;
@@ -64,103 +64,97 @@ namespace Vocaluxe.Base
public static void Init() public static void Init()
{ {
_GameMode = new CGameModeNormal(); _SongQueue = new CSongQueue();
_GameMode.Init(); _SongQueue.Init();
Players = new SPlayer[CSettings.MaxNumPlayer]; Players = new SPlayer[CSettings.MaxNumPlayer];
ResetPlayer(); ResetPlayer();
CConfig.UsePlayers(); CConfig.UsePlayers();
} }
public static void EnterNormalGame()
{
_GameMode = new CGameModeNormal();
_GameMode.Init();
}
public static EGameMode GameMode public static EGameMode GameMode
{ {
get { return _GameMode.GetCurrentGameMode(); } get { return _SongQueue.GetCurrentGameMode(); }
} }
public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode) 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) public static bool AddSong(int absoluteIndex, EGameMode gameMode)
{ {
return _GameMode.AddSong(absoluteIndex, gameMode); return _SongQueue.AddSong(absoluteIndex, gameMode);
} }
public static bool RemoveVisibleSong(int visibleIndex) public static bool RemoveVisibleSong(int visibleIndex)
{ {
return _GameMode.RemoveVisibleSong(visibleIndex); return _SongQueue.RemoveVisibleSong(visibleIndex);
} }
public static bool RemoveSong(int absoluteIndex) public static bool RemoveSong(int absoluteIndex)
{ {
return _GameMode.RemoveSong(absoluteIndex); return _SongQueue.RemoveSong(absoluteIndex);
} }
public static void ClearSongs() public static void ClearSongs()
{ {
_GameMode.ClearSongs(); _SongQueue.ClearSongs();
} }
public static void Reset() public static void Reset()
{ {
_GameMode.Reset(); _SongQueue.Reset();
} }
public static void Start() public static void Start()
{ {
_GameMode.Start(Players); _SongQueue.Start(Players);
} }
public static void NextRound() public static void NextRound()
{ {
_GameMode.NextRound(Players); _SongQueue.NextRound(Players);
} }
public static bool IsFinished() public static bool IsFinished()
{ {
return _GameMode.IsFinished(); return _SongQueue.IsFinished();
} }
public static int RoundNr public static int RoundNr
{ {
get { return _GameMode.GetCurrentRoundNr(); } get { return _SongQueue.GetCurrentRoundNr(); }
} }
public static CSong GetSong() public static CSong GetSong()
{ {
return _GameMode.GetSong(); return _SongQueue.GetSong();
} }
public static CSong GetSong(int num) public static CSong GetSong(int num)
{ {
return _GameMode.GetSong(num); return _SongQueue.GetSong(num);
} }
public static EGameMode GetGameMode(int num) public static EGameMode GetGameMode(int num)
{ {
return _GameMode.GetGameMode(num); return _SongQueue.GetGameMode(num);
} }
public static int GetNumSongs() public static int GetNumSongs()
{ {
return _GameMode.GetNumSongs(); return _SongQueue.GetNumSongs();
} }
public static CPoints GetPoints() public static CPoints GetPoints()
{ {
return _GameMode.GetPoints(); return _SongQueue.GetPoints();
} }
public static int NumRounds public static int NumRounds
{ {
get { return _GameMode.GetNumSongs(); } get { return _SongQueue.GetNumSongs(); }
} }
public static int NumPlayer public static int NumPlayer
@@ -200,7 +194,7 @@ namespace Vocaluxe.Base
public static void UpdatePoints(float time) public static void UpdatePoints(float time)
{ {
CSong song = _GameMode.GetSong(); CSong song = _SongQueue.GetSong();
if (song == null) if (song == null)
return; return;
@@ -225,8 +219,8 @@ namespace Vocaluxe.Base
{ {
for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++) for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++)
{ {
if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || if ((_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) (_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
Players[p].SongFinished = true; Players[p].SongFinished = true;
CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines; CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines;
-24
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
namespace Vocaluxe.GameModes
{
// Nomal singing
class CGameModeNormal : CGameMode {}
}
+1 -1
View File
@@ -612,7 +612,7 @@ namespace Vocaluxe.Screens
_SearchActive = _Sso.Sorting.SearchActive; _SearchActive = _Sso.Sorting.SearchActive;
_SearchText = _Sso.Sorting.SearchString; _SearchText = _Sso.Sorting.SearchString;
CGame.EnterNormalGame(); CGame.Reset();
_SongMenus[_SongMenu].OnShow(); _SongMenus[_SongMenu].OnShow();
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
@@ -22,30 +22,30 @@ using Vocaluxe.Base;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes namespace Vocaluxe.SongQueue
{ {
struct SSongQueque struct SSongQueueEntry
{ {
public readonly int SongID; public readonly int SongID;
public readonly EGameMode GameMode; public readonly EGameMode GameMode;
public SSongQueque(int songID, EGameMode gameMode) public SSongQueueEntry(int songID, EGameMode gameMode)
{ {
SongID = songID; SongID = songID;
GameMode = gameMode; GameMode = gameMode;
} }
} }
abstract class CGameMode : IGameMode class CSongQueue : ISongQueue
{ {
private List<SSongQueque> _SongQueque; private List<SSongQueueEntry> _SongQueque;
private int _CurrentSong; private int _CurrentSong;
private CPoints _Points; private CPoints _Points;
#region Implementation #region Implementation
public virtual void Init() public virtual void Init()
{ {
_SongQueque = new List<SSongQueque>(); _SongQueque = new List<SSongQueueEntry>();
Reset(); Reset();
} }
@@ -64,7 +64,7 @@ namespace Vocaluxe.GameModes
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
return false; return false;
_SongQueque.Add(new SSongQueque(songID, gameMode)); _SongQueque.Add(new SSongQueueEntry(songID, gameMode));
return true; return true;
} }
return false; return false;
@@ -78,7 +78,7 @@ namespace Vocaluxe.GameModes
if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet) if (gameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(songID).IsDuet)
return false; return false;
_SongQueque.Add(new SSongQueque(songID, gameMode)); _SongQueque.Add(new SSongQueueEntry(songID, gameMode));
return true; return true;
} }
return false; return false;
@@ -215,7 +215,7 @@ namespace Vocaluxe.GameModes
public virtual CSong GetSong(int num) 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 CSongs.GetSong(_SongQueque[num - 1].SongID);
return null; return null;
@@ -223,8 +223,8 @@ namespace Vocaluxe.GameModes
public virtual EGameMode GetGameMode(int num) public virtual EGameMode GetGameMode(int num)
{ {
if (num - 1 < _SongQueque.Count && num > -1) if (num - 1 < _SongQueque.Count && num > 0)
return _SongQueque[num].GameMode; return _SongQueque[num - 1].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL; return EGameMode.TR_GAMEMODE_NORMAL;
} }
@@ -20,9 +20,9 @@
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes namespace Vocaluxe.SongQueue
{ {
interface IGameMode interface ISongQueue
{ {
void Init(); void Init();
+2 -3
View File
@@ -198,9 +198,8 @@
<Compile Include="CSplashScreen.cs"> <Compile Include="CSplashScreen.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="GameModes\CGameMode.cs" /> <Compile Include="SongQueue\CSongQueue.cs" />
<Compile Include="GameModes\CGameModeNormal.cs" /> <Compile Include="SongQueue\ISongQueue.cs" />
<Compile Include="GameModes\IGameMode.cs" />
<Compile Include="GlobalSuppressions.cs" /> <Compile Include="GlobalSuppressions.cs" />
<Compile Include="Lib\Draw\CDirect3D.cs"> <Compile Include="Lib\Draw\CDirect3D.cs">
<SubType>Form</SubType> <SubType>Form</SubType>