Ejemplo n.º 1
0
        public static void SetTeamNames()
        {
            PlayerMan p           = PlayerMan.inst;
            int       playerCount = MatchConfiguration.GetPlayerCount();

            //Set-up if only two wrestlers exist
            if (playerCount == 2)
            {
                teamNames[0] = DataBase.GetWrestlerFullName(PlayerMan.inst.GetPlObj(0).WresParam);
                teamNames[1] = DataBase.GetWrestlerFullName(PlayerMan.inst.GetPlObj(4).WresParam);
                return;
            }

            //Set-up for if multi-man teams exist
            try
            {
                //Get Team One Members
                List <String> wrestlers = new List <String>();
                wrestlers.Clear();

                for (int i = 0; i < 4; i++)
                {
                    Player plObj = PlayerMan.inst.GetPlObj(i);
                    if (!plObj)
                    {
                        continue;
                    }
                    if (!plObj.isSecond && !plObj.isSleep && !plObj.isIntruder)
                    {
                        wrestlers.Add(DataBase.GetWrestlerFullName(plObj.WresParam));
                    }
                }

                //Determine if a team is necessary
                if (wrestlers.Count == 1)
                {
                    teamNames[0] = wrestlers[0];
                }
                else
                {
                    teamNames[0] = MatchConfiguration.GetTeamName(wrestlers, SideCornerPostEnum.Left);
                }

                //Get Team Two Members
                wrestlers.Clear();

                for (int i = 4; i < 8; i++)
                {
                    Player plObj = PlayerMan.inst.GetPlObj(i);
                    if (!plObj)
                    {
                        continue;
                    }
                    if (!plObj.isSecond && !plObj.isSleep && !plObj.isIntruder)
                    {
                        wrestlers.Add(DataBase.GetWrestlerFullName(plObj.WresParam));
                    }
                }

                //Determine if a team is necessary
                if (wrestlers.Count == 1)
                {
                    teamNames[1] = wrestlers[0];
                }
                else
                {
                    teamNames[1] = MatchConfiguration.GetTeamName(wrestlers, SideCornerPostEnum.Right);
                }
            }
            catch
            {
                teamNames[0] = "Blue Team";
                teamNames[1] = "Red Team";
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }