private bool CheckDuplicates(MatchConfig.WresIDGroup wrestler, SideCornerPostEnum side) { bool isDuplicate = false; if (side == SideCornerPostEnum.Left) { foreach (MatchConfig.WresIDGroup item in el_blueList.Items) { if (wrestler == item) { isDuplicate = true; break; } } } else { foreach (MatchConfig.WresIDGroup item in el_redList.Items) { if (wrestler == item) { isDuplicate = true; break; } } } return(isDuplicate); }
public static WresIDGroup GetWrestlerData(int id, List <WresIDGroup> wrestlerList) { WresIDGroup wrestlerData = null; foreach (WresIDGroup wrestler in wrestlerList) { if (wrestler.ID == id) { wrestlerData = wrestler; break; } } return(wrestlerData); }
public static List <WresIDGroup> LoadWrestlers() { List <WresIDGroup> wrestlers = new List <WresIDGroup>(); foreach (EditWrestlerData current in SaveData.inst.editWrestlerData) { WresIDGroup wresIDGroup = new WresIDGroup { Name = DataBase.GetWrestlerFullName(current.wrestlerParam), ID = (Int32)current.editWrestlerID, Group = current.wrestlerParam.groupID }; wrestlers.Add(wresIDGroup); } return(wrestlers); }
public static WrestlerID GetWrestlerNo(WresIDGroup wrestler) { return((WrestlerID)wrestler.ID); }
private void sr_start_Click(object sender, EventArgs e) { if (!ValidateMatch()) { return; } if (MoreMatchTypes_Form.SurvivalRoadData.InProgress) { ShowError("Please end the current Survival Road session first."); } #region Variables MatchSetting settings = GlobalWork.GetInst().MatchSetting; MatchConfig.WresIDGroup player = (MatchConfig.WresIDGroup)sr_wrestler.SelectedItem; MatchConfig.WresIDGroup second = (MatchConfig.WresIDGroup)sr_second.SelectedItem; String selectedType = sr_matchType.SelectedItem.ToString(); WrestlerID wrestlerNo = WrestlerID.AbbieJones; bool isSecond = true; bool controlBoth = false; bool validEntry = false; int control = 0; int oppCount = sr_teamList.Items.Count; #endregion try { settings = SetMatchConfig("Survival", settings); sr_progress.Clear(); //Set-up player team for (int i = 0; i < 4; i++) { //Handling the first player if (i == 0) { wrestlerNo = (WrestlerID)player.ID; isSecond = false; control = 1; validEntry = true; } else if (i == 1) { if (second != null) { validEntry = true; wrestlerNo = (WrestlerID)second.ID; if (sr_tag.Checked) { isSecond = false; if (sr_controlBoth.Checked) { control = 1; } else { control = 0; } } else if (!sr_tag.Checked) { isSecond = true; } //Ensure we handle cases where a second isn't allowed, and a tag match hasn't been selected. if (!sr_tag.Checked && (!selectedType.Equals("Normal"))) { validEntry = false; } } else { validEntry = false; } } else if (i > 1) { validEntry = false; } //Determine if this is a simulation if (sr_simulate.Checked) { control = 0; if (sr_simSecond.Checked && i == 1 && selectedType.Equals("Normal")) { control = 1; } } settings = MatchConfiguration.AddPlayers(validEntry, wrestlerNo, i, control, isSecond, 0, settings); } //Set-up opponents MatchConfig.WresIDGroup opponent; int opponentCount = sr_teamList.Items.Count; for (int i = 4; i < 8; i++) { if (i > 5) { validEntry = false; } else { validEntry = true; int searchIndex; //Get Random opponent if (sr_random.Checked) { searchIndex = UnityEngine.Random.Range(0, opponentCount); } else { searchIndex = 0; } //Determine if we're creating a tag team or single competitor if (opponentCount == 1) { opponent = (MatchConfig.WresIDGroup)sr_teamList.Items[searchIndex]; wrestlerNo = MatchConfiguration.GetWrestlerNo(opponent); initialOpponents[0] = opponent; } else if (i == 4) { opponent = (MatchConfig.WresIDGroup)sr_teamList.Items[searchIndex]; wrestlerNo = MatchConfiguration.GetWrestlerNo(opponent); initialOpponents[0] = opponent; } else if (sr_tag.Checked && i == 5) { opponent = (MatchConfig.WresIDGroup)sr_teamList.Items[searchIndex]; wrestlerNo = MatchConfiguration.GetWrestlerNo(opponent); //Ensure that we aren't fielding duplicate wrestlers while (initialOpponents[0].ID == (int)wrestlerNo) { searchIndex = UnityEngine.Random.Range(0, opponentCount); opponent = (MatchConfig.WresIDGroup)sr_teamList.Items[searchIndex]; wrestlerNo = MatchConfiguration.GetWrestlerNo(opponent); } initialOpponents[1] = opponent; } else if (!sr_tag.Checked && i == 5) { validEntry = false; } } settings = MatchConfiguration.AddPlayers(validEntry, wrestlerNo, i, 0, false, 0, settings); } StartMatch(); } catch (Exception ex) { ShowError("An error has occured."); L.D("ValidateSurvivalMatchError: " + ex); } }
private void sr_Add_Click(object sender, EventArgs e) { try { if (sr_searchResult.SelectedItem == null) { return; } MatchConfig.WresIDGroup wrestler = (MatchConfig.WresIDGroup)sr_searchResult.SelectedItem; if (sr_addWrestler.Checked) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)wrestler.ID)) { ShowError(wrestler.Name + " includes DLC that you do not own."); return; } sr_wrestler.Items.Clear(); sr_wrestler.Items.Add(sr_searchResult.SelectedItem); sr_wrestler.SelectedIndex = 0; } if (sr_addSecond.Checked) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)wrestler.ID)) { ShowError(wrestler.Name + " includes DLC that you do not own."); return; } sr_second.Items.Clear(); sr_second.Items.Add(sr_searchResult.SelectedItem); sr_second.SelectedIndex = 0; } if (sr_addSingle.Checked) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)wrestler.ID)) { ShowError(wrestler.Name + " includes DLC that you do not own."); return; } sr_teamList.Items.Add(sr_searchResult.SelectedItem); } if (sr_addAll.Checked) { int invalidOptions = 0; foreach (MatchConfig.WresIDGroup item in sr_searchResult.Items) { if (sr_wrestler.Items.Count > 0) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)item.ID)) { invalidOptions++; continue; } if (((MatchConfig.WresIDGroup)sr_wrestler.SelectedItem).Name.Equals(item.Name)) { continue; } if (sr_second.Items.Count > 0) { if (((MatchConfig.WresIDGroup)sr_second.SelectedItem).Name.Equals(item.Name)) { continue; } } } sr_teamList.Items.Add(item); } if (invalidOptions > 0) { ShowError(invalidOptions + " wrestlers include DLC that you do not own, and were skipped."); } } } catch (Exception exception) { L.D(exception.ToString()); } }
private void el_addBtn_Click(object sender, EventArgs e) { if (el_resultList.SelectedItem == null) { return; } MatchConfig.WresIDGroup wrestler = (MatchConfig.WresIDGroup)el_resultList.SelectedItem; if (rb_singleBlue.Checked) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)wrestler.ID)) { ShowError(wrestler.Name + " includes DLC that you do not own."); return; } if (!CheckDuplicates((MatchConfig.WresIDGroup)el_resultList.SelectedItem, SideCornerPostEnum.Left)) { el_blueList.Items.Add(el_resultList.SelectedItem); } } else if (rb_singleRed.Checked) { if (!MatchConfiguration.ValidateWrestler((WrestlerID)wrestler.ID)) { ShowError(wrestler.Name + " includes DLC that you do not own."); return; } if (!CheckDuplicates((MatchConfig.WresIDGroup)el_resultList.SelectedItem, SideCornerPostEnum.Right)) { el_redList.Items.Add(el_resultList.SelectedItem); } } else if (rb_allBlue.Checked) { int invalidOptions = 0; for (int i = 0; i < el_resultList.Items.Count; i++) { MatchConfig.WresIDGroup item = (MatchConfig.WresIDGroup)el_resultList.Items[i]; if (!MatchConfiguration.ValidateWrestler((WrestlerID)item.ID)) { invalidOptions++; continue; } if (!CheckDuplicates(item, SideCornerPostEnum.Left)) { el_blueList.Items.Add(item); } } if (invalidOptions > 0) { ShowError(invalidOptions + " wrestlers include DLC that you do not own, and were skipped."); } } else if (rb_allRed.Checked) { int invalidOptions = 0; for (int i = 0; i < el_resultList.Items.Count; i++) { MatchConfig.WresIDGroup item = (MatchConfig.WresIDGroup)el_resultList.Items[i]; if (!MatchConfiguration.ValidateWrestler((WrestlerID)item.ID)) { invalidOptions++; continue; } if (!CheckDuplicates(item, SideCornerPostEnum.Right)) { el_redList.Items.Add(item); } } if (invalidOptions > 0) { ShowError(invalidOptions + " wrestlers include DLC that you do not own, and were skipped."); } } //Generate default team name List <String> wrestlers = new List <String>(); if (rb_singleBlue.Checked || rb_allBlue.Checked) { if (el_blueTeamName.Text.Trim().Equals(String.Empty)) { foreach (MatchConfig.WresIDGroup item in el_blueList.Items) { wrestlers.Add(item.Name); } el_blueTeamName.Text = MatchConfiguration.GetTeamName(wrestlers, SideCornerPostEnum.Left); } } if (rb_singleRed.Checked || rb_allRed.Checked) { if (el_redTeamName.Text.Trim().Equals(String.Empty)) { foreach (MatchConfig.WresIDGroup item in el_redList.Items) { wrestlers.Add(item.Name); } el_redTeamName.Text = MatchConfiguration.GetTeamName(wrestlers, SideCornerPostEnum.Right); } } }