public RoundData(string n, List <Debater> debaters) : this() { RoundName = n; foreach (Debater d in debaters) { d.SetRoom(RoundName, RoomData.Dummy()); if (d.Role.IsTeamMember) { AddMemberToTeamList(allTeams, new RoundDebater(d, true)); } else if (d.Role.IsJudge) { allJudges.Add(new RoundDebater(d, true)); } } allJudges.Sort(); allTeams.Sort(); // empty rooms AddEmptyRooms(allTeams.Count); }
// this is really bad coding. // but it seems to keep the arrays consistent! public void UpdateAllArrays() { // set all to shown foreach (RoundDebater rd in allJudges) { rd.IsShown = true; Debater d = Tournament.I.FindDebater(rd); if (d != null) { d.SetRoom(roundName, RoomData.Dummy()); } } foreach (TeamData td in allTeams) { foreach (RoundDebater rd in td) { rd.IsShown = true; Debater d = Tournament.I.FindDebater(rd); if (d != null) { d.SetRoom(roundName, RoomData.Dummy()); } } } // then set roomMembers to false foreach (RoomData room in rooms) { foreach (RoundDebater rd in room.GetRoomMembers()) { if (rd == null) { continue; } // check both cases if (rd.Role.IsJudge) { RoundDebater judge = allJudges.Find(delegate(RoundDebater rd_) { return(rd_.Equals(rd)); }); // judge should always be found, // is not shown in pool judge.IsShown = false; } else if (rd.Role.IsTeamMember) { // we need to find the reference of rd in allTeams, // set this one to not shown in pool, since it is in room TeamData td = allTeams.Find(delegate(TeamData td_) { return(td_.Contains(rd)); }); foreach (RoundDebater rd_ in td) { if (rd_.Equals(rd)) { rd_.IsShown = false; } } } // update visited rooms Debater d = Tournament.I.FindDebater(rd); if (d != null) { d.SetRoom(roundName, room); } } } }