Auto cleanup of party modes
This commit is contained in:
1 parent
91e6d4901b
commit
cd62c3cd88
16 files changed
+497
-595
No files matched your search
@@ -5,15 +5,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
public class ChallengeRounds
|
||||
{
|
||||
private Random _Rand;
|
||||
private int _NumPlayer;
|
||||
private readonly Random _Rand;
|
||||
private readonly int _NumPlayer;
|
||||
|
||||
public List<Combination> Rounds;
|
||||
|
||||
public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce)
|
||||
{
|
||||
Rounds = new List<Combination>();
|
||||
_Rand = new Random(System.DateTime.Now.Millisecond);
|
||||
_Rand = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0)
|
||||
_NumPlayer = 0;
|
||||
@@ -38,26 +38,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
Rounds.Add(Combinations.GetNextCombination(null));
|
||||
|
||||
for (int i = 1; i < NumRounds; i++)
|
||||
{
|
||||
|
||||
Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i)));
|
||||
}
|
||||
}
|
||||
|
||||
private List<int> GetPlayerDemand(int RoundIndex)
|
||||
{
|
||||
List<int> NumPlayed = new List<int>(_NumPlayer);
|
||||
for (int i = 0; i < _NumPlayer; i++)
|
||||
{
|
||||
NumPlayed.Add(0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < RoundIndex; i++)
|
||||
{
|
||||
foreach (int PlayerIndex in Rounds[i].Player)
|
||||
{
|
||||
NumPlayed[PlayerIndex]++;
|
||||
}
|
||||
}
|
||||
|
||||
int max = 0;
|
||||
@@ -92,7 +85,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
else
|
||||
last.Add(i);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,17 +118,17 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
class Combinations
|
||||
{
|
||||
private List<Combination> _Combs;
|
||||
private Random _Rand;
|
||||
private int _NumPlayer;
|
||||
private int _NumMics;
|
||||
private readonly List<Combination> _Combs;
|
||||
private readonly Random _Rand;
|
||||
private readonly int _NumPlayer;
|
||||
private readonly int _NumMics;
|
||||
|
||||
public Combinations(int NumPlayer, int NumMics, Random Rand)
|
||||
{
|
||||
_Combs = new List<Combination>();
|
||||
_NumMics = NumMics;
|
||||
_NumPlayer = NumPlayer;
|
||||
_Rand = Rand;
|
||||
_Rand = Rand;
|
||||
}
|
||||
|
||||
public Combination GetNextCombination(List<int> PlayerNrDemand)
|
||||
@@ -147,9 +139,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
Combination combs = new Combination();
|
||||
|
||||
if (_NumPlayer == _NumMics)
|
||||
{
|
||||
return _Combs[0];
|
||||
}
|
||||
|
||||
//filter against PlayerNrDemand
|
||||
List<Combination> combsFiltered = new List<Combination>();
|
||||
@@ -176,18 +166,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (combsFiltered.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _Combs.Count; i++)
|
||||
{
|
||||
combsFiltered.Add(_Combs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int num = combsFiltered.Count;
|
||||
int rand = _Rand.Next(num);
|
||||
Combination c = new Combination();
|
||||
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
|
||||
{
|
||||
c.Player.Add(combsFiltered[rand].Player[i]);
|
||||
}
|
||||
_Combs.Remove(combsFiltered[rand]);
|
||||
|
||||
return combsFiltered[rand];
|
||||
@@ -206,9 +192,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
for (int j = 0; j < _NumPlayer; j++)
|
||||
{
|
||||
if ((i & (1 << j)) > 0)
|
||||
{
|
||||
c.Player.Add(j);
|
||||
}
|
||||
}
|
||||
|
||||
if (c.Player.Count == _NumMics)
|
||||
@@ -240,9 +224,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
bool result = true;
|
||||
foreach (int p in PlayerIndices)
|
||||
{
|
||||
result &= IsAvailable(p);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -250,10 +232,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
bool result = false;
|
||||
foreach (int p in PlayerIndices)
|
||||
{
|
||||
result |= IsAvailable(p);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -7,30 +7,29 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public class PartyScreenChallengeConfig : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
|
||||
const string SelectSlideNumMics = "SelectSlideNumMics";
|
||||
const string SelectSlideNumRounds = "SelectSlideNumRounds";
|
||||
const string ButtonNext = "ButtonNext";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
private const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
|
||||
private const string SelectSlideNumMics = "SelectSlideNumMics";
|
||||
private const string SelectSlideNumRounds = "SelectSlideNumRounds";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
|
||||
private int _MaxNumMics = 2;
|
||||
private int _MaxNumRounds = 100;
|
||||
private int _RoundSteps = 1;
|
||||
|
||||
DataFromScreen Data;
|
||||
|
||||
public PartyScreenChallengeConfig()
|
||||
{
|
||||
}
|
||||
private DataFromScreen Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] { SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds };
|
||||
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
|
||||
_ThemeSelectSlides = new[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds};
|
||||
_ThemeButtons = new[] {ButtonNext, ButtonBack};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenConfig config = new FromScreenConfig();
|
||||
@@ -42,7 +41,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -58,19 +57,16 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);;
|
||||
CBase.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);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
@@ -117,9 +113,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -153,15 +147,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
// build num player slide (min player ... max player);
|
||||
SelectSlides[SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
|
||||
UpdateMicsAtOnce();
|
||||
SetRoundSteps();
|
||||
UpdateSlideRounds();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSlides()
|
||||
{
|
||||
@@ -178,13 +170,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
|
||||
while (num > _MaxNumRounds)
|
||||
{
|
||||
num -= _RoundSteps;
|
||||
}
|
||||
Data.ScreenConfig.NumRounds = num;
|
||||
}
|
||||
|
||||
UpdateSlideRounds();
|
||||
UpdateSlideRounds();
|
||||
}
|
||||
|
||||
private void UpdateMicsAtOnce()
|
||||
@@ -200,9 +190,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
// build mics at once slide
|
||||
SelectSlides[SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= MaxNum; i++)
|
||||
{
|
||||
SelectSlides[SelectSlideNumMics].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
}
|
||||
|
||||
@@ -211,9 +199,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
// build num rounds slide
|
||||
SelectSlides[SelectSlideNumRounds].Clear();
|
||||
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
{
|
||||
SelectSlides[SelectSlideNumRounds].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
|
||||
}
|
||||
|
||||
@@ -231,7 +217,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (mod == 0)
|
||||
_RoundSteps = res;
|
||||
else
|
||||
_RoundSteps = Data.ScreenConfig.NumPlayer;
|
||||
_RoundSteps = Data.ScreenConfig.NumPlayer;
|
||||
}
|
||||
|
||||
private void Back()
|
||||
@@ -244,4 +230,4 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,41 +22,43 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public List<CText> TextScores;
|
||||
}
|
||||
|
||||
|
||||
public class PartyScreenChallengeMain : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string TextPosition = "TextPosition";
|
||||
const string TextPlayerName = "TextPlayerName";
|
||||
const string TextNumPlayed = "TextNumPlayed";
|
||||
const string TextWon = "TextWon";
|
||||
const string TextSingPoints = "TextSingPoints";
|
||||
const string TextGamePoints = "TextGamePoints";
|
||||
const string TextNextPlayer = "TextNextPlayer";
|
||||
const string TextPopupReallyExit = "TextPopupReallyExit";
|
||||
const string TextRoundPlayer = "TextRoundPlayer";
|
||||
const string TextRoundScore = "TextRoundScore";
|
||||
const string TextRoundNumber = "TextRoundNumber";
|
||||
const string TextFinishMessage = "TextFinishMessage";
|
||||
const string TextFinishPlayerWin = "TextFinishPlayerWin";
|
||||
const string TextNextPlayerMessage = "TextNextPlayerMessage";
|
||||
private const string TextPosition = "TextPosition";
|
||||
private const string TextPlayerName = "TextPlayerName";
|
||||
private const string TextNumPlayed = "TextNumPlayed";
|
||||
private const string TextWon = "TextWon";
|
||||
private const string TextSingPoints = "TextSingPoints";
|
||||
private const string TextGamePoints = "TextGamePoints";
|
||||
private const string TextNextPlayer = "TextNextPlayer";
|
||||
private const string TextPopupReallyExit = "TextPopupReallyExit";
|
||||
private const string TextRoundPlayer = "TextRoundPlayer";
|
||||
private const string TextRoundScore = "TextRoundScore";
|
||||
private const string TextRoundNumber = "TextRoundNumber";
|
||||
private const string TextFinishMessage = "TextFinishMessage";
|
||||
private const string TextFinishPlayerWin = "TextFinishPlayerWin";
|
||||
private const string TextNextPlayerMessage = "TextNextPlayerMessage";
|
||||
|
||||
const string ButtonNextRound = "ButtonNextRound";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
const string ButtonExit = "ButtonExit";
|
||||
const string ButtonPopupYes = "ButtonPopupYes";
|
||||
const string ButtonPopupNo = "ButtonPopupNo";
|
||||
const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
|
||||
const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
|
||||
const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
|
||||
const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
|
||||
private const string ButtonNextRound = "ButtonNextRound";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
private const string ButtonExit = "ButtonExit";
|
||||
private const string ButtonPopupYes = "ButtonPopupYes";
|
||||
private const string ButtonPopupNo = "ButtonPopupNo";
|
||||
private const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
|
||||
private const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
|
||||
private const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
|
||||
private const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
|
||||
|
||||
const string StaticPopupBG = "StaticPopupBG";
|
||||
const string StaticNextPlayer = "StaticNextPlayer";
|
||||
private const string StaticPopupBG = "StaticPopupBG";
|
||||
private const string StaticNextPlayer = "StaticNextPlayer";
|
||||
|
||||
private bool ExitPopupVisible = false;
|
||||
private bool ExitPopupVisible;
|
||||
|
||||
private DataFromScreen Data;
|
||||
private DataToScreenMain GameState;
|
||||
@@ -68,8 +70,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private SRectF RoundsTableScrollArea;
|
||||
private SRectF PlayerTableScrollArea;
|
||||
private int RoundsTableOffset = 0;
|
||||
private int PlayerTableOffset = 0;
|
||||
private int RoundsTableOffset;
|
||||
private int PlayerTableOffset;
|
||||
private int NumPlayerVisible = 10;
|
||||
private int NumRoundsVisible = 3;
|
||||
|
||||
@@ -83,14 +85,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer, TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage };
|
||||
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp };
|
||||
_ThemeStatics = new string[] { StaticPopupBG, StaticNextPlayer };
|
||||
_ThemeTexts = new[]
|
||||
{
|
||||
TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer,
|
||||
TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage
|
||||
};
|
||||
_ThemeButtons = new[]
|
||||
{ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp};
|
||||
_ThemeStatics = new[] {StaticPopupBG, StaticNextPlayer};
|
||||
}
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
|
||||
GameState = new DataToScreenMain();
|
||||
BuildPlayerTable();
|
||||
@@ -118,19 +125,16 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
@@ -138,10 +142,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameState.CurrentRoundNr == 1)
|
||||
Back();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
break;
|
||||
@@ -212,19 +218,21 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameState.CurrentRoundNr == 1)
|
||||
Back();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel != 0)
|
||||
{
|
||||
if(CHelper.IsInBounds(RoundsTableScrollArea, MouseEvent))
|
||||
if (CHelper.IsInBounds(RoundsTableScrollArea, MouseEvent))
|
||||
ScrollRoundsTable(MouseEvent.Wheel);
|
||||
if(CHelper.IsInBounds(PlayerTableScrollArea, MouseEvent))
|
||||
if (CHelper.IsInBounds(PlayerTableScrollArea, MouseEvent))
|
||||
ScrollPlayerTable(MouseEvent.Wheel);
|
||||
}
|
||||
|
||||
@@ -322,7 +330,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void UpdateNextPlayerPositions()
|
||||
{
|
||||
float x = CBase.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
|
||||
float x = CBase.Settings.GetRenderW() / 2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce - 1) * 15)) / 2;
|
||||
float static_y = 590;
|
||||
float text_y = 550;
|
||||
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
|
||||
@@ -446,7 +454,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
for (int column = row * NumPlayerInOneRow; column < num; column++)
|
||||
{
|
||||
//Player
|
||||
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2;
|
||||
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) +
|
||||
((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2;
|
||||
float maxw = ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2 - 5;
|
||||
RoundsTable[round].TextPlayer[column].X = _x;
|
||||
RoundsTable[round].TextPlayer[column].Y = y;
|
||||
@@ -469,7 +478,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
SProfile[] profile = CBase.Profiles.GetProfiles();
|
||||
for (int i = 0; i < RoundsTable.Count; i++)
|
||||
{
|
||||
for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
|
||||
for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
|
||||
{
|
||||
if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
|
||||
{
|
||||
@@ -497,7 +506,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
RoundsTable[i].TextPlayer[p].Visible = false;
|
||||
RoundsTable[i].TextScores[p].Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +575,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
TableRow row = PlayerTable[i];
|
||||
|
||||
if (i+PlayerTableOffset < GameState.ResultTable.Count)
|
||||
if (i + PlayerTableOffset < GameState.ResultTable.Count)
|
||||
{
|
||||
row.Pos.Visible = true;
|
||||
row.Name.Visible = true;
|
||||
@@ -576,11 +585,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Pos.Text = GameState.ResultTable[i + PlayerTableOffset].Position.ToString() + ".";
|
||||
row.Name.Text = profiles[GameState.ResultTable[i+PlayerTableOffset].PlayerID].PlayerName;
|
||||
row.Rounds.Text = GameState.ResultTable[i+PlayerTableOffset].NumRounds.ToString();
|
||||
row.Won.Text = GameState.ResultTable[i+PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumGamePoints.ToString();
|
||||
row.Name.Text = profiles[GameState.ResultTable[i + PlayerTableOffset].PlayerID].PlayerName;
|
||||
row.Rounds.Text = GameState.ResultTable[i + PlayerTableOffset].NumRounds.ToString();
|
||||
row.Won.Text = GameState.ResultTable[i + PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumGamePoints.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -649,4 +658,4 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public class PartyScreenChallengeNames : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion { get { return 1; } }
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
const string ButtonNext = "ButtonNext";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
const string ButtonPlayerDestination = "ButtonPlayerDestination";
|
||||
const string ButtonPlayerChoose = "ButtonPlayerChoose";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
|
||||
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
|
||||
|
||||
private List<CPlayerChooseButton> PlayerChooseButtons;
|
||||
private List<CButton> PlayerDestinationButtons;
|
||||
@@ -35,14 +38,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private int PlayerChooseButtonsOffset = 0;
|
||||
|
||||
private CStatic chooseAvatarStatic;
|
||||
private bool SelectingMouseActive = false;
|
||||
private int OldMouseX = 0;
|
||||
private int OldMouseY = 0;
|
||||
private bool SelectingMouseActive;
|
||||
private int OldMouseX;
|
||||
private int OldMouseY;
|
||||
private int SelectedPlayerNr = -1;
|
||||
private bool ButtonsAdded = false;
|
||||
private bool ButtonsAdded;
|
||||
|
||||
private int NumPlayer = 4;
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
|
||||
private class CPlayerChooseButton
|
||||
@@ -51,10 +54,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public int ProfileID;
|
||||
}
|
||||
|
||||
public PartyScreenChallengeNames()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -67,7 +66,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose };
|
||||
_ThemeButtons = new[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenNames names = new FromScreenNames();
|
||||
@@ -79,7 +78,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -96,52 +95,45 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
NumPlayer = config.NumPlayer;
|
||||
|
||||
while (Data.ScreenNames.ProfileIDs.Count > NumPlayer)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDs.RemoveAt(Data.ScreenNames.ProfileIDs.Count - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
Back();
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
case Keys.Enter:
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
if (Buttons[ButtonNext].Selected)
|
||||
Next();
|
||||
|
||||
if (Buttons[ButtonNext].Selected)
|
||||
Next();
|
||||
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -186,7 +178,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
OldMouseX = MouseEvent.X;
|
||||
OldMouseY = MouseEvent.Y;
|
||||
}
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||
else if (SelectingMouseActive)
|
||||
{
|
||||
//Check if really a player was selected
|
||||
@@ -196,7 +188,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
|
||||
{
|
||||
//Check first, if area is "active"
|
||||
if (PlayerDestinationButtons[i].Visible == true)
|
||||
if (PlayerDestinationButtons[i].Visible)
|
||||
{
|
||||
//Check if Mouse is in area
|
||||
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
|
||||
@@ -245,9 +237,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -336,14 +326,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private void UpdateButtonPlayerChoose()
|
||||
{
|
||||
UpdateVisibleProfiles();
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
{
|
||||
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
|
||||
(PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose(int Offset)
|
||||
@@ -402,9 +389,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,4 +507,4 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user