Refactor PartyModes in preparation for a more unified name selection and maybe config

This commit is contained in:
Flamefire committed 2014-12-14 20:40:08 +01:00
1 parent 29dccbd8ae
commit 84e9163b96
22 files changed
+386 -426

No files matched your search

+1
View File
@@ -101,6 +101,7 @@
<string name="TR_SCREENPARTY_VERSION">Version</string> <string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">Can\'t load this party-mode.</string> <string name="TR_SCREENPARTY_ERROR">Can\'t load this party-mode.</string>
<string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string> <string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string>
<string name="TR_SCREENPARTY_ERROR_MIC_NUM">%d mics are required for this party-mode!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string> <string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string>
<string name="TR_SCREENPARTY_NOTEAMS">No teams</string> <string name="TR_SCREENPARTY_NOTEAMS">No teams</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string> <string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string>
+1
View File
@@ -101,6 +101,7 @@
<string name="TR_SCREENPARTY_VERSION">Version</string> <string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">Dieser Party-Modus konnte nicht geladen werden.</string> <string name="TR_SCREENPARTY_ERROR">Dieser Party-Modus konnte nicht geladen werden.</string>
<string name="TR_SCREENPARTY_ERROR_MICS">Es sind keine Mikros konfiguriert!</string> <string name="TR_SCREENPARTY_ERROR_MICS">Es sind keine Mikros konfiguriert!</string>
<string name="TR_SCREENPARTY_ERROR_MIC_NUM">Für diesen Party-Modus werden %d Mikros benötigt!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Zielgruppe</string> <string name="TR_SCREENPARTY_TARGETAUDIENCE">Zielgruppe</string>
<string name="TR_SCREENPARTY_NOTEAMS">Keine Teams</string> <string name="TR_SCREENPARTY_NOTEAMS">Keine Teams</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Anzahl der Teams</string> <string name="TR_SCREENPARTY_NUMTEAMS">Anzahl der Teams</string>
@@ -92,7 +92,7 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
if (roundIndex == 0 || numPlayed[i] < max) 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); result.Add(i);
else if (numPlayed[i] < max) else if (numPlayed[i] < max)
other.Add(i); other.Add(i);
@@ -101,7 +101,7 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
if (roundIndex > 0) if (roundIndex > 0)
{ {
if (!Rounds[roundIndex - 1].IsAvailable(i)) if (!Rounds[roundIndex - 1].Contains(i))
other.Add(i); other.Add(i);
else else
last.Add(i); last.Add(i);
@@ -165,11 +165,11 @@ namespace VocaluxeLib.PartyModes.Challenge
//filter against PlayerNrDemand //filter against PlayerNrDemand
List<CCombination> combsFiltered = new List<CCombination>(); List<CCombination> combsFiltered = new List<CCombination>();
if (playerNrDemand != null) if (playerNrDemand != null)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); combsFiltered.AddRange(_Combs.Where(t => t.ContainsAll(playerNrDemand)));
//1st fallback //1st fallback
if (playerNrDemand != null && combsFiltered.Count == 0) if (playerNrDemand != null && combsFiltered.Count == 0)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); combsFiltered.AddRange(_Combs.Where(t => t.ContainsAny(playerNrDemand)));
//2nd fallback //2nd fallback
if (combsFiltered.Count == 0) if (combsFiltered.Count == 0)
@@ -191,7 +191,7 @@ namespace VocaluxeLib.PartyModes.Challenge
int num = (int)Math.Pow(2, _NumPlayer); 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(); CCombination c = new CCombination();
@@ -216,19 +216,19 @@ namespace VocaluxeLib.PartyModes.Challenge
Player = new List<int>(); Player = new List<int>();
} }
public bool IsAvailable(int playerIndex) public bool Contains(int playerIndex)
{ {
return Player.Any(p => p == 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 public sealed class CPartyModeChallenge : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private const int _MaxPlayer = 12; public override int MinMics
private const int _MinPlayer = 1; {
private const int _MaxTeams = 0; get { return 1; }
private const int _MinTeams = 0; }
private const int _MaxNumRounds = 100; 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 private enum EStage
{ {
@@ -108,7 +135,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeChallenge(int id, string folder) : base(id, folder) public CPartyModeChallenge(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -125,6 +152,8 @@ namespace VocaluxeLib.PartyModes.Challenge
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -283,31 +312,6 @@ namespace VocaluxeLib.PartyModes.Challenge
_ScreenSongOptions.Sorting.SearchActive = visible; _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) public override void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace VocaluxeLib.PartyModes.Challenge namespace VocaluxeLib.PartyModes.Challenge
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private const string _ButtonNext = "ButtonNext"; private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack"; private const string _ButtonBack = "ButtonBack";
private int _MaxNumMics = 2; private const int _MaxNumRounds = 100;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1; private int _RoundSteps = 1;
public override void Init() public override void Init()
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
base.OnShow(); base.OnShow();
_MaxNumMics = CBase.Config.GetMaxNumMics();
if (_MaxNumMics > 6)
_MaxNumMics = 6;
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
_RebuildSlides(); _RebuildSlides();
} }
@@ -125,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
_SelectSlides[_SelectSlideNumPlayers].Clear(); _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].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString(); _SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString();
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
int player = _PartyMode.GameData.NumPlayer; int player = _PartyMode.GameData.NumPlayer;
int mics = _PartyMode.GameData.NumPlayerAtOnce; int mics = _PartyMode.GameData.NumPlayerAtOnce;
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _UpdateMicsAtOnce() private void _UpdateMicsAtOnce()
{ {
int maxNum = _MaxNumMics; int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
maxNum = _PartyMode.GameData.NumPlayer;
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
_PartyMode.GameData.NumPlayerAtOnce = maxNum; _PartyMode.GameData.NumPlayerAtOnce = maxNum;
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_NextPlayerTexts = new List<CText>(); _NextPlayerTexts = new List<CText>();
_NextPlayerStatics = new List<CStatic>(); _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])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.Challenge
x += _Statics[_StaticNextPlayer].Rect.W + 15; 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; _NextPlayerStatics[i].Visible = false;
_NextPlayerTexts[i].Visible = false; _NextPlayerTexts[i].Visible = false;
@@ -72,13 +72,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public sealed class CPartyModeChallengeMedley : CPartyMode public sealed class CPartyModeChallengeMedley : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // 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; 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 private enum EStage
{ {
Config, Config,
@@ -114,7 +142,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeChallengeMedley(int id, string folder) : base(id, folder) public CPartyModeChallengeMedley(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -131,6 +159,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
@@ -290,31 +320,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ScreenSongOptions.Sorting.SearchActive = visible; _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) public override void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace VocaluxeLib.PartyModes.ChallengeMedley namespace VocaluxeLib.PartyModes.ChallengeMedley
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private const string _ButtonNext = "ButtonNext"; private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack"; private const string _ButtonBack = "ButtonBack";
private int _MaxNumMics = 2; private const int _MaxNumRounds = 100;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1; private int _RoundSteps = 1;
public override void Init() public override void Init()
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
base.OnShow(); base.OnShow();
_MaxNumMics = CBase.Config.GetMaxNumMics();
if (_MaxNumMics > 6)
_MaxNumMics = 6;
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
_RebuildSlides(); _RebuildSlides();
} }
@@ -125,9 +119,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
_SelectSlides[_SelectSlideNumPlayers].Clear(); _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].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.MinPlayers;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
int player = _PartyMode.GameData.NumPlayer; int player = _PartyMode.GameData.NumPlayer;
int mics = _PartyMode.GameData.NumPlayerAtOnce; int mics = _PartyMode.GameData.NumPlayerAtOnce;
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _UpdateMicsAtOnce() private void _UpdateMicsAtOnce()
{ {
int maxNum = _MaxNumMics; int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
maxNum = _PartyMode.GameData.NumPlayer;
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
_PartyMode.GameData.NumPlayerAtOnce = maxNum; _PartyMode.GameData.NumPlayerAtOnce = maxNum;
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_NextPlayerTexts = new List<CText>(); _NextPlayerTexts = new List<CText>();
_NextPlayerStatics = new List<CStatic>(); _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])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
x += _Statics[_StaticNextPlayer].Rect.W + 15; 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; _NextPlayerStatics[i].Visible = false;
_NextPlayerTexts[i].Visible = false; _NextPlayerTexts[i].Visible = false;
@@ -36,15 +36,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
// ReSharper restore InconsistentNaming // 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 class CRound
{ {
public int SongID; public int SongID;
@@ -71,13 +62,39 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public sealed class CPartyModeTicTacToe : CPartyMode public sealed class CPartyModeTicTacToe : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private const int _MaxPlayer = 20; public override int MinMics
private const int _MinPlayer = 2; {
private const int _MaxTeams = 2; get { return 2; }
private const int _MinTeams = 2; }
private const int _MinPlayerPerTeam = 1; public override int MaxMics
private const int _MaxPlayerPerTeam = 10; {
private const int _NumFields = 9; 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 private enum EStage
{ {
@@ -99,10 +116,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public List<int> PlayerTeam2; public List<int> PlayerTeam2;
public ESongSource SongSource; public ESongSource SongSource;
public int CategoryID; public int CategoryIndex;
public int PlaylistID; public int PlaylistID;
public EPartyGameMode GameMode; public EGameMode GameMode;
public List<CRound> Rounds; public List<CRound> Rounds;
public List<int> Songs; public List<int> Songs;
@@ -117,7 +134,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeTicTacToe(int id, string folder) : base(id, folder) public CPartyModeTicTacToe(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -142,8 +159,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
FieldNr = 0, FieldNr = 0,
SongSource = ESongSource.TR_ALLSONGS, SongSource = ESongSource.TR_ALLSONGS,
PlaylistID = 0, PlaylistID = 0,
CategoryID = 0, CategoryIndex = 0,
GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL, GameMode = EGameMode.TR_GAMEMODE_NORMAL,
Rounds = new List<CRound>(), Rounds = new List<CRound>(),
Songs = new List<int>(), Songs = new List<int>(),
NumJokerRandom = new int[2], NumJokerRandom = new int[2],
@@ -153,6 +170,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -277,41 +296,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
throw new ArgumentException("Not required!"); 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 JokerUsed(int teamNr) {}
public override void SongSelected(int songID) public override void SongSelected(int songID)
@@ -447,46 +431,26 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (GameData.Songs.Count > 0) if (GameData.Songs.Count > 0)
return; 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) switch (GameData.SongSource)
{ {
case ESongSource.TR_PLAYLIST: case ESongSource.TR_PLAYLIST:
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
{ {
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; 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); GameData.Songs.Add(id);
} }
break; break;
case ESongSource.TR_ALLSONGS: case ESongSource.TR_ALLSONGS:
ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs(); 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; break;
case ESongSource.TR_CATEGORY: case ESongSource.TR_CATEGORY:
CBase.Songs.SetCategory(GameData.CategoryID); CBase.Songs.SetCategory(GameData.CategoryIndex);
avSongs = CBase.Songs.GetVisibleSongs(); 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); CBase.Songs.SetCategory(-1);
break; break;
@@ -534,23 +498,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (isDuet) if (isDuet)
players[1].VoiceNr = 1; players[1].VoiceNr = 1;
var gm = EGameMode.TR_GAMEMODE_NORMAL; CBase.Game.AddSong(round.SongID, GameData.GameMode);
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);
} }
private void _SetNumJokers() private void _SetNumJokers()
@@ -16,6 +16,7 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
@@ -113,8 +114,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
base.OnShow(); base.OnShow();
if (CBase.Config.GetMaxNumMics() >= 2) Debug.Assert(CBase.Config.GetMaxNumMics() >= 2);
_ConfigOk = true;
_FillSlides(); _FillSlides();
_UpdateSlides(); _UpdateSlides();
@@ -129,15 +129,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FillSlides() private void _FillSlides()
{ {
_SelectSlides[_SelectSlideNumFields].Clear(); _SelectSlides[_SelectSlideNumFields].Clear();
_SelectSlides[_SelectSlideNumFields].AddValue("9"); _SelectSlides[_SelectSlideNumFields].AddValue(9);
_SelectSlides[_SelectSlideNumFields].AddValue("16"); _SelectSlides[_SelectSlideNumFields].AddValue(16);
_SelectSlides[_SelectSlideNumFields].AddValue("25"); _SelectSlides[_SelectSlideNumFields].AddValue(25);
if (_PartyMode.GameData.NumFields == 9)
_SelectSlides[_SelectSlideNumFields].Selection = 0; _SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;
else if (_PartyMode.GameData.NumFields == 16)
_SelectSlides[_SelectSlideNumFields].Selection = 1;
else if (_PartyMode.GameData.NumFields == 25)
_SelectSlides[_SelectSlideNumFields].Selection = 2;
_SelectSlides[_SelectSlideSongSource].Clear(); _SelectSlides[_SelectSlideSongSource].Clear();
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource); _SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource);
@@ -152,52 +148,32 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID; _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST; _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(); _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].AddValue(value);
} }
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryID; _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY; _SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
_SelectSlides[_SelectSlideGameMode].Visible = true; _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() private void _UpdateSlides()
{ {
if (_SelectSlides[_SelectSlideNumFields].Selection == 0) _PartyMode.GameData.NumFields = _SelectSlides[_SelectSlideNumFields].SelectedTag;
_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.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection; _PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
_PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection; _PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
_PartyMode.GameData.CategoryID = _SelectSlides[_SelectSlideCategory].Selection; _PartyMode.GameData.CategoryIndex = _SelectSlides[_SelectSlideCategory].Selection;
_PartyMode.GameData.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection; _PartyMode.GameData.GameMode = (EGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
var gm = EGameMode.TR_GAMEMODE_NORMAL; EGameMode gm = _PartyMode.GameData.GameMode;
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;
}
if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST) if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST)
{ {
@@ -224,11 +200,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
if (CBase.Songs.GetNumCategories() == 0) if (CBase.Songs.GetNumCategories() == 0)
_ConfigOk = false; _ConfigOk = false;
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryID) <= 0) else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryIndex) <= 0)
_ConfigOk = false; _ConfigOk = false;
else else
{ {
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryID); CBase.Songs.SetCategory(_PartyMode.GameData.CategoryIndex);
_ConfigOk = false; _ConfigOk = false;
foreach (CSong song in CBase.Songs.GetVisibleSongs()) foreach (CSong song in CBase.Songs.GetVisibleSongs())
{ {
+53 -43
View File
@@ -18,6 +18,7 @@
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Base.ThemeSystem;
@@ -32,40 +33,52 @@ namespace Vocaluxe.Base
{ {
private const int _PartyModeSystemVersion = 1; private const int _PartyModeSystemVersion = 1;
private static Dictionary<int, SPartyMode> _PartyModes; private static readonly Dictionary<int, SPartyMode> _PartyModes = new Dictionary<int, SPartyMode>();
private static int _NextID; private static int _NextID;
private static IPartyMode _CurrentPartyMode;
private static int _NormalGameModeID;
private static SPartyMode _CurrentPartyMode;
#region public stuff #region public stuff
public static void Init() public static bool Init()
{ {
_PartyModes = new Dictionary<int, SPartyMode>(); if (_PartyModes.Count > 0)
_NextID = 0; return false; //Already initialized
SPartyMode pm = new SPartyMode
//add dummy normal game mode and set it as default {
var pm = new SPartyMode {ScreenFiles = new List<string>(), PartyMode = new CPartyModeNone(_NextID++, null)}; Info = new SPartyModeInfos {Author = "Vocaluxe Team", Description = "Normal game", Name = "Normal", TargetAudience = "Just a normal game for everyone"},
_NormalGameModeID = pm.PartyMode.ID; PartyMode = new CPartyModeNormal(-1),
_PartyModes.Add(pm.PartyMode.ID, pm); PartyModeSystemVersion = _PartyModeSystemVersion,
_CurrentPartyMode = pm; ScreenFiles = new List<string>()
};
_PartyModes.Add(-1, pm);
_CurrentPartyMode = pm.PartyMode;
Debug.Assert(_CurrentPartyMode != null && _CurrentPartyMode.ID == -1);
//load other party modes //load other party modes
_LoadPartyModes(); _LoadPartyModes();
return _CurrentPartyMode.Init();
} }
public static int CurrentPartyModeID public static int CurrentPartyModeID
{ {
get get { return _CurrentPartyMode.ID; }
set
{ {
if (_CurrentPartyMode.PartyMode.ID != _NormalGameModeID) if (_CurrentPartyMode.ID == value)
return _CurrentPartyMode.PartyMode.ID; return;
if (value != -1 && !_PartyModes.ContainsKey(value))
return -1; throw new ArgumentException("Partymode with ID=" + value + " does not exist!");
IPartyMode pm = _PartyModes[value].PartyMode;
if (pm.Init())
_CurrentPartyMode = pm;
else
{
CLog.LogError("Could not init PartyMode \"" + _PartyModes[value].Info.Name + "\"! Removing...", true);
_PartyModes.Remove(value);
}
} }
} }
public static int NumModes public static int Count
{ {
get { return _PartyModes.Count; } get { return _PartyModes.Count; }
} }
@@ -90,85 +103,81 @@ namespace Vocaluxe.Base
public static List<SPartyModeInfos> GetPartyModeInfos() public static List<SPartyModeInfos> GetPartyModeInfos()
{ {
var infos = new List<SPartyModeInfos>(); List<SPartyModeInfos> list = new List<SPartyModeInfos>();
foreach (SPartyMode pm in _PartyModes.Values)
foreach (KeyValuePair<int, SPartyMode> kvp in _PartyModes)
{ {
if (kvp.Key != _NormalGameModeID) if (pm.PartyMode.ID >= 0)
infos.Add(kvp.Value.Info); list.Add(pm.Info);
} }
return infos; return list;
} }
public static void SetNormalGameMode() public static void SetNormalGameMode()
{ {
CSongs.ResetPartySongSung(); CSongs.ResetPartySongSung();
SetPartyMode(_NormalGameModeID); CurrentPartyModeID = -1;
} }
public static void SetPartyMode(int partyModeID) public static void SetPartyMode(int partyModeID)
{ {
if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode)) CurrentPartyModeID = partyModeID;
CLog.LogError("CParty: Can't find party mode ID: " + partyModeID);
_CurrentPartyMode.PartyMode.Init();
} }
#endregion public stuff #endregion public stuff
#region Interface #region Interface
public static void UpdateGame() public static void UpdateGame()
{ {
_CurrentPartyMode.PartyMode.UpdateGame(); _CurrentPartyMode.UpdateGame();
} }
public static IMenu GetStartScreen() public static IMenu GetStartScreen()
{ {
return _CurrentPartyMode.PartyMode.GetStartScreen(); return _CurrentPartyMode.GetStartScreen();
} }
public static SScreenSongOptions GetSongSelectionOptions() public static SScreenSongOptions GetSongSelectionOptions()
{ {
return _CurrentPartyMode.PartyMode.GetScreenSongOptions(); return _CurrentPartyMode.GetScreenSongOptions();
} }
public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
{ {
_CurrentPartyMode.PartyMode.OnSongChange(songIndex, ref screenSongOptions); _CurrentPartyMode.OnSongChange(songIndex, ref screenSongOptions);
} }
public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
{ {
_CurrentPartyMode.PartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions); _CurrentPartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions);
} }
public static void SetSearchString(string searchString, bool visible) public static void SetSearchString(string searchString, bool visible)
{ {
_CurrentPartyMode.PartyMode.SetSearchString(searchString, visible); _CurrentPartyMode.SetSearchString(searchString, visible);
} }
public static void JokerUsed(int teamNr) public static void JokerUsed(int teamNr)
{ {
_CurrentPartyMode.PartyMode.JokerUsed(teamNr); _CurrentPartyMode.JokerUsed(teamNr);
} }
public static void SongSelected(int songID) public static void SongSelected(int songID)
{ {
_CurrentPartyMode.PartyMode.SongSelected(songID); _CurrentPartyMode.SongSelected(songID);
} }
public static void FinishedSinging() public static void FinishedSinging()
{ {
_CurrentPartyMode.PartyMode.FinishedSinging(); _CurrentPartyMode.FinishedSinging();
} }
public static void LeavingScore() public static void LeavingScore()
{ {
_CurrentPartyMode.PartyMode.LeavingScore(); _CurrentPartyMode.LeavingScore();
} }
public static void LeavingHighscore() public static void LeavingHighscore()
{ {
_CurrentPartyMode.PartyMode.LeavingHighscore(); _CurrentPartyMode.LeavingHighscore();
} }
#endregion Interface #endregion Interface
@@ -216,7 +225,7 @@ namespace Vocaluxe.Base
return false; return false;
object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false, object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false,
BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++, pathToPm}, null, null); BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++}, null, null);
if (instance == null) if (instance == null)
{ {
CLog.LogError("Error creating Instance of PartyMode file: " + filePath); CLog.LogError("Error creating Instance of PartyMode file: " + filePath);
@@ -258,7 +267,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
pm.PartyMode.LoadTheme(); pm.PartyMode.LoadTheme();
pm.Info.LoadData(pm.PartyMode); pm.Info.ExtInfo = pm.PartyMode;
return true; return true;
} }
@@ -269,6 +278,7 @@ namespace Vocaluxe.Base
var compilerParams = new CompilerParameters(); var compilerParams = new CompilerParameters();
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll"); compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");
compilerParams.ReferencedAssemblies.Add("System.Core.dll"); compilerParams.ReferencedAssemblies.Add("System.Core.dll");
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll"); compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
+2 -11
View File
@@ -17,6 +17,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization; using System.Xml.Serialization;
using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Fonts;
using VocaluxeLib; using VocaluxeLib;
@@ -121,17 +122,7 @@ namespace Vocaluxe.Base
[XmlAltName("PartyModeVersionMajor")] public int VersionMajor; [XmlAltName("PartyModeVersionMajor")] public int VersionMajor;
[XmlAltName("PartyModeVersionMinor")] public int VersionMinor; [XmlAltName("PartyModeVersionMinor")] public int VersionMinor;
public string TargetAudience; public string TargetAudience;
[XmlIgnore] public int MaxPlayers, MinPlayers, MaxTeams, MinTeams; [XmlIgnore] public IPartyModeInfo ExtInfo;
[XmlIgnore] public int PartyModeID;
public void LoadData(IPartyMode pm)
{
MaxPlayers = pm.GetMaxPlayer();
MinPlayers = pm.GetMinPlayer();
MaxTeams = pm.GetMaxTeams();
MinTeams = pm.GetMinTeams();
PartyModeID = pm.ID;
}
} }
struct SPartyMode struct SPartyMode
+2 -1
View File
@@ -238,7 +238,8 @@ namespace Vocaluxe
// Init Party Modes; // Init Party Modes;
CLog.StartBenchmark("Init Party Modes"); CLog.StartBenchmark("Init Party Modes");
CParty.Init(); if (!CParty.Init())
throw new CLoadingException("Party Modes");
CLog.StopBenchmark("Init Party Modes"); CLog.StopBenchmark("Init Party Modes");
Application.DoEvents(); Application.DoEvents();
+29 -22
View File
@@ -20,6 +20,7 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
@@ -115,7 +116,7 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideModes].Clear(); _SelectSlides[_SelectSlideModes].Clear();
foreach (SPartyModeInfos info in _PartyModeInfos) foreach (SPartyModeInfos info in _PartyModeInfos)
_SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); _SelectSlides[_SelectSlideModes].AddValue(info.Name, info.ExtInfo.ID);
_SelectSlides[_SelectSlideModes].Selection = 0; _SelectSlides[_SelectSlideModes].Selection = 0;
_UpdateSelection(); _UpdateSelection();
@@ -134,42 +135,48 @@ namespace Vocaluxe.Screens
int index = _SelectSlides[_SelectSlideModes].Selection; int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; {
index = 0;
_SelectSlides[_SelectSlideModes].Selection = 0;
}
//Description //Description
_Texts[_TextDescription].Text = _PartyModeInfos[index].Description; SPartyModeInfos infos = _PartyModeInfos[index];
_Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; IPartyModeInfo extInfo = infos.ExtInfo;
_Texts[_TextDescription].Text = infos.Description;
_Texts[_TextDescription].TranslationID = extInfo.ID;
//TargetAudience //TargetAudience
_Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextTargetAudience].TranslationID = extInfo.ID;
_Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; _Texts[_TextTargetAudience].Text = infos.TargetAudience;
//NumTeams //NumTeams
if (_PartyModeInfos[index].MaxTeams == 0) if (extInfo.MaxTeams == 1)
_Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; _Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS";
else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams) else if (extInfo.MaxTeams == extInfo.MinTeams)
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumTeams].Text = extInfo.MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) else
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; _Texts[_TextNumTeams].Text = extInfo.MinTeams + " - " + extInfo.MaxTeams;
//NumPlayers //NumPlayers
if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) if (extInfo.MaxPlayers == extInfo.MinPlayers)
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumPlayers].Text = extInfo.MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) else
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; _Texts[_TextNumPlayers].Text = extInfo.MinPlayers + " - " + extInfo.MaxPlayers;
//Author //Author
_Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; _Texts[_TextAuthor].Text = infos.Author;
_Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextAuthor].TranslationID = extInfo.ID;
//Version //Version
_Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; _Texts[_TextVersion].Text = infos.VersionMajor + "." + infos.VersionMinor;
_Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextVersion].TranslationID = extInfo.ID;
if (CConfig.GetMaxNumMics() == 0) if (CConfig.GetMaxNumMics() < extInfo.MinMics)
{ {
_Buttons[_ButtonStart].Visible = false; _Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR_MICS"; _Texts[_TextError].Text = CConfig.GetMaxNumMics() == 0
? "TR_SCREENPARTY_ERROR_MICS" : CLanguage.Translate("TR_SCREENPARTY_ERROR_MIC_NUM").Replace("%d", extInfo.MinMics.ToString());
_Texts[_TextError].Visible = true; _Texts[_TextError].Visible = true;
} }
else else
@@ -193,7 +200,7 @@ namespace Vocaluxe.Screens
return; return;
} }
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); CParty.SetPartyMode(_PartyModeInfos[index].ExtInfo.ID);
CGraphics.FadeTo(CParty.GetStartScreen()); CGraphics.FadeTo(CParty.GetStartScreen());
} }
} }
+8 -11
View File
@@ -187,26 +187,23 @@ namespace Vocaluxe.Screens
private static string _GetRating(double points) private static string _GetRating(double points)
{ {
string rating = String.Empty; string rating;
if (points >= 9800) if (points >= 9800)
{
//in case of the game names so:
rating = "TR_RATING_VOCAL_HERO"; rating = "TR_RATING_VOCAL_HERO";
} else if (points >= 8400)
else if (points < 9800 && points >= 8400)
rating = "TR_RATING_SUPERSTAR"; rating = "TR_RATING_SUPERSTAR";
else if (points < 8400 && points >= 7000) else if (points >= 7000)
rating = "TR_RATING_LEAD_SINGER"; rating = "TR_RATING_LEAD_SINGER";
else if (points < 7000 && points >= 5600) else if (points >= 5600)
rating = "TR_RATING_RISING_STAR"; rating = "TR_RATING_RISING_STAR";
else if (points < 5600 && points >= 4200) else if (points >= 4200)
rating = "TR_RATING_HOPEFUL"; rating = "TR_RATING_HOPEFUL";
else if (points < 4200 && points >= 2800) else if (points >= 2800)
rating = "TR_RATING_WANNABE"; rating = "TR_RATING_WANNABE";
else if (points < 2800 && points >= 1400) else if (points >= 1400)
rating = "TR_RATING_AMATEUR"; rating = "TR_RATING_AMATEUR";
else if (points < 1400) else
rating = "TR_RATING_TONE_DEAF"; rating = "TR_RATING_TONE_DEAF";
return rating; return rating;
+16 -16
View File
@@ -149,7 +149,7 @@ namespace VocaluxeLib.Menu
{ {
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
resetSelection = true; resetSelection = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
resetSelection = true; resetSelection = true;
} }
else if (!_SelectingFast) else if (!_SelectingFast)
@@ -346,9 +346,9 @@ namespace VocaluxeLib.Menu
if (numPressed > 0) if (numPressed > 0)
{ {
if (_ChangeTeamNumDynamic && numPressed < _PartyMode.GetMaxTeams() && numPressed > _SelectSlides[_SelectSlideTeams].NumValues) if (_ChangeTeamNumDynamic && numPressed < _PartyMode.MaxTeams && numPressed > _SelectSlides[_SelectSlideTeams].NumValues)
{ {
while (numPressed < _PartyMode.GetMaxTeams()) while (numPressed < _PartyMode.MaxTeams)
IncreaseTeamNum(); IncreaseTeamNum();
} }
if (numPressed <= _SelectSlides[_SelectSlideTeams].NumValues) if (numPressed <= _SelectSlides[_SelectSlideTeams].NumValues)
@@ -435,7 +435,7 @@ namespace VocaluxeLib.Menu
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
stopSelectingFast = true; stopSelectingFast = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
stopSelectingFast = true; stopSelectingFast = true;
} }
else else
@@ -507,7 +507,7 @@ namespace VocaluxeLib.Menu
{ {
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
stopSelectingFast = true; stopSelectingFast = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
stopSelectingFast = true; stopSelectingFast = true;
} }
else if (mouseEvent.MB) else if (mouseEvent.MB)
@@ -573,7 +573,7 @@ namespace VocaluxeLib.Menu
if (!_AllowChangeTeamNum) if (!_AllowChangeTeamNum)
return; return;
if (_NumTeams + 1 <= _PartyMode.GetMaxTeams()) if (_NumTeams + 1 <= _PartyMode.MaxTeams)
{ {
_NumTeams++; _NumTeams++;
int[] numPlayerTeams = _NumPlayerTeams; int[] numPlayerTeams = _NumPlayerTeams;
@@ -602,7 +602,7 @@ namespace VocaluxeLib.Menu
if (!_AllowChangeTeamNum) if (!_AllowChangeTeamNum)
return; return;
if (_NumTeams - 1 >= _PartyMode.GetMinTeams()) if (_NumTeams - 1 >= _PartyMode.MinTeams)
_NumTeams--; _NumTeams--;
_UpdateButtonState(); _UpdateButtonState();
} }
@@ -613,7 +613,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_NumPlayerTeams.Length > team) if (_NumPlayerTeams.Length > team)
{ {
if (_NumPlayerTeams[team] + 1 <= _PartyMode.GetMaxPlayerPerTeam()) if (_NumPlayerTeams[team] + 1 <= _PartyMode.MaxPlayersPerTeam)
_NumPlayerTeams[team]++; _NumPlayerTeams[team]++;
_UpdatePlayerSlide(); _UpdatePlayerSlide();
} }
@@ -626,7 +626,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_NumPlayerTeams.Length > team) if (_NumPlayerTeams.Length > team)
{ {
if (_NumPlayerTeams[team] - 1 >= _PartyMode.GetMinPlayerPerTeam()) if (_NumPlayerTeams[team] - 1 >= _PartyMode.MinPlayersPerTeam)
_NumPlayerTeams[team]--; _NumPlayerTeams[team]--;
if (_TeamList[team].Count > _NumPlayerTeams[team]) if (_TeamList[team].Count > _NumPlayerTeams[team])
_RemovePlayerByIndex(team, _NumPlayerTeams[team] - 1); _RemovePlayerByIndex(team, _NumPlayerTeams[team] - 1);
@@ -699,20 +699,20 @@ namespace VocaluxeLib.Menu
private void _UpdateButtonVisibility() private void _UpdateButtonVisibility()
{ {
_Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.GetMinTeams() != _PartyMode.GetMaxTeams(); _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams;
_Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.GetMinTeams() != _PartyMode.GetMaxTeams(); _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams;
_Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum;
_Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum;
} }
private void _UpdateButtonState() private void _UpdateButtonState()
{ {
_Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.GetMaxTeams(); _Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.MaxTeams;
_Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.GetMinTeams(); _Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.MinTeams;
if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam) if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam)
{ {
_Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam(); _Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.MaxPlayersPerTeam;
_Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam(); _Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.MinPlayersPerTeam;
} }
else else
{ {
@@ -725,7 +725,7 @@ namespace VocaluxeLib.Menu
{ {
if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic) if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic)
return; return;
if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam()) if (_NumPlayerTeams[team] == _PartyMode.MaxPlayersPerTeam)
return; return;
_NameSelections[_NameSelection].UseProfile(profileID); _NameSelections[_NameSelection].UseProfile(profileID);
+20
View File
@@ -390,6 +390,15 @@ namespace VocaluxeLib.Menu
_NeedsRevalidate = true; _NeedsRevalidate = true;
} }
/// <summary>
/// Adds an integer to the slide setting its tag to the value and its text to the text representation of the tag
/// </summary>
/// <param name="tag">Value to add</param>
public void AddValue(int tag)
{
AddValue(tag.ToString(), null, tag);
}
/// <summary> /// <summary>
/// Adds an entry to the slide. /// Adds an entry to the slide.
/// </summary> /// </summary>
@@ -434,6 +443,17 @@ namespace VocaluxeLib.Menu
AddValue(values[i], textures[i]); AddValue(values[i], textures[i]);
} }
public void RemoveValue(string text)
{
int idx = _Values.FindIndex(val => val.Text == text);
if (idx < 0)
return;
_Values.RemoveAt(idx);
if (Selection >= idx)
Selection--;
_Invalidate();
}
public void SetValues<T>(int selection) public void SetValues<T>(int selection)
{ {
AddValues(Enum.GetNames(typeof(T))); AddValues(Enum.GetNames(typeof(T)));
+31 -61
View File
@@ -16,21 +16,20 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
public abstract class CPartyMode : IPartyMode public abstract class CPartyMode : IPartyMode
{ {
private readonly string _Folder;
private readonly int _ID; private readonly int _ID;
protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()}; protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};
protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>(); protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>();
protected CPartyMode(int id, string folder) protected CPartyMode(int id)
{ {
_ID = id; _ID = id;
_Folder = folder;
} }
#region Implementation #region Implementation
@@ -39,7 +38,15 @@ namespace VocaluxeLib.PartyModes
get { return _ID; } get { return _ID; }
} }
public abstract bool Init(); public int NumPlayers { get; set; }
public int NumTeams { get; set; }
public virtual bool Init()
{
Debug.Assert(MinPlayers > 0 && MinPlayers <= MaxPlayers);
Debug.Assert(MinTeams > 0 && MinTeams <= MaxTeams);
return true;
}
public void LoadTheme() public void LoadTheme()
{ {
@@ -75,61 +82,6 @@ namespace VocaluxeLib.PartyModes
entry.Value.SaveTheme(); entry.Value.SaveTheme();
} }
public virtual void UpdateGame() {}
public abstract IMenu GetStartScreen();
public virtual SScreenSongOptions GetScreenSongOptions()
{
return new SScreenSongOptions();
}
public virtual void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {}
public virtual void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {}
public virtual int GetMaxPlayer()
{
return 6;
}
public virtual int GetMinPlayer()
{
return 1;
}
public virtual int GetMaxTeams()
{
return 0;
}
public virtual int GetMinTeams()
{
return 0;
}
public virtual int GetMinPlayerPerTeam()
{
return GetMinPlayer();
}
public virtual int GetMaxPlayerPerTeam()
{
return GetMaxPlayer();
}
public virtual int GetMaxNumRounds()
{
return 1;
}
public string GetFolder()
{
return _Folder;
}
public virtual void SetSearchString(string searchString, bool visible) {}
public virtual void JokerUsed(int teamNr) public virtual void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -142,8 +94,6 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Selection.NumJokers[teamNr]--; _ScreenSongOptions.Selection.NumJokers[teamNr]--;
} }
public abstract void SongSelected(int songID);
public virtual void FinishedSinging() public virtual void FinishedSinging()
{ {
CBase.Graphics.FadeTo(EScreen.Score); CBase.Graphics.FadeTo(EScreen.Score);
@@ -159,5 +109,25 @@ namespace VocaluxeLib.PartyModes
CBase.Graphics.FadeTo(EScreen.Song); CBase.Graphics.FadeTo(EScreen.Song);
} }
#endregion Implementation #endregion Implementation
#region Abstract members
public abstract int MinMics { get; }
public abstract int MaxMics { get; }
public abstract int MinPlayers { get; }
public abstract int MaxPlayers { get; }
public abstract int MinTeams { get; }
public abstract int MaxTeams { get; }
public abstract int MinPlayersPerTeam { get; }
public abstract int MaxPlayersPerTeam { get; }
public abstract void UpdateGame();
public abstract IMenu GetStartScreen();
public abstract SScreenSongOptions GetScreenSongOptions();
public abstract void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
public abstract void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions);
public abstract void SetSearchString(string searchString, bool visible);
public abstract void SongSelected(int songID);
#endregion Abstract members
} }
} }
@@ -20,10 +20,42 @@ using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
public class CPartyModeNone : CPartyMode public class CPartyModeNormal : CPartyMode
{ {
//just a dummy for normal game mode public override int MinMics
public CPartyModeNone(int id, string folder) : base(id, folder) {
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 CBase.Settings.GetMaxNumPlayer(); }
}
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; }
}
public CPartyModeNormal(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = false; _ScreenSongOptions.Selection.PartyMode = false;
@@ -42,6 +74,8 @@ namespace VocaluxeLib.PartyModes
return true; return true;
} }
public override void UpdateGame() {}
public override IMenu GetStartScreen() public override IMenu GetStartScreen()
{ {
return CBase.Graphics.GetScreen(EScreen.Names); return CBase.Graphics.GetScreen(EScreen.Names);
@@ -60,6 +94,10 @@ namespace VocaluxeLib.PartyModes
return _ScreenSongOptions; return _ScreenSongOptions;
} }
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {}
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {}
public override void SetSearchString(string searchString, bool visible) public override void SetSearchString(string searchString, bool visible)
{ {
_ScreenSongOptions.Sorting.SearchString = searchString; _ScreenSongOptions.Sorting.SearchString = searchString;
+16 -9
View File
@@ -79,9 +79,24 @@ namespace VocaluxeLib.PartyModes
} }
#endregion Structs #endregion Structs
public interface IPartyMode public interface IPartyModeInfo
{ {
int ID { get; } int ID { get; }
int MinMics { get; }
int MaxMics { get; }
int MinPlayers { get; }
int MaxPlayers { get; }
int MinTeams { get; }
int MaxTeams { get; }
int MinPlayersPerTeam { get; }
int MaxPlayersPerTeam { get; }
}
public interface IPartyMode : IPartyModeInfo
{
int NumPlayers { get; set; }
int NumTeams { get; set; }
bool Init(); bool Init();
void LoadTheme(); void LoadTheme();
@@ -99,14 +114,6 @@ namespace VocaluxeLib.PartyModes
void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions); void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions); void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions);
int GetMaxPlayer();
int GetMinPlayer();
int GetMaxTeams();
int GetMinTeams();
int GetMinPlayerPerTeam();
int GetMaxPlayerPerTeam();
int GetMaxNumRounds();
void SetSearchString(string searchString, bool visible); void SetSearchString(string searchString, bool visible);
void JokerUsed(int teamNr); void JokerUsed(int teamNr);
+1 -1
View File
@@ -139,7 +139,7 @@
<Compile Include="Songs\CSongLoader.cs" /> <Compile Include="Songs\CSongLoader.cs" />
<Compile Include="Structs.cs" /> <Compile Include="Structs.cs" />
<Compile Include="PartyModes\CPartyMode.cs" /> <Compile Include="PartyModes\CPartyMode.cs" />
<Compile Include="PartyModes\CPartyModeNone.cs" /> <Compile Include="PartyModes\CPartyModeNormal.cs" />
<Compile Include="PartyModes\IPartyMode.cs" /> <Compile Include="PartyModes\IPartyMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\CWavFile.cs" /> <Compile Include="Utils\CWavFile.cs" />