Example #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();
                }
            }
        }
Example #2
0
        private void TourLeague4_Paint(object sender, PaintEventArgs e)
        {
            if (show)
            {
                Font             font             = new Font("宋体", 11 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                TournamentConfig tournamentConfig = ConfigData.GetTournamentConfig(tid);
                foreach (int mid in TournamentBook.GetTournamentMatchIds(tid))
                {
                    TournamentMatchConfig tournamentMatchConfig = ConfigData.GetTournamentMatchConfig(mid);
                    Image head = MatchManager.GetHeadImage(tourData.Pids[tournamentMatchConfig.LeftValue]);
                    if (head != null)
                    {
                        e.Graphics.DrawImage(head, 10 + (36 - headSize) / 2, gridSize * tournamentMatchConfig.Offset + 10 + (36 - headSize) / 2, headSize, headSize);
                    }
                    Brush nbrush = new SolidBrush(MatchManager.GetNameColor(tourData.Results[tournamentMatchConfig.Offset].Winner, tourData.Pids[tournamentMatchConfig.LeftValue]));
                    e.Graphics.DrawString(MatchManager.GetPlayerName(tourData.Pids[tournamentMatchConfig.LeftValue]), font, nbrush, 50, gridSize * tournamentMatchConfig.Offset + 25);
                    nbrush.Dispose();

                    head = MatchManager.GetHeadImage(tourData.Pids[tournamentMatchConfig.RightValue]);
                    if (head != null)
                    {
                        e.Graphics.DrawImage(head, 210 + (36 - headSize) / 2, gridSize * tournamentMatchConfig.Offset + 10 + (36 - headSize) / 2, headSize, headSize);
                    }
                    nbrush = new SolidBrush(MatchManager.GetNameColor(tourData.Results[tournamentMatchConfig.Offset].Winner, tourData.Pids[tournamentMatchConfig.RightValue]));
                    e.Graphics.DrawString(MatchManager.GetPlayerName(tourData.Pids[tournamentMatchConfig.RightValue]), font, nbrush, 250, gridSize * tournamentMatchConfig.Offset + 25);
                    nbrush.Dispose();

                    if (tourData.Results[tournamentMatchConfig.Offset].Winner != 0)
                    {
                        e.Graphics.DrawString(tourData.Results[tournamentMatchConfig.Offset].Winner == tourData.Pids[tournamentMatchConfig.LeftValue] ? "胜" : "负", font, Brushes.White, 143, gridSize * tournamentMatchConfig.Offset + 25);
                    }
                }

                List <int[]> ranks = tourData.GetRanks();
                Brush        brush = new SolidBrush(Color.FromArgb(15, 15, 15));
                e.Graphics.FillRectangle(brush, 340, 53, 165, 200);
                brush.Dispose();
                e.Graphics.DrawRectangle(Pens.Gray, 340, 53, 165, tournamentConfig.PlayerCount * 50);
                e.Graphics.DrawLine(Pens.Gray, 400, 53, 400, 53 + tournamentConfig.PlayerCount * 50);
                for (int i = 0; i < tournamentConfig.PlayerCount - 1; i++)
                {
                    e.Graphics.DrawLine(Pens.Gray, 340, 103 + 50 * i, 505, 103 + 50 * i);
                }
                for (int i = 0; i < tournamentConfig.PlayerCount; i++)
                {
                    Image head = MatchManager.GetHeadImage(ranks[i][0]);
                    if (head != null)
                    {
                        e.Graphics.DrawImage(head, 350, 50 * i + 60, 36, 36);
                        e.Graphics.DrawString(string.Format("{0}战 {1}胜 {2}分", ranks[i][1], ranks[i][2], ranks[i][3]), font, Brushes.White, 410, 50 * i + 75);
                    }
                }

                font.Dispose();
            }
        }
Example #3
0
        private void CalendarForm_Paint(object sender, PaintEventArgs e)
        {
            BorderPainter.Draw(e.Graphics, "", Width, Height);

            Font font = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);

            e.Graphics.DrawString("日 历", font, Brushes.White, Width / 2 - 40, 8);
            font.Dispose();

            if (!showImage)
            {
                return;
            }

            //if (nowSeason == UserProfile.Profile.time.Season)
            //{
            //    int day = UserProfile.Profile.time.Day;
            //    for (int i = 0; i < 28; i++)
            //    {
            //        if (day > i)
            //        {
            //            e.Graphics.FillRectangle(Brushes.DimGray, 30 + 70 * (i%7), 45 + 70 * (i/7), 70,70);
            //        }
            //        else if (day == i)
            //        {
            //            e.Graphics.FillRectangle(Brushes.DarkRed, 30 + 70 * (i % 7), 45 + 70 * (i / 7), 70, 70);
            //        }
            //    }
            //}
            Pen pen = new Pen(Color.White, 2);

            for (int i = 0; i < 5; i++)
            {
                e.Graphics.DrawLine(pen, 30, 45 + 70 * i, 520, 45 + 70 * i);
            }
            for (int i = 0; i < 8; i++)
            {
                e.Graphics.DrawLine(pen, 30 + 70 * i, 45, 30 + 70 * i, 325);
            }
            pen.Dispose();
            font = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
            Font font2 = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);

            for (int i = 0; i < 28; i++)
            {
                e.Graphics.DrawString((i + 1).ToString().PadLeft(2), font, Brushes.White, 70 * (i % 7) + 63, 70 * (i / 7) + 53);
                int date = nowSeason * 28 + i;
                int maid = TournamentBook.GetDayApplyId(date);
                int mmid = TournamentBook.GetDayMatchId(date);

                if (maid != 0)
                {
                    e.Graphics.DrawImage(HSIcons.GetIconsByEName("oth2"), 70 * (i % 7) + 37, 70 * (i / 7) + 50, 24, 24);
                    e.Graphics.DrawString(ConfigDatas.ConfigData.GetTournamentConfig(maid).Name, font2, Brushes.White, 70 * (i % 7) + 33, 70 * (i / 7) + 95);
                }
                else if (mmid != 0)
                {
                    e.Graphics.DrawImage(HSIcons.GetIconsByEName("oth1"), 70 * (i % 7) + 37, 70 * (i / 7) + 50, 24, 24);
                    e.Graphics.DrawString(ConfigDatas.ConfigData.GetTournamentConfig(mmid).Name, font2, Brushes.White, 70 * (i % 7) + 33, 70 * (i / 7) + 95);
                }
            }
            font.Dispose();
            font2.Dispose();
        }
        private void pictureBox1_MouseEnter(object sender, EventArgs e)
        {
            Image img = TournamentBook.GetPreview(tid);

            tooltip.Show(img, sender as Control, 24, 0);
        }