Apply R# clean-up for reliability (#877)
* Apply R# clean-up for reliability - Migrate to NUnit4 Assert.That - Update dependencise versions - Fix LangVersion to 9.0 (until net core migration) - Reformat code - Apply 'var' style (easier for refactoring) - Remove redundant parentheses - Add braces on every condition blocks (1 line) - Uses new null checking patterns - Uses AutoProperties when possible - Uses string scalar type instead of class - Clean usings - Add .orig files in git ignore - Rename some properties to respect defined conventions and US format definition - ID -> Id - BPM -> Bpm - Finish -> End * Update R# settings according to the clean-up made
This commit is contained in:
1 parent
b9b0f7c8df
commit
6ffa63b923
236 files changed
+14194
-7278
No files matched your search
@@ -40,16 +40,20 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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<CRound> old = new List<CRound>(_Rounds);
|
||||
var old = new List<CRound>(_Rounds);
|
||||
_Rounds.Clear();
|
||||
_BuildRounds(numRounds, numPlayer, playersPerRound);
|
||||
if (Count > old.Count)
|
||||
@@ -66,50 +70,60 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
/// <param name="numSung">List matching the playerIndex to the number of songs sung</param>
|
||||
private static List<int> _GetPlayersForRound(IList<int> numSung)
|
||||
{
|
||||
List<int> mustSing = new List<int>();
|
||||
int max = numSung.Max();
|
||||
for (int i = 0; i < numSung.Count; i++)
|
||||
var mustSing = new List<int>();
|
||||
var max = numSung.Max();
|
||||
for (var i = 0; i < numSung.Count; i++)
|
||||
{
|
||||
if (numSung[i] < max)
|
||||
{
|
||||
mustSing.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return mustSing;
|
||||
}
|
||||
|
||||
private static void _AddCombinations(int numPlayer, int playersPerRound, List<CRound> combinations)
|
||||
{
|
||||
List<int> input = new List<int>(numPlayer);
|
||||
for (int i = 0; i < numPlayer; i++)
|
||||
var input = new List<int>(numPlayer);
|
||||
for (var i = 0; i < numPlayer; i++)
|
||||
{
|
||||
input.Add(i);
|
||||
CCombinations<int> combs = new CCombinations<int>(input, playersPerRound);
|
||||
}
|
||||
|
||||
var combs = new CCombinations<int>(input, playersPerRound);
|
||||
combinations.AddRange(combs.Select(combination => new CRound(combination)));
|
||||
combinations.Shuffle();
|
||||
}
|
||||
|
||||
private static CRound _GetMatchingCombination(List<int> playersInRound, List<int> numSung, List<CRound> combinations)
|
||||
{
|
||||
foreach (CRound round in combinations)
|
||||
foreach (var round in combinations)
|
||||
{
|
||||
int matching = round.Players.Count(playersInRound.Contains);
|
||||
var 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<CRound> nextOptions = combinations.Where(c => c.Players.Count(playersInRound.Contains) == maxMatching).ToList();
|
||||
var maxMatching = combinations.Max(c => c.Players.Count(playersInRound.Contains));
|
||||
var 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)
|
||||
var minSung = int.MaxValue;
|
||||
foreach (var round in nextOptions)
|
||||
{
|
||||
int curNumSung = round.Players.Sum(pl => numSung[pl]);
|
||||
var curNumSung = round.Players.Sum(pl => numSung[pl]);
|
||||
if (curNumSung < minSung)
|
||||
{
|
||||
minSung = curNumSung;
|
||||
result = round;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Assert(result != null);
|
||||
return result;
|
||||
}
|
||||
@@ -118,24 +132,35 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// What we want is that every player sung the same amount of songs
|
||||
// So we keep track how many songs each palyer sung
|
||||
List<int> numSung = new List<int>(numPlayer);
|
||||
for (int i = 0; i < numPlayer; i++)
|
||||
var numSung = new List<int>(numPlayer);
|
||||
for (var i = 0; i < numPlayer; i++)
|
||||
{
|
||||
numSung.Add(0);
|
||||
List<CRound> combinations = new List<CRound>();
|
||||
}
|
||||
|
||||
var combinations = new List<CRound>();
|
||||
// Posibly add more rounds than requested if the song count per player is unequal
|
||||
for (int i = 0; i < numRounds * 10; i++)
|
||||
for (var i = 0; i < numRounds * 10; i++)
|
||||
{
|
||||
if (combinations.Count == 0)
|
||||
{
|
||||
_AddCombinations(numPlayer, playersPerRound, combinations);
|
||||
List<int> playersInRound = _GetPlayersForRound(numSung);
|
||||
CRound curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
|
||||
foreach (int player in curRound.Players)
|
||||
}
|
||||
|
||||
var playersInRound = _GetPlayersForRound(numSung);
|
||||
var curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
|
||||
foreach (var 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Game;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Utils;
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@@ -31,7 +29,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public class CResultTableRow : IComparable
|
||||
{
|
||||
public int Position;
|
||||
public Guid PlayerID;
|
||||
public Guid PlayerId;
|
||||
public int NumPlayed;
|
||||
public int NumWon;
|
||||
public int NumSingPoints;
|
||||
@@ -42,13 +40,16 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
var row = obj as CResultTableRow;
|
||||
if (row != null)
|
||||
{
|
||||
int res = row.NumGamePoints.CompareTo(NumGamePoints);
|
||||
var res = row.NumGamePoints.CompareTo(NumGamePoints);
|
||||
if (res == 0)
|
||||
{
|
||||
res = row.NumSingPoints.CompareTo(NumSingPoints);
|
||||
if (res == 0)
|
||||
{
|
||||
res = row.NumWon.CompareTo(NumWon);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
public sealed class CPartyModeChallenge : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
public override int MinMics
|
||||
{
|
||||
@@ -123,12 +124,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public int NumJokers;
|
||||
public bool RefillJokers;
|
||||
public int[] Jokers;
|
||||
public List<Guid> ProfileIDs;
|
||||
public List<Guid> ProfileIds;
|
||||
|
||||
public ESongSource SongSource;
|
||||
public ESongSorting Sorting;
|
||||
public int CategoryIndex;
|
||||
public int PlaylistID;
|
||||
public int PlaylistId;
|
||||
|
||||
public EGameMode GameMode;
|
||||
public int NumMedleySongs;
|
||||
@@ -144,7 +145,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private struct SStats
|
||||
{
|
||||
public Guid ProfileID;
|
||||
public Guid ProfileId;
|
||||
public int SingPoints;
|
||||
public int GamePoints;
|
||||
public int Won;
|
||||
@@ -158,13 +159,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_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 int[] { 5, 5 };
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchString = string.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistId = -1;
|
||||
|
||||
GameData = new SData
|
||||
{
|
||||
@@ -174,10 +175,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
NumJokers = 5,
|
||||
RefillJokers = true,
|
||||
CurrentRoundNr = 1,
|
||||
ProfileIDs = new List<Guid>(),
|
||||
ProfileIds = new List<Guid>(),
|
||||
Sorting = CBase.Config.GetSongSorting(),
|
||||
SongSource = ESongSource.TR_SONGSOURCE_ALLSONGS,
|
||||
PlaylistID = 0,
|
||||
PlaylistId = 0,
|
||||
CategoryIndex = 0,
|
||||
GameMode = EGameMode.TR_GAMEMODE_NORMAL,
|
||||
NumMedleySongs = 5,
|
||||
@@ -197,7 +198,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Selection.CategoryIndex = -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<CResultTableRow>();
|
||||
}
|
||||
@@ -205,16 +208,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public override bool Init()
|
||||
{
|
||||
if (!base.Init())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetDefaults();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void UpdateGame()
|
||||
{
|
||||
|
||||
}
|
||||
public override void UpdateGame() { }
|
||||
|
||||
private IMenu _GetNextScreen()
|
||||
{
|
||||
@@ -272,6 +274,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Stage = EStage.SongSelection;
|
||||
_PrepareSongSelection();
|
||||
}
|
||||
|
||||
break;
|
||||
case EStage.SongSelection:
|
||||
_Stage = EStage.Singing;
|
||||
@@ -284,6 +287,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
@@ -306,6 +310,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
default: // Rest is not allowed
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
@@ -322,7 +327,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
|
||||
{
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = false;
|
||||
}
|
||||
|
||||
_ScreenSongOptions.Selection.SongIndex = songIndex;
|
||||
|
||||
@@ -358,24 +365,29 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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];
|
||||
var 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)
|
||||
public override void SongSelected(int songId)
|
||||
{
|
||||
_PrepareRound(new int[] { songID });
|
||||
_PrepareRound(new int[] { songId });
|
||||
|
||||
Next();
|
||||
}
|
||||
@@ -383,8 +395,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public override void LeavingHighscore()
|
||||
{
|
||||
//Remember sung songs, so they don't will be selected a second time
|
||||
for(int i = 0; i < CBase.Game.GetNumSongs(); i++)
|
||||
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).ID);
|
||||
for (var i = 0; i < CBase.Game.GetNumSongs(); i++)
|
||||
{
|
||||
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).Id);
|
||||
}
|
||||
|
||||
GameData.CurrentRoundNr++;
|
||||
|
||||
@@ -397,17 +411,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private void _PrepareMedleyRound()
|
||||
{
|
||||
//Select songs for medley
|
||||
int[] songIDs = new int[GameData.NumMedleySongs];
|
||||
for (int i = 0; i < GameData.NumMedleySongs; i++)
|
||||
var songIds = new int[GameData.NumMedleySongs];
|
||||
for (var i = 0; i < GameData.NumMedleySongs; i++)
|
||||
{
|
||||
if (GameData.Songs.Count == 0)
|
||||
{
|
||||
_UpdateSongList();
|
||||
}
|
||||
|
||||
songIDs[i] = GameData.Songs[0];
|
||||
songIds[i] = GameData.Songs[0];
|
||||
GameData.Songs.RemoveAt(0);
|
||||
}
|
||||
|
||||
_PrepareRound(songIDs);
|
||||
_PrepareRound(songIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -425,7 +441,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case ESongSource.TR_SONGSOURCE_ALLSONGS:
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistId = -1;
|
||||
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
_ScreenSongOptions.Selection.CategoryIndex = -1;
|
||||
@@ -435,7 +451,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case ESongSource.TR_SONGSOURCE_CATEGORY:
|
||||
_ScreenSongOptions.Sorting.SongSorting = GameData.Sorting;
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = -1;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistId = -1;
|
||||
|
||||
_ScreenSongOptions.Selection.CategoryIndex = GameData.CategoryIndex;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
|
||||
@@ -444,7 +460,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case ESongSource.TR_SONGSOURCE_PLAYLIST:
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistID = GameData.PlaylistID;
|
||||
_ScreenSongOptions.Sorting.FilterPlaylistId = GameData.PlaylistId;
|
||||
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
|
||||
break;
|
||||
@@ -457,9 +473,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
/// <summary>
|
||||
/// Prepare next game and fill song queue based on configuration and given songs.
|
||||
/// </summary>
|
||||
/// <param name="songIDs">Array of SongIDs that are selected</param>
|
||||
/// <param name="songIds">Array of SongIds that are selected</param>
|
||||
/// <returns>false, if something can't setup correctly</returns>
|
||||
private bool _PrepareRound(int[] songIDs)
|
||||
private bool _PrepareRound(int[] songIds)
|
||||
{
|
||||
//Reset game
|
||||
CBase.Game.Reset();
|
||||
@@ -467,73 +483,86 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
#region PlayerNames
|
||||
CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
var players = CBase.Game.GetPlayers();
|
||||
if (players == null || players.Length < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get current round
|
||||
CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
|
||||
var c = GameData.Rounds[GameData.CurrentRoundNr - 1];
|
||||
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
for (var i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//try to fill with correct player data
|
||||
if (c != null)
|
||||
players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
|
||||
{
|
||||
players[i].ProfileId = GameData.ProfileIds[c.Players[i]];
|
||||
}
|
||||
else
|
||||
players[i].ProfileID = Guid.Empty;
|
||||
{
|
||||
players[i].ProfileId = Guid.Empty;
|
||||
}
|
||||
}
|
||||
#endregion PlayerNames
|
||||
|
||||
#region SongQueue
|
||||
//Add all songs with configure game mode to song queue
|
||||
for (int i = 0; i < songIDs.Length; i++)
|
||||
CBase.Game.AddSong(songIDs[i], GameData.GameMode);
|
||||
for (var i = 0; i < songIds.Length; i++)
|
||||
{
|
||||
CBase.Game.AddSong(songIds[i], GameData.GameMode);
|
||||
}
|
||||
#endregion SongQueue
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void _SetNumJokers()
|
||||
{
|
||||
int[] jokers = new int[GameData.NumPlayerAtOnce];
|
||||
var jokers = new int[GameData.NumPlayerAtOnce];
|
||||
if (GameData.RefillJokers)
|
||||
{
|
||||
for (int i = 0; i < jokers.Length; i++)
|
||||
jokers[i] = GameData.NumJokers;
|
||||
{
|
||||
for (var 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++)
|
||||
for (var 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++)
|
||||
|
||||
var round = GameData.Rounds[GameData.CurrentRoundNr - 1];
|
||||
for (var 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)
|
||||
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIds.Count < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
|
||||
return;
|
||||
}
|
||||
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
|
||||
CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
|
||||
var 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]]);
|
||||
for (var i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIds[c.Players[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -543,37 +572,43 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private void _UpdateSongList()
|
||||
{
|
||||
if (GameData.Songs.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (GameData.SongSource)
|
||||
{
|
||||
case ESongSource.TR_SONGSOURCE_PLAYLIST:
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
|
||||
for (var i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistId); i++)
|
||||
{
|
||||
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID;
|
||||
if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(EGameMode.TR_GAMEMODE_MEDLEY))
|
||||
var id = CBase.Playlist.GetSong(GameData.PlaylistId, i).SongId;
|
||||
if (CBase.Songs.GetSongById(id).IsGameModeAvailable(EGameMode.TR_GAMEMODE_MEDLEY))
|
||||
{
|
||||
GameData.Songs.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ESongSource.TR_SONGSOURCE_ALLSONGS:
|
||||
ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs();
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(EGameMode.TR_GAMEMODE_MEDLEY)).Select(song => song.ID));
|
||||
var avSongs = CBase.Songs.GetSongs();
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_MEDLEY)).Select(song => song.Id));
|
||||
break;
|
||||
|
||||
case ESongSource.TR_SONGSOURCE_CATEGORY:
|
||||
//Save old sorting to roll it back after getting songs for configured category
|
||||
ESongSorting oldSorting = CBase.Config.GetSongSorting();
|
||||
CBase.Songs.SortSongs(GameData.Sorting, EOffOn.TR_CONFIG_ON, CBase.Config.GetIgnoreArticles() ,String.Empty, EDuetOptions.NoDuets, -1);
|
||||
var oldSorting = CBase.Config.GetSongSorting();
|
||||
CBase.Songs.SortSongs(GameData.Sorting, EOffOn.TR_CONFIG_ON, CBase.Config.GetIgnoreArticles(), string.Empty, EDuetOptions.NoDuets, -1);
|
||||
|
||||
CBase.Songs.SetCategory(GameData.CategoryIndex);
|
||||
avSongs = CBase.Songs.GetVisibleSongs();
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(EGameMode.TR_GAMEMODE_MEDLEY)).Select(song => song.ID));
|
||||
GameData.Songs.AddRange(avSongs.Where(song => song.IsGameModeAvailable(EGameMode.TR_GAMEMODE_MEDLEY)).Select(song => song.Id));
|
||||
|
||||
CBase.Songs.SetCategory(-1);
|
||||
CBase.Songs.SortSongs(oldSorting, CBase.Config.GetTabs(), CBase.Config.GetIgnoreArticles(), String.Empty, EDuetOptions.NoDuets, -1);
|
||||
CBase.Songs.SortSongs(oldSorting, CBase.Config.GetTabs(), CBase.Config.GetIgnoreArticles(), string.Empty, EDuetOptions.NoDuets, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
GameData.Songs.Shuffle();
|
||||
}
|
||||
|
||||
@@ -582,41 +617,46 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
//Prepare results table
|
||||
if (GameData.ResultTable.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < GameData.NumPlayer; i++)
|
||||
for (var i = 0; i < GameData.NumPlayer; i++)
|
||||
{
|
||||
var row = new CResultTableRow { PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0 };
|
||||
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 (var i = 0; i < GameData.NumRounds; i++)
|
||||
{
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
for (var j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
{
|
||||
GameData.Results[i, j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Get points from game
|
||||
CPoints points = CBase.Game.GetPoints();
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
var points = CBase.Game.GetPoints();
|
||||
var players = CBase.Game.GetPlayers();
|
||||
|
||||
//Go over all rounds and sum up points
|
||||
for (int round = 0; round < points.NumRounds; round++)
|
||||
for (var round = 0; round < points.NumRounds; round++)
|
||||
{
|
||||
SPlayer[] res = points.GetPlayer(round, GameData.NumPlayerAtOnce);
|
||||
var res = points.GetPlayer(round, GameData.NumPlayerAtOnce);
|
||||
|
||||
if (res == null || res.Length < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
for (var p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
{
|
||||
players[p].Points += res[p].Points;
|
||||
players[p].PointsGoldenNotes += res[p].PointsGoldenNotes;
|
||||
players[p].PointsLineBonus += res[p].PointsLineBonus;
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate average points
|
||||
for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
for (var p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
{
|
||||
players[p].Points /= points.NumRounds;
|
||||
players[p].PointsGoldenNotes /= points.NumRounds;
|
||||
@@ -626,15 +666,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
GameData.Results[GameData.CurrentRoundNr - 2, p] = (int)Math.Round(players[p].Points);
|
||||
}
|
||||
|
||||
List<SStats> stats = _GetPointsForPlayer(players);
|
||||
var stats = _GetPointsForPlayer(players);
|
||||
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
for (var i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//Find matching row in results table
|
||||
int index = -1;
|
||||
for (int j = 0; j < GameData.ResultTable.Count; j++)
|
||||
var index = -1;
|
||||
for (var j = 0; j < GameData.ResultTable.Count; j++)
|
||||
{
|
||||
if (stats[i].ProfileID == GameData.ResultTable[j].PlayerID)
|
||||
if (stats[i].ProfileId == GameData.ResultTable[j].PlayerId)
|
||||
{
|
||||
index = j;
|
||||
break;
|
||||
@@ -642,8 +682,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
continue;
|
||||
CResultTableRow row = GameData.ResultTable[index];
|
||||
}
|
||||
|
||||
var row = GameData.ResultTable[index];
|
||||
|
||||
//Update results entry
|
||||
row.NumPlayed++;
|
||||
@@ -657,13 +700,16 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
GameData.ResultTable.Sort();
|
||||
|
||||
//Update position-number
|
||||
int pos = 1;
|
||||
int lastPoints = 0;
|
||||
int lastSingPoints = 0;
|
||||
foreach (CResultTableRow resultRow in GameData.ResultTable)
|
||||
var pos = 1;
|
||||
var lastPoints = 0;
|
||||
var lastSingPoints = 0;
|
||||
foreach (var resultRow in GameData.ResultTable)
|
||||
{
|
||||
if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
|
||||
resultRow.Position = pos;
|
||||
lastPoints = resultRow.NumGamePoints;
|
||||
lastSingPoints = resultRow.NumSingPoints;
|
||||
@@ -673,21 +719,21 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private List<SStats> _GetPointsForPlayer(SPlayer[] results)
|
||||
{
|
||||
var result = new List<SStats>();
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
for (var 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};
|
||||
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;
|
||||
var current = result[result.Count - 1].SingPoints;
|
||||
var points = result.Count;
|
||||
var wonset = false;
|
||||
|
||||
for (int i = result.Count - 1; i >= 0; i--)
|
||||
for (var i = result.Count - 1; i >= 0; i--)
|
||||
{
|
||||
SStats res = result[i];
|
||||
var res = result[i];
|
||||
|
||||
if (i < result.Count - 1)
|
||||
{
|
||||
@@ -700,7 +746,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
else
|
||||
{
|
||||
if (!wonset)
|
||||
{
|
||||
res.Won = 1;
|
||||
}
|
||||
|
||||
res.GamePoints = points;
|
||||
}
|
||||
}
|
||||
@@ -719,4 +768,4 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeConfig : CPartyScreenChallenge
|
||||
// ReSharper restore UnusedMember.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
@@ -46,14 +46,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] { _SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds, _SelectSlideNumJokers, _SelectSlideRefillJokers };
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
_ThemeButtons = new string[] { _ButtonNext, _ButtonBack };
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
|
||||
if (keyEvent.KeyPressed) {}
|
||||
if (keyEvent.KeyPressed) { }
|
||||
else
|
||||
{
|
||||
switch (keyEvent.Key)
|
||||
@@ -67,10 +67,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_UpdateSlides();
|
||||
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
{
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
{
|
||||
_PartyMode.Next();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -82,6 +87,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -93,14 +99,20 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
{
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
{
|
||||
_PartyMode.Next();
|
||||
}
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -121,22 +133,26 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// build num player slide (min player ... max player);
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
|
||||
for (var 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++)
|
||||
for (var 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].AddValue(CBase.Language.Translate("TR_BUTTON_NO", PartyModeId));
|
||||
_SelectSlides[_SelectSlideRefillJokers].AddValue(CBase.Language.Translate("TR_BUTTON_YES", PartyModeId));
|
||||
_SelectSlides[_SelectSlideRefillJokers].SelectLastValue();
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
@@ -146,22 +162,25 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
int player = _PartyMode.GameData.NumPlayer;
|
||||
int mics = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
var player = _PartyMode.GameData.NumPlayer;
|
||||
var 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;
|
||||
_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);
|
||||
var num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce);
|
||||
while (num > _MaxNumRounds)
|
||||
{
|
||||
num -= _RoundSteps;
|
||||
}
|
||||
|
||||
_PartyMode.GameData.NumRounds = num;
|
||||
}
|
||||
|
||||
@@ -170,15 +189,20 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateMicsAtOnce()
|
||||
{
|
||||
int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
|
||||
var 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++)
|
||||
for (var i = 1; i <= maxNum; i++)
|
||||
{
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
}
|
||||
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
|
||||
}
|
||||
|
||||
@@ -186,8 +210,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// build num rounds slide
|
||||
_SelectSlides[_SelectSlideNumRounds].Clear();
|
||||
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
for (var i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
{
|
||||
_SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
|
||||
}
|
||||
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1;
|
||||
}
|
||||
|
||||
@@ -199,8 +226,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return;
|
||||
}
|
||||
|
||||
int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce;
|
||||
int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce;
|
||||
var res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce;
|
||||
var mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce;
|
||||
|
||||
_RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeMain : CPartyScreenChallenge
|
||||
// ReSharper restore UnusedMember.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
@@ -97,17 +97,17 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
base.Init();
|
||||
|
||||
_ThemeTexts = new string[]
|
||||
{
|
||||
_TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber,
|
||||
_TextRoundPlayer,
|
||||
_TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage
|
||||
};
|
||||
{
|
||||
_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};
|
||||
{
|
||||
_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown,
|
||||
_ButtonRoundsScrollUp
|
||||
};
|
||||
_ThemeStatics = new string[] { _StaticPopupBG, _StaticNextPlayer };
|
||||
}
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_NextPlayerTexts = new List<CText>();
|
||||
_NextPlayerStatics = new List<CStatic>();
|
||||
|
||||
for (int i = 0; i < _PartyMode.MaxPlayers; i++)
|
||||
for (var i = 0; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
|
||||
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
|
||||
@@ -127,6 +127,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
|
||||
_NextPlayerStatics[_NextPlayerStatics.Count - 1].Aspect = EAspect.Crop;
|
||||
}
|
||||
|
||||
_Statics[_StaticNextPlayer].Visible = false;
|
||||
}
|
||||
|
||||
@@ -134,7 +135,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
|
||||
if (keyEvent.KeyPressed) {}
|
||||
if (keyEvent.KeyPressed) { }
|
||||
else
|
||||
{
|
||||
switch (keyEvent.Key)
|
||||
@@ -144,42 +145,76 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -192,26 +227,51 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,20 +280,31 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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;
|
||||
@@ -250,9 +321,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_UpdateNextPlayerPositions();
|
||||
_UpdateNextPlayerContents();
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
_BuildRoundsTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2);
|
||||
}
|
||||
|
||||
_UpdateRoundsTable();
|
||||
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
@@ -305,16 +381,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_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;
|
||||
var x = (float)CBase.Settings.GetRenderW() / 2 -
|
||||
(_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W + (_PartyMode.GameData.NumPlayerAtOnce - 1) * 15) / 2;
|
||||
const float staticY = 885;
|
||||
const float textY = 825;
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
for (var i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//static
|
||||
_NextPlayerStatics[i].X = x;
|
||||
@@ -327,7 +405,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
|
||||
|
||||
for (var i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -339,9 +418,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
for (var i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
Guid id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
|
||||
var 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);
|
||||
@@ -350,7 +429,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
else
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = false;
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
for (var i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -362,21 +441,22 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
//Create lists
|
||||
_RoundsTable = new List<CRoundsTableRow>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
var rtr = new CRoundsTableRow {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
|
||||
var rtr = new CRoundsTableRow { TextPlayer = new List<CText>(), TextScores = new List<CText>() };
|
||||
_RoundsTable.Add(rtr);
|
||||
}
|
||||
|
||||
//Create statics and texts for rounds
|
||||
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
||||
foreach (var roundRow in _RoundsTable)
|
||||
{
|
||||
//Round-number
|
||||
CText text = GetNewText(_Texts[_TextRoundNumber]);
|
||||
var text = GetNewText(_Texts[_TextRoundNumber]);
|
||||
_AddText(text);
|
||||
roundRow.Number = text;
|
||||
for (int row = 0; row < 2; row++)
|
||||
for (var row = 0; row < 2; row++)
|
||||
{
|
||||
for (int column = 0; column < 3; column++)
|
||||
for (var column = 0; column < 3; column++)
|
||||
{
|
||||
//Player
|
||||
text = GetNewText(_Texts[_TextRoundPlayer]);
|
||||
@@ -399,39 +479,42 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_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;
|
||||
var numberX = _Texts[_TextRoundNumber].X;
|
||||
var 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;
|
||||
var delta = _Texts[_TextRoundNumber].Rect.H;
|
||||
|
||||
//Update statics and texts for rounds
|
||||
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
||||
foreach (var 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++)
|
||||
var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / (double)numPlayerInOneRow);
|
||||
for (var row = 0; row < numInnerRows; row++)
|
||||
{
|
||||
int num = (row + 1) * numPlayerInOneRow;
|
||||
int numPlayerInThisRow = numPlayerInOneRow;
|
||||
var num = (row + 1) * numPlayerInOneRow;
|
||||
var numPlayerInThisRow = numPlayerInOneRow;
|
||||
if (num > _PartyMode.GameData.NumPlayerAtOnce)
|
||||
{
|
||||
num = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow);
|
||||
numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - row * numPlayerInOneRow;
|
||||
}
|
||||
for (int column = row * numPlayerInOneRow; column < num; column++)
|
||||
|
||||
for (var 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;
|
||||
var x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) +
|
||||
(CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow / 2;
|
||||
var 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;
|
||||
@@ -440,33 +523,40 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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 (var i = 0; i < _RoundsTable.Count; i++)
|
||||
{
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
for (var 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].Number.Text = i + 1 + _RoundsTableOffset + ")";
|
||||
_RoundsTable[i].TextPlayer[p].Text =
|
||||
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players[p]]);
|
||||
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIds[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players[p]]);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
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
|
||||
{
|
||||
@@ -474,10 +564,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_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++)
|
||||
for (var p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
{
|
||||
_RoundsTable[i].TextPlayer[p].Visible = false;
|
||||
_RoundsTable[i].TextScores[p].Visible = false;
|
||||
@@ -491,24 +582,24 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _BuildPlayerTable()
|
||||
{
|
||||
_PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X};
|
||||
_PlayerTableScrollArea = new SRectF { X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X };
|
||||
|
||||
_PlayerTable = new List<STableRow>();
|
||||
float delta = _Texts[_TextPosition].Rect.H * 1.2f;
|
||||
var delta = _Texts[_TextPosition].Rect.H * 1.2f;
|
||||
|
||||
float h = 0;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (var 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])
|
||||
};
|
||||
{
|
||||
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);
|
||||
@@ -517,7 +608,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.SingPoints.Y += delta * (i + 1);
|
||||
row.GamePoints.Y += delta * (i + 1);
|
||||
|
||||
row.Pos.Text = (i + 1) + ".";
|
||||
row.Pos.Text = i + 1 + ".";
|
||||
|
||||
row.Pos.Visible = false;
|
||||
row.Name.Visible = false;
|
||||
@@ -537,14 +628,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
h = delta * (i + 1);
|
||||
}
|
||||
|
||||
_PlayerTableScrollArea.H = h + delta;
|
||||
}
|
||||
|
||||
private void _UpdatePlayerTable()
|
||||
{
|
||||
for (int i = 0; i < _PlayerTable.Count; i++)
|
||||
for (var i = 0; i < _PlayerTable.Count; i++)
|
||||
{
|
||||
STableRow row = _PlayerTable[i];
|
||||
var row = _PlayerTable[i];
|
||||
|
||||
if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count)
|
||||
{
|
||||
@@ -556,7 +648,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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.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();
|
||||
@@ -574,21 +666,31 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
_Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIds.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _ScrollPlayerTable(int offset)
|
||||
{
|
||||
if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible)
|
||||
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)
|
||||
}
|
||||
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;
|
||||
}
|
||||
else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIds.Count - _NumPlayerVisible)
|
||||
{
|
||||
_PlayerTableOffset = _PartyMode.GameData.ProfileIds.Count - _NumPlayerVisible;
|
||||
}
|
||||
|
||||
_UpdatePlayerTable();
|
||||
}
|
||||
@@ -596,36 +698,51 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
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 = "";
|
||||
var s = "";
|
||||
|
||||
for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++)
|
||||
for (var 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);
|
||||
}
|
||||
|
||||
s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeNames : CMenuPartyNameSelection
|
||||
// ReSharper restore UnusedMember.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
@@ -45,24 +45,32 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.OnShow();
|
||||
SetPartyModeData(_PartyMode.GameData.NumPlayer);
|
||||
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
|
||||
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
|
||||
while (_PartyMode.GameData.ProfileIds.Count > _NumPlayer)
|
||||
{
|
||||
_PartyMode.GameData.ProfileIds.RemoveAt(_PartyMode.GameData.ProfileIds.Count - 1);
|
||||
}
|
||||
|
||||
List<Guid>[] ids = new List<Guid>[] {_PartyMode.GameData.ProfileIDs};
|
||||
var ids = new List<Guid>[] { _PartyMode.GameData.ProfileIds };
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
public override void Back()
|
||||
{
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
{
|
||||
_PartyMode.GameData.ProfileIds = _TeamList[0];
|
||||
}
|
||||
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
public override void Next()
|
||||
{
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
{
|
||||
_PartyMode.GameData.ProfileIds = _TeamList[0];
|
||||
}
|
||||
|
||||
_PartyMode.Next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
@@ -26,7 +22,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
Source = _PartyMode.GameData.SongSource;
|
||||
Sorting = _PartyMode.GameData.Sorting;
|
||||
Category = _PartyMode.GameData.CategoryIndex;
|
||||
Playlist = _PartyMode.GameData.PlaylistID;
|
||||
Playlist = _PartyMode.GameData.PlaylistId;
|
||||
SongMode = _PartyMode.GameData.GameMode;
|
||||
NumMedleySongs = _PartyMode.GameData.NumMedleySongs;
|
||||
|
||||
@@ -62,9 +58,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_PartyMode.GameData.SongSource = Source;
|
||||
_PartyMode.GameData.Sorting = Sorting;
|
||||
_PartyMode.GameData.CategoryIndex = Category;
|
||||
_PartyMode.GameData.PlaylistID = Playlist;
|
||||
_PartyMode.GameData.PlaylistId = Playlist;
|
||||
_PartyMode.GameData.GameMode = SongMode;
|
||||
_PartyMode.GameData.NumMedleySongs = NumMedleySongs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -40,6 +41,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -52,6 +54,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -65,6 +68,7 @@
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InstallerWin|AnyCPU'">
|
||||
<OutputPath>bin</OutputPath>
|
||||
@@ -78,6 +82,7 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CChallengeRounds.cs" />
|
||||
@@ -119,4 +124,4 @@ rm -f "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\GlobalSuppressions.cs"
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in new issue
Block a user