private Bitmap renderAddition(out int picHeight) { Bitmap addBitmap = null; picHeight = 0; if (gear.Additions.Count > 0) { addBitmap = new Bitmap(252, DefaultPicHeight); Graphics g = Graphics.FromImage(addBitmap); StringBuilder sb = new StringBuilder(); foreach (Addition addition in gear.Additions) { string conString = addition.GetConString(), propString = addition.GetPropString(); if (!string.IsNullOrEmpty(conString) || !string.IsNullOrEmpty(propString)) { sb.Append("- "); if (!string.IsNullOrEmpty(conString)) { sb.AppendLine(conString); } if (!string.IsNullOrEmpty(propString)) { sb.AppendLine(propString); } sb.AppendLine(); } } if (sb.Length > 0) { picHeight = 10; GearGraphics.DrawString(g, sb.ToString(), GearGraphics.ItemDetailFont, 8, 236, ref picHeight, 16); } g.Dispose(); } return(addBitmap); }
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 StringResult(true); 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, "[最高等级:" + 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, "[现在等级 " + 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, "[下次等级 " + (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 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, "[Max Level:" + 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[Requires: " + 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, "[Level " + 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, "[Next Level " + (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("Invisible"); } if (Skill.Hyper != HyperSkillType.None) { attr.Add("Hyper: " + Skill.Hyper); } if (Skill.CombatOrders) { attr.Add("Combat Orders"); } if (Skill.NotRemoved) { attr.Add("Not Removed"); } if (Skill.MasterLevel > 0 && Skill.MasterLevel < Skill.MaxLevel) { attr.Add("Inital Mastery LVL: " + 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[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[Requires] " + 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 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("Available until yyyy M d HH mm"); 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("Required level :" + 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, "(Available time:" + value + "days)", GearGraphics.ItemDetailFont, 100, right, ref picH, 16); } if (item.Specs.TryGetValue(ItemSpecType.recipeUseCount, out value) && value > 0) { GearGraphics.DrawString(g, "(Available:" + value + "times)", GearGraphics.ItemDetailFont, 100, 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("<Use restrictions>", 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}level or above", sr.Name, reqSkillLevel), GearGraphics.ItemDetailFont, GearGraphics.SetItemNameBrush, 13, picH); picH += 16; picH += 6; } picH = Math.Max(iconY + 94, picH + 6); 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; } //绘制标题 bool hasPart2 = false; 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; hasPart2 = true; } string expireTime = null; if (item.Props.TryGetValue(ItemPropType.permanent, out value) && value != 0) { expireTime = ItemStringHelper.GetItemPropString(ItemPropType.permanent, value); } else if (item.Props.TryGetValue(ItemPropType.life, out value) && value > 0) { DateTime time = DateTime.Now.AddDays(value); expireTime = time.ToString("USABLE UNTIL M-d-yyyy AT H:m"); } if (!string.IsNullOrEmpty(expireTime)) { g.DrawString(expireTime, GearGraphics.ItemDetailFont, Brushes.White, tooltip.Width / 2, picH, format); picH += 16; hasPart2 = true; } if (hasPart2) { picH += 1; } //装备限时 if (item.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, 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.Origin.Y) * 2); } if (item.Cash) { Bitmap cashImg = null; if (item.Props.TryGetValue(ItemPropType.wonderGrade, out value) && value > 0) { string resKey = $"CashShop_img_CashItem_label_{value + 3}"; cashImg = Resource.ResourceManager.GetObject(resKey) as Bitmap; } if (cashImg == null) //default cashImg { cashImg = Resource.CashItem_0; } g.DrawImage(GearGraphics.EnlargeBitmap(cashImg), 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("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; 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, "(Use Within " + value + " day(s))", GearGraphics.ItemDetailFont, 100, right, ref picH, 16); } if (item.Specs.TryGetValue(ItemSpecType.recipeUseCount, out value) && value > 0) { GearGraphics.DrawString(g, "(Craftable " + value + " time(s)", 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); string descLeftAlign = sr["desc_leftalign"]; if (!string.IsNullOrEmpty(descLeftAlign) || item.Sample.Bitmap != null || willDrawNickTag) { if (picH < iconY + 84) { picH = iconY + 84; } if (!string.IsNullOrEmpty(descLeftAlign)) { picH += 12; GearGraphics.DrawString(g, descLeftAlign, GearGraphics.ItemDetailFont, 14, right, ref picH, 16); } 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("<Requirements>", 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} Lv. {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 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 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); }
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, 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[要求等级:" + 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, "[现在等级 " + 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, "[下次等级 " + (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("隐藏技能"); } 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, 272, 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 += "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); }