config screen receives now some data from game mode

This commit is contained in:
Alexander Eckart committed 2012-12-16 14:50:18 +01:00
1 parent 9e9383d5ad
commit 88630e5161
4 files changed
+60 -10

No files matched your search

@@ -59,7 +59,7 @@ namespace Vocaluxe.PartyModes
public class PartyModeChallenge : CPartyMode
{
private const int MaxPlayer = 10;
private const int MinPlayer = 2;
private const int MinPlayer = 1;
private const int MaxTeams = 0;
private const int MinTeams = 0;
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
const string ButtonBack = "ButtonBack";
private int MaxNumMics = 2;
private int MaxNumRounds = 10;
private int MaxNumRounds = 100;
DataFromScreen Data;
@@ -38,9 +38,9 @@ namespace Vocaluxe.PartyModes
Data = new DataFromScreen();
FromScreenConfig config = new FromScreenConfig();
config.NumPlayer = 0;
config.NumPlayerAtOnce = 0;
config.NumRounds = 0;
config.NumPlayer = 4;
config.NumPlayerAtOnce = 2;
config.NumRounds = 12;
Data.ScreenConfig = config;
}
@@ -49,6 +49,24 @@ namespace Vocaluxe.PartyModes
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenConfig config = new DataToScreenConfig();
try
{
config = (DataToScreenConfig)ReceivedData;
Data.ScreenConfig.NumPlayer = config.NumPlayer;
Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
Data.ScreenConfig.NumRounds = config.NumRounds;
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
}
}
public override bool HandleInput(KeyEvent KeyEvent)
{
base.HandleInput(KeyEvent);
@@ -118,18 +136,25 @@ namespace Vocaluxe.PartyModes
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - 1;
//TODO: Max number of mics should be number of mics available
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
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();
}
+1 -1
View File
@@ -59,7 +59,7 @@ namespace Vocaluxe.PartyModes
public class PartyModeChallenge : CPartyMode
{
private const int MaxPlayer = 10;
private const int MinPlayer = 2;
private const int MinPlayer = 1;
private const int MaxTeams = 0;
private const int MinTeams = 0;
@@ -19,7 +19,7 @@ namespace Vocaluxe.PartyModes
const string ButtonBack = "ButtonBack";
private int MaxNumMics = 2;
private int MaxNumRounds = 10;
private int MaxNumRounds = 100;
DataFromScreen Data;
@@ -38,9 +38,9 @@ namespace Vocaluxe.PartyModes
Data = new DataFromScreen();
FromScreenConfig config = new FromScreenConfig();
config.NumPlayer = 0;
config.NumPlayerAtOnce = 0;
config.NumRounds = 0;
config.NumPlayer = 4;
config.NumPlayerAtOnce = 2;
config.NumRounds = 12;
Data.ScreenConfig = config;
}
@@ -49,6 +49,24 @@ namespace Vocaluxe.PartyModes
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenConfig config = new DataToScreenConfig();
try
{
config = (DataToScreenConfig)ReceivedData;
Data.ScreenConfig.NumPlayer = config.NumPlayer;
Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
Data.ScreenConfig.NumRounds = config.NumRounds;
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
}
}
public override bool HandleInput(KeyEvent KeyEvent)
{
base.HandleInput(KeyEvent);
@@ -118,18 +136,25 @@ namespace Vocaluxe.PartyModes
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - 1;
//TODO: Max number of mics should be number of mics available
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
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();
}