internal PdfTrueTypeFont(TrueTypeFont ttf, String encoding, bool embedded) : base() { SetFontProgram(ttf); this.embedded = embedded; FontNames fontNames = ttf.GetFontNames(); if (embedded && !fontNames.AllowEmbedding()) { throw new PdfException("{0} cannot be embedded due to licensing restrictions.").SetMessageParams(fontNames .GetFontName()); } if ((encoding == null || encoding.Length == 0) && ttf.IsFontSpecific()) { encoding = FontEncoding.FONT_SPECIFIC; } if (encoding != null && FontEncoding.FONT_SPECIFIC.ToLowerInvariant().Equals(encoding.ToLowerInvariant())) { fontEncoding = FontEncoding.CreateFontSpecificEncoding(); } else { fontEncoding = FontEncoding.CreateFontEncoding(encoding); } }
internal PdfTrueTypeFont(TrueTypeFont ttf, String encoding, bool embedded) : base() { SetFontProgram(ttf); this.embedded = embedded; FontNames fontNames = ttf.GetFontNames(); if (embedded && !fontNames.AllowEmbedding()) { throw new PdfException("1.cannot.be.embedded.due.to.licensing.restrictions").SetMessageParams(fontNames.GetFontName ()); } if ((encoding == null || encoding.Length == 0) && ttf.IsFontSpecific()) { encoding = FontEncoding.FONT_SPECIFIC; } if (encoding != null && FontEncoding.FONT_SPECIFIC.ToLower(System.Globalization.CultureInfo.InvariantCulture ).Equals(encoding.ToLower(System.Globalization.CultureInfo.InvariantCulture))) { fontEncoding = FontEncoding.CreateFontSpecificEncoding(); } else { fontEncoding = FontEncoding.CreateFontEncoding(encoding); } }
bool IsFontBold(FontNames font) { const int normalWeight = 400; bool heavyWeight = (font.GetFontWeight() > normalWeight); bool itextProperty = (font.IsBold()); return(heavyWeight || itextProperty); }
string GetFontName(FontNames font) { // Family Name - sometimes return null string[][] familyNameArray = font.GetFamilyName(); string fontname = font.GetFontName(); return(RemoveFontStyleSuffix(RemoveSubFontPrefix(fontname))); }
//Returns the font list index int FindFontTheme(FontNames f) { for (int i = 0; i < sd.fonts.Count; i++) { if (sd.fonts[i].fontNames == chosenFont) { return(i); } } return(0); }
object WorkFont(FontNames font) { var stat = new { Name = font.GetFontName(), Weight = font.GetFontWeight(), IsBold = font.IsBold(), GetFamilyName = font.GetFamilyName() }; return(stat); }
/// <summary> /// /// </summary> /// <param name="fontNames"></param> /// <returns></returns> FontStyle GetFontStyle(FontNames fontNames) { var fontname = fontNames.GetFontName(); var fontStyleRegex = Regex.Match(fontname, @"[-,][\w\s]+$"); if (fontStyleRegex.Success) { var result = fontStyleRegex.Value.ToLower(); if (result.Contains("bold")) { return(FontStyle.Bold); } } return(FontStyle.Regular); }
/// <summary> /// Generates the font descriptor for this font or /// <see langword="null"/> /// if it is one of the 14 built in fonts. /// </summary> /// <returns> /// the PdfDictionary containing the font descriptor or /// <see langword="null"/> /// . /// </returns> protected internal override PdfDictionary GetFontDescriptor(String fontName) { FontMetrics fontMetrics = fontProgram.GetFontMetrics(); FontNames fontNames = fontProgram.GetFontNames(); PdfDictionary fontDescriptor = new PdfDictionary(); MakeObjectIndirect(fontDescriptor); fontDescriptor.Put(PdfName.Type, PdfName.FontDescriptor); fontDescriptor.Put(PdfName.FontName, new PdfName(fontName)); fontDescriptor.Put(PdfName.Ascent, new PdfNumber(fontMetrics.GetTypoAscender())); fontDescriptor.Put(PdfName.CapHeight, new PdfNumber(fontMetrics.GetCapHeight())); fontDescriptor.Put(PdfName.Descent, new PdfNumber(fontMetrics.GetTypoDescender())); fontDescriptor.Put(PdfName.FontBBox, new PdfArray(ArrayUtil.CloneArray(fontMetrics.GetBbox()))); fontDescriptor.Put(PdfName.ItalicAngle, new PdfNumber(fontMetrics.GetItalicAngle())); fontDescriptor.Put(PdfName.StemV, new PdfNumber(fontMetrics.GetStemV())); if (fontMetrics.GetXHeight() > 0) { fontDescriptor.Put(PdfName.XHeight, new PdfNumber(fontMetrics.GetXHeight())); } if (fontMetrics.GetStemH() > 0) { fontDescriptor.Put(PdfName.StemH, new PdfNumber(fontMetrics.GetStemH())); } if (fontNames.GetFontWeight() > 0) { fontDescriptor.Put(PdfName.FontWeight, new PdfNumber(fontNames.GetFontWeight())); } if (fontNames.GetFamilyName() != null && fontNames.GetFamilyName().Length > 0 && fontNames.GetFamilyName() [0].Length >= 4) { fontDescriptor.Put(PdfName.FontFamily, new PdfString(fontNames.GetFamilyName()[0][3])); } //add font stream and flush it immediately AddFontStream(fontDescriptor); int flags = fontProgram.GetPdfFontFlags(); if (fontProgram.IsFontSpecific() != fontEncoding.IsFontSpecific()) { flags &= ~(4 | 32); // reset both flags flags |= fontEncoding.IsFontSpecific() ? 4 : 32; } // set based on font encoding fontDescriptor.Put(PdfName.Flags, new PdfNumber(flags)); return(fontDescriptor); }
/// <summary> /// Generates the font descriptor for this font or /// <see langword="null"/> /// if it is one of the 14 built in fonts. /// </summary> /// <returns> /// the PdfDictionary containing the font descriptor or /// <see langword="null"/> /// . /// </returns> protected internal override PdfDictionary GetFontDescriptor(String fontName) { FontMetrics fontMetrics = fontProgram.GetFontMetrics(); FontNames fontNames = fontProgram.GetFontNames(); PdfDictionary fontDescriptor = new PdfDictionary(); MarkObjectAsIndirect(fontDescriptor); fontDescriptor.Put(PdfName.Type, PdfName.FontDescriptor); fontDescriptor.Put(PdfName.FontName, new PdfName(fontName)); fontDescriptor.Put(PdfName.Ascent, new PdfNumber(fontMetrics.GetTypoAscender())); fontDescriptor.Put(PdfName.CapHeight, new PdfNumber(fontMetrics.GetCapHeight())); fontDescriptor.Put(PdfName.Descent, new PdfNumber(fontMetrics.GetTypoDescender())); fontDescriptor.Put(PdfName.FontBBox, new PdfArray(ArrayUtil.CloneArray(fontMetrics.GetBbox()))); fontDescriptor.Put(PdfName.ItalicAngle, new PdfNumber(fontMetrics.GetItalicAngle())); fontDescriptor.Put(PdfName.StemV, new PdfNumber(fontMetrics.GetStemV())); if (fontMetrics.GetXHeight() > 0) { fontDescriptor.Put(PdfName.XHeight, new PdfNumber(fontMetrics.GetXHeight())); } if (fontMetrics.GetStemH() > 0) { fontDescriptor.Put(PdfName.StemH, new PdfNumber(fontMetrics.GetStemH())); } if (fontNames.GetFontWeight() > 0) { fontDescriptor.Put(PdfName.FontWeight, new PdfNumber(fontNames.GetFontWeight())); } if (fontNames.GetFamilyName() != null && fontNames.GetFamilyName().Length > 0 && fontNames.GetFamilyName() [0].Length >= 4) { fontDescriptor.Put(PdfName.FontFamily, new PdfString(fontNames.GetFamilyName()[0][3])); } AddFontStream(fontDescriptor); int flags = fontProgram.GetPdfFontFlags(); if (!fontEncoding.IsFontSpecific()) { flags &= ~64; } fontDescriptor.Put(PdfName.Flags, new PdfNumber(flags)); return(fontDescriptor); }
string GetFontStyle(FontNames font) { string fontname = font.GetFontName(); string style = "Regular"; if (fontname.Contains("Bold")) { return("Bold"); } else if (fontname.Contains("Italic")) { return("Italic"); } // bold may apply to inline text used for subscript texts if (style != "Bold" && IsFontBold(font)) { PdfReaderException.Warning($"Font-style {fontname} may be bold"); } return(style); }
protected internal override PdfDictionary GetFontDescriptor(String fontName) { if (fontName != null && fontName.Length > 0) { PdfDictionary fontDescriptor = new PdfDictionary(); MakeObjectIndirect(fontDescriptor); fontDescriptor.Put(PdfName.Type, PdfName.FontDescriptor); FontMetrics fontMetrics = fontProgram.GetFontMetrics(); fontDescriptor.Put(PdfName.CapHeight, new PdfNumber(fontMetrics.GetCapHeight())); fontDescriptor.Put(PdfName.ItalicAngle, new PdfNumber(fontMetrics.GetItalicAngle())); FontNames fontNames = fontProgram.GetFontNames(); fontDescriptor.Put(PdfName.FontWeight, new PdfNumber(fontNames.GetFontWeight())); fontDescriptor.Put(PdfName.FontName, new PdfName(fontName)); if (fontNames.GetFamilyName() != null && fontNames.GetFamilyName().Length > 0 && fontNames.GetFamilyName() [0].Length >= 4) { fontDescriptor.Put(PdfName.FontFamily, new PdfString(fontNames.GetFamilyName()[0][3])); } int flags = fontProgram.GetPdfFontFlags(); // reset both flags flags &= ~(FontDescriptorFlags.Symbolic | FontDescriptorFlags.Nonsymbolic); // set fontSpecific based on font encoding flags |= fontEncoding.IsFontSpecific() ? FontDescriptorFlags.Symbolic : FontDescriptorFlags.Nonsymbolic; fontDescriptor.Put(PdfName.Flags, new PdfNumber(flags)); return(fontDescriptor); } else { if (GetPdfObject().GetIndirectReference() != null && GetPdfObject().GetIndirectReference().GetDocument().IsTagged ()) { ILog logger = LogManager.GetLogger(typeof(iText.Kernel.Font.PdfType3Font)); logger.Warn(iText.IO.LogMessageConstant.TYPE3_FONT_ISSUE_TAGGED_PDF); } } return(null); }
public MainPage() { this.InitializeComponent(); SelectedFont = FontNames.First(); }
//Returns the font list index int FindFontTheme(FontNames f){ for (int i = 0; i < sd.fonts.Count; i++) { if (sd.fonts[i].fontNames == chosenFont) return i; } return 0; }
public void PaintTopInGame(ClipState clipState) { if (clipState != ClipState.BeforeClip) { return; } if (!Hud.Game.IsInGame) { return; } if (OnlyGR && !Hud.Game.Me.InGreaterRift) { return; } var players = Hud.Game.Players.Where(p => p.IsMe?ShowMe:(ShowOthers && p.HasValidActor)).OrderBy(p => p.PortraitIndex); if (players.Count() == 0) { return; } var y = Hud.Window.Size.Height * Ypor; foreach (var player in players) { var x = Hud.Window.Size.Width * Xpor; if (player.HeroClassDefinition.HeroClass == HeroClass.Necromancer) { IPlayerSkill skill = player.Powers.UsedNecromancerPowers.SkeletalMage; // 462089 if ((skill != null) && (skill?.Rune == 1)) { if (!Singularity) { continue; } { // Simple bloque if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout, x + 1, y); y += layout.Metrics.Height + 1; } if (skill.Buff != null) { var stacks = ((skill.Buff.IconCounts[6] == 1) && (skill.Buff.TimeLeftSeconds[5] == 0))? 0:skill.Buff.IconCounts[6]; if (stacks == 0) { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, skill.SnoPower.NormalIconTextureId, 0, 0, 0); } else { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, skill.SnoPower.NormalIconTextureId, stacks, skill.Buff.TimeLeftSeconds[5], skill.Buff.TimeElapsedSeconds[5], skill.Buff.TimeLeftSeconds[6]); } } else { Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } x += SizeIconWidth; } skill = player.Powers.UsedNecromancerPowers.BoneArmor; // 466857 if (skill != null) { if (skill.Buff != null) { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, skill.SnoPower.NormalIconTextureId, skill.Buff.IconCounts[0], skill.Buff.TimeLeftSeconds[0], skill.Buff.TimeElapsedSeconds[0]); } else { Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } x += SizeIconWidth; } skill = player.Powers.UsedNecromancerPowers.Simulacrum; // 465350 if (skill != null) { DrawIconSkill(x, y, SizeIconWidth, SizeIconHeight, skill, 1); // index 1 , para averiguar el timeleft x += SizeIconWidth; } skill = player.Powers.UsedNecromancerPowers.LandOfTheDead; // 465839 if (skill != null) { DrawIconSkill(x, y, SizeIconWidth, SizeIconHeight, skill, 0); // index 0 // x += SizeIconWidth; // Si seguimos añadiendo más.. } } else if (player.Powers.BuffIsActive(476587)) { if (!Nayr) { continue; } { // Simple bloque if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout, x + 1, y); y += layout.Metrics.Height + 1; } var c = player.Powers.GetBuff(476587).IconCounts[7]; if (c > 0) { int j = 7; double timeleft = 0; double timeleft2 = 15; for (var i = 1; i < 7; i++) { var t = player.Powers.GetBuff(476587).TimeLeftSeconds[i]; if (t > 0) { if (t > timeleft) { j = i; timeleft = t; } if (t < timeleft2) { timeleft2 = t; } } } DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, 2831437924, c, player.Powers.GetBuff(476587).TimeLeftSeconds[j], player.Powers.GetBuff(476587).TimeElapsedSeconds[j], (c > 1)?timeleft2:0); } else { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, 2831437924, 0, 0, 0); } x += SizeIconWidth; } skill = player.Powers.UsedNecromancerPowers.BoneArmor; // 466857 if (skill != null) // 466857 { if (skill.Buff != null) { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, skill.SnoPower.NormalIconTextureId, skill.Buff.IconCounts[0], skill.Buff.TimeLeftSeconds[0], skill.Buff.TimeElapsedSeconds[0]); } else { Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } x += SizeIconWidth; } if (player.Powers.BuffIsActive(475251)) { Hud.Texture.InventoryLegendaryBackgroundLarge.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.P65_Unique_Scythe2H_02).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); if (Math.Abs(Hud.Game.CurrentGameTick - Ticks0) > 20) { Count0 = Hud.Game.AliveMonsters.Where(m => m.FloorCoordinate.XYDistanceTo(player.FloorCoordinate) <= 25).Count(); Ticks0 = Hud.Game.CurrentGameTick; } layout = FontTimeLeft.GetTextLayout(Count0.ToString()); FontStacks.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 2.0f)); x += SizeIconWidth; } } else { continue; } } else if (player.HeroClassDefinition.HeroClass == HeroClass.WitchDoctor) { IPlayerSkill skill = player.Powers.UsedWitchDoctorPowers.SpiritBarrage; // 108506 if ((skill != null) && (skill.Rune == 2 || player.Powers.BuffIsActive(484270))) { if (!SpiritBarrage) { continue; } { // Simple bloque if (ShowNames) { layout = FontNames.GetTextLayout(player.BattleTagAbovePortrait); FontNames.DrawText(layout, x + 1, y); y += layout.Metrics.Height + 1; } var actors = Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._wd_spiritbarragerune_aoe_ghostmodel && (a.SummonerAcdDynamicId == player.SummonerId)); Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); // TextureId 1117784160 int total = actors.Count(); if (total > 0) { foreach (var a in actors) { if (!Phantasms.ContainsKey(a.AnnId)) { Phantasms[a.AnnId] = a.CreatedAtInGameTick; } } actors = actors.OrderByDescending(a => Phantasms[a.AnnId]); Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); var c = 0; foreach (var actor in actors) { if (++c > 3) { break; } var t = (player.Powers.BuffIsActive(484270)?10:5) - (Hud.Game.CurrentGameTick - Phantasms[actor.AnnId]) / 60f; if (t <= 0) { var layout = FontExpl.GetTextLayout("🞴"); FontExpl.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 8.0f), y + (layout.Metrics.Height * 0.56f * (c - 1))); } else { FontDefault = (t > SBWarning)? FontCounter:FontLimit; var layout = FontDefault.GetTextLayout(String.Format("{0:0}", (int)(t + 0.90))); // Redondeará a X si es menor a X.10 FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 7.0f), y + (layout.Metrics.Height * 0.85f * (c - 1))); } } } else { Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } layout = FontStacks.GetTextLayout(total.ToString()); (total == 0?FontStacksRed:FontStacks).DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 1.15f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 1.05f)); layout = FontAS.GetTextLayout(player.Offense.AttackSpeed.ToString("F2", CultureInfo.InvariantCulture)); FontAS.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 1.15f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 7.0f)); x += SizeIconWidth; } skill = player.Powers.UsedWitchDoctorPowers.SoulHarvest; if (skill != null) { if (skill.Buff != null) // 67616 { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, skill.SnoPower.NormalIconTextureId, skill.Buff.IconCounts[0], skill.Buff.TimeLeftSeconds[0], skill.Buff.TimeElapsedSeconds[0]); } else { Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); // skill.SnoPower.NormalIconTextureId = 2196086897 Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } x += SizeIconWidth; } if (ShowLocust) { skill = player.Powers.UsedWitchDoctorPowers.LocustSwarm; if (skill != null) { Hud.Texture.GetTexture(skill.SnoPower.NormalIconTextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); var m = Hud.Game.AliveMonsters.Where(a => a.FloorCoordinate.XYDistanceTo(player.FloorCoordinate) <= 40); var mLc = m.Where(a => a.Locust).Count(); if (mLc > 0) { var mc = m.Count(); var e = m.Where(a => (a.Rarity == ActorRarity.Champion || a.Rarity == ActorRarity.Rare || a.Rarity == ActorRarity.Boss) && (a.SummonerAcdDynamicId == 0)); var ec = e.Count(); var eLc = e.Where(a => a.Locust).Count(); if (mc > ec) { layout = FontLocust.GetTextLayout(mLc.ToString() + "|" + mc.ToString()); FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 6.0f)); } if (ec > 0) { layout = FontLocust.GetTextLayout(eLc.ToString() + "|" + ec.ToString()); FontLocust.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 1.20f)); } } x += SizeIconWidth; } } if (ShowBigBadVoodoo) { skill = player.Powers.UsedWitchDoctorPowers.BigBadVoodoo; if (skill != null) { DrawIconSkill(x, y, SizeIconWidth, SizeIconHeight, skill, 4); // index 4 , para averiguar el timeleft x += SizeIconWidth; } } if (player.Powers.UsedPassives.Any(p => p.Sno == Hud.Sno.SnoPowers.WitchDoctor_Passive_GruesomeFeast.Sno)) // 208594 { IBuff buff = player.Powers.GetBuff(208594); if (buff != null) // Hud.Sno.SnoPowers.WitchDoctor_Passive_GruesomeFeast.NormalIconTextureId = 1591242582 { DrawIconBuff(x, y, SizeIconWidth, SizeIconHeight, 1591242582, buff.IconCounts[1], buff.TimeLeftSeconds[1], buff.TimeElapsedSeconds[1]); } else { Hud.Texture.GetTexture(1591242582).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); Hud.Texture.DebuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } x += SizeIconWidth; if (ShowGlobes) { var n = Hud.Game.Actors.Where(a => a.SnoActor.Kind == ActorKind.HealthGlobe).Count(); if (n > 0) { layout = FontWhite.GetTextLayout(n.ToString()); var w = (n < 10)? layout.Metrics.Width + 1:(layout.Metrics.Width / 2 + 2); BrushRed.DrawEllipse(x + SizeIconWidth / 2, y + SizeIconHeight / 2, w, w); FontWhite.DrawText(layout, x + (SizeIconWidth - layout.Metrics.Width) / 2, y + (SizeIconHeight - layout.Metrics.Height) / 2 - 1); } } } } else { continue; } } else { continue; } x = Hud.Window.Size.Width * Xpor; y += SizeIconHeight; if (ShowCoe && (player.Powers.GetBuff(Hud.Sno.SnoPowers.ConventionOfElements.Sno) != null)) // 430674 { var BuffCoE = player.Powers.GetBuff(430674); var HeroBonusElements = AllBonusElements[player.HeroClassDefinition.HeroClass]; var j = HeroBonusElements.Count; var ActiveElement = -1; var BestElement = -1; double MaxBonus = -1; bool UniqueBestElement = false; for (var k = j - 1; k > -1; k--) { var index = HeroBonusElements[k]; if (BuffCoE.IconCounts[index] > 0) { ActiveElement = index; } var bonus = player.Offense.ElementalDamageBonus[IndexToBonus[index]]; if (bonus > MaxBonus) { MaxBonus = bonus; BestElement = index; UniqueBestElement = true; } else if (bonus == MaxBonus) { UniqueBestElement = false; } } if ((ActiveElement != -1) && (BestElement != -1)) { for (var l = 0; l < j; l++) { if (HeroBonusElements[j - 1] != BestElement) { HeroBonusElements.Insert(0, HeroBonusElements[j - 1]); HeroBonusElements.RemoveAt(j); } else { break; } } y += ProgressBarWidth; foreach (var index in HeroBonusElements) { Hud.Texture.GetTexture(BuffCoE.SnoPower.Icons[index].TextureId).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); DrawTimeLeftClock(new RectangleF(x, y, SizeIconWidth, SizeIconHeight), BuffCoE.TimeElapsedSeconds[index], BuffCoE.TimeLeftSeconds[index]); double s = 0; if (UniqueBestElement) { if (index == ActiveElement) { s = BuffCoE.TimeLeftSeconds[index]; if (index == BestElement) { FontDefault = FontGreen; BrushDefault = BrushGreen; } else { FontDefault = FontGray; } Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } else { if (index == BestElement) { s = (j - HeroBonusElements.IndexOf(ActiveElement) - 1) * 4 - BuffCoE.TimeElapsedSeconds[ActiveElement]; if (s > ((j - 1) * 2)) { FontDefault = FontOrange; BrushDefault = BrushOrange; } else { FontDefault = FontYellow; BrushDefault = BrushYellow; } } (InactiveRedFrame?Hud.Texture.DebuffFrameTexture:Hud.Texture.BuffFrameTexture).Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } } else { if (player.Offense.ElementalDamageBonus[IndexToBonus[index]] == player.Offense.HighestElementalDamageBonus) { layout = FontBlue.GetTextLayout((player.Offense.HighestElementalDamageBonus * 100).ToString()); FontBlue.DrawText(layout, x + (SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 1.15f, y + (SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 1.07f); } s = BuffCoE.TimeLeftSeconds[index]; BrushDefault = BrushBlue; FontDefault = FontWhite; Hud.Texture.BuffFrameTexture.Draw(x, y, SizeIconWidth, SizeIconHeight, Opacity); } if (s > 0) { //layout = FontDefault.GetTextLayout(s.ToString( (s < 1)? "F1" : "F0") ); layout = FontDefault.GetTextLayout((s < 1)? s.ToString("F1") : String.Format("{0:0}", (int)(s + 0.80))); // Redondeará a X si es menor a X.20 FontDefault.DrawText(layout, x + ((SizeIconWidth - (float)Math.Ceiling(layout.Metrics.Width)) / 2.0f), y + ((SizeIconHeight - (float)Math.Ceiling(layout.Metrics.Height)) / 2.0f)); } x += SizeIconWidth; } BrushBlack.DrawRectangle(x, y, -SizeIconWidth * j, -ProgressBarWidth); var t = (float)(SizeIconWidth * (j - HeroBonusElements.IndexOf(ActiveElement) - BuffCoE.TimeElapsedSeconds[ActiveElement] / 4)); if (t > 0) { BrushDefault.DrawRectangle(x, y, -t, -ProgressBarWidth); } y = y + SizeIconHeight; } } y += SizeIconHeight * (ShowNames?0.1f:0.4f); } }
public virtual void Initialize() { text = "Placeholder"; isShowing = true; isCentered = false; position = Vector2.Zero; scale = Vector2.One; rotation = 0f; color = Color.Black; effects = SpriteEffects.None; layer = 0.5f; font = FontNames.Segoe_UI_Mono; }