Ejemplo n.º 1
0
        private Form1.Team[] CheckNewTeams(TableLayoutPanel tableLayout, bool bonus)
        {
            List <Form1.Team> teams_list = new List <Form1.Team>();

            //Обнуление бонусных очков за прошлый сезон
            Form1.Team t;
            for (int i = 0; i < m_MainForm.m_TeamsAll.Count; i++)
            {
                t = m_MainForm.m_TeamsAll[i];
                t.c_bonus_score          = 0;
                m_MainForm.m_TeamsAll[i] = t;
            }


            for (int i = 0; i < tableLayout.RowCount - 1; i++)
            {
                if (tableLayout.GetControlFromPosition(2, i + 1).Text == "")
                {
                    continue;
                }
                bool is_contains = false;
                for (int j = 0; j < m_MainForm.m_TeamsAll.Count; j++)
                {
                    if (tableLayout.GetControlFromPosition(1, i + 1).Text == m_MainForm.m_TeamsAll[j].c_owner && tableLayout.GetControlFromPosition(2, i + 1).Text == m_MainForm.m_TeamsAll[j].c_name)
                    {
                        teams_list.Add(m_MainForm.m_TeamsAll[j]);
                        is_contains = true;
                        break;
                    }
                }

                if (!is_contains)
                {
                    teams_list.Add(CreateNewTeam(tableLayout.GetControlFromPosition(1, i + 1).Text, tableLayout.GetControlFromPosition(2, i + 1).Text, m_MainForm.m_TeamsAll[m_MainForm.m_TeamsAll.Count - 1].c_id + 1));
                    m_MainForm.m_TeamsAll.Add(teams_list[teams_list.Count - 1]);
                }

                if (i < 3)
                {
                    Form1.Team tt = teams_list[teams_list.Count - 1];
                    tt.c_bonus_score = 1;
                    teams_list[teams_list.Count - 1] = tt;
                }

                else if (i >= tableLayout.RowCount - 4)
                {
                    Form1.Team tt = teams_list[teams_list.Count - 1];
                    tt.c_bonus_score = -1;
                    teams_list[teams_list.Count - 1] = tt;
                }
                else
                {
                    Form1.Team tt = teams_list[teams_list.Count - 1];
                    tt.c_bonus_score = 0;
                    teams_list[teams_list.Count - 1] = tt;
                }
            }
            Form1.Team[] new_teams = teams_list.ToArray();
            return(new_teams);
        }
Ejemplo n.º 2
0
 private Form1.Team CreateNewTeam(string owner, string name, int id)
 {
     Form1.Team team = new Form1.Team();
     team.c_owner          = owner;
     team.c_name           = name;
     team.c_id             = id;
     team.c_number         = 0;
     team.c_games          = 0;
     team.c_wins           = 0;
     team.c_score          = 0;
     team.c_loses          = 0;
     team.c_goals_scored   = 0;
     team.c_goals_conceded = 0;
     team.c_draws          = 0;
     team.c_champion_score = 0;
     team.c_3rd_place      = 0;
     team.c_2nd_place      = 0;
     team.c_1st_place      = 0;
     team.c_bonus_score    = 0;
     return(team);
 }