コード例 #1
0
        public override Bitmap Render()
        {
            if (this.Recipe == null)
            {
                return(null);
            }
            int      picHeight;
            Bitmap   originBmp = RenderRecipe(out picHeight);
            Bitmap   tooltip   = new Bitmap(originBmp.Width, picHeight);
            Graphics g         = Graphics.FromImage(tooltip);

            //绘制背景区域
            GearGraphics.DrawNewTooltipBack(g, 0, 0, tooltip.Width, tooltip.Height);

            //复制图像
            g.DrawImage(originBmp, 0, 0, new Rectangle(0, 0, originBmp.Width, picHeight), GraphicsUnit.Pixel);

            //左上角
            g.DrawImage(Resource.UIToolTip_img_Item_Frame2_cover, 3, 3);

            if (this.ShowObjectID)
            {
                GearGraphics.DrawGearDetailNumber(g, 3, 3, Recipe.RecipeID.ToString("d8"), true);
            }

            if (originBmp != null)
            {
                originBmp.Dispose();
            }

            g.Dispose();
            return(tooltip);
        }
コード例 #2
0
        private void drawGearReq(Graphics g, ref int picHeight)
        {
            int  value;
            bool isGetProp;
            bool can;

            //等级要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqLevel, out value);
            can       = (charStat == null || charStat.Level >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqLEV : Resource.ToolTip_Equip_Cannot_reqLEV, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;

            //力量要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqSTR, out value);
            can       = (charStat == null || charStat.Strength.GetSum() >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqSTR : Resource.ToolTip_Equip_Cannot_reqSTR, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;

            //敏捷要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqDEX, out value);
            can       = (charStat == null || charStat.Dexterity.GetSum() >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqDEX : Resource.ToolTip_Equip_Cannot_reqDEX, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;

            //智力要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqINT, out value);
            can       = (charStat == null || charStat.Intelligence.GetSum() >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqINT : Resource.ToolTip_Equip_Cannot_reqINT, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;

            //运气要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqLUK, out value);
            can       = (charStat == null || charStat.Luck.GetSum() >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqLUK : Resource.ToolTip_Equip_Cannot_reqLUK, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;

            //人气要求
            isGetProp = gear.Props.TryGetValue(GearPropType.reqPOP, out value);
            can       = (charStat == null || charStat.Pop >= value);
            g.DrawImage(can ? Resource.ToolTip_Equip_Can_reqPOP : Resource.ToolTip_Equip_Cannot_reqPOP, 96, picHeight);
            GearGraphics.DrawGearDetailNumber(g, 156, picHeight + 4, isGetProp ? value.ToString() : "-", can);
            picHeight += 12;
        }
コード例 #3
0
        public override Bitmap Render()
        {
            if (this.Skill == null)
            {
                return(null);
            }

            CanvasRegion region = this.IsWideMode ? CanvasRegion.Wide : CanvasRegion.Original;

            int      picHeight;
            Bitmap   originBmp = RenderSkill(region, out picHeight);
            Bitmap   tooltip   = new Bitmap(originBmp.Width, picHeight);
            Graphics g         = Graphics.FromImage(tooltip);

            //绘制背景区域
            GearGraphics.DrawNewTooltipBack(g, 0, 0, tooltip.Width, tooltip.Height);

            //复制图像
            g.DrawImage(originBmp, 0, 0, new Rectangle(0, 0, originBmp.Width, picHeight), GraphicsUnit.Pixel);

            //左上角
            g.DrawImage(Resource.UIToolTip_img_Item_Frame2_cover, 3, 3);

            if (this.ShowObjectID)
            {
                GearGraphics.DrawGearDetailNumber(g, 3, 3, Skill.SkillID.ToString("d7"), true);
            }

            if (originBmp != null)
            {
                originBmp.Dispose();
            }

            g.Dispose();
            return(tooltip);
        }
コード例 #4
0
        public override Bitmap Render()
        {
            if (this.item == null)
            {
                return(null);
            }
            //绘制道具
            int    picHeight;
            Bitmap itemBmp       = RenderItem(out picHeight);
            Bitmap recipeInfoBmp = null;
            Bitmap recipeItemBmp = null;
            Bitmap setItemBmp    = null;

            //图纸相关
            int recipeID;

            if (this.item.Specs.TryGetValue(ItemSpecType.recipe, out recipeID))
            {
                int    recipeSkillID = recipeID / 10000;
                Recipe recipe        = null;
                //寻找配方
                Wz_Node recipeNode = PluginBase.PluginManager.FindWz(string.Format(@"Skill\Recipe_{0}.img\{1}", recipeSkillID, recipeID));
                if (recipeNode != null)
                {
                    recipe = Recipe.CreateFromNode(recipeNode);
                }
                //生成配方图像
                if (recipe != null)
                {
                    if (this.LinkRecipeInfo)
                    {
                        recipeInfoBmp = RenderLinkRecipeInfo(recipe);
                    }

                    if (this.LinkRecipeItem)
                    {
                        int itemID      = recipe.MainTargetItemID;
                        int itemIDClass = itemID / 1000000;
                        if (itemIDClass == 1) //通过ID寻找装备
                        {
                            Wz_Node charaWz = PluginManager.FindWz(Wz_Type.Character);
                            if (charaWz != null)
                            {
                                string imgName = itemID.ToString("d8") + ".img";
                                foreach (Wz_Node node0 in charaWz.Nodes)
                                {
                                    Wz_Node imgNode = node0.FindNodeByPath(imgName, true);
                                    if (imgNode != null)
                                    {
                                        Gear gear = Gear.CreateFromNode(imgNode, path => PluginManager.FindWz(path));
                                        if (gear != null)
                                        {
                                            recipeItemBmp = RenderLinkRecipeGear(gear);
                                        }

                                        break;
                                    }
                                }
                            }
                        }
                        else if (itemIDClass >= 2 && itemIDClass <= 5) //通过ID寻找道具
                        {
                            Wz_Node itemWz = PluginManager.FindWz(Wz_Type.Item);
                            if (itemWz != null)
                            {
                                string imgClass = (itemID / 10000).ToString("d4") + ".img\\" + itemID.ToString("d8");
                                foreach (Wz_Node node0 in itemWz.Nodes)
                                {
                                    Wz_Node imgNode = node0.FindNodeByPath(imgClass, true);
                                    if (imgNode != null)
                                    {
                                        Item item = Item.CreateFromNode(imgNode, PluginManager.FindWz);
                                        if (item != null)
                                        {
                                            recipeItemBmp = RenderLinkRecipeItem(item);
                                        }

                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            int setID;

            if (this.item.Props.TryGetValue(ItemPropType.setItemID, out setID))
            {
                SetItem setItem;
                if (CharaSimLoader.LoadedSetItems.TryGetValue(setID, out setItem))
                {
                    setItemBmp = RenderSetItem(setItem);
                }
            }

            //计算布局
            Size  totalSize        = new Size(itemBmp.Width, picHeight);
            Point recipeInfoOrigin = Point.Empty;
            Point recipeItemOrigin = Point.Empty;
            Point setItemOrigin    = Point.Empty;

            if (recipeItemBmp != null)
            {
                recipeItemOrigin.X = totalSize.Width;
                totalSize.Width   += recipeItemBmp.Width;

                if (recipeInfoBmp != null)
                {
                    recipeInfoOrigin.X = itemBmp.Width - recipeInfoBmp.Width;
                    recipeInfoOrigin.Y = picHeight;
                    totalSize.Height   = Math.Max(picHeight + recipeInfoBmp.Height, recipeItemBmp.Height);
                }
                else
                {
                    totalSize.Height = Math.Max(picHeight, recipeItemBmp.Height);
                }
            }
            else if (recipeInfoBmp != null)
            {
                totalSize.Width   += recipeInfoBmp.Width;
                totalSize.Height   = Math.Max(picHeight, recipeInfoBmp.Height);
                recipeInfoOrigin.X = itemBmp.Width;
            }
            if (setItemBmp != null)
            {
                setItemOrigin    = new Point(totalSize.Width, 0);
                totalSize.Width += setItemBmp.Width;
                totalSize.Height = Math.Max(totalSize.Height, setItemBmp.Height);
            }

            //开始绘制
            Bitmap   tooltip = new Bitmap(totalSize.Width, totalSize.Height);
            Graphics g       = Graphics.FromImage(tooltip);

            if (itemBmp != null)
            {
                //绘制背景区域
                GearGraphics.DrawNewTooltipBack(g, 0, 0, itemBmp.Width, picHeight);
                //复制图像
                g.DrawImage(itemBmp, 0, 0, new Rectangle(0, 0, itemBmp.Width, picHeight), GraphicsUnit.Pixel);
                //左上角
                g.DrawImage(Resource.UIToolTip_img_Item_Frame2_cover, 3, 3);

                if (this.ShowObjectID)
                {
                    GearGraphics.DrawGearDetailNumber(g, 3, 3, item.ItemID.ToString("d8"), true);
                }
            }

            //绘制配方
            if (recipeInfoBmp != null)
            {
                g.DrawImage(recipeInfoBmp, recipeInfoOrigin.X, recipeInfoOrigin.Y,
                            new Rectangle(Point.Empty, recipeInfoBmp.Size), GraphicsUnit.Pixel);
            }

            //绘制产出道具
            if (recipeItemBmp != null)
            {
                g.DrawImage(recipeItemBmp, recipeItemOrigin.X, recipeItemOrigin.Y,
                            new Rectangle(Point.Empty, recipeItemBmp.Size), GraphicsUnit.Pixel);
            }

            //绘制套装
            if (setItemBmp != null)
            {
                g.DrawImage(setItemBmp, setItemOrigin.X, setItemOrigin.Y,
                            new Rectangle(Point.Empty, setItemBmp.Size), GraphicsUnit.Pixel);
            }

            if (itemBmp != null)
            {
                itemBmp.Dispose();
            }
            if (recipeInfoBmp != null)
            {
                recipeInfoBmp.Dispose();
            }
            if (recipeItemBmp != null)
            {
                recipeItemBmp.Dispose();
            }
            if (setItemBmp != null)
            {
                setItemBmp.Dispose();
            }

            g.Dispose();
            return(tooltip);
        }
コード例 #5
0
        private Bitmap renderBase(out int picHeight, out int iconY)
        {
            //绘制左侧部分
            Bitmap       leftPart = new Bitmap(252, DefaultPicHeight);
            Graphics     g        = Graphics.FromImage(leftPart);
            StringFormat format   = new StringFormat();
            int          value;

            picHeight = 10;
            if (gear.Star > 0) //绘制星星
            {
                if (gear.Star < 5)
                {
                    for (int i = 0; i < gear.Star; i++)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star, 126 - gear.Star * 13 / 2 + 13 * i, picHeight);
                    }
                    picHeight += 18;
                }
                else
                {
                    int star = gear.Star % 5, star2 = gear.Star / 5;
                    int dx = 126 - (13 * star + 26 * star2) / 2;
                    for (int i = 0; i < 1; i++, dx += 26)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star2, dx, picHeight);
                    }
                    for (int i = 0; i < star; i++, dx += 13)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star, dx, picHeight + 5);
                    }
                    for (int i = 1; i < star2; i++, dx += 26)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star2, dx, picHeight);
                    }
                    picHeight += 28;
                }
            }

            //装备标题
            StringResult sr;

            if (StringLinker == null || !StringLinker.StringEqp.TryGetValue(gear.ItemID, out sr))
            {
                sr      = new StringResult();
                sr.Name = "(null)";
            }
            string gearName = sr.Name;
            string nameAdd  = gear.ScrollUp > 0 ? ("+" + gear.ScrollUp) : null;

            switch (Gear.GetGender(gear.ItemID))
            {
            case 0: nameAdd += "男"; break;

            case 1: nameAdd += "女"; break;
            }
            if (!string.IsNullOrEmpty(nameAdd))
            {
                gearName += " (" + nameAdd + ")";
            }
            format.Alignment = StringAlignment.Center;
            g.DrawString(gearName, GearGraphics.ItemNameFont,
                         GearGraphics.GetGearNameBrush(gear.diff, gear.ScrollUp > 0), 124, picHeight, format);//绘制装备名称
            picHeight += 19;

            //装备rank
            string rankStr;

            if (gear.GetBooleanValue(GearPropType.specialGrade))
            {
                rankStr = ItemStringHelper.GetGearGradeString(GearGrade.Special);
            }
            else
            {
                rankStr = ItemStringHelper.GetGearGradeString(gear.Grade);
            }
            g.DrawString(rankStr, GearGraphics.ItemDetailFont, Brushes.White, 127, picHeight, format);
            picHeight += 21;

            //额外属性
            for (int i = 0; i < 2; i++)
            {
                string attrStr = GetGearAttributeString(i);
                if (!string.IsNullOrEmpty(attrStr))
                {
                    g.DrawString(attrStr, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, 126, picHeight, format);
                    picHeight += 19;
                }
            }

            //装备限时
            if (gear.TimeLimited)
            {
                DateTime time      = DateTime.Now.AddDays(7d);
                string   expireStr = time.ToString("到yyyy年 M月 d日 H时 m分可以用");
                g.DrawString(expireStr, GearGraphics.ItemDetailFont, Brushes.White, 126, picHeight, format);
                picHeight += 16;
            }

            picHeight += 1;
            iconY      = picHeight + 1;
            bool epic = gear.Epic;

            //绘制图标
            if (gear.Icon.Bitmap != null)
            {
                g.DrawImage(GearGraphics.EnlargeBitmap(gear.Icon.Bitmap),
                            14 + (1 - gear.Icon.Origin.X) * 2,
                            iconY + (33 - gear.Icon.Origin.Y) * 2);
            }
            if (gear.Cash)
            {
                g.DrawImage(GearGraphics.EnlargeBitmap(Resource.CashItem_0),
                            14 + 68 - 26,
                            iconY + 68 - 26);
            }

            //绘制属性要求
            drawGearReq(g, ref picHeight);

            //绘制装备等级
            if (gear.Props.TryGetValue(GearPropType.level, out value))
            {
                g.DrawImage(Resource.ToolTip_Equip_GrowthEnabled_itemLEV, 96, picHeight);
                GearGraphics.DrawGearGrowthNumber(g, 160, picHeight + 4, (value == -1) ? "m" : value.ToString(), true);
                picHeight += 12;
                g.DrawImage(Resource.ToolTip_Equip_GrowthEnabled_itemEXP, 96, picHeight);
                GearGraphics.DrawGearGrowthNumber(g, 160, picHeight + 4, (value == -1) ? "m" : "0%", true);
            }
            else
            {
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_itemLEV, 96, picHeight);
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_none, 160, picHeight + 4 + 3);
                picHeight += 12;
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_itemEXP, 96, picHeight);
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_none, 160, picHeight + 4 + 3);
            }
            picHeight += 12;
            if (gear.Props.TryGetValue(GearPropType.durability, out value))
            {
                if (value > 100)
                {
                    value = 100;
                }
                g.DrawImage(value > 0 ? Resource.ToolTip_Equip_Can_durability : Resource.ToolTip_Equip_Cannot_durability, 96, picHeight);
                GearGraphics.DrawGearDetailNumber(g, 173, picHeight, value.ToString() + "%", value > 0);
            }
            picHeight += 13;

            //绘制职业要求
            int reqJob;

            gear.Props.TryGetValue(GearPropType.reqJob, out reqJob);
            g.DrawString("新手", GearGraphics.ItemDetailFont, reqJob > 0 ? Brushes.Red : Brushes.White, 10, picHeight);
            if (reqJob == 0)
            {
                reqJob = 0x1f;             //0001 1111
            }
            if (reqJob == -1)
            {
                reqJob = 0;               //0000 0000
            }
            g.DrawString("战士", GearGraphics.ItemDetailFont, (reqJob & 1) == 0 ? Brushes.Red : Brushes.White, 46, picHeight);
            g.DrawString("魔法师", GearGraphics.ItemDetailFont, (reqJob & 2) == 0 ? Brushes.Red : Brushes.White, 82, picHeight);
            g.DrawString("弓箭手", GearGraphics.ItemDetailFont, (reqJob & 4) == 0 ? Brushes.Red : Brushes.White, 130, picHeight);
            g.DrawString("飞侠", GearGraphics.ItemDetailFont, (reqJob & 8) == 0 ? Brushes.Red : Brushes.White, 178, picHeight);
            g.DrawString("海盗", GearGraphics.ItemDetailFont, (reqJob & 16) == 0 ? Brushes.Red : Brushes.White, 214, picHeight);
            picHeight += 19;

            //额外职业要求
            string extraReq = ItemStringHelper.GetExtraJobReqString(gear.type) ??
                              (gear.Props.TryGetValue(GearPropType.reqSpecJob, out value) ? ItemStringHelper.GetExtraJobReqString(value) : null);

            if (!string.IsNullOrEmpty(extraReq))
            {
                g.DrawString(extraReq, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, 124, picHeight, format);
                picHeight += 18;
            }

            //分割线1号
            g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
            picHeight += 9;

            bool hasPart2 = false;

            //绘制属性
            if (gear.Props.TryGetValue(GearPropType.superiorEqp, out value) && value > 0)
            {
                g.DrawString("极真", GearGraphics.ItemNameFont, GearGraphics.SetItemNameBrush, 126, picHeight, format);
                picHeight += 18;
            }
            if (gear.Props.TryGetValue(GearPropType.limitBreak, out value) && value > 0)
            {
                g.DrawString("突破极限", GearGraphics.ItemNameFont, GearGraphics.SetItemNameBrush, 126, picHeight, format);
                picHeight += 18;
            }

            bool   isWeapon = Gear.IsLeftWeapon(gear.type) || Gear.IsDoubleHandWeapon(gear.type);
            string typeStr  = ItemStringHelper.GetGearTypeString(gear.type);

            if (!string.IsNullOrEmpty(typeStr))
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString((isWeapon ? "武器" : "装备") + "分类 : " + typeStr,
                             GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            if (gear.Props.TryGetValue(GearPropType.attackSpeed, out value))
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString("攻击速度 : " + ItemStringHelper.GetAttackSpeedString(value),
                             GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            List <GearPropType> props = new List <GearPropType>();

            foreach (KeyValuePair <GearPropType, int> p in gear.Props)
            {
                if ((int)p.Key < 100 && p.Value != 0)
                {
                    props.Add(p.Key);
                }
            }
            props.Sort();
            foreach (GearPropType type in props)
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString(ItemStringHelper.GetGearPropString(type, gear.Props[type]), (epic && Gear.IsEpicPropType(type)) ? GearGraphics.EpicGearDetailFont : GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            bool hasTuc = gear.HasTuc && gear.Props.TryGetValue(GearPropType.tuc, out value);

            if (hasTuc)
            {
                g.DrawString("·可升级次数 : " + value + "回", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            if (gear.Props.TryGetValue(GearPropType.limitBreak, out value) && value > 0)
            {
                g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.limitBreak, value), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }

            if (hasTuc && gear.Hammer > -1)
            {
                if (gear.Hammer == 2)
                {
                    g.DrawString("黄金锤提炼完成", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                    picHeight += 16;
                }
                if (gear.Props.TryGetValue(GearPropType.superiorEqp, out value) && value > 0)
                {
                    g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.superiorEqp, value), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picHeight);
                    picHeight += 16;
                }
                if (gear.Star > 0)
                {
                    g.DrawString("·应用" + gear.Star + "星强化", GearGraphics.ItemDetailFont, GearGraphics.OrangeBrush, 8, picHeight);
                    picHeight += 16;
                }
                picHeight += 2;
                g.DrawString("金锤子已提高的强化次数", GearGraphics.ItemDetailFont, GearGraphics.GoldHammerBrush, 8, picHeight);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                g.DrawString(": " + gear.Hammer.ToString() + (gear.Hammer == 2 ? "(MAX)" : null), GearGraphics.TahomaFont, GearGraphics.GoldHammerBrush, 140, picHeight - 2);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
                picHeight          += 14;
                hasPart2            = true;
            }


            //分割线2号
            if (hasPart2)
            {
                g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
                picHeight += 9;
            }

            //绘制潜能
            int optionCount = 0;

            foreach (Potential potential in gear.Options)
            {
                if (potential != null)
                {
                    g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                    g.DrawString(potential.ConvertSummary(), GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                    picHeight += 16;
                    optionCount++;
                }
            }
            if (optionCount > 0)
            {
                picHeight += 4 * optionCount;
            }
            else if (gear.CanPotential)
            {
                GearGraphics.DrawString(g, " #c潜能卷轴# 可增加 #cC级物品# 潜力,但需鉴定。\n #c放大镜# 可解除 #c未鉴定物品# 潜能的封印。",
                                        GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 4;
            }

            //绘制附加潜能
            int adOptionCount = 0;

            foreach (Potential potential in gear.AdditionalOptions)
            {
                if (potential != null)
                {
                    adOptionCount++;
                }
            }
            if (adOptionCount > 0)
            {
                //分割线3号
                picHeight -= 3;
                g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
                g.DrawImage(GetAdditionalOptionIcon(gear.AdditionGrade), 8, picHeight + 1);
                g.DrawString("附加潜能", GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 26, picHeight + 2);
                picHeight += 24;

                foreach (Potential potential in gear.AdditionalOptions)
                {
                    if (potential != null)
                    {
                        g.DrawString("+", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                        g.DrawString(potential.ConvertSummary(), GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                        picHeight += 18;
                        adOptionCount++;
                    }
                }
                picHeight += 5;
            }

            //绘制desc
            if (!string.IsNullOrEmpty(sr.Desc))
            {
                if (optionCount > 0)
                {
                    picHeight -= 2;
                }
                picHeight -= 3;
                GearGraphics.DrawString(g, sr.Desc, GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 5;
            }
            if (gear.Props.TryGetValue(GearPropType.tradeAvailable, out value) && value != 0)
            {
                g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.tradeAvailable, value),
                             GearGraphics.ItemDetailFont,
                             GearGraphics.OrangeBrush,
                             14, picHeight - 5);
                picHeight += 16;
            }

            if (gear.Props.TryGetValue(GearPropType.accountShareTag, out value) && value != 0)
            {
                GearGraphics.DrawString(g, " #c" + ItemStringHelper.GetGearPropString(GearPropType.accountShareTag, 1) + "#",
                                        GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 16;
            }

            //绘制倾向
            if (gear.State == GearState.itemList)
            {
                string         incline      = null;
                GearPropType[] inclineTypes = new GearPropType[] {
                    GearPropType.charismaEXP,
                    GearPropType.senseEXP,
                    GearPropType.insightEXP,
                    GearPropType.willEXP,
                    GearPropType.craftEXP,
                    GearPropType.charmEXP
                };

                string[] inclineString = new string[] {
                    "领导力", "感性", "洞察力", "意志", "手技", "魅力"
                };

                for (int i = 0; i < inclineTypes.Length; i++)
                {
                    if (gear.Props.TryGetValue(inclineTypes[i], out value) && value > 0)
                    {
                        incline += "," + inclineString[i] + value;
                    }
                }

                if (!string.IsNullOrEmpty(incline))
                {
                    picHeight -= 5;
                    GearGraphics.DrawString(g, "\n #c装备时可以获得" + incline.Substring(1) + "的经验值,仅限1次。#",
                                            GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                    picHeight += 8;
                }
            }
            format.Dispose();
            g.Dispose();
            return(leftPart);
        }
コード例 #6
0
        private Bitmap renderBase(out int picHeight, out int iconY)
        {
            //绘制左侧部分
            Bitmap       leftPart = new Bitmap(252, DefaultPicHeight);
            Graphics     g        = Graphics.FromImage(leftPart);
            StringFormat format   = new StringFormat();
            int          value;

            picHeight = 10;
            if (gear.Star > 0) //绘制星星
            {
                if (gear.Star < 5)
                {
                    for (int i = 0; i < gear.Star; i++)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star, 126 - gear.Star * 13 / 2 + 13 * i, picHeight);
                    }
                    picHeight += 18;
                }
                else
                {
                    int star = gear.Star % 5, star2 = gear.Star / 5;
                    int dx = 126 - (13 * star + 26 * star2) / 2;
                    for (int i = 0; i < 1; i++, dx += 26)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star2, dx, picHeight);
                    }
                    for (int i = 0; i < star; i++, dx += 13)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star, dx, picHeight + 5);
                    }
                    for (int i = 1; i < star2; i++, dx += 26)
                    {
                        g.DrawImage(Resource.ToolTip_Equip_Star_Star2, dx, picHeight);
                    }
                    picHeight += 28;
                }
            }

            //装备标题
            StringResult sr;

            if (StringLinker == null || !StringLinker.StringEqp.TryGetValue(gear.ItemID, out sr))
            {
                sr      = new StringResult();
                sr.Name = "(null)";
            }
            string gearName = sr.Name;
            string nameAdd  = gear.ScrollUp > 0 ? ("+" + gear.ScrollUp) : null;

            switch (Gear.GetGender(gear.ItemID))
            {
            case 0: nameAdd += "Male"; break;

            case 1: nameAdd += "Female"; break;
            }
            if (!string.IsNullOrEmpty(nameAdd))
            {
                gearName += " (" + nameAdd + ")";
            }
            format.Alignment = StringAlignment.Center;
            g.DrawString(gearName, GearGraphics.ItemNameFont,
                         GearGraphics.GetGearNameBrush(gear.diff, gear.ScrollUp > 0), 124, picHeight, format);//绘制装备名称
            picHeight += 19;

            //装备rank
            string rankStr;

            if (gear.GetBooleanValue(GearPropType.specialGrade))
            {
                rankStr = ItemStringHelper.GetGearGradeString(GearGrade.Special);
            }
            else
            {
                rankStr = ItemStringHelper.GetGearGradeString(gear.Grade);
            }
            g.DrawString(rankStr, GearGraphics.ItemDetailFont, Brushes.White, 127, picHeight, format);
            picHeight += 21;

            //额外属性
            for (int i = 0; i < 2; i++)
            {
                string attrStr = GetGearAttributeString(i);
                if (!string.IsNullOrEmpty(attrStr))
                {
                    g.DrawString(attrStr, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, 126, picHeight, format);
                    picHeight += 19;
                }
            }

            //装备限时
            if (gear.TimeLimited)
            {
                DateTime time      = DateTime.Now.AddDays(7d);
                string   expireStr = time.ToString("USABLE UNTIL M-d-yyyy AT H:m");
                g.DrawString(expireStr, GearGraphics.ItemDetailFont, Brushes.White, 126, picHeight, format);
                picHeight += 16;
            }

            picHeight += 1;
            iconY      = picHeight + 1;
            bool epic = gear.Epic;

            //绘制图标
            if (gear.Icon.Bitmap != null)
            {
                g.DrawImage(GearGraphics.EnlargeBitmap(gear.Icon.Bitmap),
                            14 + (1 - gear.Icon.Origin.X) * 2,
                            iconY + (33 - gear.Icon.Origin.Y) * 2);
            }
            if (gear.Cash)
            {
                g.DrawImage(GearGraphics.EnlargeBitmap(Resource.CashItem_0),
                            14 + 68 - 26,
                            iconY + 68 - 26);
            }

            //绘制属性要求
            drawGearReq(g, ref picHeight);

            //绘制装备等级
            if (gear.Props.TryGetValue(GearPropType.level, out value))
            {
                g.DrawImage(Resource.ToolTip_Equip_GrowthEnabled_itemLEV, 96, picHeight);
                GearGraphics.DrawGearGrowthNumber(g, 160, picHeight + 4, (value == -1) ? "m" : value.ToString(), true);
                picHeight += 12;
                g.DrawImage(Resource.ToolTip_Equip_GrowthEnabled_itemEXP, 96, picHeight);
                GearGraphics.DrawGearGrowthNumber(g, 160, picHeight + 4, (value == -1) ? "m" : "0%", true);
            }
            else
            {
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_itemLEV, 96, picHeight);
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_none, 160, picHeight + 4 + 3);
                picHeight += 12;
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_itemEXP, 96, picHeight);
                g.DrawImage(Resource.ToolTip_Equip_GrowthDisabled_none, 160, picHeight + 4 + 3);
            }
            picHeight += 12;
            if (gear.Props.TryGetValue(GearPropType.durability, out value))
            {
                if (value > 100)
                {
                    value = 100;
                }
                g.DrawImage(value > 0 ? Resource.ToolTip_Equip_Can_durability : Resource.ToolTip_Equip_Cannot_durability, 96, picHeight);
                GearGraphics.DrawGearDetailNumber(g, 173, picHeight, value.ToString() + "%", value > 0);
            }
            picHeight += 13;

            //绘制职业要求
            int reqJob;

            gear.Props.TryGetValue(GearPropType.reqJob, out reqJob);
            g.DrawString("Common", GearGraphics.ItemDetailFont, reqJob > 0 ? Brushes.Red : Brushes.White, 10, picHeight);
            if (reqJob == 0)
            {
                reqJob = 0x1f;             //0001 1111
            }
            if (reqJob == -1)
            {
                reqJob = 0;               //0000 0000
            }
            g.DrawString("Warrior", GearGraphics.ItemDetailFont, (reqJob & 1) == 0 ? Brushes.Red : Brushes.White, 46, picHeight);
            g.DrawString("Magician", GearGraphics.ItemDetailFont, (reqJob & 2) == 0 ? Brushes.Red : Brushes.White, 82, picHeight);
            g.DrawString("Bowman", GearGraphics.ItemDetailFont, (reqJob & 4) == 0 ? Brushes.Red : Brushes.White, 130, picHeight);
            g.DrawString("Thief", GearGraphics.ItemDetailFont, (reqJob & 8) == 0 ? Brushes.Red : Brushes.White, 178, picHeight);
            g.DrawString("Pirate", GearGraphics.ItemDetailFont, (reqJob & 16) == 0 ? Brushes.Red : Brushes.White, 214, picHeight);
            picHeight += 19;

            //额外职业要求
            string extraReq = ItemStringHelper.GetExtraJobReqString(gear.type) ??
                              (gear.Props.TryGetValue(GearPropType.reqSpecJob, out value) ? ItemStringHelper.GetExtraJobReqString(value) : null);

            if (!string.IsNullOrEmpty(extraReq))
            {
                g.DrawString(extraReq, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, 124, picHeight, format);
                picHeight += 18;
            }

            //分割线1号
            g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
            picHeight += 9;

            bool hasPart2 = false;

            //绘制属性
            if (gear.Props.TryGetValue(GearPropType.superiorEqp, out value) && value > 0)
            {
                g.DrawString("Superior", GearGraphics.ItemNameFont, GearGraphics.SetItemNameBrush, 126, picHeight, format);
                picHeight += 18;
            }
            if (gear.Props.TryGetValue(GearPropType.limitBreak, out value) && value > 0)
            {
                g.DrawString("Max Damage: ", GearGraphics.ItemNameFont, GearGraphics.SetItemNameBrush, 126, picHeight, format);
                picHeight += 18;
            }

            bool   isWeapon = Gear.IsLeftWeapon(gear.type) || Gear.IsDoubleHandWeapon(gear.type);
            string typeStr  = ItemStringHelper.GetGearTypeString(gear.type);

            if (!string.IsNullOrEmpty(typeStr))
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString((isWeapon ? "Arms" : "Equipment") + "Type : " + typeStr,
                             GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            if (gear.Props.TryGetValue(GearPropType.attackSpeed, out value))
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString("Attack Speed : " + ItemStringHelper.GetAttackSpeedString(value),
                             GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            List <GearPropType> props = new List <GearPropType>();

            foreach (KeyValuePair <GearPropType, int> p in gear.Props)
            {
                if ((int)p.Key < 100 && p.Value != 0)
                {
                    props.Add(p.Key);
                }
            }
            props.Sort();
            foreach (GearPropType type in props)
            {
                g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                g.DrawString(ItemStringHelper.GetGearPropString(type, gear.Props[type]), (epic && Gear.IsEpicPropType(type)) ? GearGraphics.EpicGearDetailFont : GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            bool hasTuc = gear.HasTuc && gear.Props.TryGetValue(GearPropType.tuc, out value);

            if (hasTuc)
            {
                g.DrawString("Remaining Enhancements : " + value, GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }
            if (gear.Props.TryGetValue(GearPropType.limitBreak, out value) && value > 0)
            {
                g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.limitBreak, value), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picHeight);
                picHeight += 16;
                hasPart2   = true;
            }

            if (hasTuc && gear.Hammer > -1)
            {
                if (gear.Hammer == 2)
                {
                    g.DrawString("Hammers Applied: 2 (Max)", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                    picHeight += 16;
                }
                if (gear.Props.TryGetValue(GearPropType.superiorEqp, out value) && value > 0)
                {
                    g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.superiorEqp, value), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picHeight);
                    picHeight += 16;
                }
                if (gear.Star > 0)
                {
                    g.DrawString("Star Force: " + gear.Star + "Infused", GearGraphics.ItemDetailFont, GearGraphics.OrangeBrush, 8, picHeight);
                    picHeight += 16;
                }
                picHeight += 2;
                g.DrawString("Hammers Applied: 0", GearGraphics.ItemDetailFont, GearGraphics.GoldHammerBrush, 8, picHeight);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                g.DrawString(": " + gear.Hammer.ToString() + (gear.Hammer == 2 ? "(MAX)" : null), GearGraphics.TahomaFont, GearGraphics.GoldHammerBrush, 140, picHeight - 2);
                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
                picHeight          += 15;
                hasPart2            = true;
            }


            //分割线2号
            if (hasPart2)
            {
                g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
                picHeight += 9;
            }

            //绘制潜能
            int optionCount = 0;

            foreach (Potential potential in gear.Options)
            {
                if (potential != null)
                {
                    g.DrawString("·", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                    g.DrawString(potential.ConvertSummary(), GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                    picHeight += 16;
                    optionCount++;
                }
            }
            if (optionCount > 0)
            {
                picHeight += 4 * optionCount;
            }
            else if (gear.CanPotential)
            {
                GearGraphics.DrawString(g, "Potential. (Click on the magnifying glass button in the item window to unleash.)",
                                        GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 4;
            }

            //绘制附加潜能
            int adOptionCount = 0;

            foreach (Potential potential in gear.AdditionalOptions)
            {
                if (potential != null)
                {
                    adOptionCount++;
                }
            }
            if (adOptionCount > 0)
            {
                //分割线3号
                picHeight -= 3;
                g.DrawLine(Pens.White, 6, picHeight, 245, picHeight);
                g.DrawImage(GetAdditionalOptionIcon(gear.AdditionGrade), 8, picHeight + 1);
                g.DrawString("Potential", GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 26, picHeight + 2);
                picHeight += 24;

                foreach (Potential potential in gear.AdditionalOptions)
                {
                    if (potential != null)
                    {
                        g.DrawString("+", GearGraphics.ItemDetailFont, Brushes.White, 8, picHeight);
                        g.DrawString(potential.ConvertSummary(), GearGraphics.ItemDetailFont, Brushes.White, 20, picHeight);
                        picHeight += 18;
                        adOptionCount++;
                    }
                }
                picHeight += 5;
            }

            //绘制desc
            if (!string.IsNullOrEmpty(sr.Desc))
            {
                if (optionCount > 0)
                {
                    picHeight -= 2;
                }
                picHeight -= 3;
                GearGraphics.DrawString(g, sr.Desc, GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 5;
            }
            if (gear.Props.TryGetValue(GearPropType.tradeAvailable, out value) && value != 0)
            {
                g.DrawString(ItemStringHelper.GetGearPropString(GearPropType.tradeAvailable, value),
                             GearGraphics.ItemDetailFont,
                             GearGraphics.OrangeBrush,
                             14, picHeight - 5);
                picHeight += 16;
            }

            if (gear.Props.TryGetValue(GearPropType.accountShareTag, out value) && value != 0)
            {
                GearGraphics.DrawString(g, " #c" + ItemStringHelper.GetGearPropString(GearPropType.accountShareTag, 1) + "#",
                                        GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                picHeight += 16;
            }

            //绘制倾向
            if (gear.State == GearState.itemList)
            {
                string         incline      = null;
                GearPropType[] inclineTypes = new GearPropType[] {
                    GearPropType.charismaEXP,
                    GearPropType.senseEXP,
                    GearPropType.insightEXP,
                    GearPropType.willEXP,
                    GearPropType.craftEXP,
                    GearPropType.charmEXP
                };

                string[] inclineString = new string[] {
                    " Ambition", " Empathy", " Insight", " Willpower", " Diligence", " Charm"
                };

                for (int i = 0; i < inclineTypes.Length; i++)
                {
                    if (gear.Props.TryGetValue(inclineTypes[i], out value) && value > 0)
                    {
                        incline += "," + value + inclineString[i];
                    }
                }

                if (!string.IsNullOrEmpty(incline))
                {
                    picHeight -= 5;
                    GearGraphics.DrawString(g, "#cGrants " + incline.Substring(1) + " EXP when first equipped (up to the daily maximum).#",
                                            GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16);
                    picHeight += 8;
                }
            }
            format.Dispose();
            g.Dispose();
            return(leftPart);
        }