finished challenge config screen

This commit is contained in:
Alexander Eckart committed 2012-12-17 17:44:51 +01:00
1 parent e1ee9504b7
commit cae4e441e1
9 files changed
+211 -110

No files matched your search

@@ -56,12 +56,13 @@ namespace Vocaluxe.PartyModes
#endregion FromScreen #endregion FromScreen
#endregion Communication #endregion Communication
public class PartyModeChallenge : CPartyMode public sealed class PartyModeChallenge : CPartyMode
{ {
private const int MaxPlayer = 10; private const int MaxPlayer = 10;
private const int MinPlayer = 1; private const int MinPlayer = 1;
private const int MaxTeams = 0; private const int MaxTeams = 0;
private const int MinTeams = 0; private const int MinTeams = 0;
private const int MaxNumRounds = 100;
enum EStage enum EStage
{ {
@@ -246,5 +247,9 @@ namespace Vocaluxe.PartyModes
return MinTeams; return MinTeams;
} }
public override int GetMaxNumRounds()
{
return MaxNumRounds;
}
} }
} }
@@ -18,8 +18,9 @@ namespace Vocaluxe.PartyModes
const string ButtonNext = "ButtonNext"; const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack"; const string ButtonBack = "ButtonBack";
private int MaxNumMics = 2; private int _MaxNumMics = 2;
private int MaxNumRounds = 100; private int _MaxNumRounds = 100;
private int _RoundSteps = 1;
DataFromScreen Data; DataFromScreen Data;
@@ -131,34 +132,11 @@ namespace Vocaluxe.PartyModes
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - 1;
_MaxNumMics = _Base.Config.GetMaxNumMics();
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
//TODO: Max number of mics should be number of mics available RebuildSlides();
int _MaxNumMics = MaxNumMics;
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
if (Data.ScreenConfig.NumPlayer < MaxNumMics)
_MaxNumMics = Data.ScreenConfig.NumPlayer;
for (int i = 1; i <= _MaxNumMics; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - 1;
//TODO: Max number ofs round should depend on number of players and mics
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
for (int i = 1; i <= MaxNumRounds; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds - 1;
UpdateSlides();
} }
public override bool UpdateGame() public override bool UpdateGame()
@@ -177,34 +155,90 @@ namespace Vocaluxe.PartyModes
base.OnClose(); base.OnClose();
} }
private void RebuildSlides()
{
// build num player slide (min player ... max player);
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
UpdateMicsAtOnce();
SetRoundSteps();
UpdateSlideRounds();
}
private void UpdateSlides() private void UpdateSlides()
{ {
//Update slides when one value was changed int player = Data.ScreenConfig.NumPlayer;
if (Data.ScreenConfig.NumPlayer != (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer())) int mics = Data.ScreenConfig.NumPlayerAtOnce;
Data.ScreenConfig.NumPlayer = SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1) * _RoundSteps;
UpdateMicsAtOnce();
SetRoundSteps();
if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce)
{ {
if (Data.ScreenConfig.NumPlayerAtOnce != (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer())) int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{ {
int OldValueNumPlayer = Data.ScreenConfig.NumPlayer; num -= _RoundSteps;
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
int _MaxNumMics = MaxNumMics;
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
if (Data.ScreenConfig.NumPlayer < MaxNumMics)
_MaxNumMics = Data.ScreenConfig.NumPlayer;
for (int i = 1; i <= _MaxNumMics; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
//Set to old selection
if (SelectSlides[htSelectSlides(SelectSlideNumMics)].NumValues >= Data.ScreenConfig.NumPlayerAtOnce)
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - 1;
//Update selection, if old selection = max player num
if (OldValueNumPlayer == Data.ScreenConfig.NumPlayerAtOnce)
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = SelectSlides[htSelectSlides(SelectSlideNumMics)].NumValues - 1;
} }
Data.ScreenConfig.NumRounds = num;
} }
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + 1; UpdateSlideRounds();
Data.ScreenConfig.NumRounds = SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1; }
private void UpdateMicsAtOnce()
{
//Data.ScreenConfig.NumPlayerAtOnce
int MaxNum = _MaxNumMics;
if (Data.ScreenConfig.NumPlayer < _MaxNumMics)
MaxNum = Data.ScreenConfig.NumPlayer;
if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum)
Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
// build mics at once slide
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
for (int i = 1; i <= MaxNum; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
}
private void UpdateSlideRounds()
{
// build num rounds slide
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
}
private void SetRoundSteps()
{
if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer)
{
_RoundSteps = 1;
return;
}
int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce;
int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce;
if (mod == 0)
_RoundSteps = res;
else
_RoundSteps = Data.ScreenConfig.NumPlayer;
} }
private void Back() private void Back()
@@ -214,10 +248,6 @@ namespace Vocaluxe.PartyModes
private void Next() private void Next()
{ {
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + 1;
Data.ScreenConfig.NumRounds = SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1;
_PartyMode.DataFromScreen(_ThemeName, Data); _PartyMode.DataFromScreen(_ThemeName, Data);
} }
} }
+6 -1
View File
@@ -56,12 +56,13 @@ namespace Vocaluxe.PartyModes
#endregion FromScreen #endregion FromScreen
#endregion Communication #endregion Communication
public class PartyModeChallenge : CPartyMode public sealed class PartyModeChallenge : CPartyMode
{ {
private const int MaxPlayer = 10; private const int MaxPlayer = 10;
private const int MinPlayer = 1; private const int MinPlayer = 1;
private const int MaxTeams = 0; private const int MaxTeams = 0;
private const int MinTeams = 0; private const int MinTeams = 0;
private const int MaxNumRounds = 100;
enum EStage enum EStage
{ {
@@ -246,5 +247,9 @@ namespace Vocaluxe.PartyModes
return MinTeams; return MinTeams;
} }
public override int GetMaxNumRounds()
{
return MaxNumRounds;
}
} }
} }
@@ -18,8 +18,9 @@ namespace Vocaluxe.PartyModes
const string ButtonNext = "ButtonNext"; const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack"; const string ButtonBack = "ButtonBack";
private int MaxNumMics = 2; private int _MaxNumMics = 2;
private int MaxNumRounds = 100; private int _MaxNumRounds = 100;
private int _RoundSteps = 1;
DataFromScreen Data; DataFromScreen Data;
@@ -131,34 +132,11 @@ namespace Vocaluxe.PartyModes
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - 1;
_MaxNumMics = _Base.Config.GetMaxNumMics();
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
//TODO: Max number of mics should be number of mics available RebuildSlides();
int _MaxNumMics = MaxNumMics;
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
if (Data.ScreenConfig.NumPlayer < MaxNumMics)
_MaxNumMics = Data.ScreenConfig.NumPlayer;
for (int i = 1; i <= _MaxNumMics; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - 1;
//TODO: Max number ofs round should depend on number of players and mics
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
for (int i = 1; i <= MaxNumRounds; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds - 1;
UpdateSlides();
} }
public override bool UpdateGame() public override bool UpdateGame()
@@ -177,34 +155,90 @@ namespace Vocaluxe.PartyModes
base.OnClose(); base.OnClose();
} }
private void RebuildSlides()
{
// build num player slide (min player ... max player);
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
UpdateMicsAtOnce();
SetRoundSteps();
UpdateSlideRounds();
}
private void UpdateSlides() private void UpdateSlides()
{ {
//Update slides when one value was changed int player = Data.ScreenConfig.NumPlayer;
if (Data.ScreenConfig.NumPlayer != (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer())) int mics = Data.ScreenConfig.NumPlayerAtOnce;
Data.ScreenConfig.NumPlayer = SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1) * _RoundSteps;
UpdateMicsAtOnce();
SetRoundSteps();
if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce)
{ {
if (Data.ScreenConfig.NumPlayerAtOnce != (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer())) int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{ {
int OldValueNumPlayer = Data.ScreenConfig.NumPlayer; num -= _RoundSteps;
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
int _MaxNumMics = MaxNumMics;
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
if (Data.ScreenConfig.NumPlayer < MaxNumMics)
_MaxNumMics = Data.ScreenConfig.NumPlayer;
for (int i = 1; i <= _MaxNumMics; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
//Set to old selection
if (SelectSlides[htSelectSlides(SelectSlideNumMics)].NumValues >= Data.ScreenConfig.NumPlayerAtOnce)
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - 1;
//Update selection, if old selection = max player num
if (OldValueNumPlayer == Data.ScreenConfig.NumPlayerAtOnce)
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = SelectSlides[htSelectSlides(SelectSlideNumMics)].NumValues - 1;
} }
Data.ScreenConfig.NumRounds = num;
} }
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + 1; UpdateSlideRounds();
Data.ScreenConfig.NumRounds = SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1; }
private void UpdateMicsAtOnce()
{
//Data.ScreenConfig.NumPlayerAtOnce
int MaxNum = _MaxNumMics;
if (Data.ScreenConfig.NumPlayer < _MaxNumMics)
MaxNum = Data.ScreenConfig.NumPlayer;
if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum)
Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
// build mics at once slide
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
for (int i = 1; i <= MaxNum; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
}
private void UpdateSlideRounds()
{
// build num rounds slide
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
}
private void SetRoundSteps()
{
if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer)
{
_RoundSteps = 1;
return;
}
int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce;
int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce;
if (mod == 0)
_RoundSteps = res;
else
_RoundSteps = Data.ScreenConfig.NumPlayer;
} }
private void Back() private void Back()
@@ -214,10 +248,6 @@ namespace Vocaluxe.PartyModes
private void Next() private void Next()
{ {
Data.ScreenConfig.NumPlayer = (SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer());
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + 1;
Data.ScreenConfig.NumRounds = SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1;
_PartyMode.DataFromScreen(_ThemeName, Data); _PartyMode.DataFromScreen(_ThemeName, Data);
} }
} }
+18
View File
@@ -115,6 +115,24 @@ namespace Vocaluxe.Base
{ {
return CConfig.IgnoreArticles; return CConfig.IgnoreArticles;
} }
public bool IsMicConfigured(int PlayerNr)
{
return CConfig.IsMicConfig(PlayerNr);
}
public int GetMaxNumMics()
{
int max = 0;
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{
if (CConfig.IsMicConfig(i + 1))
max = i + 1;
else
break;
}
return max;
}
} }
class BSettings : ISettings class BSettings : ISettings
+4
View File
@@ -192,11 +192,15 @@ namespace Vocaluxe.Screens
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; return;
if (_Base.Config.GetMaxNumMics() == 0)
return; //TODO: Add message!
if (_PartyModeInfos[index].Playable) if (_PartyModeInfos[index].Playable)
{ {
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID);
CGraphics.FadeTo(EScreens.ScreenPartyDummy); CGraphics.FadeTo(EScreens.ScreenPartyDummy);
} }
//TODO: else Message!
} }
} }
} }
+3
View File
@@ -75,6 +75,9 @@ namespace Vocaluxe.Menu
ESongSorting GetSongSorting(); ESongSorting GetSongSorting();
EOffOn GetTabs(); EOffOn GetTabs();
EOffOn GetIgnoreArticles(); EOffOn GetIgnoreArticles();
bool IsMicConfigured(int PlayerNr);
int GetMaxNumMics();
} }
public interface ISettings public interface ISettings
+5
View File
@@ -83,6 +83,11 @@ namespace Vocaluxe.PartyModes
return 0; return 0;
} }
public virtual int GetMaxNumRounds()
{
return 1;
}
public virtual void SetSearchString(string SearchString, bool Visible) public virtual void SetSearchString(string SearchString, bool Visible)
{ {
} }
+1
View File
@@ -65,6 +65,7 @@ namespace Vocaluxe.PartyModes
int GetMinPlayer(); int GetMinPlayer();
int GetMaxTeams(); int GetMaxTeams();
int GetMinTeams(); int GetMinTeams();
int GetMaxNumRounds();
void SetSearchString(string SearchString, bool Visible); void SetSearchString(string SearchString, bool Visible);