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:
Quentin Bray authored and GitHub committed 2026-06-22 19:52:06 +02:00
1 parent b9b0f7c8df
commit 6ffa63b923
236 files changed
+14194 -7278

No files matched your search

@@ -17,10 +17,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using VocaluxeLib.Songs;
namespace VocaluxeLib.PartyModes.TicTacToe
{
@@ -71,7 +69,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private const string _StaticTeam2 = "StaticTeam2";
private readonly string[] _EqualizerTeam = new string[]
{"EqualizerTeam1", "EqualizerTeam2"};
{ "EqualizerTeam1", "EqualizerTeam2" };
private bool _ExitPopupVisible;
@@ -97,12 +95,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe
base.Init();
_ThemeTexts = new string[]
{_TextPopupReallyExit, _TextTeamChoosing, _TextFinishMessage, _TextNextPlayerT1, _TextNextPlayerT2, _TextNextPlayerNameT1, _TextNextPlayerNameT2};
{ _TextPopupReallyExit, _TextTeamChoosing, _TextFinishMessage, _TextNextPlayerT1, _TextNextPlayerT2, _TextNextPlayerNameT1, _TextNextPlayerNameT2 };
_ThemeButtons = new string[]
{
_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonField, _ButtonJokerRandomT1, _ButtonJokerRandomT2, _ButtonJokerRetryT1,
_ButtonJokerRetryT2, _ButtonSwitchPlayerT1, _ButtonSwitchPlayerT2
};
{
_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonField, _ButtonJokerRandomT1, _ButtonJokerRandomT2, _ButtonJokerRetryT1,
_ButtonJokerRetryT2, _ButtonSwitchPlayerT1, _ButtonSwitchPlayerT2
};
_ThemeStatics = new string[] { _StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2, _StaticTeam1, _StaticTeam2 };
var texts = new List<string>();
@@ -135,28 +133,48 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (!_ExitPopupVisible)
{
if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
{
_Back();
}
else if (_Status == EStatus.None)
{
_EndParty();
}
else
{
_ShowPopup(true);
}
}
else
{
_ShowPopup(false);
}
break;
case Keys.Enter:
if (!_ExitPopupVisible)
{
if (_Buttons[_ButtonNextRound].Selected)
{
_NextRound();
}
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
{
_Back();
}
if (_Buttons[_ButtonExit].Selected && (_PartyMode.GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None)
{
_ShowPopup(true);
}
else if (_Status == EStatus.None)
{
_EndParty();
for (int i = 0; i < _PartyMode.GameData.NumFields; i++)
}
for (var i = 0; i < _PartyMode.GameData.NumFields; i++)
{
switch (_Status)
{
@@ -166,6 +184,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.GameData.FieldNr = i;
_FieldSelected();
}
break;
case EStatus.JokerRetry:
@@ -174,35 +193,61 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.GameData.FieldNr = i;
_FieldSelectedAgain();
}
break;
}
}
if (_Status == EStatus.FieldSelected)
{
if (_Buttons[_ButtonJokerRandomT1].Selected)
{
_UseJoker(0, 0);
}
if (_Buttons[_ButtonJokerRandomT2].Selected)
{
_UseJoker(1, 0);
}
if (_Buttons[_ButtonJokerRetryT1].Selected)
{
_UseJoker(0, 1);
}
if (_Buttons[_ButtonJokerRetryT2].Selected)
{
_UseJoker(1, 1);
}
if (_Buttons[_ButtonSwitchPlayerT1].Selected)
{
_ChangePlayer(0, true);
}
if (_Buttons[_ButtonSwitchPlayerT2].Selected)
{
_ChangePlayer(1, true);
}
}
}
else
{
if (_Buttons[_ButtonPopupYes].Selected)
{
_EndParty();
}
if (_Buttons[_ButtonPopupNo].Selected)
{
_ShowPopup(false);
}
}
break;
}
}
return true;
}
@@ -215,17 +260,28 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (!_ExitPopupVisible)
{
if (_Buttons[_ButtonNextRound].Selected)
{
_NextRound();
}
if (_Buttons[_ButtonBack].Selected)
{
_Back();
}
if (_Buttons[_ButtonExit].Selected)
{
if (_Status == EStatus.None)
{
_EndParty();
}
else
{
_ShowPopup(true);
}
}
for (int i = 0; i < _PartyMode.GameData.NumFields; i++)
for (var i = 0; i < _PartyMode.GameData.NumFields; i++)
{
switch (_Status)
{
@@ -235,6 +291,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.GameData.FieldNr = i;
_FieldSelected();
}
break;
case EStatus.JokerRetry:
@@ -243,31 +300,55 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.GameData.FieldNr = i;
_FieldSelectedAgain();
}
break;
}
}
if (_Status == EStatus.FieldSelected)
{
if (_Buttons[_ButtonJokerRandomT1].Selected)
{
_UseJoker(0, 0);
}
if (_Buttons[_ButtonJokerRandomT2].Selected)
{
_UseJoker(1, 0);
}
if (_Buttons[_ButtonJokerRetryT1].Selected)
{
_UseJoker(0, 1);
}
if (_Buttons[_ButtonJokerRetryT2].Selected)
{
_UseJoker(1, 1);
}
if (_Buttons[_ButtonSwitchPlayerT1].Selected)
{
_ChangePlayer(0, true);
}
if (_Buttons[_ButtonSwitchPlayerT2].Selected)
{
_ChangePlayer(1, true);
}
}
}
else
{
if (_Buttons[_ButtonPopupYes].Selected)
{
_EndParty();
}
if (_Buttons[_ButtonPopupNo].Selected)
{
_ShowPopup(false);
}
}
}
@@ -276,14 +357,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (!_ExitPopupVisible)
{
if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
{
_Back();
}
else if (_Status == EStatus.None)
{
_EndParty();
}
else
{
_ShowPopup(true);
}
}
else
{
_ShowPopup(false);
}
}
if (mouseEvent.Wheel != 0) { }
@@ -322,7 +411,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_UpdateFields();
_UpdateFieldContents();
int winner = _GetWinner();
var winner = _GetWinner();
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.NumFields && winner == 0)
{
_UpdateTeamChoosingMessage();
@@ -354,14 +443,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (winner > 0)
{
_Texts[_TextFinishMessage].Color = CBase.Themes.GetPlayerColor(winner);
_Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", PartyModeID) + " " +
_Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", PartyModeId) + " " + CBase.Language.Translate("TR_TEAM", PartyModeId) + " " +
winner;
}
else
{
_Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1);
_Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", PartyModeID);
_Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", PartyModeId);
}
_SelectElement(_Buttons[_ButtonExit]);
}
@@ -371,9 +461,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override bool UpdateGame()
{
if (!_Equalizers[_EqualizerTeam[0]].Visible)
{
return true;
}
for (int i = 0; i < 2; i++)
for (var i = 0; i < 2; i++)
{
CBase.Record.AnalyzeBuffer(i);
_Equalizers["EqualizerTeam" + (i + 1)].Update(CBase.Record.ToneWeigth(i), CBase.Record.GetMaxVolume(i));
@@ -384,9 +476,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _CreateFields()
{
for (int i = 0; i < 25; i++)
for (var i = 0; i < 25; i++)
{
CButton f = GetNewButton(_Buttons[_ButtonField]);
var f = GetNewButton(_Buttons[_ButtonField]);
f.Visible = false;
_AddButton(f);
_Fields.Add(f);
@@ -396,16 +488,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _UpdateFields()
{
var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields);
float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow;
float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow;
var fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow;
var fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow;
_FieldSize = Math.Min(fieldSizeX, fieldSizeY);
_FieldFirstX = (float)CBase.Settings.GetRenderW() / 2 - (numOneRow * _FieldSize + (numOneRow - 1) * _FieldSpace) / 2;
_FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (numOneRow * _FieldSize + numOneRow * _FieldSpace) / 2;
int row = 0;
int column = 0;
float x = _FieldFirstX;
float y = _FieldFirstY;
for (int i = 0; i < _Fields.Count; i++)
var row = 0;
var column = 0;
var x = _FieldFirstX;
var y = _FieldFirstY;
for (var i = 0; i < _Fields.Count; i++)
{
if (i < _PartyMode.GameData.NumFields)
{
@@ -416,7 +508,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Fields[i].Visible = true;
_Fields[i].Selectable = true;
column++;
if ((i + 1) >= numOneRow * (row + 1))
if (i + 1 >= numOneRow * (row + 1))
{
column = 0;
row++;
@@ -424,7 +516,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
x = _FieldFirstX;
}
else
{
x = _FieldFirstX + _FieldSize * column + _FieldSpace * column;
}
}
else
{
@@ -436,7 +530,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _UpdateFieldContents()
{
for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++)
for (var i = 0; i < _PartyMode.GameData.Rounds.Count; i++)
{
_Fields[i].Selectable = true;
_Fields[i].Texture = _Buttons[_ButtonField].Texture;
@@ -445,26 +539,34 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (_PartyMode.GameData.Rounds[i].Finished)
{
_Fields[i].Selectable = false;
_Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongIDs[0]).CoverTextureBig;
_Fields[i].Texture = CBase.Songs.GetSongById(_PartyMode.GameData.Rounds[i].SongIds[0]).CoverTextureBig;
_Fields[i].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner);
_Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner);
}
if (_Status == EStatus.FieldSelected && _PartyMode.GameData.FieldNr == i)
{
_Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongIDs[0]).CoverTextureBig;
_Fields[i].Texture = CBase.Songs.GetSongById(_PartyMode.GameData.Rounds[i].SongIds[0]).CoverTextureBig;
_Fields[i].Color = new SColorF(1, 1, 1, 1);
_Fields[i].SelColor = new SColorF(1, 1, 1, 1);
_Fields[i].Selectable = false;
}
if (_Status == EStatus.JokerRetry && _PartyMode.GameData.Rounds[i].Finished)
{
_Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1);
_Fields[i].Selectable = true;
}
if (_Status == EStatus.JokerRetry && !_PartyMode.GameData.Rounds[i].Finished)
{
_Fields[i].Selectable = false;
}
if (_Status == EStatus.FieldSelected)
{
_Fields[i].Selectable = false;
}
}
}
@@ -474,17 +576,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{
_ChangePlayer();
}
_PartyMode.UpdateSongList();
int[] songIDs = new int[_PartyMode.GameData.GameMode == EGameMode.TR_GAMEMODE_MEDLEY ? _PartyMode.GameData.NumMedleySongs : 1];
for (int i = 0; i < songIDs.Length; i++)
var songIds = new int[_PartyMode.GameData.GameMode == EGameMode.TR_GAMEMODE_MEDLEY ? _PartyMode.GameData.NumMedleySongs : 1];
for (var i = 0; i < songIds.Length; i++)
{
songIDs[i] = _PartyMode.GameData.Songs[0];
songIds[i] = _PartyMode.GameData.Songs[0];
_PartyMode.GameData.Songs.RemoveAt(0);
}
_StartPreview(songIDs[0]);
_StartPreview(songIds[0]);
_Status = EStatus.FieldSelected;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIDs = songIDs;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIds = songIds;
_UpdateFieldContents();
_UpdateJokerButtons();
_UpdateSwitchPlayerButtons();
@@ -498,10 +601,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FieldSelectedAgain()
{
int[] songIDs = _PartyMode.GameData.Rounds[_OldSelectedField].SongIDs;
_StartPreview(songIDs[0]);
var songIds = _PartyMode.GameData.Rounds[_OldSelectedField].SongIds;
_StartPreview(songIds[0]);
_Status = EStatus.FieldSelected;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIDs = songIDs;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongIds = songIds;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1;
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2;
_UpdateFieldContents();
@@ -516,32 +619,31 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_SelectElement(_Buttons[_ButtonNextRound]);
}
private void _StartPreview(int songID)
private void _StartPreview(int songId)
{
CSong song = CBase.Songs.GetSongByID(songID);
var song = CBase.Songs.GetSongById(songId);
CBase.BackgroundMusic.LoadPreview(song);
}
private int _GetRamdom(int max)
{
lock (syncLock)
{
return random.Next(max+1);
{
return random.Next(max + 1);
}
}
private void _ChangePlayer(int teamNr = -1, bool next = false)
{
if (_PartyMode.GameData.ProfileIDsTeam1.Count > 0 && (teamNr == 0 || teamNr == -1))
if (_PartyMode.GameData.ProfileIdsTeam1.Count > 0 && (teamNr == 0 || teamNr == -1))
{
idPlayer1 = _GetTeamPlayer(idPlayer1, _PartyMode.GameData.ProfileIDsTeam1.Count, next);
idPlayer1 = _GetTeamPlayer(idPlayer1, _PartyMode.GameData.ProfileIdsTeam1.Count, next);
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = idPlayer1;
}
if (_PartyMode.GameData.ProfileIDsTeam2.Count > 0 && (teamNr == 1 || teamNr == -1))
if (_PartyMode.GameData.ProfileIdsTeam2.Count > 0 && (teamNr == 1 || teamNr == -1))
{
idPlayer2 = _GetTeamPlayer(idPlayer2, _PartyMode.GameData.ProfileIDsTeam2.Count, next);
idPlayer2 = _GetTeamPlayer(idPlayer2, _PartyMode.GameData.ProfileIdsTeam2.Count, next);
_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = idPlayer2;
}
@@ -553,15 +655,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (next)
{
idPlayer++;
if (idPlayer >= _PartyMode.GameData.ProfileIDsTeam1.Count)
if (idPlayer >= _PartyMode.GameData.ProfileIdsTeam1.Count)
{
idPlayer = 0;
}
}
else
{
idPlayer = _GetRamdom(_PartyMode.GameData.ProfileIDsTeam1.Count - 1);
idPlayer = _GetRamdom(_PartyMode.GameData.ProfileIdsTeam1.Count - 1);
}
return idPlayer;
}
@@ -572,13 +675,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Texts[_TextNextPlayerNameT1].Visible = true;
_Texts[_TextNextPlayerNameT2].Visible = true;
_Texts[_TextNextPlayerNameT1].Text =
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIdsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
_Texts[_TextNextPlayerNameT2].Text =
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIdsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
_Statics[_StaticAvatarT1].Visible = true;
_Statics[_StaticAvatarT2].Visible = true;
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIdsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]);
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIdsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]);
_Statics[_StaticTeam1].Visible = true;
_Statics[_StaticTeam2].Visible = true;
_Equalizers[_EqualizerTeam[0]].Visible = true;
@@ -596,6 +699,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_PartyMode.GameData.NumJokerRandom[teamNr]--;
_FieldSelected(true);
}
break;
//Retry-Joker
@@ -610,20 +714,26 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_UpdateFieldContents();
_Buttons[_ButtonNextRound].Visible = false;
}
break;
}
_UpdateJokerButtons();
}
private void _UpdateTeamChoosingMessage()
{
_Texts[_TextTeamChoosing].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1);
_Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + (_PartyMode.GameData.Team + 1) + "! " +
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", PartyModeID);
_Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", PartyModeId) + " " + (_PartyMode.GameData.Team + 1) + "! " +
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", PartyModeId);
if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing)
{
_Texts[_TextTeamChoosing].Visible = true;
}
else
{
_Texts[_TextTeamChoosing].Visible = false;
}
}
private void _UpdateJokerButtons()
@@ -649,7 +759,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Buttons[_ButtonSwitchPlayerT1].Visible = true;
_Buttons[_ButtonSwitchPlayerT2].Visible = true;
}
}
private void _NextRound()
@@ -672,7 +781,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
if (_ExitPopupVisible)
{
_SelectElement(_Buttons[_ButtonPopupNo]);
}
}
private void _Back()
@@ -683,51 +794,71 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _BuildWinnerPossibilities()
{
var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields);
_Possibilities = new int[(numOneRow * 2) + 2, numOneRow];
for (int i = 0; i < _Possibilities.GetLength(0); i++)
_Possibilities = new int[numOneRow * 2 + 2, numOneRow];
for (var i = 0; i < _Possibilities.GetLength(0); i++)
{
if (i < numOneRow)
{
for (int c = 0; c < numOneRow; c++)
for (var c = 0; c < numOneRow; c++)
{
_Possibilities[i, c] = i * numOneRow + c;
}
}
else if (i < numOneRow * 2)
{
for (int c = 0; c < numOneRow; c++)
_Possibilities[i, c] = (i - numOneRow) + (c * numOneRow);
for (var c = 0; c < numOneRow; c++)
{
_Possibilities[i, c] = i - numOneRow + c * numOneRow;
}
}
else if (i == _Possibilities.GetLength(0) - 2)
{
for (int c = 0; c < numOneRow; c++)
for (var c = 0; c < numOneRow; c++)
{
_Possibilities[i, c] = (numOneRow + 1) * c;
}
}
else if (i == _Possibilities.GetLength(0) - 1)
{
for (int c = 0; c < numOneRow; c++)
for (var c = 0; c < numOneRow; c++)
{
_Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1);
}
}
}
}
private int _GetWinner()
{
for (int i = 0; i < _Possibilities.GetLength(0); i++)
for (var i = 0; i < _Possibilities.GetLength(0); i++)
{
var check = new List<int>();
for (int j = 0; j < _Possibilities.GetLength(1); j++)
for (var j = 0; j < _Possibilities.GetLength(1); j++)
{
if (_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner > 0)
{
check.Add(_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner);
}
}
if (check.Count != _Possibilities.GetLength(1))
{
continue;
}
//Check for winner
if (check.Contains(1) && !check.Contains(2))
{
return 1;
}
if (check.Contains(2) && !check.Contains(1))
{
return 2;
}
}
return 0;
}
}
}
}