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
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user