Beispiel #1
0
        public void CheckAllTournament(int day)
        {
            foreach (var tournamentConfig in ConfigData.TournamentDict.Values)
            {
                if (tournamentConfig.ApplyDate == day)
                {
                    DbTournamentData tourdata = GetTournamentData(tournamentConfig.Id);
                    tourdata.Pids = PeopleBook.GetRandNPeople(tournamentConfig.PlayerCount, tournamentConfig.MinLevel, tournamentConfig.MaxLevel);
                    if (tourdata.Engage)
                    {
                        tourdata.Pids[MathTool.GetRandom(tournamentConfig.PlayerCount)] = -1; //player
                    }
                    tourdata.Results = new MatchResult[tournamentConfig.MaxLevel];
                }

                if (tournamentConfig.BeginDate <= day && tournamentConfig.EndDate >= day)
                {
                    foreach (int mid in TournamentBook.GetTournamentMatchIds(tournamentConfig.Id))
                    {
                        TournamentMatchConfig tournamentMatchConfig = ConfigData.GetTournamentMatchConfig(mid);
                        if (tournamentMatchConfig.Date == day && Tournaments[tournamentConfig.Id].Results[tournamentMatchConfig.Offset].Winner == 0)
                        {
                            Tournaments[tournamentConfig.Id].CheckMatch(tournamentMatchConfig.Offset, true);
                        }
                    }
                }
                if (tournamentConfig.EndDate == day)
                {
                    Tournaments[tournamentConfig.Id].Award();
                }
            }
        }
Beispiel #2
0
 public DbTournamentData GetTournamentData(int tid)
 {
     if (Tournaments == null)
     {
         Tournaments = new Dictionary <int, DbTournamentData>();
     }
     if (!Tournaments.ContainsKey(tid))
     {
         DbTournamentData tourdata = new DbTournamentData(tid);
         Tournaments.Add(tid, tourdata);
     }
     return(Tournaments[tid]);
 }
Beispiel #3
0
        public void Init(int id)
        {
            show = true;

            tid      = id;
            tourData = UserProfile.InfoWorld.GetTournamentData(id);

            if (buttons != null)
            {
                foreach (Button button in buttons)
                {
                    Controls.Remove(button);
                }
            }

            buttons = new Button[15];
            for (int i = 0; i < 8; i++)
            {
                Button btn = MatchManager.GetButton(i, 131, 72 * i + 26);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i] = btn;
            }
            for (int i = 0; i < 4; i++)
            {
                Button btn = MatchManager.GetButton(i + 8, 249, 144 * i + 62);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i + 8] = btn;
            }
            for (int i = 0; i < 2; i++)
            {
                Button btn = MatchManager.GetButton(i + 12, 367, 288 * i + 135);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i + 12] = btn;
            }
            Button btn2 = MatchManager.GetButton(14, 485, 280);

            btn2.Click += new EventHandler(button1_Click);
            Controls.Add(btn2);
            buttons[14] = btn2;

            RefreshButtons();

            Invalidate();
        }
Beispiel #4
0
        public void Init(int id)
        {
            show = true;

            tid      = id;
            tourData = UserProfile.InfoWorld.GetTournamentData(id);

            TournamentConfig tournamentConfig = ConfigData.GetTournamentConfig(tid);

            if (tournamentConfig.PlayerCount > 4)
            {
                headSize = 24;
                gridSize = 36;
            }
            else
            {
                headSize = 36;
                gridSize = 50;
            }
            if (buttons != null)
            {
                foreach (Button button in buttons)
                {
                    Controls.Remove(button);
                }
            }
            buttons = new Button[tournamentConfig.MatchCount];
            for (int i = 0; i < tournamentConfig.MatchCount; i++)
            {
                Button btn = MatchManager.GetButton(i, 116, 18 + gridSize * i);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i] = btn;
            }

            RefreshButtons();

            Height = Math.Max(410, tournamentConfig.MatchCount * gridSize);
            Invalidate();
        }
Beispiel #5
0
        public void Init(int id)
        {
            show = true;

            tid      = id;
            tourData = UserProfile.InfoWorld.GetTournamentData(id);

            if (buttons != null)
            {
                foreach (Button button in buttons)
                {
                    Controls.Remove(button);
                }
            }

            buttons = new Button[7];
            for (int i = 0; i < 4; i++)
            {
                Button btn = MatchManager.GetButton(i, 152, 47 + 100 * i);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i] = btn;
            }
            for (int i = 0; i < 2; i++)
            {
                Button btn = MatchManager.GetButton(i + 4, 290, 97 + 200 * i);
                btn.Click += new EventHandler(button1_Click);
                Controls.Add(btn);
                buttons[i + 4] = btn;
            }
            Button btn2 = MatchManager.GetButton(6, 426, 197);

            btn2.Click += new EventHandler(button1_Click);
            Controls.Add(btn2);
            buttons[6] = btn2;

            RefreshButtons();

            Invalidate();
        }