public override Bitmap Render() { if (NpcInfo == null) { return(null); } Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp); //预绘制 List <TextBlock> titleBlocks = new List <TextBlock>(); List <TextBlock> propBlocks = new List <TextBlock>(); int picY = 0; if (NpcInfo.ID > -1) { string mobName = GetNpcName(NpcInfo.ID); var block = PrepareText(g, mobName ?? "(null)", GearGraphics.ItemNameFont2, Brushes.White, 0, 0); titleBlocks.Add(block); block = PrepareText(g, "ID:" + NpcInfo.ID, GearGraphics.ItemDetailFont, Brushes.White, block.Size.Width + 4, 4); titleBlocks.Add(block); } propBlocks.Add(PrepareText(g, "Found At:", GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushG, 0, 0)); if (NpcInfo.ID != null) { var locNode = PluginBase.PluginManager.FindWz("Etc\\NpcLocation.img\\" + NpcInfo.ID.ToString()); if (locNode != null) { foreach (var locMapNode in locNode.Nodes) { int mapID; string mapName = null; if (int.TryParse(locMapNode.Text, out mapID)) { mapName = GetMapName(mapID); } string npcLoc = string.Format(" {0}({1})", mapName ?? "null", locMapNode.Text); propBlocks.Add(PrepareText(g, npcLoc, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } } } if (propBlocks.Count == 1) //获取地区失败 { propBlocks.Add(PrepareText(g, " Unknown", GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } //计算大小 Rectangle titleRect = Measure(titleBlocks); Rectangle imgRect = Rectangle.Empty; Rectangle textRect = Measure(propBlocks); Bitmap npcImg = NpcInfo.Default.Bitmap; if (npcImg != null) { if (npcImg.Width > 250 || npcImg.Height > 300) //进行缩放 { double scale = Math.Min((double)250 / npcImg.Width, (double)300 / npcImg.Height); imgRect = new Rectangle(0, 0, (int)(npcImg.Width * scale), (int)(npcImg.Height * scale)); } else { imgRect = new Rectangle(0, 0, npcImg.Width, npcImg.Height); } } //布局 //水平排列 int width = 0; if (!imgRect.IsEmpty) { textRect.X = imgRect.Width + 4; } width = Math.Max(titleRect.Width, Math.Max(imgRect.Right, textRect.Right)); titleRect.X = (width - titleRect.Width) / 2; //垂直居中 int height = Math.Max(imgRect.Height, textRect.Height); imgRect.Y = (height - imgRect.Height) / 2; textRect.Y = (height - textRect.Height) / 2; if (!titleRect.IsEmpty) { height += titleRect.Height + 4; imgRect.Y += titleRect.Bottom + 4; textRect.Y += titleRect.Bottom + 4; } //绘制 bmp = new Bitmap(width + 20, height + 20); titleRect.Offset(10, 10); imgRect.Offset(10, 10); textRect.Offset(10, 10); g = Graphics.FromImage(bmp); //绘制背景 GearGraphics.DrawNewTooltipBack(g, 0, 0, bmp.Width, bmp.Height); //绘制标题 foreach (var item in titleBlocks) { DrawText(g, item, titleRect.Location); } //绘制图像 if (npcImg != null && !imgRect.IsEmpty) { g.DrawImage(npcImg, imgRect); } //绘制文本 foreach (var item in propBlocks) { DrawText(g, item, textRect.Location); } g.Dispose(); return(bmp); }
private Bitmap RenderSkill(out int picH) { //int h = 128; Bitmap bitmap = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(bitmap); picH = 33; //iconY StringResult sr; if (!StringLinker.StringSkill.TryGetValue(skill.SkillID, out sr)) { sr = new StringResultSkill(); sr.Name = "(null)"; } StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont, Brushes.White, 143, 10, format);//绘制标题 if (skill.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(skill.Icon.Bitmap), 14 + (1 - skill.Icon.Origin.X) * 2, picH + (33 - skill.Icon.Bitmap.Height) * 2);//绘制图标 } //绘制desc picH = 35; GearGraphics.DrawString(g, "[Master Level: " + skill.MaxLevel + "]", GearGraphics.ItemDetailFont, 90, 270, ref picH, 16); if (sr.Desc != null) { GearGraphics.DrawString(g, sr.Desc, GearGraphics.ItemDetailFont, 90, 270, ref picH, 16); } picH = Math.Max(picH, 114); g.DrawLine(Pens.White, 6, picH, 283, picH); //分割线 picH += 5; if (skill.Level > 0) { string hStr = null; if (skill.PreBBSkill) { if (sr.SkillH.Count >= skill.Level) { hStr = sr.SkillH[skill.Level - 1]; } } else { if (sr.SkillH.Count > 0) { hStr = SummaryParser.GetSkillSummary(skill, skill.Level, sr, SummaryParams.Default); } } picH += 4; GearGraphics.DrawString(g, "[Current Level " + skill.Level + "]", GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); } if (skill.Level < skill.MaxLevel) { string hStr = null; if (skill.PreBBSkill) { if (sr.SkillH.Count >= skill.Level + 1) { hStr = sr.SkillH[skill.Level]; } } else { if (sr.SkillH.Count > 0) { hStr = SummaryParser.GetSkillSummary(skill, skill.Level + 1, sr, SummaryParams.Default); } } picH += 4; GearGraphics.DrawString(g, "[Next Level " + (skill.Level + 1) + "]", GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); } picH += 9; g.Dispose(); return(bitmap); }
private Bitmap RenderItem(out int picH) { Bitmap tooltip = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(tooltip); StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone(); int value; picH = 10; //物品标题 StringResult sr; if (StringLinker == null || !StringLinker.StringItem.TryGetValue(item.ItemID, out sr)) { sr = new StringResult(); sr.Name = "(null)"; } SizeF titleSize = g.MeasureString(sr.Name, GearGraphics.ItemNameFont2, short.MaxValue, format); titleSize.Width += 12 * 2; if (titleSize.Width > 290) { //重构大小 g.Dispose(); tooltip.Dispose(); tooltip = new Bitmap((int)Math.Ceiling(titleSize.Width), DefaultPicHeight); g = Graphics.FromImage(tooltip); picH = 10; } //绘制标题 format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont2, Brushes.White, tooltip.Width / 2, picH, format); picH += 22; //额外特性 string attr = GetItemAttributeString(); if (!string.IsNullOrEmpty(attr)) { g.DrawString(attr, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, tooltip.Width / 2, picH, format); picH += 19; } //装备限时 if (item.TimeLimited) { DateTime time = DateTime.Now.AddDays(7d); string expireStr = time.ToString("到yyyy年 M月 d日 H时 m分可以用"); g.DrawString(expireStr, GearGraphics.ItemDetailFont, Brushes.White, tooltip.Width / 2, picH, format); picH += 21; } //绘制图标 int iconY = picH; int iconX = 14; g.DrawImage(Resource.UIToolTip_img_Item_ItemIcon_base, iconX, picH); if (item.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(item.Icon.Bitmap), iconX + 6 + (1 - item.Icon.Origin.X) * 2, picH + 6 + (33 - item.Icon.Bitmap.Height) * 2); } if (item.Cash) { g.DrawImage(GearGraphics.EnlargeBitmap(Resource.CashItem_0), iconX + 6 + 68 - 26, picH + 6 + 68 - 26); } g.DrawImage(Resource.UIToolTip_img_Item_ItemIcon_cover, iconX + 4, picH + 4); //绘制左上角cover if (item.Props.TryGetValue(ItemPropType.reqLevel, out value)) { g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawString("要求等级 :" + value, GearGraphics.ItemReqLevelFont, Brushes.White, 97, picH); picH += 15; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; } else { picH += 3; } int right = tooltip.Width - 18; string desc = null; if (item.Level > 0) { desc += $"[LV.{item.Level}] "; } desc += sr.Desc; if (!string.IsNullOrEmpty(desc)) { GearGraphics.DrawString(g, desc, GearGraphics.ItemDetailFont2, 100, right, ref picH, 16); } if (!string.IsNullOrEmpty(sr.AutoDesc)) { GearGraphics.DrawString(g, sr.AutoDesc, GearGraphics.ItemDetailFont2, 100, right, ref picH, 16); } if (item.Props.TryGetValue(ItemPropType.tradeAvailable, out value) && value > 0) { attr = ItemStringHelper.GetItemPropString(ItemPropType.tradeAvailable, value); if (!string.IsNullOrEmpty(attr)) { GearGraphics.DrawString(g, "#c" + attr + "#", GearGraphics.ItemDetailFont2, 100, right, ref picH, 16); } } if (item.Specs.TryGetValue(ItemSpecType.recipeValidDay, out value) && value > 0) { GearGraphics.DrawString(g, "(可制作时间:" + value + "天)", GearGraphics.ItemDetailFont, 100, right, ref picH, 16); } if (item.Specs.TryGetValue(ItemSpecType.recipeUseCount, out value) && value > 0) { GearGraphics.DrawString(g, "(可制作次数:" + value + "次)", GearGraphics.ItemDetailFont, 100, right, ref picH, 16); } picH += 3; Wz_Node nickResNode = null; bool willDrawNickTag = this.ShowNickTag && this.Item.Props.TryGetValue(ItemPropType.nickTag, out value) && this.TryGetNickResource(value, out nickResNode); if (item.Sample.Bitmap != null || willDrawNickTag) { if (picH < iconY + 84) { picH = iconY + 84; } if (item.Sample.Bitmap != null) { g.DrawImage(item.Sample.Bitmap, (tooltip.Width - item.Sample.Bitmap.Width) / 2, picH); picH += item.Sample.Bitmap.Height; picH += 2; } if (nickResNode != null) { //获取称号名称 string nickName; string nickWithQR = sr["nickWithQR"]; if (nickWithQR != null) { string qrDefault = sr["qrDefault"] ?? string.Empty; nickName = Regex.Replace(nickWithQR, "#qr.*?#", qrDefault); } else { nickName = sr.Name; } GearGraphics.DrawNameTag(g, nickResNode, nickName, tooltip.Width, ref picH); picH += 4; } } //绘制配方需求 if (item.Specs.TryGetValue(ItemSpecType.recipe, out value)) { int reqSkill, reqSkillLevel; if (!item.Specs.TryGetValue(ItemSpecType.reqSkill, out reqSkill)) { reqSkill = value / 10000 * 10000; } if (!item.Specs.TryGetValue(ItemSpecType.reqSkillLevel, out reqSkillLevel)) { reqSkillLevel = 1; } picH = Math.Max(picH, iconY + 107); g.DrawLine(Pens.White, 6, picH, 283, picH);//分割线 picH += 10; g.DrawString("<使用限制条件>", GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picH); picH += 17; //技能标题 if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(reqSkill, out sr)) { sr = new StringResult(); sr.Name = "(null)"; } g.DrawString(string.Format("· {0}{1}级以上", sr.Name, reqSkillLevel), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 13, picH); picH += 16; picH += 6; } picH = Math.Max(iconY + 94, picH + 6); return(tooltip); }
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); }
/// <summary> /// 绘制套装属性。 /// </summary> private void RenderEffect(Graphics g, ref int picHeight) { foreach (KeyValuePair <int, SetItemEffect> effect in this.SetItem.Effects) { string effTitle; if (this.SetItem.SetItemID < 0) { effTitle = $"服务器内重复装备效果({effect.Key} / {this.SetItem.CompleteCount})"; } else { effTitle = effect.Key + " Set Items Equipped"; } g.DrawString(effTitle, GearGraphics.ItemDetailFont, GearGraphics.GreenBrush2, 8, picHeight); picHeight += 16; //Brush brush = effect.Value.Enabled ? Brushes.White : GearGraphics.GrayBrush2; var color = effect.Value.Enabled ? Color.White : GearGraphics.GrayColor2; //T116 合并套装 var props = IsCombineProperties ? Gear.CombineProperties(effect.Value.PropsV5) : effect.Value.PropsV5; foreach (KeyValuePair <GearPropType, object> prop in props) { if (prop.Key == GearPropType.Option) { List <Potential> ops = (List <Potential>)prop.Value; foreach (Potential p in ops) { GearGraphics.DrawPlainText(g, p.ConvertSummary(), GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); } } else if (prop.Key == GearPropType.OptionToMob) { List <SetItemOptionToMob> ops = (List <SetItemOptionToMob>)prop.Value; foreach (SetItemOptionToMob p in ops) { GearGraphics.DrawPlainText(g, p.ConvertSummary(), GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); } } else if (prop.Key == GearPropType.activeSkill) { List <SetItemActiveSkill> ops = (List <SetItemActiveSkill>)prop.Value; foreach (SetItemActiveSkill p in ops) { StringResult sr; if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(p.SkillID, out sr)) { sr = new StringResult(); sr.Name = p.SkillID.ToString(); } string summary = $"Able to use the skill <{sr.Name}>"; GearGraphics.DrawPlainText(g, summary, GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); } } else if (prop.Key == GearPropType.bonusByTime) { var ops = (List <SetItemBonusByTime>)prop.Value; foreach (SetItemBonusByTime p in ops) { GearGraphics.DrawPlainText(g, $"{p.TermStart}小时后", GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); foreach (var bonusProp in p.Props) { var summary = ItemStringHelper.GetGearPropString(bonusProp.Key, Convert.ToInt32(bonusProp.Value)); GearGraphics.DrawPlainText(g, summary, GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); } } } else { var summary = ItemStringHelper.GetGearPropString(prop.Key, Convert.ToInt32(prop.Value)); GearGraphics.DrawPlainText(g, summary, GearGraphics.ItemDetailFont2, color, 10, 244, ref picHeight, 16); } } } }
public override Bitmap Render() { if (MobInfo == null) { return(null); } Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp); //预绘制 List <TextBlock> titleBlocks = new List <TextBlock>(); if (MobInfo.ID > -1) { string mobName = GetMobName(MobInfo.ID); var block = PrepareText(g, mobName ?? "(null)", GearGraphics.ItemNameFont2, Brushes.White, 0, 0); titleBlocks.Add(block); block = PrepareText(g, "ID:" + MobInfo.ID, GearGraphics.ItemDetailFont, Brushes.White, block.Size.Width + 4, 4); titleBlocks.Add(block); } List <TextBlock> propBlocks = new List <TextBlock>(); int picY = 0; StringBuilder sbExt = new StringBuilder(); if (MobInfo.Boss) { sbExt.Append("Boss "); } if (MobInfo.Undead) { sbExt.Append("不死系 "); } if (MobInfo.FirstAttack) { sbExt.Append("主动攻击 "); } if (!MobInfo.BodyAttack) { sbExt.Append("无触碰伤害 "); } if (MobInfo.DamagedByMob) { sbExt.Append("只受怪物伤害 "); } if (MobInfo.Invincible) { sbExt.Append("无敌 "); } if (MobInfo.NotAttack) { sbExt.Append("无法攻击 "); } if (MobInfo.FixedDamage > 0) { sbExt.Append("固定伤害" + MobInfo.FixedDamage + " "); } if (sbExt.Length > 1) { sbExt.Remove(sbExt.Length - 1, 1); propBlocks.Add(PrepareText(g, sbExt.ToString(), GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); picY += 16; } if (MobInfo.RemoveAfter > 0) { propBlocks.Add(PrepareText(g, "出生" + MobInfo.RemoveAfter + "秒后自动消失", GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); picY += 16; } propBlocks.Add(PrepareText(g, "Level: " + MobInfo.Level, GearGraphics.ItemDetailFont, Brushes.White, 0, picY)); propBlocks.Add(PrepareText(g, "HP: " + (!string.IsNullOrEmpty(MobInfo.FinalMaxHP) ? MobInfo.FinalMaxHP : MobInfo.MaxHP.ToString()), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "MP: " + (!string.IsNullOrEmpty(MobInfo.FinalMaxMP) ? MobInfo.FinalMaxMP : MobInfo.MaxMP.ToString()), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "PAD: " + MobInfo.PADamage, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "MAD: " + MobInfo.MADamage, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "PDr: " + MobInfo.PDRate + "%", GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "MDr: " + MobInfo.MDRate + "%", GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Acc: " + MobInfo.Acc, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Eva: " + MobInfo.Eva, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "KB: " + MobInfo.Pushed, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Exp: " + MobInfo.Exp, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, GetElemAttrString(MobInfo.ElemAttr), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); picY += 28; if (MobInfo.Revive.Count > 0) { Dictionary <int, int> reviveCounts = new Dictionary <int, int>(); foreach (var reviveID in MobInfo.Revive) { int count = 0; reviveCounts.TryGetValue(reviveID, out count); reviveCounts[reviveID] = count + 1; } StringBuilder sb = new StringBuilder(); sb.Append("死后召唤 "); int rowCount = 0; foreach (var kv in reviveCounts) { if (rowCount++ > 0) { sb.AppendLine().Append(" "); } string mobName = GetMobName(kv.Key); sb.AppendFormat("{0}({1:D7})", mobName, kv.Key); if (kv.Value > 1) { sb.Append("*" + kv.Value); } } propBlocks.Add(PrepareText(g, sb.ToString(), GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); } g.Dispose(); bmp.Dispose(); //计算大小 Rectangle titleRect = Measure(titleBlocks); Rectangle imgRect = Rectangle.Empty; Rectangle textRect = Measure(propBlocks); Bitmap mobImg = MobInfo.Default.Bitmap; if (mobImg != null) { if (mobImg.Width > 250 || mobImg.Height > 300) //进行缩放 { double scale = Math.Min((double)250 / mobImg.Width, (double)300 / mobImg.Height); imgRect = new Rectangle(0, 0, (int)(mobImg.Width * scale), (int)(mobImg.Height * scale)); } else { imgRect = new Rectangle(0, 0, mobImg.Width, mobImg.Height); } } //布局 //水平排列 int width = 0; if (!imgRect.IsEmpty) { textRect.X = imgRect.Width + 4; } width = Math.Max(titleRect.Width, Math.Max(imgRect.Right, textRect.Right)); titleRect.X = (width - titleRect.Width) / 2; //垂直居中 int height = Math.Max(imgRect.Height, textRect.Height); imgRect.Y = (height - imgRect.Height) / 2; textRect.Y = (height - textRect.Height) / 2; if (!titleRect.IsEmpty) { height += titleRect.Height + 4; imgRect.Y += titleRect.Bottom + 4; textRect.Y += titleRect.Bottom + 4; } //绘制 bmp = new Bitmap(width + 20, height + 20); titleRect.Offset(10, 10); imgRect.Offset(10, 10); textRect.Offset(10, 10); g = Graphics.FromImage(bmp); //绘制背景 GearGraphics.DrawNewTooltipBack(g, 0, 0, bmp.Width, bmp.Height); //绘制标题 foreach (var item in titleBlocks) { DrawText(g, item, titleRect.Location); } //绘制图像 if (mobImg != null && !imgRect.IsEmpty) { g.DrawImage(mobImg, imgRect); } //绘制文本 foreach (var item in propBlocks) { DrawText(g, item, textRect.Location); } g.Dispose(); return(bmp); }
public override Bitmap Render() { if (this.gear == null) { return(null); } int picHeight, iconY, picHeight2, picHeight3; Bitmap left = renderBase(out picHeight, out iconY); Bitmap add = renderAddition(out picHeight2); Bitmap set = renderSetItem(out picHeight3); //整合图像 int width = 252; if (add != null) { width += 252; } if (set != null) { width += 252; } Bitmap tooltip = new Bitmap(width, Math.Max(Math.Max(picHeight, picHeight2), picHeight3)); Graphics g = Graphics.FromImage(tooltip); bool epic = gear.Epic; width = 0; //绘制主图 if (left != null) { g.FillRectangle(epic ? GearGraphics.EpicGearBackBrush : GearGraphics.GearBackBrush, 2, 2, 248, picHeight - 4); g.CompositingMode = CompositingMode.SourceCopy; g.FillRectangle(epic ? GearGraphics.EpicGearIconBackBrush : GearGraphics.GearIconBackBrush, 14, iconY, 68, 68); g.CompositingMode = CompositingMode.SourceOver; g.DrawImage(left, 0, 0, new Rectangle(0, 0, 252, picHeight - 2), GraphicsUnit.Pixel); //绘制外边框 g.DrawLines(epic ? GearGraphics.EpicGearBackPen : GearGraphics.GearBackPen, GearGraphics.GetBorderPath(0, 252, picHeight)); //绘制等级边框 Pen pen = GearGraphics.GetGearItemBorderPen(gear.Grade); if (pen != null) { g.DrawLines(pen, getRankBorderPath(picHeight)); } width += 252; } //绘制addition if (add != null) { //底色和边框 g.FillRectangle(epic ? GearGraphics.EpicGearBackBrush : GearGraphics.GearBackBrush, width + 2, 2, 248, picHeight - 4); g.DrawLines(epic ? GearGraphics.EpicGearBackPen : GearGraphics.GearBackPen, GearGraphics.GetBorderPath(width, 252, picHeight)); //复制原图 g.DrawImage(add, width, 0, new Rectangle(0, 0, 252, picHeight2), GraphicsUnit.Pixel); add.Dispose(); width += 252; } //绘制setitem if (set != null) { //底色和边框 g.FillRectangle(GearGraphics.GearBackBrush, width + 2, 2, 248, picHeight3 - 4); g.DrawLines(GearGraphics.GearBackPen, GearGraphics.GetBorderPath(width, 252, picHeight3)); //复制原图 g.DrawImage(set, width, 0, new Rectangle(0, 0, 252, picHeight3), GraphicsUnit.Pixel); set.Dispose(); width += 252; } // GearGraphics.DrawGearDetailNumber(g, 2, 2, gear.ItemID.ToString("d8"), true); g.Dispose(); return(tooltip); }
private Bitmap RenderSkill(out int picH) { Bitmap bitmap = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(bitmap); StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone(); picH = 0; //获取文字 StringResult sr; if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(Skill.SkillID, out sr)) { sr = new StringResultSkill(); sr.Name = "(null)"; } //绘制技能名称 format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont2, Brushes.White, 144, 10, format); //绘制图标 picH = 33; g.FillRectangle(GearGraphics.GearIconBackBrush2, 14, picH, 68, 68); if (Skill.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(Skill.Icon.Bitmap), 14 + (1 - Skill.Icon.Origin.X) * 2, picH + (33 - Skill.Icon.Bitmap.Height) * 2); } //绘制desc picH = 35; if (!Skill.PreBBSkill) { GearGraphics.DrawString(g, "[Master Level: " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 90, 270, ref picH, 16); } if (sr.Desc != null) { string hdesc = SummaryParser.GetSkillSummary(sr.Desc, Skill.Level, Skill.Common, SummaryParams.Default); //string hStr = SummaryParser.GetSkillSummary(skill, skill.Level, sr, SummaryParams.Default); GearGraphics.DrawString(g, hdesc, GearGraphics.ItemDetailFont2, 90, 270, ref picH, 16); } if (Skill.ReqLevel > 0) { GearGraphics.DrawString(g, "#c[Required Level:" + Skill.ReqLevel.ToString() + "]#", GearGraphics.ItemDetailFont2, 90, 270, ref picH, 16); } if (Skill.ReqAmount > 0) { GearGraphics.DrawString(g, "#c" + ItemStringHelper.GetSkillReqAmount(Skill.SkillID, Skill.ReqAmount) + "#", GearGraphics.ItemDetailFont2, 90, 270, ref picH, 16); } //分割线 picH = Math.Max(picH, 114); g.DrawLine(Pens.White, 6, picH, 283, picH); picH += 9; if (Skill.Level > 0) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level, sr, SummaryParams.Default); GearGraphics.DrawString(g, "[Current Level " + Skill.Level + "]", GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 8, 272, ref picH, 16); } } if (Skill.Level < Skill.MaxLevel) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level + 1, sr, SummaryParams.Default); GearGraphics.DrawString(g, "[Next Level " + (Skill.Level + 1) + "]", GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 8, 272, ref picH, 16); } } picH += 9; List <string> skillDescEx = new List <string>(); if (ShowProperties) { List <string> attr = new List <string>(); if (Skill.Invisible) { attr.Add("[Hidden Skill]"); } if (Skill.Hyper != HyperSkillType.None) { attr.Add("[Hyper Skill: " + Skill.Hyper + "]"); } if (Skill.CombatOrders) { attr.Add("[Can pass Master Level with Combat Orders]"); } if (Skill.NotRemoved) { attr.Add("[Cannot be canceled]"); } if (Skill.MasterLevel > 0 && Skill.MasterLevel < Skill.MaxLevel) { attr.Add("[Requires Mastery Book to pass Lv. " + Skill.MasterLevel + "]"); } if (Skill.NotIncBuffDuration) { attr.Add("[Not affected by Buff Duration increases]"); } if (Skill.NotCooltimeReset) { attr.Add("[Not affected by Cooldown reductions/resets]"); } if (attr.Count > 0) { skillDescEx.Add("#c" + string.Join("\n", attr.ToArray()) + "#"); } } if (ShowDelay && Skill.Action.Count > 0) { foreach (string action in Skill.Action) { skillDescEx.Add("#c[Skill Delay] " + action + ": " + CharaSimLoader.GetActionDelay(action) + " ms#"); } } if (ShowReqSkill && Skill.ReqSkill.Count > 0) { foreach (var kv in Skill.ReqSkill) { string skillName; if (this.StringLinker != null && this.StringLinker.StringSkill.TryGetValue(kv.Key, out sr)) { skillName = sr.Name; } else { skillName = kv.Key.ToString(); } skillDescEx.Add("#c[Required Skill]: " + skillName + ": " + kv.Value + " #"); } } if (skillDescEx.Count > 0) { g.DrawLine(Pens.White, 6, picH, 283, picH); picH += 9; foreach (var descEx in skillDescEx) { GearGraphics.DrawString(g, descEx, GearGraphics.ItemDetailFont, 8, 272, ref picH, 16); } picH += 9; } format.Dispose(); g.Dispose(); return(bitmap); }
private Bitmap RenderSkill(CanvasRegion region, out int picH) { Bitmap bitmap = new Bitmap(region.Width, DefaultPicHeight); Graphics g = Graphics.FromImage(bitmap); StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone(); picH = 0; //获取文字 StringResult sr; if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(Skill.SkillID, out sr)) { sr = new StringResultSkill(); sr.Name = "(null)"; } //绘制技能名称 format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont2, Brushes.White, region.TitleCenterX, 10, format); //绘制图标 picH = 33; g.FillRectangle(GearGraphics.GearIconBackBrush2, 14, picH, 68, 68); if (Skill.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(Skill.Icon.Bitmap), 14 + (1 - Skill.Icon.Origin.X) * 2, picH + (33 - Skill.Icon.Bitmap.Height) * 2); } //绘制desc picH = 35; if (!Skill.PreBBSkill) { GearGraphics.DrawString(g, "[最高等级:" + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, region.SkillDescLeft, region.TextRight, ref picH, 16); } if (sr.Desc != null) { string hdesc = SummaryParser.GetSkillSummary(sr.Desc, Skill.Level, Skill.Common, SummaryParams.Default); //string hStr = SummaryParser.GetSkillSummary(skill, skill.Level, sr, SummaryParams.Default); GearGraphics.DrawString(g, hdesc, GearGraphics.ItemDetailFont2, region.SkillDescLeft, region.TextRight, ref picH, 16); } if (Skill.ReqLevel > 0) { GearGraphics.DrawString(g, "#c[要求等级:" + Skill.ReqLevel.ToString() + "]#", GearGraphics.ItemDetailFont2, region.SkillDescLeft, region.TextRight, ref picH, 16); } if (Skill.ReqAmount > 0) { GearGraphics.DrawString(g, "#c" + ItemStringHelper.GetSkillReqAmount(Skill.SkillID, Skill.ReqAmount) + "#", GearGraphics.ItemDetailFont2, region.SkillDescLeft, region.TextRight, ref picH, 16); } //分割线 picH = Math.Max(picH, 114); g.DrawLine(Pens.White, region.SplitterX1, picH, region.SplitterX2, picH); picH += 9; if (Skill.Level > 0) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level, sr, SummaryParams.Default, new SkillSummaryOptions { ConvertCooltimeMS = this.DisplayCooltimeMSAsSec, ConvertPerM = this.DisplayPermyriadAsPercent }); GearGraphics.DrawString(g, "[现在等级 " + Skill.Level + "]", GearGraphics.ItemDetailFont, region.LevelDescLeft, region.TextRight, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, region.LevelDescLeft, region.TextRight, ref picH, 16); } } if (Skill.Level < Skill.MaxLevel) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level + 1, sr, SummaryParams.Default, new SkillSummaryOptions { ConvertCooltimeMS = this.DisplayCooltimeMSAsSec, ConvertPerM = this.DisplayPermyriadAsPercent }); GearGraphics.DrawString(g, "[下次等级 " + (Skill.Level + 1) + "]", GearGraphics.ItemDetailFont, region.LevelDescLeft, region.TextRight, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, region.LevelDescLeft, region.TextRight, ref picH, 16); } } picH += 9; List <string> skillDescEx = new List <string>(); if (ShowProperties) { List <string> attr = new List <string>(); if (Skill.Invisible) { attr.Add("隐藏技能"); } if (Skill.Hyper != HyperSkillType.None) { attr.Add("超级技能:" + Skill.Hyper); } if (Skill.CombatOrders) { attr.Add("战斗命令加成"); } if (Skill.NotRemoved) { attr.Add("无法被移除"); } if (Skill.MasterLevel > 0 && Skill.MasterLevel < Skill.MaxLevel) { attr.Add("初始掌握:Lv." + Skill.MasterLevel); } if (attr.Count > 0) { skillDescEx.Add("#c" + string.Join(", ", attr.ToArray()) + "#"); } } if (ShowDelay && Skill.Action.Count > 0) { foreach (string action in Skill.Action) { skillDescEx.Add("#c[技能延时] " + action + ": " + CharaSimLoader.GetActionDelay(action) + " ms#"); } } if (ShowReqSkill && Skill.ReqSkill.Count > 0) { foreach (var kv in Skill.ReqSkill) { string skillName; if (this.StringLinker != null && this.StringLinker.StringSkill.TryGetValue(kv.Key, out sr)) { skillName = sr.Name; } else { skillName = kv.Key.ToString(); } skillDescEx.Add("#c[前置技能] " + skillName + ": " + kv.Value + " 级#"); } } if (skillDescEx.Count > 0) { g.DrawLine(Pens.White, region.SplitterX1, picH, region.SplitterX2, picH); picH += 9; foreach (var descEx in skillDescEx) { GearGraphics.DrawString(g, descEx, GearGraphics.ItemDetailFont, region.LevelDescLeft, region.TextRight, ref picH, 16); } picH += 9; } format.Dispose(); g.Dispose(); return(bitmap); }
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); }
public override Bitmap Render() { if (MobInfo == null) { return(null); } Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp); //预绘制 List <TextBlock> titleBlocks = new List <TextBlock>(); if (MobInfo.ID > -1) { string mobName = GetMobName(MobInfo.ID); var block = PrepareText(g, mobName ?? "(null)", GearGraphics.ItemNameFont2, Brushes.White, 0, 0); titleBlocks.Add(block); block = PrepareText(g, "ID:" + MobInfo.ID, GearGraphics.ItemDetailFont, Brushes.White, block.Size.Width + 4, 4); titleBlocks.Add(block); } List <TextBlock> propBlocks = new List <TextBlock>(); int picY = 0; StringBuilder sbExt = new StringBuilder(); if (MobInfo.Boss && MobInfo.PartyBonusMob) { sbExt.Append("[Mini-Boss] "); } if (MobInfo.Boss && !MobInfo.PartyBonusMob) { sbExt.Append("[Boss] "); } if (MobInfo.Undead) { sbExt.Append("[Undead] "); } if (MobInfo.FirstAttack) { sbExt.Append("[Auto-Aggressive] "); } if (!MobInfo.BodyAttack) { sbExt.Append("[No Touch Damage] "); } if (MobInfo.FixedBodyAttackDamageR > 0) { sbExt.Append("[Fixed Touch Damage: " + MobInfo.FixedBodyAttackDamageR + "%] "); } if (MobInfo.DamagedByMob || MobInfo.AllyMob) { sbExt.Append("[Ally Mob] "); } if (MobInfo.Invincible) { sbExt.Append("[Invincible] "); } if (MobInfo.NotAttack) { sbExt.Append("[Cannot Attack] "); } if (MobInfo.IgnoreMoveImpact) { sbExt.Append("[Immune to Rush] "); } if (MobInfo.IgnoreMovable) { sbExt.Append("[Immune to Stun/Bind] "); } if (MobInfo.FixedDamage > 0) { sbExt.Append("[Fixed Damage: " + MobInfo.FixedDamage + "] "); } if (MobInfo.ChangeableMob) { sbExt.Append("[Level/Stats Scale to Average Level] "); } if (MobInfo.OnlyNormalAttack) { sbExt.Append("[Only Damaged by Basic Attacks] "); } if (MobInfo.OnlyHittedByCommonAttack) { sbExt.Append("[Only Hit by Basic Attacks] "); } if (sbExt.Length > 1) { sbExt.Remove(sbExt.Length - 1, 1); propBlocks.Add(PrepareText(g, sbExt.ToString(), GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); picY += 16; } if (MobInfo.RemoveAfter > 0) { propBlocks.Add(PrepareText(g, "[After " + MobInfo.RemoveAfter + " seconds, dies automatically] ", GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); picY += 16; } propBlocks.Add(PrepareText(g, "LEVEL: " + MobInfo.Level, GearGraphics.ItemDetailFont, Brushes.White, 0, picY)); string hpNum = !string.IsNullOrEmpty(MobInfo.FinalMaxHP) ? this.AddCommaSeparators(MobInfo.FinalMaxHP) : MobInfo.MaxHP.ToString("N0"); propBlocks.Add(PrepareText(g, "HP: " + hpNum, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); string mpNum = !string.IsNullOrEmpty(MobInfo.FinalMaxMP) ? this.AddCommaSeparators(MobInfo.FinalMaxMP) : MobInfo.MaxMP.ToString("N0"); propBlocks.Add(PrepareText(g, "MP: " + mpNum, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Physical Damage: " + MobInfo.PADamage.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Magic Damage: " + MobInfo.MADamage.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Physical Defense: " + MobInfo.PDDamage.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "Magic Defense: " + MobInfo.MDDamage.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "PDRate: " + MobInfo.PDRate + "%", GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "MDRate: " + MobInfo.MDRate + "%", GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); if (MobInfo.HPRecovery > 0) { propBlocks.Add(PrepareText(g, "HP Recovery (periodically): " + MobInfo.HPRecovery.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.MPRecovery > 0) { propBlocks.Add(PrepareText(g, "MP Recovery (periodically): " + MobInfo.MPRecovery.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } propBlocks.Add(PrepareText(g, "Accuracy: " + MobInfo.Acc.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); propBlocks.Add(PrepareText(g, "EXP: " + MobInfo.Exp.ToString("N0"), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); if (MobInfo.CharismaEXP > 0) { propBlocks.Add(PrepareText(g, "Ambition EXP: " + MobInfo.CharismaEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.SenseEXP > 0) { propBlocks.Add(PrepareText(g, "Empathy EXP: " + MobInfo.SenseEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.InsightEXP > 0) { propBlocks.Add(PrepareText(g, "Insight EXP: " + MobInfo.InsightEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.WillEXP > 0) { propBlocks.Add(PrepareText(g, "Willpower EXP: " + MobInfo.WillEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.CraftEXP > 0) { propBlocks.Add(PrepareText(g, "Diligence EXP: " + MobInfo.CraftEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.CharmEXP > 0) { propBlocks.Add(PrepareText(g, "Charm EXP: " + MobInfo.CharmEXP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (MobInfo.WP > 0) { propBlocks.Add(PrepareText(g, "Weapon Points (for Zero): " + MobInfo.WP, GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } if (GetElemAttrString(MobInfo.ElemAttr) != "") { propBlocks.Add(PrepareText(g, "Elements: " + GetElemAttrString(MobInfo.ElemAttr), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); } propBlocks.Add(PrepareText(g, "Category: " + GetMobCategoryName(MobInfo.Category), GearGraphics.ItemDetailFont, Brushes.White, 0, picY += 16)); picY += 28; if (MobInfo.Revive.Count > 0) { Dictionary <int, int> reviveCounts = new Dictionary <int, int>(); foreach (var reviveID in MobInfo.Revive) { int count = 0; reviveCounts.TryGetValue(reviveID, out count); reviveCounts[reviveID] = count + 1; } StringBuilder sb = new StringBuilder(); sb.Append("Summons upon death: "); int rowCount = 0; foreach (var kv in reviveCounts) { if (rowCount++ > 0) { sb.AppendLine().Append(" "); } string mobName = GetMobName(kv.Key); sb.AppendFormat("{0}({1:D7})", mobName, kv.Key); if (kv.Value > 1) { sb.Append(" * " + kv.Value); } } propBlocks.Add(PrepareText(g, sb.ToString(), GearGraphics.ItemDetailFont, Brushes.GreenYellow, 0, picY)); } g.Dispose(); bmp.Dispose(); //计算大小 Rectangle titleRect = Measure(titleBlocks); Rectangle imgRect = Rectangle.Empty; Rectangle textRect = Measure(propBlocks); Bitmap mobImg = MobInfo.Default.Bitmap; if (mobImg != null) { if (mobImg.Width > 250 || mobImg.Height > 300) //进行缩放 { double scale = Math.Min((double)250 / mobImg.Width, (double)300 / mobImg.Height); imgRect = new Rectangle(0, 0, (int)(mobImg.Width * scale), (int)(mobImg.Height * scale)); } else { imgRect = new Rectangle(0, 0, mobImg.Width, mobImg.Height); } } //布局 //水平排列 int width = 0; if (!imgRect.IsEmpty) { textRect.X = imgRect.Width + 4; } width = Math.Max(titleRect.Width, Math.Max(imgRect.Right, textRect.Right)); titleRect.X = (width - titleRect.Width) / 2; //垂直居中 int height = Math.Max(imgRect.Height, textRect.Height); imgRect.Y = (height - imgRect.Height) / 2; textRect.Y = (height - textRect.Height) / 2; if (!titleRect.IsEmpty) { height += titleRect.Height + 4; imgRect.Y += titleRect.Bottom + 4; textRect.Y += titleRect.Bottom + 4; } //绘制 bmp = new Bitmap(width + 20, height + 20); titleRect.Offset(10, 10); imgRect.Offset(10, 10); textRect.Offset(10, 10); g = Graphics.FromImage(bmp); //绘制背景 GearGraphics.DrawNewTooltipBack(g, 0, 0, bmp.Width, bmp.Height); //绘制标题 foreach (var item in titleBlocks) { DrawText(g, item, titleRect.Location); } //绘制图像 if (mobImg != null && !imgRect.IsEmpty) { g.DrawImage(mobImg, imgRect); } //绘制文本 foreach (var item in propBlocks) { DrawText(g, item, textRect.Location); } g.Dispose(); return(bmp); }
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); }
private Bitmap renderItem(out int picHeight, out int iconY) { Bitmap tooltip = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(tooltip); StringFormat format = new StringFormat(); int value; format.Alignment = StringAlignment.Center; picHeight = 10; iconY = 32; //物品标题 StringResult sr; if (StringLinker == null || !StringLinker.StringItem.TryGetValue(item.ItemID, out sr)) { sr = new StringResult(); sr.Name = "(null)"; } string gearName = sr.Name; g.DrawString(gearName, GearGraphics.ItemNameFont, Brushes.White, 145, picHeight, format);//绘制装备名称 picHeight += 21; string attr = GetItemAttributeString(); if (!string.IsNullOrEmpty(attr)) { g.DrawString(attr, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, 145, picHeight, format); iconY += 19; } //绘制图标 if (item.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(item.Icon.Bitmap), 14 + (1 - item.Icon.Origin.X) * 2, iconY + (33 - item.Icon.Origin.Y) * 2); } if (item.Cash) { g.DrawImage(GearGraphics.EnlargeBitmap(Resource.CashItem_0), 14 + 68 - 26, iconY + 68 - 26); } picHeight = iconY; if (item.Props.TryGetValue(ItemPropType.reqLevel, out value)) { g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawString("Required level : " + value, GearGraphics.ItemReqLevelFont, Brushes.White, 92, picHeight); picHeight += 15; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; } else { picHeight += 3; } if (!string.IsNullOrEmpty(sr.Desc)) { GearGraphics.DrawString(g, sr.Desc + sr.AutoDesc, GearGraphics.ItemDetailFont, 92, 272, ref picHeight, 16); } if (item.Props.TryGetValue(ItemPropType.tradeAvailable, out value) && value > 0) { attr = ItemStringHelper.GetItemPropString(ItemPropType.tradeAvailable, value); if (!string.IsNullOrEmpty(attr)) { GearGraphics.DrawString(g, "#c" + attr + "#", GearGraphics.ItemDetailFont, 92, 272, ref picHeight, 16); } } picHeight = Math.Max(iconY + 84, iconY + 16 * (int)Math.Ceiling((picHeight - iconY) / 16.0)); return(tooltip); }
private Bitmap RenderItem(out int picH) { Bitmap tooltip = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(tooltip); StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone(); int value; picH = 10; //物品标题 StringResult sr; if (StringLinker == null || !StringLinker.StringItem.TryGetValue(item.ItemID, out sr)) { sr = new StringResult(); sr.Name = "(null)"; } SizeF titleSize = g.MeasureString(sr.Name, GearGraphics.ItemNameFont2, short.MaxValue, format); titleSize.Width += 12 * 2; if (titleSize.Width > 290) { //重构大小 g.Dispose(); tooltip.Dispose(); tooltip = new Bitmap((int)Math.Ceiling(titleSize.Width), DefaultPicHeight); g = Graphics.FromImage(tooltip); picH = 10; } format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont2, Brushes.White, tooltip.Width / 2, picH, format); picH += 22; string attr = GetItemAttributeString(); if (!string.IsNullOrEmpty(attr)) { g.DrawString(attr, GearGraphics.ItemDetailFont, GearGraphics.GearNameBrushC, tooltip.Width / 2, picH, format); picH += 19; } //绘制图标 int iconY = picH; g.DrawImage(Resource.UIToolTip_img_Item_ItemIcon_base, 14, picH); if (item.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(item.Icon.Bitmap), 20 + (1 - item.Icon.Origin.X) * 2, picH + 6 + (33 - item.Icon.Bitmap.Height) * 2); } if (item.Cash) { g.DrawImage(GearGraphics.EnlargeBitmap(Resource.CashItem_0), 20 + 68 - 26, picH + 6 + 68 - 26); } g.DrawImage(Resource.UIToolTip_img_Item_ItemIcon_cover, 18, picH + 4); //绘制左上角cover if (item.Props.TryGetValue(ItemPropType.reqLevel, out value)) { g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.DrawString("REQ LEV : " + value, GearGraphics.ItemReqLevelFont, Brushes.White, 97, picH); picH += 15; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; } else { picH += 3; } int right = tooltip.Width - 18; if (!string.IsNullOrEmpty(sr.Desc)) { GearGraphics.DrawString(g, sr.Desc + sr.AutoDesc, GearGraphics.ItemDetailFont2, 98, right, ref picH, 16); } if (item.Props.TryGetValue(ItemPropType.tradeAvailable, out value) && value > 0) { attr = ItemStringHelper.GetItemPropString(ItemPropType.tradeAvailable, value); if (!string.IsNullOrEmpty(attr)) { GearGraphics.DrawString(g, "#c" + attr + "#", GearGraphics.ItemDetailFont2, 98, right, ref picH, 16); } } if (item.Specs.TryGetValue(ItemSpecType.recipeValidDay, out value) && value > 0) { GearGraphics.DrawString(g, "( 제작 가능 기간 : " + value + "일 )", GearGraphics.ItemDetailFont, 98, right, ref picH, 16); } if (item.Specs.TryGetValue(ItemSpecType.recipeUseCount, out value) && value > 0) { GearGraphics.DrawString(g, "( 제작 가능 횟수 : " + value + "회 )", GearGraphics.ItemDetailFont, 98, right, ref picH, 16); } picH += 3; if (item.Sample.Bitmap != null) { if (picH < iconY + 84) { picH = iconY + 84; } g.DrawImage(item.Sample.Bitmap, (tooltip.Width - item.Sample.Bitmap.Width) / 2, picH); picH += item.Sample.Bitmap.Height; picH += 2; } //绘制配方需求 if (item.Specs.TryGetValue(ItemSpecType.recipe, out value)) { int reqSkill, reqSkillLevel; if (!item.Specs.TryGetValue(ItemSpecType.reqSkill, out reqSkill)) { reqSkill = value / 10000 * 10000; } if (!item.Specs.TryGetValue(ItemSpecType.reqSkillLevel, out reqSkillLevel)) { reqSkillLevel = 1; } picH = Math.Max(picH, iconY + 107); g.DrawLine(Pens.White, 6, picH, 283, picH);//分割线 picH += 10; g.DrawString("< 사용 제한조건 >", GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 8, picH); picH += 17; //技能标题 if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(reqSkill, out sr)) { sr = new StringResult(); sr.Name = "(null)"; } switch (sr.Name) { case "장비제작": sr.Name = "장비 제작"; break; case "장신구제작": sr.Name = "장신구 제작"; break; } g.DrawString(string.Format("· {0} {1}레벨 이상", sr.Name, reqSkillLevel), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 13, picH); picH += 16; picH += 6; } picH = Math.Max(iconY + 94, picH + 6); return(tooltip); }
private Bitmap RenderSkill(out int picH) { Bitmap bitmap = new Bitmap(290, DefaultPicHeight); Graphics g = Graphics.FromImage(bitmap); StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone(); picH = 0; //获取文字 StringResult sr; if (StringLinker == null || !StringLinker.StringSkill.TryGetValue(Skill.SkillID, out sr)) { sr = new StringResult(true); sr.Name = "(null)"; } //绘制技能名称 format.Alignment = StringAlignment.Center; g.DrawString(sr.Name, GearGraphics.ItemNameFont2, Brushes.White, 144, 10, format); //绘制图标 picH = 33; g.FillRectangle(GearGraphics.GearIconBackBrush2, 14, picH, 68, 68); if (Skill.Icon.Bitmap != null) { g.DrawImage(GearGraphics.EnlargeBitmap(Skill.Icon.Bitmap), 14 + (1 - Skill.Icon.Origin.X) * 2, picH + (33 - Skill.Icon.Bitmap.Height) * 2); } //绘制desc picH = 35; if (!Skill.PreBBSkill) { GearGraphics.DrawString(g, "[마스터 레벨 : " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 92, 272, ref picH, 16); } if (sr.Desc != null) { string hdesc = SummaryParser.GetSkillSummary(sr.Desc, Skill.Level, Skill.Common, SummaryParams.Default); //string hStr = SummaryParser.GetSkillSummary(skill, skill.Level, sr, SummaryParams.Default); GearGraphics.DrawString(g, hdesc, GearGraphics.ItemDetailFont2, 92, 272, ref picH, 16); } if (Skill.ReqLevel > 0) { GearGraphics.DrawString(g, "#c[요구레벨 : " + Skill.ReqLevel.ToString() + "]#", GearGraphics.ItemDetailFont2, 92, 272, ref picH, 16); } if (Skill.ReqAmount > 0) { GearGraphics.DrawString(g, "#c" + ItemStringHelper.GetSkillReqAmount(Skill.SkillID, Skill.ReqAmount) + "#", GearGraphics.ItemDetailFont2, 92, 272, ref picH, 16); } //分割线 picH = Math.Max(picH, 114); g.DrawLine(Pens.White, 6, picH, 283, picH); picH += 9; if (Skill.Level > 0) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level, sr, SummaryParams.Default); GearGraphics.DrawString(g, "[현재레벨 " + Skill.Level + "]", GearGraphics.ItemDetailFont, 10, 274, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 274, ref picH, 16); } } if (Skill.Level < Skill.MaxLevel) { string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level + 1, sr, SummaryParams.Default); GearGraphics.DrawString(g, "[다음레벨 " + (Skill.Level + 1) + "]", GearGraphics.ItemDetailFont, 10, 274, ref picH, 16); if (hStr != null) { GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 274, ref picH, 16); } } picH += 9; List <string> skillDescEx = new List <string>(); if (ShowProperties) { List <string> attr = new List <string>(); if (Skill.Invisible) { attr.Add("스킬창에 표시되지 않음"); } if (Skill.Hyper != HyperSkillType.None) { attr.Add("하이퍼스킬: " + Skill.Hyper); } if (Skill.CombatOrders) { attr.Add("컴뱃오더스 적용 가능"); } if (Skill.NotRemoved) { attr.Add("버프 해제 불가"); } if (Skill.MasterLevel > 0 && Skill.MasterLevel < Skill.MaxLevel) { attr.Add("마스터리북 미사용시 마스터 레벨: Lv." + Skill.MasterLevel); } if (attr.Count > 0) { skillDescEx.Add("#c" + string.Join(", ", attr.ToArray()) + "#"); } } if (ShowDelay && Skill.Action.Count > 0) { foreach (string action in Skill.Action) { skillDescEx.Add("#c[딜레이] " + action + ": " + CharaSimLoader.GetActionDelay(action) + " ms#"); } } if (ShowReqSkill && Skill.ReqSkill.Count > 0) { foreach (var kv in Skill.ReqSkill) { string skillName; if (this.StringLinker != null && this.StringLinker.StringSkill.TryGetValue(kv.Key, out sr)) { skillName = sr.Name; } else { skillName = kv.Key.ToString(); } skillDescEx.Add("#c[필요스킬] " + skillName + ": " + kv.Value + " 이상#"); } } if (skillDescEx.Count > 0) { g.DrawLine(Pens.White, 6, picH, 283, picH); picH += 9; foreach (var descEx in skillDescEx) { GearGraphics.DrawString(g, descEx, GearGraphics.ItemDetailFont, 8, 266, ref picH, 16); } picH += 9; } format.Dispose(); g.Dispose(); return(bitmap); }