Refactor PartyModes in preparation for a more unified name selection and maybe config
This commit is contained in:
1 parent
29dccbd8ae
commit
84e9163b96
22 files changed
+386
-426
No files matched your search
@@ -92,7 +92,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (roundIndex == 0 || numPlayed[i] < max)
|
||||
{
|
||||
if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i))
|
||||
if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].Contains(i))
|
||||
result.Add(i);
|
||||
else if (numPlayed[i] < max)
|
||||
other.Add(i);
|
||||
@@ -101,7 +101,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (roundIndex > 0)
|
||||
{
|
||||
if (!Rounds[roundIndex - 1].IsAvailable(i))
|
||||
if (!Rounds[roundIndex - 1].Contains(i))
|
||||
other.Add(i);
|
||||
else
|
||||
last.Add(i);
|
||||
@@ -165,11 +165,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
//filter against PlayerNrDemand
|
||||
List<CCombination> combsFiltered = new List<CCombination>();
|
||||
if (playerNrDemand != null)
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand)));
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.ContainsAll(playerNrDemand)));
|
||||
|
||||
//1st fallback
|
||||
if (playerNrDemand != null && combsFiltered.Count == 0)
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand)));
|
||||
combsFiltered.AddRange(_Combs.Where(t => t.ContainsAny(playerNrDemand)));
|
||||
|
||||
//2nd fallback
|
||||
if (combsFiltered.Count == 0)
|
||||
@@ -191,7 +191,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
int num = (int)Math.Pow(2, _NumPlayer);
|
||||
|
||||
for (int i = 1; i <= num; i++)
|
||||
for (int i = 1; i < num; i++)
|
||||
{
|
||||
CCombination c = new CCombination();
|
||||
|
||||
@@ -216,19 +216,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
Player = new List<int>();
|
||||
}
|
||||
|
||||
public bool IsAvailable(int playerIndex)
|
||||
public bool Contains(int playerIndex)
|
||||
{
|
||||
return Player.Any(p => p == playerIndex);
|
||||
}
|
||||
|
||||
public bool IsAvailableAll(IEnumerable<int> playerIndices)
|
||||
public bool ContainsAll(IEnumerable<int> playerIndices)
|
||||
{
|
||||
return playerIndices.All(IsAvailable);
|
||||
return playerIndices.All(Contains);
|
||||
}
|
||||
|
||||
public bool IsAvailableSomeone(IEnumerable<int> playerIndices)
|
||||
public bool ContainsAny(IEnumerable<int> playerIndices)
|
||||
{
|
||||
return playerIndices.Any(IsAvailable);
|
||||
return playerIndices.Any(Contains);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,11 +67,38 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public sealed class CPartyModeChallenge : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 12;
|
||||
private const int _MinPlayer = 1;
|
||||
private const int _MaxTeams = 0;
|
||||
private const int _MinTeams = 0;
|
||||
private const int _MaxNumRounds = 100;
|
||||
public override int MinMics
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxMics
|
||||
{
|
||||
get { return CBase.Config.GetMaxNumMics(); }
|
||||
}
|
||||
public override int MinPlayers
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxPlayers
|
||||
{
|
||||
get { return 12; }
|
||||
}
|
||||
public override int MinTeams
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxTeams
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MinPlayersPerTeam
|
||||
{
|
||||
get { return MinPlayers; }
|
||||
}
|
||||
public override int MaxPlayersPerTeam
|
||||
{
|
||||
get { return MaxPlayers; }
|
||||
}
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
@@ -108,7 +135,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeChallenge(int id, string folder) : base(id, folder)
|
||||
public CPartyModeChallenge(int id) : base(id)
|
||||
{
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
@@ -125,6 +152,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
if (!base.Init())
|
||||
return false;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
@@ -283,31 +312,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Sorting.SearchActive = visible;
|
||||
}
|
||||
|
||||
public override int GetMaxPlayer()
|
||||
{
|
||||
return _MaxPlayer;
|
||||
}
|
||||
|
||||
public override int GetMinPlayer()
|
||||
{
|
||||
return _MinPlayer;
|
||||
}
|
||||
|
||||
public override int GetMaxTeams()
|
||||
{
|
||||
return _MaxTeams;
|
||||
}
|
||||
|
||||
public override int GetMinTeams()
|
||||
{
|
||||
return _MinTeams;
|
||||
}
|
||||
|
||||
public override int GetMaxNumRounds()
|
||||
{
|
||||
return _MaxNumRounds;
|
||||
}
|
||||
|
||||
public override void JokerUsed(int teamNr)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.NumJokers == null)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.Challenge
|
||||
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private const string _ButtonNext = "ButtonNext";
|
||||
private const string _ButtonBack = "ButtonBack";
|
||||
|
||||
private int _MaxNumMics = 2;
|
||||
private int _MaxNumRounds = 100;
|
||||
private const int _MaxNumRounds = 100;
|
||||
private int _RoundSteps = 1;
|
||||
|
||||
public override void Init()
|
||||
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
_MaxNumMics = CBase.Config.GetMaxNumMics();
|
||||
if (_MaxNumMics > 6)
|
||||
_MaxNumMics = 6;
|
||||
|
||||
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
|
||||
|
||||
_RebuildSlides();
|
||||
}
|
||||
|
||||
@@ -125,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
|
||||
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString();
|
||||
|
||||
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
int player = _PartyMode.GameData.NumPlayer;
|
||||
int mics = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
|
||||
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateMicsAtOnce()
|
||||
{
|
||||
int maxNum = _MaxNumMics;
|
||||
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
|
||||
maxNum = _PartyMode.GameData.NumPlayer;
|
||||
int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
|
||||
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
|
||||
_PartyMode.GameData.NumPlayerAtOnce = maxNum;
|
||||
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_SelectSlides[_SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= maxNum; i++)
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
|
||||
}
|
||||
|
||||
private void _UpdateSlideRounds()
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_NextPlayerTexts = new List<CText>();
|
||||
_NextPlayerStatics = new List<CStatic>();
|
||||
|
||||
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = 0; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
|
||||
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
|
||||
@@ -72,13 +72,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public sealed class CPartyModeChallengeMedley : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 12;
|
||||
private const int _MinPlayer = 1;
|
||||
private const int _MaxTeams = 0;
|
||||
private const int _MinTeams = 0;
|
||||
private const int _MaxNumRounds = 100;
|
||||
private const int _NumSongs = 5;
|
||||
|
||||
public override int MinMics
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxMics
|
||||
{
|
||||
get { return CBase.Config.GetMaxNumMics(); }
|
||||
}
|
||||
public override int MinPlayers
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxPlayers
|
||||
{
|
||||
get { return 12; }
|
||||
}
|
||||
public override int MinTeams
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxTeams
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MinPlayersPerTeam
|
||||
{
|
||||
get { return MinPlayers; }
|
||||
}
|
||||
public override int MaxPlayersPerTeam
|
||||
{
|
||||
get { return MaxPlayers; }
|
||||
}
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
Config,
|
||||
@@ -114,7 +142,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeChallengeMedley(int id, string folder) : base(id, folder)
|
||||
public CPartyModeChallengeMedley(int id) : base(id)
|
||||
{
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
@@ -131,6 +159,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
if (!base.Init())
|
||||
return false;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
|
||||
@@ -290,31 +320,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Sorting.SearchActive = visible;
|
||||
}
|
||||
|
||||
public override int GetMaxPlayer()
|
||||
{
|
||||
return _MaxPlayer;
|
||||
}
|
||||
|
||||
public override int GetMinPlayer()
|
||||
{
|
||||
return _MinPlayer;
|
||||
}
|
||||
|
||||
public override int GetMaxTeams()
|
||||
{
|
||||
return _MaxTeams;
|
||||
}
|
||||
|
||||
public override int GetMinTeams()
|
||||
{
|
||||
return _MinTeams;
|
||||
}
|
||||
|
||||
public override int GetMaxNumRounds()
|
||||
{
|
||||
return _MaxNumRounds;
|
||||
}
|
||||
|
||||
public override void JokerUsed(int teamNr)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.NumJokers == null)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private const string _ButtonNext = "ButtonNext";
|
||||
private const string _ButtonBack = "ButtonBack";
|
||||
|
||||
private int _MaxNumMics = 2;
|
||||
private int _MaxNumRounds = 100;
|
||||
private const int _MaxNumRounds = 100;
|
||||
private int _RoundSteps = 1;
|
||||
|
||||
public override void Init()
|
||||
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
_MaxNumMics = CBase.Config.GetMaxNumMics();
|
||||
if (_MaxNumMics > 6)
|
||||
_MaxNumMics = 6;
|
||||
|
||||
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
|
||||
|
||||
_RebuildSlides();
|
||||
}
|
||||
|
||||
@@ -125,9 +119,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
|
||||
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.MinPlayers;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
int player = _PartyMode.GameData.NumPlayer;
|
||||
int mics = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
|
||||
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateMicsAtOnce()
|
||||
{
|
||||
int maxNum = _MaxNumMics;
|
||||
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
|
||||
maxNum = _PartyMode.GameData.NumPlayer;
|
||||
int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
|
||||
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
|
||||
_PartyMode.GameData.NumPlayerAtOnce = maxNum;
|
||||
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_SelectSlides[_SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= maxNum; i++)
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
|
||||
}
|
||||
|
||||
private void _UpdateSlideRounds()
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_NextPlayerTexts = new List<CText>();
|
||||
_NextPlayerStatics = new List<CStatic>();
|
||||
|
||||
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = 0; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
|
||||
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
|
||||
@@ -36,15 +36,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
public enum EPartyGameMode
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
TR_GAMEMODE_NORMAL,
|
||||
TR_GAMEMODE_SHORTSONG,
|
||||
TR_GAMEMODE_DUET
|
||||
// ReSharper restore InconsistentNaming
|
||||
}
|
||||
|
||||
public class CRound
|
||||
{
|
||||
public int SongID;
|
||||
@@ -71,13 +62,39 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public sealed class CPartyModeTicTacToe : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 20;
|
||||
private const int _MinPlayer = 2;
|
||||
private const int _MaxTeams = 2;
|
||||
private const int _MinTeams = 2;
|
||||
private const int _MinPlayerPerTeam = 1;
|
||||
private const int _MaxPlayerPerTeam = 10;
|
||||
private const int _NumFields = 9;
|
||||
public override int MinMics
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
public override int MaxMics
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
public override int MinPlayers
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
public override int MaxPlayers
|
||||
{
|
||||
get { return 20; }
|
||||
}
|
||||
public override int MinTeams
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
public override int MaxTeams
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override int MinPlayersPerTeam
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public override int MaxPlayersPerTeam
|
||||
{
|
||||
get { return 10; }
|
||||
}
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
@@ -99,10 +116,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public List<int> PlayerTeam2;
|
||||
|
||||
public ESongSource SongSource;
|
||||
public int CategoryID;
|
||||
public int CategoryIndex;
|
||||
public int PlaylistID;
|
||||
|
||||
public EPartyGameMode GameMode;
|
||||
public EGameMode GameMode;
|
||||
|
||||
public List<CRound> Rounds;
|
||||
public List<int> Songs;
|
||||
@@ -117,7 +134,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeTicTacToe(int id, string folder) : base(id, folder)
|
||||
public CPartyModeTicTacToe(int id) : base(id)
|
||||
{
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
@@ -142,8 +159,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
FieldNr = 0,
|
||||
SongSource = ESongSource.TR_ALLSONGS,
|
||||
PlaylistID = 0,
|
||||
CategoryID = 0,
|
||||
GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL,
|
||||
CategoryIndex = 0,
|
||||
GameMode = EGameMode.TR_GAMEMODE_NORMAL,
|
||||
Rounds = new List<CRound>(),
|
||||
Songs = new List<int>(),
|
||||
NumJokerRandom = new int[2],
|
||||
@@ -153,6 +170,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
if (!base.Init())
|
||||
return false;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
@@ -277,41 +296,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
throw new ArgumentException("Not required!");
|
||||
}
|
||||
|
||||
public override int GetMaxPlayer()
|
||||
{
|
||||
return _MaxPlayer;
|
||||
}
|
||||
|
||||
public override int GetMinPlayer()
|
||||
{
|
||||
return _MinPlayer;
|
||||
}
|
||||
|
||||
public override int GetMaxTeams()
|
||||
{
|
||||
return _MaxTeams;
|
||||
}
|
||||
|
||||
public override int GetMinTeams()
|
||||
{
|
||||
return _MinTeams;
|
||||
}
|
||||
|
||||
public override int GetMinPlayerPerTeam()
|
||||
{
|
||||
return _MinPlayerPerTeam;
|
||||
}
|
||||
|
||||
public override int GetMaxPlayerPerTeam()
|
||||
{
|
||||
return _MaxPlayerPerTeam;
|
||||
}
|
||||
|
||||
public override int GetMaxNumRounds()
|
||||
{
|
||||
return _NumFields;
|
||||
}
|
||||
|
||||
public override void JokerUsed(int teamNr) {}
|
||||
|
||||
public override void SongSelected(int songID)
|
||||
@@ -447,46 +431,26 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (GameData.Songs.Count > 0)
|
||||
return;
|
||||
|
||||
EGameMode gm;
|
||||
switch (GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_DUET:
|
||||
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
|
||||
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
|
||||
break;
|
||||
|
||||
default:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (GameData.SongSource)
|
||||
{
|
||||
case ESongSource.TR_PLAYLIST:
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
|
||||
{
|
||||
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID;
|
||||
if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(gm))
|
||||
if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(GameData.GameMode))
|
||||
GameData.Songs.Add(id);
|
||||
}
|
||||
break;
|
||||
|
||||
case ESongSource.TR_ALLSONGS:
|
||||
ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs();
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID));
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID));
|
||||
break;
|
||||
|
||||
case ESongSource.TR_CATEGORY:
|
||||
CBase.Songs.SetCategory(GameData.CategoryID);
|
||||
CBase.Songs.SetCategory(GameData.CategoryIndex);
|
||||
avSongs = CBase.Songs.GetVisibleSongs();
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID));
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID));
|
||||
|
||||
CBase.Songs.SetCategory(-1);
|
||||
break;
|
||||
@@ -534,23 +498,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (isDuet)
|
||||
players[1].VoiceNr = 1;
|
||||
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_DUET:
|
||||
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
|
||||
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
|
||||
break;
|
||||
}
|
||||
CBase.Game.AddSong(round.SongID, gm);
|
||||
CBase.Game.AddSong(round.SongID, GameData.GameMode);
|
||||
}
|
||||
|
||||
private void _SetNumJokers()
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Songs;
|
||||
@@ -113,8 +114,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
if (CBase.Config.GetMaxNumMics() >= 2)
|
||||
_ConfigOk = true;
|
||||
Debug.Assert(CBase.Config.GetMaxNumMics() >= 2);
|
||||
|
||||
_FillSlides();
|
||||
_UpdateSlides();
|
||||
@@ -129,15 +129,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void _FillSlides()
|
||||
{
|
||||
_SelectSlides[_SelectSlideNumFields].Clear();
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("9");
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("16");
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("25");
|
||||
if (_PartyMode.GameData.NumFields == 9)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 0;
|
||||
else if (_PartyMode.GameData.NumFields == 16)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 1;
|
||||
else if (_PartyMode.GameData.NumFields == 25)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 2;
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue(9);
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue(16);
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue(25);
|
||||
|
||||
_SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;
|
||||
|
||||
_SelectSlides[_SelectSlideSongSource].Clear();
|
||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource);
|
||||
@@ -152,52 +148,32 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
var categories = new string[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
categories[i] = CBase.Songs.GetCategory(i).Name;
|
||||
_SelectSlides[_SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < categories.Length; i++)
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
{
|
||||
string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
CCategory cat = CBase.Songs.GetCategory(i);
|
||||
string value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryID;
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
|
||||
|
||||
_SelectSlides[_SelectSlideGameMode].Visible = true;
|
||||
_SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_PartyMode.GameData.GameMode);
|
||||
_SelectSlides[_SelectSlideGameMode].Clear();
|
||||
_SelectSlides[_SelectSlideGameMode].SetValues<EGameMode>((int)_PartyMode.GameData.GameMode);
|
||||
_SelectSlides[_SelectSlideGameMode].RemoveValue(EGameMode.TR_GAMEMODE_MEDLEY.ToString());
|
||||
}
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideNumFields].Selection == 0)
|
||||
_PartyMode.GameData.NumFields = 9;
|
||||
else if (_SelectSlides[_SelectSlideNumFields].Selection == 1)
|
||||
_PartyMode.GameData.NumFields = 16;
|
||||
else if (_SelectSlides[_SelectSlideNumFields].Selection == 2)
|
||||
_PartyMode.GameData.NumFields = 25;
|
||||
_PartyMode.GameData.NumFields = _SelectSlides[_SelectSlideNumFields].SelectedTag;
|
||||
|
||||
_PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
|
||||
_PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
|
||||
_PartyMode.GameData.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_PartyMode.GameData.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||
_PartyMode.GameData.CategoryIndex = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_PartyMode.GameData.GameMode = (EGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (_PartyMode.GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_DUET:
|
||||
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||
break;
|
||||
|
||||
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
|
||||
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
|
||||
break;
|
||||
}
|
||||
EGameMode gm = _PartyMode.GameData.GameMode;
|
||||
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST)
|
||||
{
|
||||
@@ -224,11 +200,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() == 0)
|
||||
_ConfigOk = false;
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryID) <= 0)
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryIndex) <= 0)
|
||||
_ConfigOk = false;
|
||||
else
|
||||
{
|
||||
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryID);
|
||||
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryIndex);
|
||||
_ConfigOk = false;
|
||||
foreach (CSong song in CBase.Songs.GetVisibleSongs())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user