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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
}
|
||||
else
|
||||
last.Add(i);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,17 +118,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
{
|
||||
bool result = true;
|
||||
foreach (int p in PlayerIndices)
|
||||
{
|
||||
result &= IsAvailable(p);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -250,10 +232,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
bool result = false;
|
||||
foreach (int p in PlayerIndices)
|
||||
{
|
||||
result |= IsAvailable(p);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,12 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
|
||||
[assembly: System.Runtime.InteropServices.ComVisible(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct DataToScreenConfig
|
||||
{
|
||||
@@ -52,9 +56,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
res = row.NumSingPoints.CompareTo(NumSingPoints);
|
||||
if (res == 0)
|
||||
{
|
||||
res = row.NumWon.CompareTo(NumWon);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -62,7 +64,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
throw new ArgumentException("object is not a ResultTableRow");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion ToScreen
|
||||
|
||||
#region FromScreen
|
||||
@@ -93,6 +94,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public bool FadeToNameSelection;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
public sealed class PartyModeChallengeMedley : CPartyMode
|
||||
@@ -104,7 +106,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private const int MaxNumRounds = 100;
|
||||
private const int NumSongs = 5;
|
||||
|
||||
enum EStage
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
@@ -113,7 +115,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
Singing
|
||||
}
|
||||
|
||||
struct Data
|
||||
private struct Data
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
@@ -129,7 +131,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public int[] CatSongIndices;
|
||||
}
|
||||
|
||||
struct Stats
|
||||
private struct Stats
|
||||
{
|
||||
public int ProfileID;
|
||||
public int SingPoints;
|
||||
@@ -149,13 +151,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
|
||||
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
ToScreenConfig = new DataToScreenConfig();
|
||||
@@ -199,7 +201,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
switch (ScreenName)
|
||||
{
|
||||
case "PartyScreenChallengeMedleyConfig":
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
data = (DataFromScreen)Data;
|
||||
@@ -332,7 +334,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return Screen;
|
||||
}
|
||||
|
||||
@@ -441,9 +443,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
|
||||
}
|
||||
|
||||
public override void SongSelected(int SongID)
|
||||
{
|
||||
}
|
||||
public override void SongSelected(int SongID) {}
|
||||
|
||||
public override void LeavingHighscore()
|
||||
{
|
||||
@@ -503,7 +503,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
#region SongQueque
|
||||
if (CBase.Songs.GetNumVisibleSongs() < NumSongs)
|
||||
CBase.Songs.ResetPartySongSung();
|
||||
|
||||
|
||||
EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
List<int> IDs = new List<int>();
|
||||
|
||||
@@ -514,7 +514,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenParty);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < VisSongs.Length; i++)
|
||||
{
|
||||
foreach (EGameMode mode in VisSongs[i].AvailableGameModes)
|
||||
@@ -522,7 +522,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
|
||||
IDs.Add(VisSongs[i].ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IDs.Count == 0)
|
||||
@@ -541,7 +540,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
IDs.Remove(SongID);
|
||||
s++;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
#endregion SongQueque
|
||||
}
|
||||
|
||||
@@ -550,30 +549,30 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
switch (GameData.NumPlayerAtOnce)
|
||||
{
|
||||
case 1:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 10 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {10};
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 4, 4, 4 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {4, 4, 4};
|
||||
break;
|
||||
|
||||
case 4:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 3, 3, 3, 3 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {3, 3, 3, 3};
|
||||
break;
|
||||
|
||||
case 5:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {2, 2, 2, 2, 2};
|
||||
break;
|
||||
|
||||
case 6:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2, 2 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {2, 2, 2, 2, 2, 2};
|
||||
break;
|
||||
default:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -584,16 +583,16 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
if (profiles == null)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
|
||||
Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
|
||||
|
||||
@@ -627,13 +626,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
GameData.ResultTable.Add(row);
|
||||
}
|
||||
|
||||
GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce];
|
||||
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
|
||||
for (int i = 0; i < GameData.NumRounds; i++)
|
||||
{
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
{
|
||||
GameData.Results[i, j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -656,9 +653,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
SPlayer[] temp = GamePoints.GetPlayer(i, GameData.NumPlayerAtOnce);
|
||||
for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
{
|
||||
results[p].Points += temp[p].Points;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
@@ -673,13 +668,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
int index = -1;
|
||||
for (int j = 0; j < GameData.ResultTable.Count; j++)
|
||||
{
|
||||
{
|
||||
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
|
||||
{
|
||||
index = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
@@ -702,7 +697,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
int pos = 1;
|
||||
int lastPoints = 0;
|
||||
int lastSingPoints = 0;
|
||||
for (int i = 0; i < GameData.ResultTable.Count; i++ )
|
||||
for (int i = 0; i < GameData.ResultTable.Count; i++)
|
||||
{
|
||||
if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints)
|
||||
pos++;
|
||||
@@ -715,7 +710,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private List<Stats> GetPointsForPlayer(SPlayer[] Results)
|
||||
{
|
||||
List<Stats> result = new List<Stats>();
|
||||
for(int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
Stats stat = new Stats();
|
||||
stat.ProfileID = Results[i].ProfileID;
|
||||
@@ -762,7 +757,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -772,11 +766,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
|
||||
{
|
||||
GameData.CatSongIndices[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
|
||||
GameData.CatSongIndices = null;
|
||||
}
|
||||
|
||||
@@ -7,30 +7,29 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public class PartyScreenChallengeMedleyConfig : 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 PartyScreenChallengeMedleyConfig()
|
||||
{
|
||||
}
|
||||
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.ChallengeMedley
|
||||
|
||||
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.ChallengeMedley
|
||||
}
|
||||
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.ChallengeMedley
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -153,15 +147,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
// 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.ChallengeMedley
|
||||
{
|
||||
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.ChallengeMedley
|
||||
// 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.ChallengeMedley
|
||||
// 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.ChallengeMedley
|
||||
if (mod == 0)
|
||||
_RoundSteps = res;
|
||||
else
|
||||
_RoundSteps = Data.ScreenConfig.NumPlayer;
|
||||
_RoundSteps = Data.ScreenConfig.NumPlayer;
|
||||
}
|
||||
|
||||
private void Back()
|
||||
@@ -244,4 +230,4 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,41 +22,43 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public List<CText> TextScores;
|
||||
}
|
||||
|
||||
|
||||
public class PartyScreenChallengeMedleyMain : 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.ChallengeMedley
|
||||
|
||||
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.ChallengeMedley
|
||||
{
|
||||
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.ChallengeMedley
|
||||
}
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
{
|
||||
RoundsTable[i].TextPlayer[p].Visible = false;
|
||||
RoundsTable[i].TextScores[p].Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +575,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public class PartyScreenChallengeMedleyNames : 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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
public int ProfileID;
|
||||
}
|
||||
|
||||
public PartyScreenChallengeMedleyNames()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -67,7 +66,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -336,14 +326,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
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.ChallengeMedley
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,4 +507,4 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
[assembly: System.Runtime.InteropServices.ComVisible(false)]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
public enum ESongSource
|
||||
@@ -29,7 +31,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int Winner;
|
||||
public bool Finished = false;
|
||||
}
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct DataToScreenConfig
|
||||
{
|
||||
@@ -104,6 +108,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public List<int> Songs;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
public sealed class PartyModeTicTacToe : CPartyMode
|
||||
@@ -114,7 +119,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private const int MinTeams = 2;
|
||||
private const int NumFields = 9;
|
||||
|
||||
enum EStage
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
@@ -123,7 +128,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Singing
|
||||
}
|
||||
|
||||
struct Data
|
||||
private struct Data
|
||||
{
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
@@ -162,13 +167,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = true;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
|
||||
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
ToScreenConfig = new DataToScreenConfig();
|
||||
@@ -224,7 +229,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
switch (ScreenName)
|
||||
{
|
||||
case "PartyScreenTicTacToeConfig":
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
data = (DataFromScreen)Data;
|
||||
@@ -284,9 +289,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
GameData.PlayerTeam2 = data.ScreenMain.PlayerTeam2;
|
||||
}
|
||||
if (data.ScreenMain.FadeToNameSelection)
|
||||
{
|
||||
_Stage = EStage.Config;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -407,7 +410,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return Screen;
|
||||
}
|
||||
|
||||
@@ -471,9 +474,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
return NumFields;
|
||||
}
|
||||
|
||||
public override void JokerUsed(int TeamNr)
|
||||
{
|
||||
}
|
||||
public override void JokerUsed(int TeamNr) {}
|
||||
|
||||
public override void SongSelected(int SongID)
|
||||
{
|
||||
@@ -528,14 +529,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
int num = 0;
|
||||
int random = 0;
|
||||
//Add IDs to team-list
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 && GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 &&
|
||||
GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
|
||||
{
|
||||
if (IDs1.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
IDs1.Add(i);
|
||||
}
|
||||
if (IDs2.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
IDs2.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs1.Count - 1) * 10);
|
||||
@@ -566,8 +572,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs.Count == 0)
|
||||
{
|
||||
if (IDs.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
IDs.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs.Count - 1) * 10);
|
||||
@@ -589,8 +597,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs.Count == 0)
|
||||
{
|
||||
if (IDs.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
IDs.Add(i);
|
||||
}
|
||||
if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
|
||||
{
|
||||
random = CBase.Game.GetRandom((IDs.Count - 1) * 20);
|
||||
@@ -623,7 +633,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
|
||||
while(GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])){
|
||||
while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1]))
|
||||
{
|
||||
List<int> Songs = new List<int>();
|
||||
switch (GameData.SongSource)
|
||||
{
|
||||
@@ -632,8 +643,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
int id = CBase.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID;
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||
if (mode == gm)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -641,8 +654,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
|
||||
if (mode == gm)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -650,14 +665,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
CBase.Songs.SetCategory(GameData.CategoryID);
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(GameData.CategoryID); i++)
|
||||
{
|
||||
foreach(EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
if(mode == gm)
|
||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
Songs.Add(CBase.Songs.GetVisibleSong(i).ID);
|
||||
}
|
||||
}
|
||||
CBase.Songs.SetCategory(-1);
|
||||
break;
|
||||
}
|
||||
while(Songs.Count > 0)
|
||||
while (Songs.Count > 0)
|
||||
{
|
||||
GameData.Songs.Add(Songs[CBase.Game.GetRandom(Songs.Count - 1)]);
|
||||
Songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
|
||||
@@ -773,13 +790,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points);
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = true;
|
||||
if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 2;
|
||||
}
|
||||
else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = false;
|
||||
|
||||
@@ -7,32 +7,32 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeConfig : 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 SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
|
||||
const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
|
||||
const string SelectSlideNumFields = "SelectSlideNumFields";
|
||||
const string SelectSlideSongSource = "SelectSlideSongSource";
|
||||
const string SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
const string SelectSlideCategory = "SelectSlideCategory";
|
||||
const string SelectSlideGameMode = "SelectSlideGameMode";
|
||||
const string ButtonNext = "ButtonNext";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
private const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
|
||||
private const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
|
||||
private const string SelectSlideNumFields = "SelectSlideNumFields";
|
||||
private const string SelectSlideSongSource = "SelectSlideSongSource";
|
||||
private const string SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
private const string SelectSlideCategory = "SelectSlideCategory";
|
||||
private const string SelectSlideGameMode = "SelectSlideGameMode";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
|
||||
private bool ConfigOk = true;
|
||||
|
||||
DataFromScreen Data;
|
||||
|
||||
public PartyScreenTicTacToeConfig()
|
||||
{
|
||||
}
|
||||
private DataFromScreen Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] { SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode };
|
||||
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
|
||||
_ThemeSelectSlides = new[]
|
||||
{SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode};
|
||||
_ThemeButtons = new[] {ButtonNext, ButtonBack};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenConfig config = new FromScreenConfig();
|
||||
@@ -48,7 +48,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -68,19 +68,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe 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)
|
||||
@@ -127,9 +124,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -161,18 +156,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
{
|
||||
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer()/2);
|
||||
SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
{
|
||||
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].AddValue(i.ToString());
|
||||
}
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 -( _PartyMode.GetMinPlayer()/2);
|
||||
SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
SelectSlides[SelectSlideNumFields].Clear();
|
||||
SelectSlides[SelectSlideNumFields].AddValue("9");
|
||||
@@ -199,10 +190,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
string[] _Categories = new string[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++ )
|
||||
{
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
_Categories[i] = CBase.Songs.GetCategory(i).Name;
|
||||
}
|
||||
SelectSlides[SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < _Categories.Length; i++)
|
||||
{
|
||||
@@ -218,8 +207,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void UpdateSlides()
|
||||
{
|
||||
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer()/2);
|
||||
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer()/2);
|
||||
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
|
||||
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
|
||||
|
||||
if (SelectSlides[SelectSlideNumFields].Selection == 0)
|
||||
Data.ScreenConfig.NumFields = 9;
|
||||
@@ -253,6 +242,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
|
||||
{
|
||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||
{
|
||||
if (CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0)
|
||||
{
|
||||
ConfigOk = false;
|
||||
@@ -260,23 +250,27 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
int id = CBase.Playlist.GetPlaylistSong(Data.ScreenConfig.PlaylistID, i).SongID;
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
if (Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() > 0)
|
||||
{
|
||||
if (CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID) > 0)
|
||||
{
|
||||
CBase.Songs.SetCategory(Data.ScreenConfig.CategoryID);
|
||||
@@ -284,11 +278,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
@@ -296,6 +292,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
else
|
||||
ConfigOk = false;
|
||||
}
|
||||
@@ -306,11 +303,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
|
||||
{
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
|
||||
{
|
||||
if (mode == gm)
|
||||
{
|
||||
ConfigOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ConfigOk)
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +319,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
|
||||
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
}
|
||||
}
|
||||
|
||||
private void Back()
|
||||
{
|
||||
@@ -332,4 +331,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,34 +23,36 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeMain : 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 TextPopupReallyExit = "TextPopupReallyExit";
|
||||
const string TextTeamChoosing = "TextTeamChoosing";
|
||||
const string TextFinishMessage = "TextFinishMessage";
|
||||
const string TextNextPlayerT1 = "TextNextPlayerT1";
|
||||
const string TextNextPlayerT2 = "TextNextPlayerT2";
|
||||
const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
|
||||
const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
|
||||
private const string TextPopupReallyExit = "TextPopupReallyExit";
|
||||
private const string TextTeamChoosing = "TextTeamChoosing";
|
||||
private const string TextFinishMessage = "TextFinishMessage";
|
||||
private const string TextNextPlayerT1 = "TextNextPlayerT1";
|
||||
private const string TextNextPlayerT2 = "TextNextPlayerT2";
|
||||
private const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
|
||||
private const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
|
||||
|
||||
const string ButtonNextRound = "ButtonNextRound";
|
||||
const string ButtonBack = "ButtonBack";
|
||||
const string ButtonExit = "ButtonExit";
|
||||
const string ButtonPopupYes = "ButtonPopupYes";
|
||||
const string ButtonPopupNo = "ButtonPopupNo";
|
||||
const string ButtonField = "ButtonField";
|
||||
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 ButtonField = "ButtonField";
|
||||
|
||||
const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
|
||||
const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
|
||||
const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
|
||||
const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
|
||||
private const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
|
||||
private const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
|
||||
private const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
|
||||
private const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
|
||||
|
||||
private const string StaticPopupBG = "StaticPopupBG";
|
||||
private const string StaticAvatarT1 = "StaticAvatarT1";
|
||||
private const string StaticAvatarT2 = "StaticAvatarT2";
|
||||
|
||||
const string StaticPopupBG = "StaticPopupBG";
|
||||
const string StaticAvatarT1 = "StaticAvatarT1";
|
||||
const string StaticAvatarT2 = "StaticAvatarT2";
|
||||
|
||||
private bool ExitPopupVisible = false;
|
||||
private bool ExitPopupVisible;
|
||||
|
||||
private DataFromScreen Data;
|
||||
private DataToScreenMain GameData;
|
||||
@@ -68,17 +70,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private int[,] Possibilities;
|
||||
private EStatus Status;
|
||||
|
||||
public PartyScreenTicTacToeMain()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeTexts = new string[] { TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2 };
|
||||
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1, ButtonJokerRetryT2 };
|
||||
_ThemeStatics = new string[] { StaticPopupBG, StaticAvatarT1, StaticAvatarT2 };
|
||||
_ThemeTexts = new[] {TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2};
|
||||
_ThemeButtons = new[]
|
||||
{
|
||||
ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1,
|
||||
ButtonJokerRetryT2
|
||||
};
|
||||
_ThemeStatics = new[] {StaticPopupBG, StaticAvatarT1, StaticAvatarT2};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenMain config = new FromScreenMain();
|
||||
@@ -97,7 +99,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
|
||||
CreateFields();
|
||||
Buttons[ButtonField].Visible = false;
|
||||
@@ -114,19 +116,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe 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)
|
||||
@@ -134,12 +133,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
|
||||
Back();
|
||||
else if(Status == EStatus.None)
|
||||
else if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
break;
|
||||
@@ -214,10 +215,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Buttons[ButtonBack].Selected)
|
||||
Back();
|
||||
if (Buttons[ButtonExit].Selected)
|
||||
{
|
||||
if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
for (int i = 0; i < GameData.NumFields; i++)
|
||||
{
|
||||
switch (Status)
|
||||
@@ -239,7 +242,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(Status == EStatus.FieldSelected)
|
||||
if (Status == EStatus.FieldSelected)
|
||||
{
|
||||
if (Buttons[ButtonJokerRandomT1].Selected)
|
||||
UseJoker(0, 0);
|
||||
@@ -249,7 +252,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
UseJoker(0, 1);
|
||||
if (Buttons[ButtonJokerRetryT2].Selected)
|
||||
UseJoker(1, 1);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -264,19 +266,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
if (!ExitPopupVisible)
|
||||
{
|
||||
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
|
||||
Back();
|
||||
else if(Status == EStatus.None)
|
||||
else if (Status == EStatus.None)
|
||||
EndParty();
|
||||
else
|
||||
ShowPopup(true);
|
||||
}
|
||||
else
|
||||
ShowPopup(false);
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel != 0)
|
||||
{
|
||||
}
|
||||
if (MouseEvent.Wheel != 0) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -289,7 +291,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
if (GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
BuildWinnerPossibilities();
|
||||
BuildWinnerPossibilities();
|
||||
SelectedField = -1;
|
||||
Buttons[ButtonBack].Visible = true;
|
||||
Buttons[ButtonExit].Visible = false;
|
||||
@@ -333,7 +335,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (Winner > 0)
|
||||
{
|
||||
Texts[TextFinishMessage].Color = CBase.Theme.GetPlayerColor(Winner);
|
||||
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + Winner;
|
||||
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " +
|
||||
Winner;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -379,7 +382,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void UpdateFields()
|
||||
{
|
||||
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
|
||||
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
|
||||
float FieldSizeY = (CBase.Settings.GetRenderH() - 150 - NumOneRow * FieldSpace) / NumOneRow;
|
||||
float FieldSizeX = (CBase.Settings.GetRenderW() - 300 - NumOneRow * FieldSpace) / NumOneRow;
|
||||
if (FieldSizeX < FieldSizeY)
|
||||
@@ -403,7 +406,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Fields[i].Button.Visible = true;
|
||||
Fields[i].Button.Enabled = true;
|
||||
column++;
|
||||
if ((i+1) >= NumOneRow * (row+1))
|
||||
if ((i + 1) >= NumOneRow * (row + 1))
|
||||
{
|
||||
column = 0;
|
||||
row++;
|
||||
@@ -446,17 +449,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
if (Status == EStatus.JokerRetry && Fields[i].Content.Finished)
|
||||
{
|
||||
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team+1);
|
||||
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team + 1);
|
||||
Fields[i].Button.Enabled = true;
|
||||
}
|
||||
if (Status == EStatus.JokerRetry && !Fields[i].Content.Finished)
|
||||
{
|
||||
Fields[i].Button.Enabled = false;
|
||||
}
|
||||
if(Status == EStatus.FieldSelected)
|
||||
{
|
||||
if (Status == EStatus.FieldSelected)
|
||||
Fields[i].Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +500,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Texts[TextNextPlayerT2].Visible = true;
|
||||
Texts[TextNextPlayerNameT1].Visible = true;
|
||||
Texts[TextNextPlayerNameT2].Visible = true;
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
|
||||
Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
|
||||
Statics[StaticAvatarT1].Visible = true;
|
||||
@@ -561,7 +560,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
switch (JokerNum)
|
||||
{
|
||||
//Random-Joker
|
||||
//Random-Joker
|
||||
case 0:
|
||||
if (GameData.NumJokerRandom[TeamNr] > 0)
|
||||
{
|
||||
@@ -572,7 +571,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
break;
|
||||
|
||||
//Retry-Joker
|
||||
//Retry-Joker
|
||||
case 1:
|
||||
if (GameData.NumJokerRetry[TeamNr] > 0 && GameData.CurrentRoundNr > 1)
|
||||
{
|
||||
@@ -593,7 +592,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void UpdateTeamChoosingMessage()
|
||||
{
|
||||
Texts[TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(GameData.Team + 1);
|
||||
Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
|
||||
Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " +
|
||||
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
|
||||
if (Status == EStatus.JokerRetry || Status == EStatus.FieldChoosing)
|
||||
Texts[TextTeamChoosing].Visible = true;
|
||||
else
|
||||
@@ -659,36 +659,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private int BuildWinnerPossibilities()
|
||||
{
|
||||
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
|
||||
Possibilities = new int[(NumOneRow * 2) + 2, NumOneRow];
|
||||
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
|
||||
Possibilities = new int[(NumOneRow * 2) + 2,NumOneRow];
|
||||
for (int i = 0; i < Possibilities.GetLength(0); i++)
|
||||
{
|
||||
if (i < NumOneRow)
|
||||
{
|
||||
for(int c = 0; c < NumOneRow; c++){
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
Possibilities[i, c] = i * NumOneRow + c;
|
||||
}
|
||||
}
|
||||
else if (i < NumOneRow * 2)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
{
|
||||
Possibilities[i, c] = (i-NumOneRow) + (c*NumOneRow);
|
||||
}
|
||||
Possibilities[i, c] = (i - NumOneRow) + (c * NumOneRow);
|
||||
}
|
||||
else if( i == Possibilities.GetLength(0) - 2)
|
||||
else if (i == Possibilities.GetLength(0) - 2)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow;c++)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
Possibilities[i, c] = (NumOneRow + 1) * c;
|
||||
}
|
||||
}
|
||||
else if (i == Possibilities.GetLength(0) - 1)
|
||||
{
|
||||
for (int c = 0; c < NumOneRow; c++)
|
||||
{
|
||||
Possibilities[i, c] = (NumOneRow - 1) * c + (NumOneRow - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -716,4 +709,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public class PartyScreenTicTacToeNames : 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";
|
||||
const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
|
||||
const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
|
||||
private const string ButtonNext = "ButtonNext";
|
||||
private const string ButtonBack = "ButtonBack";
|
||||
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
|
||||
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
|
||||
private const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
|
||||
private const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
|
||||
|
||||
private List<CPlayerChooseButton> PlayerChooseButtons;
|
||||
private List<CButton> PlayerDestinationButtons;
|
||||
@@ -34,18 +37,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private const int PlayerChooseButtonsFirstY = 105;
|
||||
private const int PlayerChooseButtonsSpaceH = 15;
|
||||
private const int PlayerChooseButtonsSpaceW = 25;
|
||||
private int PlayerChooseButtonsOffset = 0;
|
||||
private int PlayerChooseButtonsOffset;
|
||||
|
||||
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 NumPlayerTeam1 = 2;
|
||||
private int NumPlayerTeam2 = 2;
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
|
||||
private class CPlayerChooseButton
|
||||
@@ -54,10 +57,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int ProfileID;
|
||||
}
|
||||
|
||||
public PartyScreenTicTacToeNames()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -71,7 +70,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Data.ScreenNames.ProfileIDsTeam2 = new List<int>();
|
||||
|
||||
List<string> buttons = new List<string>();
|
||||
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown };
|
||||
_ThemeButtons = new[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown};
|
||||
|
||||
Data = new DataFromScreen();
|
||||
FromScreenNames names = new FromScreenNames();
|
||||
@@ -84,7 +83,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
base.LoadTheme(XmlPath);
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -105,62 +104,53 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
NumPlayerTeam2 = config.NumPlayerTeam2;
|
||||
|
||||
while (Data.ScreenNames.ProfileIDsTeam1.Count > NumPlayerTeam1)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam1.RemoveAt(Data.ScreenNames.ProfileIDsTeam1.Count - 1);
|
||||
}
|
||||
while (Data.ScreenNames.ProfileIDsTeam2.Count > NumPlayerTeam2)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(Data.ScreenNames.ProfileIDsTeam2.Count - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); ;
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe 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 (Buttons[ButtonPlayerChooseScrollUp].Selected)
|
||||
Scroll(-1);
|
||||
|
||||
if (Buttons[ButtonPlayerChooseScrollUp].Selected)
|
||||
Scroll(-1);
|
||||
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
|
||||
Scroll(1);
|
||||
|
||||
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
|
||||
Scroll(1);
|
||||
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
OnRemove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,7 +185,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Check if LeftButton is hold and Select-Mode active
|
||||
if (MouseEvent.LBH && SelectingMouseActive)
|
||||
{
|
||||
@@ -207,7 +197,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
return true;
|
||||
}
|
||||
// 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
|
||||
@@ -217,7 +207,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
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))
|
||||
@@ -286,14 +276,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
Scroll(1);
|
||||
}
|
||||
|
||||
if(MouseEvent.LD && IsMouseOver(MouseEvent))
|
||||
if (MouseEvent.LD && IsMouseOver(MouseEvent))
|
||||
{
|
||||
if (!OnAdd())
|
||||
OnRemove();
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -335,12 +325,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
PlayerChooseButtonsOffset += Offset;
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
|
||||
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
|
||||
{
|
||||
PlayerChooseButtonsOffset += Offset;
|
||||
UpdateButtonPlayerChoose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AddButtonPlayerDestination()
|
||||
@@ -397,16 +386,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
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);
|
||||
}
|
||||
Buttons[ButtonPlayerChooseScrollUp].Enabled = PlayerChooseButtonsOffset > 0;
|
||||
Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count > PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
|
||||
Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count >
|
||||
PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
|
||||
}
|
||||
|
||||
private void UpdateButtonPlayerChoose(int Offset)
|
||||
@@ -475,9 +462,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
PlayerChooseButtonsVisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,11 +617,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH*2; i++)
|
||||
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH * 2; i++)
|
||||
{
|
||||
if (PlayerDestinationButtons[i].Selected)
|
||||
{
|
||||
if (((i-PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
|
||||
if (((i - PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
|
||||
{
|
||||
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - PlayerDestinationButtonsNumH);
|
||||
UpdateButtonNext();
|
||||
@@ -664,4 +649,4 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_PartyMode.DataFromScreen(ThemeName, Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user