示例#1
0
        public void Draw(Graphics g)
        {
            if (show)
            {
                AchieveConfig achieveConfig = ConfigData.GetAchieveConfig(aid);

                virtualRegion.Draw(g);

                int bound = achieveConfig.Condition.Value;
                int get   = DataType.User.UserProfile.Profile.GetAchieveState(aid);

                Font  ft   = new Font("宋体", 11.5f * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                Image back = PicLoader.Read("System", "AchieveBack.JPG");
                if (get >= bound)
                {
                    get = bound;
                    g.DrawImage(back, x, y, width, height);
                    g.DrawImage(AchieveBook.GetAchieveImage(aid), x + 14, y + 12, 50, 50);
                    g.DrawString(achieveConfig.Name, ft, Brushes.Gold, x + 98, y + 12);
                }
                else
                {
                    Rectangle destBack = new Rectangle(x, y, width, height);
                    g.DrawImage(back, destBack, 0, 0, back.Width, back.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray);

                    Rectangle dest = new Rectangle(x + 14, y + 12, 50, 50);
                    g.DrawImage(AchieveBook.GetAchieveImage(aid), dest, 0, 0, 64, 64, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
                    g.DrawString(achieveConfig.Name, ft, Brushes.Gray, x + 98, y + 12);
                }
                back.Dispose();
                ft.Dispose();
                LinearGradientBrush b1 = new LinearGradientBrush(new Rectangle(x + 102, y + 53, 100, 9), Color.White, Color.Gray, LinearGradientMode.Vertical);
                g.FillRectangle(b1, x + 87, y + 44, get * 88 / bound, 9);
                b1.Dispose();
            }
        }
示例#2
0
        public static Image GetPreview(int id)
        {
            AchieveConfig achieveConfig = ConfigData.AchieveDict[id];

            int           wid = 120, heg = 10;
            Font          fontsong  = new Font("宋体", 9 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            Font          fontsong2 = new Font("宋体", 10 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
            List <string> datas     = new List <string>();
            List <string> colors    = new List <string>();

            datas.Add(achieveConfig.Name);
            colors.Add("Gold");
            datas.Add(achieveConfig.Descript);
            colors.Add("LightBlue");
            datas.Add("");
            colors.Add("White");
            datas.Add("完成情况");
            colors.Add("White");
            int bound = achieveConfig.Condition.Value;
            int get   = UserProfile.Profile.GetAchieveState(id);

            if (get >= bound)
            {
                datas.Add("已达成");
                colors.Add("Lime");
            }
            else
            {
                if (achieveConfig.Type == AchieveTypes.Battle)
                {
                    datas.Add("0/1");
                    colors.Add("LemonChiffon");
                }
                else if (get == 0)
                {
                    datas.Add(string.Format("{0}/{1}", get, bound));
                    colors.Add("Red");
                }
                else if (get < bound)
                {
                    datas.Add(string.Format("{0}/{1}", get, bound));
                    colors.Add("LemonChiffon");
                }
                datas.Add(string.Format("达成奖励: {0}", achieveConfig.Money.ToString().PadLeft(2, ' ')));
                colors.Add("Cyan");
            }

            Bitmap   bmp = new Bitmap(300, 300);
            Graphics g   = Graphics.FromImage(bmp);

            foreach (string s in datas)
            {
                wid = Math.Max(wid, (int)g.MeasureString(s, fontsong).Width);
            }
            heg  = datas.Count * 16;
            wid += 5; heg += 5;
            g.Dispose();
            bmp.Dispose();
            bmp = new Bitmap(wid, heg);
            g   = Graphics.FromImage(bmp);
            g.FillRectangle(Brushes.Black, 0, 0, wid, heg);
            g.FillRectangle(new SolidBrush(Color.FromArgb(30, 30, 30)), 0, 0, wid, 18);
            Pen pen = new Pen(Brushes.Gray, 2);

            g.DrawRectangle(pen, 1, 1, wid - 3, heg - 3);
            pen.Dispose();
            int y = 3;

            g.DrawString(datas[0], fontsong2, new SolidBrush(Color.FromName(colors[0])), 3, y);
            for (int i = 1; i < datas.Count; i++)
            {
                y += 16;
                Brush brush = new SolidBrush(Color.FromName(colors[i]));
                g.DrawString(datas[i], fontsong, brush, 3, y, StringFormat.GenericTypographic);
                brush.Dispose();
            }

            if (get < bound)
            {
                g.DrawImage(HSIcons.GetIconsByEName("res8"), 82, y - 1, 14, 14);
            }
            fontsong.Dispose();
            fontsong2.Dispose();
            g.Dispose();
            return(bmp);
        }
示例#3
0
        public int GetAchieveState(int id)
        {
            if (InfoAchieve.GetAchieve(id))
            {
                return(int.MaxValue);
            }

            AchieveConfig achieveConfig = ConfigData.GetAchieveConfig(id);

            switch (achieveConfig.Condition.Id)
            {
            case 1: return(InfoBasic.Level);

            case 2: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalWin));

            case 3: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalKill));

            case 4: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalSummon));

            case 5: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalWeapon));

            case 6: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalSpell));

            case 8: return(InfoRival.GetRivalAvailCount());

            case 9: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalOnline));

            case 11: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalPick));

            case 12: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalDig));

            case 13: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalFish));

            case 14: return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.ContinueWin));

            case 21: return(InfoBag.Resource.Gold);

            case 22: return(InfoBag.Resource.Lumber);

            case 23: return(InfoBag.Resource.Stone);

            case 24: return(InfoBag.Resource.Mercury);

            case 25: return(InfoBag.Resource.Sulfur);

            case 26: return(InfoBag.Resource.Carbuncle);

            case 27: return(InfoBag.Resource.Gem);

            case 30: return(InfoCard.GetCardCountByType(CardTypes.Null));

            case 31: return(InfoCard.GetCardCountByType(CardTypes.Monster));

            case 32: return(InfoCard.GetCardCountByType(CardTypes.Weapon));

            case 33: return(InfoCard.GetCardCountByType(CardTypes.Spell));

            case 50: return(BattleManager.Instance.StatisticData.FastWin);

            case 51: return(BattleManager.Instance.StatisticData.Round);

            case 52: return(BattleManager.Instance.StatisticData.Left.MonsterAdd);

            case 53: return(BattleManager.Instance.StatisticData.Left.WeaponAdd);

            case 54: return(BattleManager.Instance.StatisticData.Left.SpellAdd);

            case 55: return(BattleManager.Instance.StatisticData.Items.Count);

            case 56: return(BattleManager.Instance.StatisticData.ZeroDie);

            case 57: return(BattleManager.Instance.StatisticData.OnlyMagic);

            case 58: return(BattleManager.Instance.StatisticData.OnlySummon);

            case 60: return(BattleManager.Instance.StatisticData.AlmostLost);
            }

            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 100, 108))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalKillByType + achieveConfig.Condition.Id - 100));
            }
            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 110, 125))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalKillByRace + achieveConfig.Condition.Id - 110));
            }
            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 131, 138))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalKillByLevel + achieveConfig.Condition.Id - 130));
            }
            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 200, 216))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalSummonByType + achieveConfig.Condition.Id - 200));
            }
            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 220, 235))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalSummonByRace + achieveConfig.Condition.Id - 220));
            }
            if (MathTool.ValueBetween(achieveConfig.Condition.Id, 241, 248))
            {
                return(InfoRecord.GetRecordById((int)MemPlayerRecordTypes.TotalSummonByLevel + achieveConfig.Condition.Id - 240));
            }

            return(0);
        }