Auto cleanup of Vocaluxe

This commit is contained in:
Flamefire committed 2013-03-22 21:09:43 +01:00
1 parent cd62c3cd88
commit b497b58740
83 files changed
+3026 -3862

No files matched your search

@@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using VocaluxeLib.Menu;
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: ComVisible(false)]
namespace VocaluxeLib.PartyModes.Challenge
{
#region Communication
#region ToScreen
public struct DataToScreenConfig
{
@@ -51,9 +55,7 @@ namespace VocaluxeLib.PartyModes.Challenge
{
res = row.NumSingPoints.CompareTo(NumSingPoints);
if (res == 0)
{
res = row.NumWon.CompareTo(NumWon);
}
}
return res;
}
@@ -61,7 +63,6 @@ namespace VocaluxeLib.PartyModes.Challenge
throw new ArgumentException("object is not a ResultTableRow");
}
}
#endregion ToScreen
#region FromScreen
@@ -92,6 +93,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public bool FadeToNameSelection;
}
#endregion FromScreen
#endregion Communication
public sealed class PartyModeChallenge : CPartyMode
@@ -102,7 +104,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private const int MinTeams = 0;
private const int MaxNumRounds = 100;
enum EStage
private enum EStage
{
NotStarted,
Config,
@@ -111,7 +113,7 @@ namespace VocaluxeLib.PartyModes.Challenge
Singing
}
struct Data
private struct Data
{
public int NumPlayer;
public int NumPlayerAtOnce;
@@ -127,7 +129,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public int[] CatSongIndices;
}
struct Stats
private struct Stats
{
public int ProfileID;
public int SingPoints;
@@ -147,13 +149,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[] {5, 5};
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
_ScreenSongOptions.Sorting.SearchString = String.Empty;
_ScreenSongOptions.Sorting.SearchActive = false;
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
_Stage = EStage.NotStarted;
ToScreenConfig = new DataToScreenConfig();
@@ -194,7 +196,7 @@ namespace VocaluxeLib.PartyModes.Challenge
switch (ScreenName)
{
case "PartyScreenChallengeConfig":
try
{
data = (DataFromScreen)Data;
@@ -327,7 +329,7 @@ namespace VocaluxeLib.PartyModes.Challenge
}
break;
}
return Screen;
}
@@ -438,7 +440,6 @@ namespace VocaluxeLib.PartyModes.Challenge
public override void SongSelected(int SongID)
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
CBase.Game.Reset();
@@ -500,30 +501,30 @@ namespace VocaluxeLib.PartyModes.Challenge
switch (GameData.NumPlayerAtOnce)
{
case 1:
_ScreenSongOptions.Selection.NumJokers = new int[] { 10 };
_ScreenSongOptions.Selection.NumJokers = new[] {10};
break;
case 2:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
break;
case 3:
_ScreenSongOptions.Selection.NumJokers = new int[] { 4, 4, 4 };
_ScreenSongOptions.Selection.NumJokers = new[] {4, 4, 4};
break;
case 4:
_ScreenSongOptions.Selection.NumJokers = new int[] { 3, 3, 3, 3 };
_ScreenSongOptions.Selection.NumJokers = new[] {3, 3, 3, 3};
break;
case 5:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new[] {2, 2, 2, 2, 2};
break;
case 6:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new[] {2, 2, 2, 2, 2, 2};
break;
default:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new[] {5, 5};
break;
}
}
@@ -534,16 +535,16 @@ namespace VocaluxeLib.PartyModes.Challenge
if (profiles == null)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
return;
}
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new[] {"foo", "bar"};
return;
}
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
@@ -577,13 +578,11 @@ namespace VocaluxeLib.PartyModes.Challenge
GameData.ResultTable.Add(row);
}
GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce];
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
for (int i = 0; i < GameData.NumRounds; i++)
{
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
{
GameData.Results[i, j] = 0;
}
}
}
else
@@ -596,9 +595,7 @@ namespace VocaluxeLib.PartyModes.Challenge
return;
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
{
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
}
List<Stats> points = GetPointsForPlayer(results);
@@ -606,13 +603,13 @@ namespace VocaluxeLib.PartyModes.Challenge
{
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)
{
@@ -635,7 +632,7 @@ namespace VocaluxeLib.PartyModes.Challenge
int pos = 1;
int lastPoints = 0;
int lastSingPoints = 0;
for (int i = 0; i < GameData.ResultTable.Count; i++ )
for (int i = 0; i < GameData.ResultTable.Count; i++)
{
if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints)
pos++;
@@ -648,7 +645,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private List<Stats> GetPointsForPlayer(SPlayer[] Results)
{
List<Stats> result = new List<Stats>();
for(int i = 0; i < GameData.NumPlayerAtOnce; i++)
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{
Stats stat = new Stats();
stat.ProfileID = Results[i].ProfileID;
@@ -695,7 +692,6 @@ namespace VocaluxeLib.PartyModes.Challenge
}
return result;
}
@@ -705,11 +701,9 @@ namespace VocaluxeLib.PartyModes.Challenge
{
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;
}