public override void Initialize() { Layer.HUD.camera.size *= 4f; int num1 = 19; int num2 = 3; TourneyGroup tourneyGroup1 = new TourneyGroup(); int num3 = 0; foreach (Team p in Teams.allRandomized) { tourneyGroup1.AddPlayer(p, true); if (tourneyGroup1.players.Count == num2) { this._groups.Add(tourneyGroup1); tourneyGroup1 = new TourneyGroup(); tourneyGroup1.groupIndex = this._groups.Count; } ++num3; if (num3 == num1) { break; } } if (tourneyGroup1.players.Count > 0) { this._groups.Add(tourneyGroup1); } List <TourneyGroup> tourneyGroupList1 = this._groups; List <TourneyGroup> tourneyGroupList2 = new List <TourneyGroup>(); int num4 = 1; while (tourneyGroupList1.Count > 1) { int num5 = 0; TourneyGroup tourneyGroup2 = (TourneyGroup)null; foreach (TourneyGroup tourneyGroup3 in tourneyGroupList1) { if (tourneyGroup2 == null) { num5 = 0; tourneyGroup2 = new TourneyGroup(); tourneyGroup2.groupIndex = tourneyGroupList2.Count; tourneyGroup2.depth = num4; tourneyGroupList2.Add(tourneyGroup2); } tourneyGroup3.next = tourneyGroup2; tourneyGroup3.next.AddPlayer(tourneyGroup3.players[Rando.Int(tourneyGroup3.players.Count - 1)]); ++num5; if (num5 == num2) { tourneyGroup2 = (TourneyGroup)null; } } ++num4; tourneyGroupList1 = tourneyGroupList2; tourneyGroupList2 = new List <TourneyGroup>(); } base.Initialize(); }
public override void Update() { if (InputProfile.DefaultPlayer1.Pressed("QUACK")) { this._groups.Clear(); Rando.generator = new Random(30502); int num1 = 2 + (int)((double)InputProfile.DefaultPlayer1.leftTrigger * 30.0); int num2 = 2 + (int)((double)InputProfile.DefaultPlayer1.rightTrigger * 2.0); TourneyGroup tourneyGroup1 = new TourneyGroup(); int num3 = 0; foreach (Team p in Teams.allRandomized) { tourneyGroup1.AddPlayer(p, true); if (tourneyGroup1.players.Count == num2) { this._groups.Add(tourneyGroup1); tourneyGroup1 = new TourneyGroup(); tourneyGroup1.groupIndex = this._groups.Count; } ++num3; if (num3 == num1) { break; } } if (tourneyGroup1.players.Count > 0) { this._groups.Add(tourneyGroup1); } TourneyGroup tourneyGroup2 = (TourneyGroup)null; List <TourneyGroup> tourneyGroupList1 = this._groups; List <TourneyGroup> tourneyGroupList2 = new List <TourneyGroup>(); int num4 = 1; while (tourneyGroupList1.Count > 1) { int num5 = 0; TourneyGroup tourneyGroup3 = (TourneyGroup)null; foreach (TourneyGroup tourneyGroup4 in tourneyGroupList1) { if (tourneyGroup3 == null) { num5 = 0; tourneyGroup3 = new TourneyGroup(); tourneyGroup3.groupIndex = tourneyGroupList2.Count; tourneyGroup3.depth = num4; tourneyGroupList2.Add(tourneyGroup3); } tourneyGroup4.next = tourneyGroup3; int index = Rando.Int(tourneyGroup4.players.Count - 1); tourneyGroup4.next.AddPlayer(tourneyGroup4.players[index], true); ++num5; if (num5 == num2) { tourneyGroup3 = (TourneyGroup)null; } } ++num4; tourneyGroupList1 = tourneyGroupList2; tourneyGroupList2 = new List <TourneyGroup>(); } this._loserGroups.Clear(); tourneyGroup2 = (TourneyGroup)null; List <TourneyGroup> tourneyGroupList3 = this._groups; List <TourneyGroup> loserGroups = this._loserGroups; List <TourneyGroup> tourneyGroupList4 = new List <TourneyGroup>(); List <Team> teamList = new List <Team>(); int num6 = 0; while (tourneyGroupList3.Count > 1) { TourneyGroup tourneyGroup3 = (TourneyGroup)null; foreach (TourneyGroup tourneyGroup4 in tourneyGroupList3) { if (tourneyGroup4.next != null) { if (!tourneyGroupList4.Contains(tourneyGroup4)) { tourneyGroupList4.Add(tourneyGroup4); } foreach (Team player in tourneyGroup4.players) { if (tourneyGroup3 == null) { tourneyGroup3 = new TourneyGroup(); tourneyGroup3.groupIndex = loserGroups.Count; tourneyGroup3.depth = num6; loserGroups.Add(tourneyGroup3); } if (!tourneyGroup4.next.players.Contains(player)) { tourneyGroup3.AddPlayer(player, true); teamList.Add(player); } if (tourneyGroup3.players.Count == num2) { tourneyGroup3 = (TourneyGroup)null; } } } } ++num6; tourneyGroupList3 = tourneyGroupList4; tourneyGroupList4 = new List <TourneyGroup>(); } } base.Update(); }