diff --git a/Output/Themes/Genius/Screens/ScreenSong.xml b/Output/Themes/Genius/Screens/ScreenSong.xml
index 1b74ad72..70d29049 100644
--- a/Output/Themes/Genius/Screens/ScreenSong.xml
+++ b/Output/Themes/Genius/Screens/ScreenSong.xml
@@ -65,7 +65,7 @@
40
40
- 360
+ 640
360
-2.1
@@ -73,11 +73,11 @@
- 950
+ 1160
65
-2.11
42
- 280
+ 100
Left
@@ -87,11 +87,11 @@
- 950
+ 1160
135
-2.11
42
- 280
+ 100
Left
@@ -101,11 +101,11 @@
- 950
+ 1160
205
-2.11
42
- 280
+ 100
Left
@@ -115,11 +115,11 @@
- 950
+ 1160
275
-2.11
42
- 280
+ 100
Left
@@ -129,11 +129,11 @@
- 950
+ 1160
345
-2.11
42
- 280
+ 100
Left
@@ -143,11 +143,11 @@
- 950
+ 1160
415
-2.11
42
- 280
+ 100
Left
@@ -244,10 +244,10 @@
Random
Random
- 850
+ 1100
50
- 80
- 80
+ 60
+ 60
-1.01
@@ -255,11 +255,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -273,10 +273,10 @@
Random
Random
- 850
+ 1100
120
- 80
- 80
+ 60
+ 60
-1.01
@@ -284,11 +284,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -302,10 +302,10 @@
Random
Random
- 850
+ 1100
190
- 80
- 80
+ 60
+ 60
-1.01
@@ -313,11 +313,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -331,10 +331,10 @@
Random
Random
- 850
+ 1100
260
- 80
- 80
+ 60
+ 60
-1.01
@@ -342,11 +342,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -360,10 +360,10 @@
Random
Random
- 850
+ 1100
330
- 80
- 80
+ 60
+ 60
-1.01
@@ -371,11 +371,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -389,10 +389,10 @@
Random
Random
- 850
+ 1100
400
- 80
- 80
+ 60
+ 60
-1.01
@@ -400,11 +400,11 @@
- 40
- 23
+ 30
+ 20
0
- 34
- 60
+ 30
+ 40
Center
@@ -661,7 +661,7 @@
Button
Button
- 960
+ 1100
500
150
50
@@ -1018,6 +1018,145 @@
+
+ 8
+ 10
+ 10
+ 7
+
+ RECORDSTYLE_SINGLE
+
+ 640
+ 40
+ 550
+ 550
+ -1
+
+
+ 640
+ 40
+ 395
+ 550
+ -1
+
+
+ 400
+ 415
+ 280
+ 170
+ -1
+
+
+ 222
+ 416
+ -1.01
+ 39
+ 340
+
+
+ Center
+ Top
+
+ Outline
+
+
+
+ 222
+ 456
+ -1.01
+ 32
+ 340
+
+
+ Center
+ Top
+
+ Outline
+
+
+
+ 222
+ 490
+ -1.01
+ 28
+ 340
+
+
+ Center
+ Top
+
+ Outline
+
+
+
+ CoverBackground
+
+
+ 40
+ 40
+ 640
+ 360
+ -1
+
+
+
+ CoverBackground
+
+
+ 40
+ 40
+ 640
+ 360
+ -1
+
+
+
+ DuetIcon
+
+
+ 200
+ 530
+ 40
+ 40
+ -1
+
+
+
+ VideoIcon
+
+
+ 120
+ 530
+ 40
+ 40
+ -1
+
+
+
+ MedleyCalcIcon
+
+
+ 280
+ 530
+ 40
+ 40
+ -1
+
+
+
+ MedleyTagIcon
+
+
+ 280
+ 530
+ 40
+ 40
+ -1
+
+
+
diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs
index 37d46362..2b4ce68f 100644
--- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs
+++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs
@@ -117,8 +117,13 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _BuildRounds(int numRounds, int numPlayer, int playersPerRound)
{
// What we want is that every player sung the same amount of songs
+ // and alternate the Players so everyone is Player1 the same amount
// So we keep track how many songs each palyer sung
List numSung = new List(numPlayer);
+
+ //and which Player had which Position the last time this combination of Players sung
+ SortedDictionary> lastRounds = new SortedDictionary>();
+
for (int i = 0; i < numPlayer; i++)
numSung.Add(0);
List combinations = new List();
@@ -129,6 +134,44 @@ namespace VocaluxeLib.PartyModes.Challenge
_AddCombinations(numPlayer, playersPerRound, combinations);
List playersInRound = _GetPlayersForRound(numSung);
CRound curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
+
+ List sortedPlayers = curRound.Players;
+ sortedPlayers.Sort((x, y) => y.CompareTo(x));
+
+ String key = "";
+
+ foreach (int player in sortedPlayers)
+ {
+ key += player;
+ }
+
+ List lastRound = new List();
+
+ if (lastRounds.ContainsKey(key))
+ {
+ lastRound = lastRounds[key];
+
+ int first = lastRound.First();
+ lastRound.RemoveAt(0);
+ lastRound.Add(first);
+
+ lastRounds[key] = lastRound;
+
+ for (int k = 0; k < lastRound.Count; k++)
+ {
+ curRound.Players[k] = lastRound[k];
+ }
+ }
+ else
+ {
+ foreach (int player in curRound.Players)
+ {
+ lastRound.Add(player);
+ }
+
+ lastRounds.Add(key, lastRound);
+ }
+
foreach (int player in curRound.Players)
numSung[player]++;
_Rounds.Add(curRound);
diff --git a/PartyModes/PartyModeChallengeRounds/CChallengeRounds.cs b/PartyModes/PartyModeChallengeRounds/CChallengeRounds.cs
deleted file mode 100644
index 2c29e2f6..00000000
--- a/PartyModes/PartyModeChallengeRounds/CChallengeRounds.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-#region license
-// This file is part of Vocaluxe.
-//
-// Vocaluxe is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Vocaluxe is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Vocaluxe. If not, see .
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using VocaluxeLib.Utils.Combinatorics;
-
-namespace VocaluxeLib.PartyModes.ChallengeRounds
-{
- public class CChallengeRounds
- {
- private readonly List _Rounds = new List();
-
- public int Count
- {
- get { return _Rounds.Count; }
- }
-
- public CRound this[int index]
- {
- get { return _Rounds[index]; }
- }
-
- public CChallengeRounds(int numRounds, int numPlayer, int playersPerRound)
- {
- if (numRounds < 1 || numPlayer < 1 || playersPerRound < 1)
- throw new ArgumentException("Invalid paramters for the rounds");
-
- if (playersPerRound > numPlayer)
- playersPerRound = numPlayer;
-
- _BuildRounds(numRounds, numPlayer, playersPerRound);
- if (Count > numRounds)
- {
- //Try again and take the better one
- List old = new List(_Rounds);
- _Rounds.Clear();
- _BuildRounds(numRounds, numPlayer, playersPerRound);
- if (Count > old.Count)
- {
- _Rounds.Clear();
- _Rounds.AddRange(old);
- }
- }
- }
-
- ///
- /// Divides players in 2 categories: Those how sung the most and the others
- ///
- /// List matching the playerIndex to the number of songs sung
- private static List _GetPlayersForRound(IList numSung)
- {
- List mustSing = new List();
- int max = numSung.Max();
- for (int i = 0; i < numSung.Count; i++)
- {
- if (numSung[i] < max)
- mustSing.Add(i);
- }
- return mustSing;
- }
-
- private static void _AddCombinations(int numPlayer, int playersPerRound, List combinations)
- {
- List input = new List(numPlayer);
- for (int i = 0; i < numPlayer; i++)
- input.Add(i);
- CCombinations combs = new CCombinations(input, playersPerRound);
- combinations.AddRange(combs.Select(combination => new CRound(combination)));
- combinations.Shuffle();
- }
-
- private static CRound _GetMatchingCombination(List playersInRound, List numSung, List combinations)
- {
- foreach (CRound round in combinations)
- {
- int matching = round.Players.Count(playersInRound.Contains);
- // A valid round contains only players from playersInRound or all players from playersInRound (and some others)
- if (matching == round.Players.Count || matching == playersInRound.Count)
- return round;
- }
- // It may happen, that there are only players that already sung against each other. So create a 2nd best option with the most number of players that should sing in it
- int maxMatching = combinations.Max(c => c.Players.Count(playersInRound.Contains));
- List nextOptions = combinations.Where(c => c.Players.Count(playersInRound.Contains) == maxMatching).ToList();
- // And select the combination that minimizes the sum of the number of songs sung (--> favor rounds with players that sung less than others)
- CRound result = null;
- int minSung = int.MaxValue;
- foreach (CRound round in nextOptions)
- {
- int curNumSung = round.Players.Sum(pl => numSung[pl]);
- if (curNumSung < minSung)
- {
- minSung = curNumSung;
- result = round;
- }
- }
- Debug.Assert(result != null);
- return result;
- }
-
- private void _BuildRounds(int numRounds, int numPlayer, int playersPerRound)
- {
- // What we want is that every player sung the same amount of songs
- // and alternate the Players so everyone is Player1 the same amount
- // So we keep track how many songs each palyer sung
- List numSung = new List(numPlayer);
-
- //and which Player had which Position the last time this combination of Players sung
- SortedDictionary> lastRounds = new SortedDictionary>();
-
- for (int i = 0; i < numPlayer; i++)
- numSung.Add(0);
- List combinations = new List();
- // Posibly add more rounds than requested if the song count per player is unequal
- for (int i = 0; i < numRounds * 10; i++)
- {
- if (combinations.Count == 0)
- _AddCombinations(numPlayer, playersPerRound, combinations);
- List playersInRound = _GetPlayersForRound(numSung);
- CRound curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
-
- List sortedPlayers = curRound.Players;
- sortedPlayers.Sort((x, y) => y.CompareTo(x));
-
- String key = "";
-
- foreach (int player in sortedPlayers)
- {
- key += player;
- }
-
- List lastRound = new List();
-
- if (lastRounds.ContainsKey(key))
- {
- lastRound = lastRounds[key];
-
- int first = lastRound.First();
- lastRound.RemoveAt(0);
- lastRound.Add(first);
-
- lastRounds[key] = lastRound;
-
- for(int k = 0; k < lastRound.Count; k++)
- {
- curRound.Players[k] = lastRound[k];
- }
- }
- else
- {
- foreach (int player in curRound.Players)
- {
- lastRound.Add(player);
- }
-
- lastRounds.Add(key, lastRound);
- }
-
- foreach (int player in curRound.Players)
- numSung[player]++;
- _Rounds.Add(curRound);
- combinations.Remove(curRound);
- //Stop if we have enough rounds and all players sung the same amount of songs
- if (_Rounds.Count >= numRounds && numSung.All(ct => ct == numSung[0]))
- break;
- }
- }
- }
-
- public class CRound
- {
- public List Players;
-
- public CRound(List players)
- {
- Players = players;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeRounds/CPartyModeChallengeRounds.cs b/PartyModes/PartyModeChallengeRounds/CPartyModeChallengeRounds.cs
deleted file mode 100644
index 0a7ad89b..00000000
--- a/PartyModes/PartyModeChallengeRounds/CPartyModeChallengeRounds.cs
+++ /dev/null
@@ -1,563 +0,0 @@
-#region license
-// This file is part of Vocaluxe.
-//
-// Vocaluxe is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Vocaluxe is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Vocaluxe. If not, see .
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VocaluxeLib.Menu;
-
-[assembly: ComVisible(false)]
-
-namespace VocaluxeLib.PartyModes.ChallengeRounds
-{
- public class CResultTableRow : IComparable
- {
- public int Position;
- public int PlayerID;
- public int NumPlayed;
- public int NumWon;
- public int NumSingPoints;
- public int NumGamePoints;
-
- public int CompareTo(object obj)
- {
- var row = obj as CResultTableRow;
- if (row != null)
- {
- int res = row.NumGamePoints.CompareTo(NumGamePoints);
- if (res == 0)
- {
- res = row.NumSingPoints.CompareTo(NumSingPoints);
- if (res == 0)
- res = row.NumWon.CompareTo(NumWon);
- }
- return res;
- }
-
- throw new ArgumentException("object is not a ResultTableRow");
- }
- }
-
- public abstract class CPartyScreenChallengeRounds : CMenuParty
- {
- protected new CPartyModeChallengeRounds _PartyMode;
-
- public override void Init()
- {
- base.Init();
- _PartyMode = (CPartyModeChallengeRounds)base._PartyMode;
- }
- }
-
- // ReSharper disable ClassNeverInstantiated.Global
- public sealed class CPartyModeChallengeRounds : CPartyMode
- // ReSharper restore ClassNeverInstantiated.Global
- {
- public override int MinMics
- {
- get { return 1; }
- }
- public override int MaxMics
- {
- get { return CBase.Config.GetMaxNumMics(); }
- }
- public override int MinPlayers
- {
- get { return 1; }
- }
- public override int MaxPlayers
- {
- get { return 12; }
- }
- public override int MinTeams
- {
- get { return 1; }
- }
- public override int MaxTeams
- {
- get { return 1; }
- }
- public override int MinPlayersPerTeam
- {
- get { return MinPlayers; }
- }
- public override int MaxPlayersPerTeam
- {
- get { return MaxPlayers; }
- }
-
- private enum EStage
- {
- Config,
- Names,
- Main,
- Singing
- }
-
- public struct SData
- {
- public int NumPlayer;
- public int NumPlayerAtOnce;
- public int NumRounds;
- public int NumJokers;
- public bool RefillJokers;
- public int[] Jokers;
- public List ProfileIDs;
-
- public CChallengeRounds Rounds;
- public List ResultTable;
- public int[,] Results;
-
- public int CurrentRoundNr;
-
- public int[] CatSongIndices;
- }
-
- private struct SStats
- {
- public int ProfileID;
- public int SingPoints;
- public int GamePoints;
- public int Won;
- }
-
- public SData GameData;
- private EStage _Stage;
-
- public CPartyModeChallengeRounds(int id) : base(id)
- {
- _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.Sorting.SearchString = String.Empty;
- _ScreenSongOptions.Sorting.SearchActive = false;
- _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
-
- GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null};
- }
-
- public override void SetDefaults()
- {
- _Stage = EStage.Config;
-
- _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
- _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
- _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
- _ScreenSongOptions.Selection.SongIndex = -1;
-
- if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
- _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
-
- GameData.ResultTable = new List();
- }
-
- public override bool Init()
- {
- if (!base.Init())
- return false;
- _Stage = EStage.Config;
-
- SetDefaults();
- return true;
- }
-
- public override void UpdateGame()
- {
- /*
- if (CBase.Songs.IsInCategory() || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
- _ScreenSongOptions.Selection.RandomOnly = true;
- else
- _ScreenSongOptions.Selection.RandomOnly = false;*/
- }
-
- private IMenu _GetNextScreen()
- {
- switch (_Stage)
- {
- case EStage.Config:
- return _Screens["CPartyScreenChallengeRoundsConfig"];
- case EStage.Names:
- return _Screens["CPartyScreenChallengeRoundsNames"];
- case EStage.Main:
- return _Screens["CPartyScreenChallengeRoundsMain"];
- case EStage.Singing:
- return CBase.Graphics.GetScreen(EScreen.Song);
- default:
- throw new ArgumentException("Invalid stage: " + _Stage);
- }
- }
-
- private void _FadeToScreen()
- {
- CBase.Graphics.FadeTo(_GetNextScreen());
- }
-
- public void Next()
- {
- switch (_Stage)
- {
- case EStage.Config:
- _Stage = EStage.Names;
- break;
- case EStage.Names:
- _Stage = EStage.Main;
- CBase.Songs.ResetSongSung();
- GameData.ResultTable = new List();
- GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
- GameData.CurrentRoundNr = 1;
- GameData.Jokers = null;
- break;
- case EStage.Main:
- _Stage = EStage.Singing;
- _StartNextRound();
- break;
- case EStage.Singing:
- _Stage = EStage.Main;
- _UpdateScores();
- break;
- default:
- throw new ArgumentException("Invalid stage: " + _Stage);
- }
- _FadeToScreen();
- }
-
- public void Back()
- {
- switch (_Stage)
- {
- case EStage.Config:
- CBase.Graphics.FadeTo(EScreen.Party);
- return;
- case EStage.Names:
- _Stage = EStage.Config;
- break;
- case EStage.Main:
- _Stage = EStage.Names;
- break;
- default: // Rest is not allowed
- throw new ArgumentException("Invalid stage: " + _Stage);
- }
- _FadeToScreen();
- }
-
- public override IMenu GetStartScreen()
- {
- return _Screens["CPartyScreenChallengeRoundsConfig"];
- }
-
- public override SScreenSongOptions GetScreenSongOptions()
- {
- _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
- _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
- _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
-
- return _ScreenSongOptions;
- }
-
- // ReSharper disable RedundantAssignment
- public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
- // ReSharper restore RedundantAssignment
- {
- _ScreenSongOptions.Selection.SongIndex = -1;
-
- if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
- {
- _ScreenSongOptions.Selection.SelectNextRandomSong = false;
- _CreateCatSongIndices();
-
- if (GameData.CatSongIndices != null)
- {
- if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
- GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
- }
- }
-
- screenSongOptions = _ScreenSongOptions;
- }
-
- // ReSharper disable RedundantAssignment
- public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
- // ReSharper restore RedundantAssignment
- {
- if (GameData.CatSongIndices != null && categoryIndex != -1)
- {
- if (GameData.CatSongIndices[categoryIndex] == -1)
- _ScreenSongOptions.Selection.SelectNextRandomSong = true;
- else
- _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex];
- }
-
- if (GameData.CatSongIndices == null && categoryIndex != -1)
- _ScreenSongOptions.Selection.SelectNextRandomSong = true;
-
- if (categoryIndex == -1)
- _ScreenSongOptions.Selection.RandomOnly = false;
-
- if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1)
- _ScreenSongOptions.Selection.RandomOnly = true;
-
- screenSongOptions = _ScreenSongOptions;
- }
-
- public override void SetSearchString(string searchString, bool visible)
- {
- _ScreenSongOptions.Sorting.SearchString = searchString;
- _ScreenSongOptions.Sorting.SearchActive = visible;
- }
-
- public override void JokerUsed(int teamNr)
- {
- if (_ScreenSongOptions.Selection.NumJokers == null)
- return;
-
- if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length)
- return;
-
- if (!GameData.RefillJokers)
- {
- CRound round = GameData.Rounds[GameData.CurrentRoundNr - 1];
- GameData.Jokers[round.Players[teamNr]]--;
- }
- _ScreenSongOptions.Selection.NumJokers[teamNr]--;
- _ScreenSongOptions.Selection.RandomOnly = true;
- _ScreenSongOptions.Selection.CategoryChangeAllowed = false;
- }
-
- public override void SongSelected(int songID)
- {
- const EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
-
- CBase.Game.Reset();
- CBase.Game.ClearSongs();
- CBase.Game.AddSong(songID, gm);
- CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
-
- SPlayer[] players = CBase.Game.GetPlayers();
- if (players == null)
- return;
-
- if (players.Length < GameData.NumPlayerAtOnce)
- return;
-
- CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
-
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
- {
- //try to fill with the right data
- if (c != null)
- players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
- else
- players[i].ProfileID = -1;
- }
-
- CBase.Graphics.FadeTo(EScreen.Sing);
- }
-
- public override void LeavingHighscore()
- {
- CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID);
- GameData.CurrentRoundNr++;
- Next();
- }
-
- private void _StartNextRound()
- {
- _ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON;
- _ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON;
- _SetNumJokers();
- _SetTeamNames();
- GameData.CatSongIndices = null;
- }
-
- private void _SetNumJokers()
- {
- int[] jokers = new int[GameData.NumPlayerAtOnce];
- if (GameData.RefillJokers)
- {
- for (int i = 0; i < jokers.Length; i++)
- jokers[i] = GameData.NumJokers;
- }
- else
- {
- if (GameData.Jokers == null)
- {
- GameData.Jokers = new int[GameData.NumPlayer];
- for (int i = 0; i < GameData.ProfileIDs.Count; i++)
- {
- GameData.Jokers[i] = GameData.NumJokers;
- }
- }
- CRound round = GameData.Rounds[GameData.CurrentRoundNr - 1];
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
- {
- jokers[i] = GameData.Jokers[round.Players[i]];
- }
- }
- _ScreenSongOptions.Selection.NumJokers = jokers;
- }
-
- private void _SetTeamNames()
- {
- if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce)
- {
- _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
- return;
- }
-
- _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
- CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
-
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
- _ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Players[i]]);
- }
-
- private void _UpdateScores()
- {
- if (GameData.ResultTable.Count == 0)
- {
- for (int i = 0; i < GameData.NumPlayer; i++)
- {
- var row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
- GameData.ResultTable.Add(row);
- }
-
- 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;
- }
- }
- SPlayer[] results = CBase.Game.GetPlayers();
- if (results == null)
- return;
-
- if (results.Length < GameData.NumPlayerAtOnce)
- return;
-
- for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
- GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
-
- List points = _GetPointsForPlayer(results);
-
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
- {
- 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)
- continue;
- CResultTableRow row = GameData.ResultTable[index];
-
- row.NumPlayed++;
- row.NumWon += points[i].Won;
- row.NumSingPoints += points[i].SingPoints;
- row.NumGamePoints += points[i].GamePoints;
-
- GameData.ResultTable[index] = row;
- }
-
-
- GameData.ResultTable.Sort();
-
- //Update position-number
- int pos = 1;
- int lastPoints = 0;
- int lastSingPoints = 0;
- foreach (CResultTableRow resultRow in GameData.ResultTable)
- {
- if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
- pos++;
- resultRow.Position = pos;
- lastPoints = resultRow.NumGamePoints;
- lastSingPoints = resultRow.NumSingPoints;
- }
- }
-
- private List _GetPointsForPlayer(SPlayer[] results)
- {
- var result = new List();
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
- {
- var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
- result.Add(stat);
- }
-
- result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints));
-
- int current = result[result.Count - 1].SingPoints;
- int points = result.Count;
- bool wonset = false;
-
- for (int i = result.Count - 1; i >= 0; i--)
- {
- SStats res = result[i];
-
- if (i < result.Count - 1)
- {
- if (current > res.SingPoints)
- {
- res.GamePoints = i * 2;
- wonset = true;
- points = res.GamePoints;
- }
- else
- {
- if (!wonset)
- res.Won = 1;
- res.GamePoints = points;
- }
- }
- else
- {
- res.GamePoints = i * 2;
- res.Won = 1;
- }
-
- current = res.SingPoints;
-
- result[i] = res;
- }
-
-
- return result;
- }
-
- private void _CreateCatSongIndices()
- {
- if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
- {
- 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;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsConfig.cs b/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsConfig.cs
deleted file mode 100644
index 3df6418d..00000000
--- a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsConfig.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-#region license
-// This file is part of Vocaluxe.
-//
-// Vocaluxe is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Vocaluxe is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Vocaluxe. If not, see .
-#endregion
-
-using System;
-using System.Windows.Forms;
-
-namespace VocaluxeLib.PartyModes.ChallengeRounds
-{
- // ReSharper disable UnusedMember.Global
- public class CPartyScreenChallengeRoundsConfig : CPartyScreenChallengeRounds
- // ReSharper restore UnusedMember.Global
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 3; }
- }
-
- private const string _SelectSlideNumPlayers = "SelectSlideNumPlayers";
- private const string _SelectSlideNumMics = "SelectSlideNumMics";
- private const string _SelectSlideNumRounds = "SelectSlideNumRounds";
- private const string _SelectSlideNumJokers = "SelectSlideNumJokers";
- private const string _SelectSlideRefillJokers = "SelectSlideRefillJokers";
- private const string _ButtonNext = "ButtonNext";
- private const string _ButtonBack = "ButtonBack";
-
- private const int _MaxNumRounds = 100;
- private int _RoundSteps = 1;
-
- public override void Init()
- {
- base.Init();
-
- _ThemeSelectSlides = new string[] { _SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds, _SelectSlideNumJokers, _SelectSlideRefillJokers };
- _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
- }
-
- public override bool HandleInput(SKeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- _PartyMode.Back();
- break;
-
- case Keys.Enter:
- _UpdateSlides();
-
- if (_Buttons[_ButtonBack].Selected)
- _PartyMode.Back();
-
- if (_Buttons[_ButtonNext].Selected)
- _PartyMode.Next();
- break;
-
- case Keys.Left:
- _UpdateSlides();
- break;
-
- case Keys.Right:
- _UpdateSlides();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(SMouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
- {
- _UpdateSlides();
- if (_Buttons[_ButtonBack].Selected)
- _PartyMode.Back();
-
- if (_Buttons[_ButtonNext].Selected)
- _PartyMode.Next();
- }
-
- if (mouseEvent.RB)
- _PartyMode.Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- _RebuildSlides();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- private void _RebuildSlides()
- {
- // build num player slide (min player ... max player);
- _SelectSlides[_SelectSlideNumPlayers].Clear();
- for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
- _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
- _SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString();
-
- // build num joker slide 1 to 10
- _SelectSlides[_SelectSlideNumJokers].Clear();
- for (int i = 1; i <= 10; i++)
- {
- _SelectSlides[_SelectSlideNumJokers].AddValue(i.ToString());
- }
- _SelectSlides[_SelectSlideNumJokers].SelectedValue = "5";
-
- //build joker config slide
- _SelectSlides[_SelectSlideRefillJokers].Clear();
- _SelectSlides[_SelectSlideRefillJokers].AddValue(CBase.Language.Translate("TR_BUTTON_NO", PartyModeID));
- _SelectSlides[_SelectSlideRefillJokers].AddValue(CBase.Language.Translate("TR_BUTTON_YES", PartyModeID));
- _SelectSlides[_SelectSlideRefillJokers].SelectLastValue();
-
- _UpdateMicsAtOnce();
- _SetRoundSteps();
- _UpdateSlideRounds();
- }
-
- private void _UpdateSlides()
- {
- int player = _PartyMode.GameData.NumPlayer;
- int mics = _PartyMode.GameData.NumPlayerAtOnce;
- _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
- _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
- _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
- _PartyMode.GameData.NumJokers = _SelectSlides[_SelectSlideNumJokers].Selection + 1;
- _PartyMode.GameData.RefillJokers = (_SelectSlides[_SelectSlideRefillJokers].Selection == 1) ? true : false;
-
- _UpdateMicsAtOnce();
- _SetRoundSteps();
-
- if (player != _PartyMode.GameData.NumPlayer || mics != _PartyMode.GameData.NumPlayerAtOnce)
- {
- int num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce);
- while (num > _MaxNumRounds)
- num -= _RoundSteps;
- _PartyMode.GameData.NumRounds = num;
- }
-
- _UpdateSlideRounds();
- }
-
- private void _UpdateMicsAtOnce()
- {
- int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
-
- if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
- _PartyMode.GameData.NumPlayerAtOnce = maxNum;
-
- // build mics at once slide
- _SelectSlides[_SelectSlideNumMics].Clear();
- for (int i = 1; i <= maxNum; i++)
- _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
- _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
- }
-
- private void _UpdateSlideRounds()
- {
- // build num rounds slide
- _SelectSlides[_SelectSlideNumRounds].Clear();
- for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
- _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
- _SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1;
- }
-
- private void _SetRoundSteps()
- {
- if (_PartyMode.GameData.NumPlayerAtOnce < 1 || _PartyMode.GameData.NumPlayer < 1 || _PartyMode.GameData.NumPlayerAtOnce > _PartyMode.GameData.NumPlayer)
- {
- _RoundSteps = 1;
- return;
- }
-
- int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce;
- int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce;
-
- _RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsMain.cs b/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsMain.cs
deleted file mode 100644
index de7c7800..00000000
--- a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsMain.cs
+++ /dev/null
@@ -1,630 +0,0 @@
-#region license
-// This file is part of Vocaluxe.
-//
-// Vocaluxe is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Vocaluxe is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Vocaluxe. If not, see .
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.ChallengeRounds
-{
- struct STableRow
- {
- public CText Pos;
- public CText Name;
- public CText Rounds;
- public CText Won;
- public CText SingPoints;
- public CText GamePoints;
- }
-
- class CRoundsTableRow
- {
- public CText Number;
- public List TextPlayer;
- public List TextScores;
- }
-
- // ReSharper disable UnusedMember.Global
- public class CPartyScreenChallengeRoundsMain : CPartyScreenChallengeRounds
- // ReSharper restore UnusedMember.Global
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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";
-
- 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";
-
- private const string _StaticPopupBG = "StaticPopupBG";
- private const string _StaticNextPlayer = "StaticNextPlayer";
-
- private bool _ExitPopupVisible;
-
- private List _PlayerTable;
- private List _RoundsTable;
-
- private List _NextPlayerTexts;
- private List _NextPlayerStatics;
-
- private SRectF _RoundsTableScrollArea;
- private SRectF _PlayerTableScrollArea;
- private int _RoundsTableOffset;
- private int _PlayerTableOffset;
- private const int _NumPlayerVisible = 10;
- private int _NumRoundsVisible = 3;
-
- public override void Init()
- {
- 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};
- }
-
- public override void LoadTheme(string xmlPath)
- {
- base.LoadTheme(xmlPath);
-
- _BuildPlayerTable();
- _CreateRoundsTable();
- _NextPlayerTexts = new List();
- _NextPlayerStatics = new List();
-
- for (int i = 0; i < _PartyMode.MaxPlayers; i++)
- {
- _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
- _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
- _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
- _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
- }
- _Statics[_StaticNextPlayer].Visible = false;
- }
-
- public override bool HandleInput(SKeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- if (!_ExitPopupVisible)
- {
- if (_PartyMode.GameData.CurrentRoundNr == 1)
- _PartyMode.Back();
- else
- _ShowPopup(true);
- }
- else
- _ShowPopup(false);
- break;
-
- case Keys.Enter:
- if (!_ExitPopupVisible)
- {
- if (_Buttons[_ButtonNextRound].Selected)
- _PartyMode.Next();
- if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
- _PartyMode.Back();
- if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
- _ShowPopup(true);
- if (_Buttons[_ButtonPlayerScrollUp].Selected)
- _ScrollPlayerTable(-1);
- if (_Buttons[_ButtonPlayerScrollDown].Selected)
- _ScrollPlayerTable(1);
- if (_Buttons[_ButtonRoundsScrollUp].Selected)
- _ScrollRoundsTable(-1);
- if (_Buttons[_ButtonRoundsScrollDown].Selected)
- _ScrollRoundsTable(1);
- }
- else
- {
- if (_Buttons[_ButtonPopupYes].Selected)
- _EndParty();
- if (_Buttons[_ButtonPopupNo].Selected)
- _ShowPopup(false);
- }
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(SMouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
- {
- if (!_ExitPopupVisible)
- {
- if (_Buttons[_ButtonNextRound].Selected)
- _PartyMode.Next();
- if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
- _PartyMode.Back();
- if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
- _ShowPopup(true);
- if (_Buttons[_ButtonPlayerScrollUp].Selected)
- _ScrollPlayerTable(-1);
- if (_Buttons[_ButtonPlayerScrollDown].Selected)
- _ScrollPlayerTable(1);
- if (_Buttons[_ButtonRoundsScrollUp].Selected)
- _ScrollRoundsTable(-1);
- if (_Buttons[_ButtonRoundsScrollDown].Selected)
- _ScrollRoundsTable(1);
- }
- else
- {
- if (_Buttons[_ButtonPopupYes].Selected)
- _EndParty();
- if (_Buttons[_ButtonPopupNo].Selected)
- _ShowPopup(false);
- }
- }
-
- if (mouseEvent.RB)
- {
- if (!_ExitPopupVisible)
- {
- if (_PartyMode.GameData.CurrentRoundNr == 1)
- _PartyMode.Back();
- else
- _ShowPopup(true);
- }
- else
- _ShowPopup(false);
- }
-
- if (mouseEvent.Wheel != 0)
- {
- if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent))
- _ScrollRoundsTable(mouseEvent.Wheel);
- if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent))
- _ScrollPlayerTable(mouseEvent.Wheel);
- }
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- _PlayerTableOffset = 0;
- _RoundsTableOffset = 0;
-
- _UpdatePlayerTable();
- _UpdateNextPlayerPositions();
- _UpdateNextPlayerContents();
- if (_PartyMode.GameData.CurrentRoundNr == 1)
- _BuildRoundsTable();
- else
- _ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2);
- _UpdateRoundsTable();
-
- if (_PartyMode.GameData.CurrentRoundNr == 1)
- {
- _Buttons[_ButtonBack].Visible = true;
- _Buttons[_ButtonExit].Visible = false;
- }
- else
- {
- _Buttons[_ButtonBack].Visible = false;
- _Buttons[_ButtonExit].Visible = true;
- }
-
- if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
- {
- _Buttons[_ButtonNextRound].Visible = true;
- _Texts[_TextFinishMessage].Visible = false;
- _Texts[_TextFinishPlayerWin].Visible = false;
- _SelectElement(_Buttons[_ButtonNextRound]);
- }
- else
- {
- _Buttons[_ButtonNextRound].Visible = false;
- _Texts[_TextFinishMessage].Visible = true;
- _Texts[_TextFinishPlayerWin].Visible = true;
- _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
- _SelectElement(_Buttons[_ButtonExit]);
- }
-
- _ShowPopup(false);
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- private void _EndParty()
- {
- CBase.Graphics.FadeTo(EScreen.Party);
- }
-
- private void _ShowPopup(bool visible)
- {
- _ExitPopupVisible = visible;
-
- _Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
- _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
- _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
- _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
-
- if (_ExitPopupVisible)
- _SelectElement(_Buttons[_ButtonPopupNo]);
- }
-
- private void _UpdateNextPlayerPositions()
- {
- float x = (float)CBase.Settings.GetRenderW() / 2 -
- ((_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_PartyMode.GameData.NumPlayerAtOnce - 1) * 15)) / 2;
- const float staticY = 590;
- const float textY = 550;
- for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
- {
- //static
- _NextPlayerStatics[i].X = x;
- _NextPlayerStatics[i].Y = staticY;
- _NextPlayerStatics[i].Visible = true;
- //text
- _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2;
- _NextPlayerTexts[i].Y = textY;
- _NextPlayerTexts[i].Visible = true;
-
- x += _Statics[_StaticNextPlayer].Rect.W + 15;
- }
- for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
- {
- _NextPlayerStatics[i].Visible = false;
- _NextPlayerTexts[i].Visible = false;
- }
- }
-
- private void _UpdateNextPlayerContents()
- {
- if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
- {
- _Texts[_TextNextPlayerMessage].Visible = true;
- for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
- {
- int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
- _NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
- _NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
- _NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
- }
- }
- else
- {
- _Texts[_TextNextPlayerMessage].Visible = false;
- for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
- {
- _NextPlayerStatics[i].Visible = false;
- _NextPlayerTexts[i].Visible = false;
- }
- }
- }
-
- private void _CreateRoundsTable()
- {
- //Create lists
- _RoundsTable = new List();
- for (int i = 0; i < 5; i++)
- {
- var rtr = new CRoundsTableRow {TextPlayer = new List(), TextScores = new List()};
- _RoundsTable.Add(rtr);
- }
- //Create statics and texts for rounds
- foreach (CRoundsTableRow roundRow in _RoundsTable)
- {
- //Round-number
- CText text = GetNewText(_Texts[_TextRoundNumber]);
- _AddText(text);
- roundRow.Number = text;
- for (int row = 0; row < 2; row++)
- {
- for (int column = 0; column < 3; column++)
- {
- //Player
- text = GetNewText(_Texts[_TextRoundPlayer]);
- _AddText(text);
- roundRow.TextPlayer.Add(text);
- //Score
- text = GetNewText(_Texts[_TextRoundScore]);
- _AddText(text);
- roundRow.TextScores.Add(text);
- }
- }
- }
- }
-
- private void _BuildRoundsTable()
- {
- _RoundsTableScrollArea = new SRectF();
-
- const int numPlayerInOneRow = 3;
- _NumRoundsVisible = _PartyMode.GameData.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
-
- if (_NumRoundsVisible > _PartyMode.GameData.Rounds.Count)
- _NumRoundsVisible = _PartyMode.GameData.Rounds.Count;
-
- float numberX = _Texts[_TextRoundNumber].X;
- float numberY = _Texts[_TextRoundNumber].Y;
-
- _RoundsTableScrollArea.X = numberX;
- _RoundsTableScrollArea.Y = numberY;
- _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20;
-
- float delta = _Texts[_TextRoundNumber].Rect.H;
-
- //Update statics and texts for rounds
- foreach (CRoundsTableRow roundRow in _RoundsTable)
- {
- //Round-number
- roundRow.Number.X = numberX;
- roundRow.Number.Y = numberY;
- var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / ((double)numPlayerInOneRow));
- for (int row = 0; row < numInnerRows; row++)
- {
- int num = (row + 1) * numPlayerInOneRow;
- int numPlayerInThisRow = numPlayerInOneRow;
- if (num > _PartyMode.GameData.NumPlayerAtOnce)
- {
- num = _PartyMode.GameData.NumPlayerAtOnce;
- numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow);
- }
- for (int column = row * numPlayerInOneRow; column < num; column++)
- {
- //Player
- float x = numberX + 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;
- roundRow.TextPlayer[column].X = x;
- roundRow.TextPlayer[column].Y = numberY;
- roundRow.TextPlayer[column].W = maxw;
- //Score
- roundRow.TextScores[column].X = x;
- roundRow.TextScores[column].Y = numberY + delta;
- roundRow.TextScores[column].W = maxw;
- }
- numberY = numberY + 2 * delta;
- }
- numberY = numberY + delta / 2;
- }
- _RoundsTableScrollArea.H = numberY - _RoundsTableScrollArea.Y;
- }
-
- private void _UpdateRoundsTable()
- {
- for (int i = 0; i < _RoundsTable.Count; i++)
- {
- for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
- {
- if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players.Count > p)
- {
- _RoundsTable[i].Number.Visible = true;
- _RoundsTable[i].TextPlayer[p].Visible = true;
- _RoundsTable[i].TextScores[p].Visible = true;
- _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
- _RoundsTable[i].TextPlayer[p].Text =
- CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players[p]]);
- // ReSharper disable ConvertIfStatementToConditionalTernaryExpression
- if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
- // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
- _RoundsTable[i].TextScores[p].Text = _PartyMode.GameData.Results[i + _RoundsTableOffset, p].ToString();
- else
- _RoundsTable[i].TextScores[p].Text = "";
- }
- else
- {
- _RoundsTable[i].TextPlayer[p].Visible = false;
- _RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- if (_PartyMode.GameData.Rounds.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
- {
- _RoundsTable[i].Number.Visible = false;
- for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
- {
- _RoundsTable[i].TextPlayer[p].Visible = false;
- _RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- }
-
- _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
- _Buttons[_ButtonRoundsScrollDown].Visible = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
- }
-
- private void _BuildPlayerTable()
- {
- _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X};
-
- _PlayerTable = new List();
- float delta = _Texts[_TextPosition].Rect.H * 1.2f;
-
- float h = 0;
-
- for (int i = 0; i < 10; i++)
- {
- var row = new STableRow
- {
- Pos = GetNewText(_Texts[_TextPosition]),
- Name = GetNewText(_Texts[_TextPlayerName]),
- Rounds = GetNewText(_Texts[_TextNumPlayed]),
- Won = GetNewText(_Texts[_TextWon]),
- SingPoints = GetNewText(_Texts[_TextSingPoints]),
- GamePoints = GetNewText(_Texts[_TextGamePoints])
- };
-
- row.Pos.Y += delta * (i + 1);
- row.Name.Y += delta * (i + 1);
- row.Rounds.Y += delta * (i + 1);
- row.Won.Y += delta * (i + 1);
- row.SingPoints.Y += delta * (i + 1);
- row.GamePoints.Y += delta * (i + 1);
-
- row.Pos.Text = (i + 1) + ".";
-
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
-
- _AddText(row.Pos);
- _AddText(row.Name);
- _AddText(row.Rounds);
- _AddText(row.Won);
- _AddText(row.SingPoints);
- _AddText(row.GamePoints);
-
- _PlayerTable.Add(row);
-
- h = delta * (i + 1);
- }
- _PlayerTableScrollArea.H = h + delta;
- }
-
- private void _UpdatePlayerTable()
- {
- for (int i = 0; i < _PlayerTable.Count; i++)
- {
- STableRow row = _PlayerTable[i];
-
- if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count)
- {
- row.Pos.Visible = true;
- row.Name.Visible = true;
- row.Rounds.Visible = true;
- row.Won.Visible = true;
- row.SingPoints.Visible = true;
- row.GamePoints.Visible = true;
-
- row.Pos.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].Position + ".";
- row.Name.Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i + _PlayerTableOffset].PlayerID);
- row.Rounds.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
- row.Won.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
- row.SingPoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
- row.GamePoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString();
- }
- else
- {
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
- }
- }
-
- _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
- _Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
- }
-
- private void _ScrollPlayerTable(int offset)
- {
- if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible)
- _PlayerTableOffset = 0;
- else if (offset < 0 && _PlayerTableOffset + offset >= 0)
- _PlayerTableOffset += offset;
- else if (offset < 0 && _PlayerTableOffset + offset < 0)
- _PlayerTableOffset = 0;
- else if (offset > 0 && _PlayerTableOffset + offset <= _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
- _PlayerTableOffset += offset;
- else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
- _PlayerTableOffset = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible;
-
- _UpdatePlayerTable();
- }
-
- private void _ScrollRoundsTable(int offset)
- {
- if (_PartyMode.GameData.Rounds.Count <= _NumRoundsVisible)
- _RoundsTableOffset = 0;
- else if (offset < 0 && _RoundsTableOffset + offset >= 0)
- _RoundsTableOffset += offset;
- else if (offset < 0 && _RoundsTableOffset + offset < 0)
- _RoundsTableOffset = 0;
- else if (offset > 0 && _RoundsTableOffset + offset <= _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
- _RoundsTableOffset += offset;
- else if (offset > 0 && _RoundsTableOffset + offset > _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
- _RoundsTableOffset = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible;
-
- _UpdateRoundsTable();
- }
-
- private string _GetPlayerWinString()
- {
- string s = "";
-
- for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++)
- {
- if (_PartyMode.GameData.ResultTable[i].Position == 1)
- {
- if (i > 0)
- s += ", ";
- s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerID);
- }
- else
- break;
- }
-
- return s;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsNames.cs b/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsNames.cs
deleted file mode 100644
index 006c29cc..00000000
--- a/PartyModes/PartyModeChallengeRounds/CPartyScreenChallengeRoundsNames.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-#region license
-// This file is part of Vocaluxe.
-//
-// Vocaluxe is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Vocaluxe is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Vocaluxe. If not, see .
-#endregion
-
-using System.Collections.Generic;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.ChallengeRounds
-{
- // ReSharper disable UnusedMember.Global
- public class CPartyScreenChallengeRoundsNames : CMenuPartyNameSelection
- // ReSharper restore UnusedMember.Global
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- private new CPartyModeChallengeRounds _PartyMode;
-
- public override void Init()
- {
- base.Init();
- _PartyMode = (CPartyModeChallengeRounds)base._PartyMode;
- _AllowChangePlayerNum = false;
- }
-
- public override void OnShow()
- {
- base.OnShow();
- SetPartyModeData(_PartyMode.GameData.NumPlayer);
- while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
- _PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
-
- List[] ids = new List[] {_PartyMode.GameData.ProfileIDs};
- SetPartyModeProfiles(ids);
- }
-
- public override void Back()
- {
- if (_TeamList.Length == 1)
- _PartyMode.GameData.ProfileIDs = _TeamList[0];
- _PartyMode.Back();
- }
-
- public override void Next()
- {
- if (_TeamList.Length == 1)
- _PartyMode.GameData.ProfileIDs = _TeamList[0];
- _PartyMode.Next();
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeRounds/GlobalSuppressions.cs b/PartyModes/PartyModeChallengeRounds/GlobalSuppressions.cs
deleted file mode 100644
index e661ff03..00000000
Binary files a/PartyModes/PartyModeChallengeRounds/GlobalSuppressions.cs and /dev/null differ
diff --git a/PartyModes/PartyModeChallengeRounds/PartyModeChallengeRounds.csproj b/PartyModes/PartyModeChallengeRounds/PartyModeChallengeRounds.csproj
deleted file mode 100644
index c3d7669e..00000000
--- a/PartyModes/PartyModeChallengeRounds/PartyModeChallengeRounds.csproj
+++ /dev/null
@@ -1,110 +0,0 @@
-
-
-
-
- DebugWin
- AnyCPU
- {AB4194D5-3B86-4915-8417-83D3AC2B6DFE}
- Library
- Properties
- VocaluxeLib.PartyModes.ChallengeRounds
- ChallengeRounds
- v4.0
- 512
- Client
-
-
- AnyCPU
- true
- full
- false
- bin
- TRACE;DEBUG;WIN
- prompt
- 4
- Off
- ..\..\CheckingRules.ruleset
-
-
- AnyCPU
- none
- true
- bin
- prompt
- 4
- false
- WIN
- Off
-
-
- AnyCPU
- true
- full
- false
- bin
- TRACE;DEBUG;LINUX
- prompt
- 4
- Off
-
-
- AnyCPU
- none
- true
- bin
- prompt
- 4
- false
- LINUX
- Off
-
-
- bin
- WIN
- true
- AnyCPU
- false
- Off
- prompt
- ManagedMinimumRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {d2b6ddef-e0e1-4ddf-a73a-e6acef5c95ec}
- VocaluxeLib
-
-
-
-
-
-
-
- if exist "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" rd "$(SolutionDir)Output\PartyModes\$(TargetName)\Code" /S /Q
-cd $(SolutionDir)Partymodes\
-xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y
- rm -rf "$(SolutionDir)Output\PartyModes\$(TargetName)\Code"
-mkdir -p "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\"
-cp -R $(ProjectDir)*.cs "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\"
-rm -f "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\GlobalSuppressions.cs"
-
-
-
-
\ No newline at end of file
diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuListRecord.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuListRecord.cs
index cd2e175d..b355eb33 100644
--- a/VocaluxeLib/Menu/SongMenu/CSongMenuListRecord.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSongMenuListRecord.cs
@@ -135,39 +135,6 @@ namespace VocaluxeLib.Menu.SongMenu
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
}
- public override bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
- {
- string item = xmlPath + "/" + elementName;
-
- bool themeLoaded = true;
- themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader);
-
-
- themeLoaded &= _Artist.LoadTheme(item + "/SongMenuListRecord", "TextArtist", xmlReader);
- themeLoaded &= _Title.LoadTheme(item + "/SongMenuListRecord", "TextTitle", xmlReader);
- themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuListRecord", "TextSongLength", xmlReader);
-
- themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuListRecord", "StaticCoverBig", xmlReader);
- themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuListRecord", "StaticTextBG", xmlReader);
- themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuListRecord", "StaticDuetIcon", xmlReader);
- themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuListRecord", "StaticVideoIcon", xmlReader);
- themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuListRecord", "StaticMedleyCalcIcon", xmlReader);
- themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuListRecord", "StaticMedleyTagIcon", xmlReader);
-
- if (themeLoaded)
- {
- _Theme.Name = elementName;
-
- _ReadSubTheme();
- _SubElements.Clear();
- _SubElements.AddRange(new IMenuElement[] { _Artist, _Title, _SongLength, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon });
- LoadSkin();
- Init();
- }
-
- return themeLoaded;
- }
-
private void _ReadSubTheme()
{
_Theme.SongMenuListRecord.TextArtist = (SThemeText)_Artist.GetTheme();