public void Paint(ISnoPower power, float x, float y, int textLenght = 25) { var name = string.Empty; var items = power.GetItemSnos(); if (items.Any(xx => xx != 0) && string.IsNullOrWhiteSpace(power.NameEnglish)) { //name = Hud.Inventory.GetSnoItem(items.First()).NameEnglish; var item = Hud.Inventory.GetSnoItem(items.First()); name = item == null?power.Sno.ToString() : item.NameEnglish; } else { name = string.IsNullOrWhiteSpace(power.NameEnglish) ? power.Sno.ToString() : power.NameEnglish; } if (name.Length > textLenght) { name = name.Substring(0, textLenght); } var layout = TextFont.GetTextLayout(string.Format("{0,25} Ic:", name)); var layoutSpacer = TextFont.GetTextLayout(":"); TextFont.DrawText(layout, x, y); if (Hud.Window.CursorInsideRect(x, y, layout.Metrics.Width, layout.Metrics.Height)) { Hud.Render.SetHint(power.Sno + " : " + power.Code + " : " + power.DescriptionEnglish); } x += layout.Metrics.Width + layoutSpacer.Metrics.Width * 2; if (power.NormalIconTextureId != 0) { var texture = Hud.Texture.GetTexture(power.NormalIconTextureId); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint("TextureId : " + power.NormalIconTextureId); } x += StandardIconSize + StandardIconSpacing; } foreach (var icon in power.Icons.Where(xxx => xxx.Exists && xxx.TextureId != 0 && xxx.TextureId != power.NormalIconTextureId).Select(xxx => xxx.TextureId).Distinct()) { var texture = Hud.Texture.GetTexture(icon); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint("TextureId : " + icon); } x += StandardIconSize + StandardIconSpacing; } layout = TextFont.GetTextLayout(" It:"); TextFont.DrawText(layout, x, y); x += layout.Metrics.Width + layoutSpacer.Metrics.Width; foreach (var sno in items) { if (sno == 0) { continue; } var item = Hud.Inventory.GetSnoItem(sno); if (item == null) { continue; } var brush = item.SetItemBonusesSno == uint.MaxValue ? LegendaryBackgroundBrush : SetBackgroundBrush; brush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); var texture = Hud.Texture.GetItemTexture(item); if (texture != null) { texture.Draw(x, y, StandardIconSize, StandardIconSize); } else { BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize); } if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize)) { Hud.Render.SetHint(item.NameEnglish + " : " + item.Sno + " : i" + item.Level + " : " + item.SetItemBonusesSno); } x += StandardIconSize + StandardIconSpacing; } }
private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref) { if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions) { return; //no minions } if (m.SummonerAcdDynamicId != 0) { return; //no clones } var w = m.CurHealth * w2 / m.MaxHealth; var per = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%"); var y = YPos + py * 8 * yref; IBrush cBrush = null; IFont cFont = null; //Brush selection switch (m.Rarity) { case ActorRarity.Boss: cBrush = BossBrush; break; case ActorRarity.Champion: cBrush = ChampionBrush; break; case ActorRarity.Rare: cBrush = RareBrush; break; case ActorRarity.RareMinion: cBrush = RareMinionBrush; break; default: cBrush = BackgroundBrush; break; } //Jugger Highlight if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut)) { cFont = RedFont; cBrush = RareJuggerBrush; } else { cFont = NameFont; } //Missing Highlight if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen) { var missing = RedFont.GetTextLayout("\u26A0"); RedFont.DrawText(missing, XPos - 17, y - py); } //Circle Non-Clones and Boss if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox) { HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty); } //Show Debuffs on Monster if (ShowDebuffAndCC) { string textDebuff = null; if (m.Locust) { textDebuff += (textDebuff == null ? "" : ", ") + "Locust"; } if (m.Palmed) { textDebuff += (textDebuff == null ? "" : ", ") + "Palm"; } if (m.Haunted) { textDebuff += (textDebuff == null ? "" : ", ") + "Haunt"; } if (m.MarkedForDeath) { textDebuff += (textDebuff == null ? "" : ", ") + "Mark"; } if (m.Strongarmed) { textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; } string textCC = null; if (m.Frozen) { textCC += (textCC == null ? "" : ", ") + "Frozen"; } if (m.Chilled) { textCC += (textCC == null ? "" : ", ") + "Chill"; } if (m.Slow) { textCC += (textCC == null ? "" : ", ") + "Slow"; } if (m.Stunned) { textCC += (textCC == null ? "" : ", ") + "Stun"; } if (m.Invulnerable) { textCC += (textCC == null ? "" : ", ") + "Invulnerable"; } if (m.Blind) { textCC += (textCC == null ? "" : ", ") + "Blind"; } var d = LightFont.GetTextLayout(textDebuff + (textDebuff != null && textCC != null ? " | " : "") + textCC); LightFont.DrawText(d, XPos + 65 + w2, y - py); } //Draw Rectangles BackgroundBrush.DrawRectangle(XPos, y, w2, h); BorderBrush.DrawRectangle(XPos, y, w2, h); cBrush.DrawRectangle(XPos, y, (float)w, h); LightFont.DrawText(per, XPos + 8 + w2, y - py); //Draw MonsterType if (ShowMonsterType) { var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized); cFont.DrawText(name, XPos + 3, y - py); } //increase linecount yref += 1.0f; }
public void PaintWorld(WorldLayer layer) { var w1 = Hud.Window.Size.Width * 0.00333f * b; var textLocust = "虫群"; //"L" var layoutLocust = TextFontLocust.GetTextLayout(textLocust); var textHaunt = "蚀魂"; //"H" var layoutHaunt = TextFontHaunt.GetTextLayout(textHaunt); var h2 = Hud.Window.Size.Height * 0.017f; var x2 = Hud.Window.Size.Width * 0.001667f * b; var x3 = Hud.Window.Size.Width * 0.02f; var monsters = Hud.Game.AliveMonsters; foreach (var monster in monsters) { bool illusionist = false; if (monster.SummonerAcdDynamicId == 0) { illusionist = false; } else { illusionist = true; } if (monster.Rarity == ActorRarity.Champion) { if (illusionist == false) { var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f1") + "%"; var layout = TextFont.GetTextLayout(hptext); var h = Hud.Window.Size.Height * 0.00034f * 35; var w = monster.CurHealth * w1 / monster.MaxHealth; var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14; var locustX = monsterX + x3 * 0.1f; var hauntX = monsterX - x3; var buffY = monsterY - h2 * 2f; var hpX = monsterX - 1.5f; if (monster.Invulnerable) { BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); } BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); if (monster.Rarity == ActorRarity.Champion) { ChampionBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h); } if (monster.Locust) { TextFontLocust.DrawText(layoutLocust, locustX, buffY); } if (monster.Haunted) { TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY); } TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f); } } if (monster.Rarity == ActorRarity.Rare) { if (illusionist == false) { var hptext = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f1") + "%"; var layout = TextFont.GetTextLayout(hptext); var h = Hud.Window.Size.Height * 0.00034f * 35; var w = monster.CurHealth * w1 / monster.MaxHealth; var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14; var locustX = monsterX + x3 * 0.1f; var hauntX = monsterX - x3; var buffY = monsterY - h2 * 2f; var hpX = monsterX - 1.5f; if (monster.Invulnerable) { BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); } BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h); if (monster.Rarity == ActorRarity.Rare) { RareBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h); } if (monster.Locust) { TextFontLocust.DrawText(layoutLocust, locustX, buffY); } if (monster.Haunted) { TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY); } TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f); } } } }
public void Paint(float x, float y, float w, float h, HorizontalAlign align) { if (!Enabled) { return; } if (TextFont == null) { return; } var text = TextFunc != null?TextFunc.Invoke() : null; var hint = HintFunc != null?HintFunc.Invoke() : null; if (string.IsNullOrEmpty(text) && HideBackgroundWhenTextIsEmpty) { return; } if (Hud.Window.CursorInsideRect(x, y, w, h)) { var expanded = false; if (ExpandUpLabels != null && ExpandUpLabels.Count > 0) { var ly = y - h; foreach (var label in ExpandUpLabels) { label.Paint(x, ly, w, h, align); label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center); ly -= h; expanded = true; } this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center); } if (ExpandDownLabels != null && ExpandDownLabels.Count > 0) { var ly = y + h; foreach (var label in ExpandDownLabels) { label.Paint(x, ly, w, h, align); label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center); ly += h; expanded = true; } this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center); } if (ExpandRightLabels != null && ExpandRightLabels.Count > 0) { var lx = x + w; foreach (var label in ExpandRightLabels) { label.Paint(lx, y, w, h, align); lx += h; expanded = true; } } if (ExpandLeftLabels != null && ExpandLeftLabels.Count > 0) { var lx = x - w; foreach (var label in ExpandLeftLabels) { label.Paint(lx, y, w, h, align); lx -= h; expanded = true; } } if (!expanded) { if (!string.IsNullOrEmpty(hint)) { Hud.Render.SetHint(hint); } } } if (BackgroundTexture1 != null) { BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1); } if (BackgroundTexture2 != null) { BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2); } if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(x, y, w, h); } if (!string.IsNullOrEmpty(text)) { var layout = TextFont.GetTextLayout(text); switch (align) { case HorizontalAlign.Left: TextFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Center: TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2); break; case HorizontalAlign.Right: TextFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2); break; } } if (BorderBrush != null) { BorderBrush.DrawRectangle(x, y, w, h); } }
/// <summary> /// /// </summary> public override void Dispose() { base.Dispose(); BackgroundBrush?.Dispose(); }
public void Paint_OLD(IActor actor, IWorldCoordinate coord, string text) { if (!Enabled) { return; } if (Brush == null) { return; } if (Radius <= 0) { return; } if (!IsEnabledFunc.Invoke()) { return; } var pct = FilledPercentFunc == null ? 100 : FilledPercentFunc.Invoke(); using (var pg = Hud.Render.CreateGeometry()) { using (var gs = pg.Open()) { var startAngleFull = 90f; var endAngleFull = 360f; var fullAngleRange = endAngleFull - startAngleFull; var halfRange = fullAngleRange / 2f; var angleStep = fullAngleRange / 90f; var halfStroke = Stroke / 2f; var start = Math.Max(startAngleFull, startAngleFull + halfRange * pct); var end = Math.Min(endAngleFull, endAngleFull - halfRange * pct); if (start > end) { return; } var started = false; var returnVectors = new List <Vector2>(); var innerVectors = new List <Vector2>(); var innerReturnVectors = new List <Vector2>(); for (var angle = startAngleFull; angle <= endAngleFull; angle += angleStep) { var radians = (angle - 180f) * Math.PI / 180.0f; var cos = (float)Math.Cos(radians); var sin = (float)Math.Sin(radians); var mx = (Radius + halfStroke) * cos; var my = (Radius + halfStroke) * sin; var vector = actor.ToVector2(mx, my, 0); if (started) { gs.AddLine(vector); } else { started = true; gs.BeginFigure(vector, FigureBegin.Filled); } var mx2 = (Radius - halfStroke) * cos; var my2 = (Radius - halfStroke) * sin; vector = actor.ToVector2(mx2, my2, 0); returnVectors.Add(vector); } returnVectors.Reverse(); foreach (var returnVector in returnVectors) { gs.AddLine(returnVector); } gs.EndFigure(FigureEnd.Closed); gs.Close(); } Brush.DrawGeometry(pg); if (BackgroundBrush != null) { BackgroundBrush.DrawGeometry(pg); } } }
public void SetParameter(int framePerSecond = 30, FontFamily fontFamily = null, int fontSize = 16, Brush backgroundBrush = null, Brush textBrush = null, String characterToDisplay = "") { bool dispRunning = false; if (DispatcherTimer.Enabled) { DispatcherTimer.Stop(); dispRunning = true; } if (fontSize > 0) { RenderingEmSize = fontSize; } else { RenderingEmSize = 16; } if (fontFamily == null) { if (TextFontFamily == null) { TextFontFamily = new FontFamily("Arial"); } } else { TextFontFamily = fontFamily; } if (characterToDisplay == "") { AvaiableLetterChars = "abcdefghijklmnopqrstuvwxyz1234567890"; } else { AvaiableLetterChars = characterToDisplay; } new Typeface(TextFontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal).TryGetGlyphTypeface(out this.GlyphTypeface); LetterAdvanceWidth = this.GlyphTypeface.AdvanceWidths[0] * this.RenderingEmSize + 4; LetterAdvanceHeight = this.GlyphTypeface.Height * this.RenderingEmSize; BaselineOrigin = new Point(2, 2); if (backgroundBrush == null) { if (BackgroundBrush == null) { BackgroundBrush = new SolidColorBrush(Color.FromArgb(255, 15, 15, 15)); } } else { BackgroundBrush = backgroundBrush; BackgroundBrush.Opacity = 1; } MainCanvas.Background = BackgroundBrush.Clone(); BackgroundBrush.Opacity = 0.1; if (textBrush == null) { if (TextBrush == null) { TextBrush = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0)); } } else { TextBrush = textBrush; } if (framePerSecond > 0) { FramePerSecond = framePerSecond; } else { if (FramePerSecond == 0) { FramePerSecond = 30; } } DispatcherTimer.Interval = 1000D / FramePerSecond; Drops = new int[(int)(CanvasRect.Width / LetterAdvanceWidth)]; for (var x = 0; x < Drops.Length; x++) { Drops[x] = 1; } if (dispRunning) { DispatcherTimer.Start(); } }
public override void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList)); } } Dictionary <IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value); var px = Hud.Window.Size.Width * 0.00125f; var py = Hud.Window.Size.Height * 0.001667f; var h = py * 6; var w2 = py * 80; var count = 0; string preStr = null; //remove clone foreach (var elite in eliteGroup1) { if (elite.Key.Rarity == ActorRarity.Champion) { var eliteCurMaxHealth = 0.0d; var eliteMaxHealth = 0.0d; bool illusionist = false; int same = 0; eliteCurMaxHealth = elite.Key.MaxHealth; same = 0; foreach (var monster2 in monsters) { if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Champion) { eliteMaxHealth = monster2.MaxHealth; } } foreach (var monster1 in monsters) { if (monster1.Rarity == ActorRarity.Champion) { if (eliteCurMaxHealth == monster1.MaxHealth) { same++; } if (same == 2) { illusionist = true; break; } } } if (illusionist == false) { var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; //BorderBrush.DrawRectangle(x, y, 70, h); BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h); TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py); ChampionBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h); preStr = elite.Value; count++; } } if (elite.Key.Rarity == ActorRarity.Rare) { var eliteCurMaxHealth = 0.0d; var eliteMaxHealth = 0.0d; bool illusionist = false; int same = 0; eliteCurMaxHealth = elite.Key.MaxHealth; same = 0; foreach (var monster2 in monsters) { if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Rare) { eliteMaxHealth = monster2.MaxHealth; } } foreach (var monster1 in monsters) { if (monster1.Rarity == ActorRarity.Rare) { if (eliteCurMaxHealth == monster1.MaxHealth) { same++; } if (same == 2) { illusionist = true; break; } } } if (illusionist == false) { var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; //BorderBrush.DrawRectangle(x, y, 70, h); BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h); TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py); RareBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h); preStr = elite.Value; count++; } } } eliteGroup.Clear(); }
public void PaintWorld(WorldLayer layer) { var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null)); foreach (var player in players) { if (player == null) { continue; } var ScreenWidth = Hud.Window.Size.Width; var ScreenHeight = Hud.Window.Size.Height; var HeroTexture = Hud.Texture.GetTexture(890155253); var HPbarWidth = (float)(ScreenWidth / 13); var HPbarHeight = (float)(ScreenHeight / 130); var ResbarWidth = (float)(ScreenWidth / 13); var ResbarHeight = (float)(ScreenHeight / 200); var CurRes = 0f; var CurRes2 = 0f; var ScreenCoordinate = player.FloorCoordinate.ToScreenCoordinate(); var PlayerX = ScreenCoordinate.X; var PlayerY = ScreenCoordinate.Y; if (HPbar == true) { var CurHealth = player.Defense.HealthCur / player.Defense.HealthMax; BorderBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); HPbarBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth * CurHealth, HPbarHeight); } if (player.HeroClassDefinition.HeroClass.ToString() == "Barbarian") { if (Resbar == true) { CurRes = player.Stats.ResourceCurFury / player.Stats.ResourceMaxFury; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); FuryBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3921484788); // male/female can't be determined, let's keep it for later... } else { HeroTexture = Hud.Texture.GetTexture(1030273087); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Crusader") { if (Resbar == true) { CurRes = player.Stats.ResourceCurWrath / player.Stats.ResourceMaxWrath; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); WrathBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3742271755); } else { HeroTexture = Hud.Texture.GetTexture(3435775766); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "DemonHunter") { if (Resbar == true) { CurRes = player.Stats.ResourceCurHatred / player.Stats.ResourceMaxHatred; CurRes2 = player.Stats.ResourceCurDiscipline / player.Stats.ResourceMaxDiscipline; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); HatreBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth, ResbarHeight); DisciplineBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth * CurRes2, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3785199803); } else { HeroTexture = Hud.Texture.GetTexture(2939779782); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Monk") { if (Resbar == true) { CurRes = player.Stats.ResourceCurSpirit / player.Stats.ResourceMaxSpirit; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); SpiritBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(2227317895); } else { HeroTexture = Hud.Texture.GetTexture(2918463890); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Necromancer") { if (Resbar == true) { CurRes = player.Stats.ResourceCurEssence / player.Stats.ResourceMaxEssence; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); EssenceBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3285997023); } else { HeroTexture = Hud.Texture.GetTexture(473831658); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "WitchDoctor") { if (Resbar == true) { CurRes = player.Stats.ResourceCurMana / player.Stats.ResourceMaxMana; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ManaBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3925954876); } else { HeroTexture = Hud.Texture.GetTexture(1603231623); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Wizard") { if (Resbar == true) { CurRes = player.Stats.ResourceCurArcane / player.Stats.ResourceMaxArcane; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ArcaneBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(44435619); } else { HeroTexture = Hud.Texture.GetTexture(876580014); } } if (Tag == true) { string battleTag = player.BattleTagAbovePortrait; if (battleTag == null) { continue; } TagDecorator.TextFunc = () => battleTag.ToString(); var BattleTagTexture = Hud.Texture.GetTexture(3098562643); BattleTagTexture.Draw(PlayerX - (float)(ScreenWidth / 10) / 2, PlayerY - (float)(ScreenHeight / 7.8f) / 2, (float)(ScreenWidth / 10), (float)(ScreenHeight / 28), 0.7843f); HeroTexture.Draw(PlayerX - (float)(Hud.Window.Size.Height / 31) / 2, PlayerY - (float)(ScreenHeight / 6.1f) / 2, (float)(ScreenHeight / 31), (float)(Hud.Window.Size.Height / 31), 1f); TagDecorator.Paint(PlayerX - (float)(ScreenWidth / 11.5) / 2, PlayerY - (float)(ScreenHeight / 9.23f) / 2, (float)(ScreenWidth / 11.5), (float)(ScreenHeight / 45), HorizontalAlign.Center); } } }
public void PaintWorld(WorldLayer layer) { var monsters = Hud.Game.AliveMonsters; Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>(); foreach (var monster in monsters) { if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare) { eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList)); } } Dictionary <IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value); var px = Hud.Window.Size.Width * 0.00125f; var py = Hud.Window.Size.Height * 0.001667f; var h = py * 5; var w2 = py * 50; var count = 0; string preStr = null; //remove clone foreach (var elite in eliteGroup1) { bool illusionist = false; if (elite.Key.SummonerAcdDynamicId == 0) { illusionist = false; } else { illusionist = true; } if (elite.Key.Rarity == ActorRarity.Champion) { if (illusionist == false) { var x = Hud.Window.Size.Width * 0.125f; var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); ChampionBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } } if (elite.Key.Rarity == ActorRarity.Rare) { if (illusionist == false) { var x = Hud.Window.Size.Width * 0.125f; var w = elite.Key.CurHealth * w2 / elite.Key.MaxHealth; var text = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%"; var layout = TextFont.GetTextLayout(text); if (preStr != elite.Value || preStr == null) { count++; } var y = py * 8 * count; if (elite.Key.Invulnerable) { BorderBrush.DrawRectangle(x, y, w2, h); } BackgroundBrush.DrawRectangle(x, y, w2, h); TextFont.DrawText(layout, x + px + w2, y - py); RareBrush.DrawRectangle(x, y, (float)w, h); preStr = elite.Value; count++; } } } eliteGroup.Clear(); }
public void Draw(Graphics g) { g.SmoothingMode = SmoothingMode.AntiAlias; int ArcWidth = this.C_RoundCorners * 2; int ArcHeight = this.C_RoundCorners * 2; int ArcX1 = Rect.Left; int ArcX2 = (this.ShadowControl) ? (Rect.Left + Rect.Width - (ArcWidth + 1)) - this.ShadowThickness : Rect.Left + Rect.Width - (ArcWidth + 1); int ArcY1 = Rect.Top; int ArcY2 = (this.ShadowControl) ? (Rect.Top + Rect.Height - (ArcHeight + 1)) - this.ShadowThickness : Rect.Top + Rect.Height - (ArcHeight + 1); System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); System.Drawing.Brush BorderBrush = new SolidBrush(Color.Orange); System.Drawing.Pen BorderPen = new Pen(BorderBrush, 2.0f); System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null; System.Drawing.Brush BackgroundBrush = new SolidBrush(Color.White); System.Drawing.SolidBrush ShadowBrush = null; System.Drawing.Drawing2D.GraphicsPath ShadowPath = null; //画出阴影效果 if (this.ShadowControl) { Color shadowColor = Color.FromArgb(192, this.ShadowColor); //说明:1-(128/255)=1-0.5=0.5 透明度为0.5,即50% ShadowBrush = new SolidBrush(shadowColor); //ShadowBrush = new SolidBrush(this.ShadowColor); ShadowPath = new System.Drawing.Drawing2D.GraphicsPath(); ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 180, SweepAngle); //顶端的左角 ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY1 + this.ShadowThickness, ArcWidth, ArcHeight, 270, SweepAngle); //顶端右角 ShadowPath.AddArc(ArcX2 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 360, SweepAngle); //底部右角 ShadowPath.AddArc(ArcX1 + this.ShadowThickness, ArcY2 + this.ShadowThickness, ArcWidth, ArcHeight, 90, SweepAngle); //底部左角 ShadowPath.CloseAllFigures(); g.FillPath(ShadowBrush, ShadowPath); } //画出图形 path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, SweepAngle); path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, SweepAngle); path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, SweepAngle); path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, SweepAngle); path.CloseAllFigures(); if (this.C_BackgroundGradientMode == DutBoxGradientMode.None) { BackgroundBrush = new SolidBrush(this.BackgroundGradientColor); g.FillPath(BackgroundBrush, path); } else { Color startColor = Color.FromArgb(192, Color.White); BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(Rect.Left, Rect.Top, Rect.Width, Rect.Height), startColor, this.BackgroundGradientColor, (LinearGradientMode)this.BackgroundGradientMode); g.FillPath(BackgroundGradientBrush, path); } //画边框 if (Focus) { g.DrawPath(BorderPen, path); } else { System.Drawing.Brush defaultBrush = new SolidBrush(this.BorderColor); System.Drawing.Pen defaultPen = new Pen(defaultBrush, this.BorderThickness); g.DrawPath(defaultPen, path); if (defaultBrush != null) { defaultBrush.Dispose(); } if (defaultPen != null) { defaultPen.Dispose(); } } //画内容 ID Font font = new Font("Arial", 14.25F, System.Drawing.FontStyle.Bold); g.DrawString((ID + 1).ToString(), font, Brushes.Black, Rect.Left + 6, Rect.Top + 6); if (Connected) { //画状态 if (!string.IsNullOrEmpty(Status)) { font = new Font("Arial", 11.25F, FontStyle.Bold); g.DrawString(Status, font, Brushes.Black, Rect.Left + 6 + 56, Rect.Top + 6 + 2); } //画进度条 Rectangle bar = new Rectangle(Rect.Left + 6, Rect.Top + 28, Rect.Width - 10, 14); ProgressBar.Rect = bar; g.SmoothingMode = SmoothingMode.Default; ProgressBar.Draw(g); g.SmoothingMode = SmoothingMode.AntiAlias; /* Button but = new Button( ); * but.Text = "打印"; * but.Location = new Point(Rect.Width - 5,14);*/ //画打印图标 20161223 bonnie string haarXmlPath = @"../../打印图标.png"; FileInfo file = new FileInfo(haarXmlPath); string fullName = file.FullName; //画SN if (!string.IsNullOrEmpty(SerialNumber)) { font = new Font("Arial", 10.25F); g.DrawString("SN:" + SerialNumber, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 40); } //画IMEI if (!string.IsNullOrEmpty(IMEI)) { font = new Font("Arial", 10.25F); g.DrawString("IMEI:" + IMEI, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 60); } font = new Font("Arial", 10.25F, FontStyle.Bold); //画time if (ElapsedTime > 0.0f) { g.DrawString((int)ElapsedTime + "/" + (int)EstimateTime, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 80); } //画测试方式 switch (Way) { case TestWay.TW_AUTO: g.DrawString("Auto", font, Brushes.DarkGreen, Rect.Left + 6 + 90, Rect.Top + 6 + 80); break; case TestWay.TW_MANUAL: g.DrawString("Manual", font, Brushes.Red, Rect.Left + 6 + 80, Rect.Top + 6 + 80); break; case TestWay.TW_NONE: break; } //画Model if (!string.IsNullOrEmpty(Model)) { font = new Font("Arial", 10.25F); g.DrawString(Model, font, Brushes.Black, Rect.Left + 6, Rect.Top + 6 + 100); } //画QRCode 48 x 48 if (QRCode != null) { bar = new Rectangle(Rect.Right - 58, Rect.Top + 84, 48, 48); //g.FillRectangle(Brushes.Red, bar); g.SmoothingMode = SmoothingMode.None; g.DrawImageUnscaled(QRCode, bar); g.SmoothingMode = SmoothingMode.AntiAlias; } if (QRCode != null) { FileInfo image_file = new FileInfo($@"./pictures/打印图标.png"); if (image_file.Exists) { PrintIocnImage = Image.FromFile(image_file.FullName); g.SmoothingMode = SmoothingMode.None; g.DrawImage(PrintIocnImage, Rect.Right - 98, Rect.Top + 104); g.SmoothingMode = SmoothingMode.AntiAlias; } } } else // disconnected - TESTING & FAIL { if (Result == ItemResult.IR_TESTING) { StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; stringFormat.FormatFlags = StringFormatFlags.LineLimit; stringFormat.Trimming = StringTrimming.EllipsisCharacter; font = new Font("Arial", 16.25F, FontStyle.Bold); g.DrawString("OFFLINE", font, Brushes.White, Rect, stringFormat); } } //画对号 if (Checked) { //g.DrawLine(BorderPen, 10, 10, 20, 20); int x = Rect.Left + Rect.Width - 30; int y = Rect.Top + 8; Pen pen = new Pen(new SolidBrush(Color.DarkOrange), this.BorderThickness); for (int i = 0; i < 6; i++) { g.DrawLine(pen, x, y, x, y + 6); x++; y++; } for (int i = 0; i < 11; i++) { g.DrawLine(pen, x, y, x, y + 6); x++; y--; } if (pen != null) { pen.Dispose(); } } //销毁Graphic 对象 if (path != null) { path.Dispose(); } if (BorderBrush != null) { BorderPen.Dispose(); } if (BorderPen != null) { BorderPen.Dispose(); } if (BackgroundGradientBrush != null) { BackgroundGradientBrush.Dispose(); } if (BackgroundBrush != null) { BackgroundBrush.Dispose(); } if (ShadowBrush != null) { ShadowBrush.Dispose(); } if (ShadowPath != null) { ShadowPath.Dispose(); } }
private async Task ApplyBlurEffectOnBackground(int blurValue) { await BackgroundBrush.Blur(blurValue, 500, 0, EasingType.Cubic, EasingMode.EaseInOut).StartAsync(); }
public override String ToString() { return(String.Format( "[StylePen] Width: {0}; Alignment: {2}; CompoundArray: {3}; MiterLimit: {4}; DashOffset: {5}; DashPattern: {6}; DashBrushes: {7}; DashStyle: {8}; StartCap: {9}; EndCap: {10}; DashCap: {11}; LineJoin: {12}; Transform: {13}; Background: {1};", Width, BackgroundBrush.ToString(), Alignment, printFloatArray(CompoundArray), MiterLimit, DashOffset, DashPattern, printBrushes(DashBrushes), DashStyle, StartCap, EndCap, DashCap, LineJoin, "not used" /* Transform */)); }
public void PaintWorld(WorldLayer layer) { if (Hud.Game.IsInTown) { return; } var h = 17; var w1 = 35; var py = Hud.Window.Size.Height / 600; var monsters = Hud.Game.AliveMonsters.Where(x => x.IsAlive); List <IMonster> monstersElite = new List <IMonster>(); foreach (var monster in monsters) { if (monster.SummonerAcdDynamicId == 0) { if (monster.Rarity == ActorRarity.RareMinion) { if (IlluSpawners.Contains(monster.SnoMonster.NameEnglish)) { foreach (var snoMonsterAffix in monster.AffixSnoList) { if (snoMonsterAffix.Affix == MonsterAffix.Illusionist) { monstersElite.Add(monster); break; } } } } } } foreach (var monster in monstersElite) { var wint = monster.CurHealth / monster.MaxHealth; var hptext = ""; if ((wint < 0) || (wint > 1)) { wint = 1; hptext = "bug"; } else { hptext = ValueToString(wint * 100, ValueFormat.NormalNumberNoDecimal); } var w = wint * w1; var layout = TextFont.GetTextLayout(hptext); var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2; var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y - py * 8; if (monsterY < 0) { monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; } monsterY -= 15.0f; var ShieldingX = monsterX - w1 / 2; var hauntX = monsterX + w1 + 5; var buffY = monsterY - 1; var hpX = monsterX + 7; BorderBrush.DrawRectangle(monsterX, monsterY, w1, h); BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h); RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h); TextFont.DrawText(layout, hpX, buffY); } }
protected internal virtual void OnDraw(SpriteBatch spriteBatch, Rect rect) { BackgroundBrush?.Draw(spriteBatch, rect); }
/// <summary>This method will paint the group title.</summary> /// <param name="g">The paint event graphics object.</param> private void PaintGroupText(System.Drawing.Graphics g) { //Check if string has something------------- if (this.Text == string.Empty) { return; } //------------------------------------------ //Set Graphics smoothing mode to Anit-Alias-- g.SmoothingMode = SmoothingMode.AntiAlias; //------------------------------------------- //Declare Variables------------------ SizeF StringSize = g.MeasureString(this.Text, this.Font); Size StringSize2 = StringSize.ToSize(); if (this.GroupImage != null) { StringSize2.Width += 18; } int ArcWidth = this.RoundCorners; int ArcHeight = this.RoundCorners; int ArcX1 = 20; int ArcX2 = (StringSize2.Width + 34) - (ArcWidth + 1); int ArcY1 = 0; int ArcY2 = 24 - (ArcHeight + 1); if (this.TitleStyle == TitleStyles.XPStyle) { ArcX1 = 0; ArcX2 = this.Width - (ArcWidth + 1); ArcY1 = 0; ArcY2 = 24 - (ArcHeight + 1); } System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); System.Drawing.Brush BorderBrush = new SolidBrush(this.BorderColor); System.Drawing.Pen BorderPen = new Pen(BorderBrush, this.BorderThickness); System.Drawing.Drawing2D.LinearGradientBrush BackgroundGradientBrush = null; System.Drawing.Brush BackgroundBrush = null;//(this.PaintGroupBox) ? new LinearGradientBrush(this.CustomGroupBoxColor) : new SolidBrush(this.BackgroundColor); System.Drawing.SolidBrush TextColorBrush = new SolidBrush(this.TitleTextColor); System.Drawing.SolidBrush ShadowBrush = null; System.Drawing.Drawing2D.GraphicsPath ShadowPath = null; //----------------------------------- //Check if shadow is needed---------- if (this.ShadowControl) { ShadowBrush = new SolidBrush(this.ShadowColor); ShadowPath = new System.Drawing.Drawing2D.GraphicsPath(); ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY1 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right ShadowPath.AddArc(ArcX2 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right ShadowPath.AddArc(ArcX1 + (this.ShadowThickness - 1), ArcY2 + (this.ShadowThickness - 1), ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle); //Bottom Left ShadowPath.CloseAllFigures(); //Paint Rounded Rectangle------------ g.FillPath(ShadowBrush, ShadowPath); //----------------------------------- } //----------------------------------- //Create Rounded Rectangle Path------ path.AddArc(ArcX1, ArcY1, ArcWidth, ArcHeight, 180, GroupBoxConstants.SweepAngle); // Top Left path.AddArc(ArcX2, ArcY1, ArcWidth, ArcHeight, 270, GroupBoxConstants.SweepAngle); //Top Right path.AddArc(ArcX2, ArcY2, ArcWidth, ArcHeight, 360, GroupBoxConstants.SweepAngle); //Bottom Right path.AddArc(ArcX1, ArcY2, ArcWidth, ArcHeight, 90, GroupBoxConstants.SweepAngle); //Bottom Left path.CloseAllFigures(); //----------------------------------- //Check if Gradient Mode is enabled-- if (this.PaintGroupBox) { //Paint Rounded Rectangle------------ BackgroundGradientBrush = new LinearGradientBrush(path.GetBounds(), this.TitileGradientColors.Color1, this.TitileGradientColors.Color2, (LinearGradientMode)this.BackgroundGradientMode); g.FillPath(BackgroundGradientBrush, path); //----------------------------------- } else { if (this.BackgroundGradientMode == GroupBoxGradientMode.None) { //Paint Rounded Rectangle------------ BackgroundBrush = new SolidBrush(this.BackColor); g.FillPath(BackgroundBrush, path); //----------------------------------- } else { BackgroundGradientBrush = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height), this.GradientColors.Color1, this.GradientColors.Color2, (LinearGradientMode)this.BackgroundGradientMode); //Paint Rounded Rectangle------------ g.FillPath(BackgroundGradientBrush, path); //----------------------------------- } } //----------------------------------- //Paint Borded----------------------- g.DrawPath(BorderPen, path); //----------------------------------- //Paint Text------------------------- int CustomStringWidth = (this.GroupImage != null) ? 44 : 28; g.DrawString(this.Text, this.Font, TextColorBrush, CustomStringWidth, 5); //----------------------------------- //Draw GroupImage if there is one---- if (this.GroupImage != null) { g.DrawImage(this.GroupImage, 28, 4, 16, 16); } //----------------------------------- //Destroy Graphic Objects------------ if (path != null) { path.Dispose(); } if (BorderBrush != null) { BorderBrush.Dispose(); } if (BorderPen != null) { BorderPen.Dispose(); } if (BackgroundGradientBrush != null) { BackgroundGradientBrush.Dispose(); } if (BackgroundBrush != null) { BackgroundBrush.Dispose(); } if (TextColorBrush != null) { TextColorBrush.Dispose(); } if (ShadowBrush != null) { ShadowBrush.Dispose(); } if (ShadowPath != null) { ShadowPath.Dispose(); } //----------------------------------- }
public void PaintTopInGame(ClipState clipState) { if (clipState != ClipState.AfterClip) { return; } if (!_showList) { return; } var lines = GetBuffLines(); var lineWithMaxLength = lines.FirstOrDefault(l => l.Length == lines.Max(ll => ll.Length)); if (string.IsNullOrEmpty(lineWithMaxLength)) { return; } var layout = Font.GetTextLayout(lineWithMaxLength); var h = layout.Metrics.Height; var w = layout.Metrics.Width; var x = StartX; var y = StartY; //var lineCount = (int)((Hud.Window.GroundRectangle.Top + Hud.Window.GroundRectangle.Height - StartX) / h); //lineCount /= 2; //var columns = new List<List<string>>() //{ // new List<string>() //}; //var currentColumnIndex = 0; //while (currentColumnIndex * lineCount < lines.Count) //{ // var column = lines.Skip(currentColumnIndex * lineCount).Take(lineCount); // columns[currentColumnIndex].AddRange(column); // currentColumnIndex++; //} var lineCount = (int)((Hud.Window.GroundRectangle.Top + Hud.Window.GroundRectangle.Height - StartX) / h); var estimatedWidth = w * ((lines.Count / lineCount) + 1); if (BackgroundBrush != null) { BackgroundBrush.DrawRectangle(StartX - h / 2f, StartY - h / 2f, estimatedWidth + h, h * Math.Min(lineCount, lines.Count) + h); } foreach (var line in GetBuffLines()) { Font.DrawText(line, x, y); if (y >= Hud.Window.GroundRectangle.Bottom - (h * 2)) { x += w; y = StartY; } else { y += h; } } }
public void PaintTopInGame(ClipState clipState) { if (Hud.Render.UiHidden) { return; } if (Hud.Game.SpecialArea != SpecialArea.GreaterRift) { return; } var bosses = Hud.Game.AliveMonsters.Where(m => m.Rarity == ActorRarity.Boss); bool BossSpawned = false; foreach (IMonster m in bosses) { BossSpawned = true; foreach (var bosstimer in BossTimers) { if (m.SnoMonster.NameEnglish == "Ember") { var healthpercent = (m.CurHealth / m.MaxHealth); if (healthpercent > 0.5) { bosstimer.Duration = 7.5; } else { bosstimer.Duration = 4.0; } } else if (m.SnoMonster.NameEnglish == "Stonesinger") { if (bosstimer.Animation == AnimSnoEnum._sandmonsterblack_attack_03_sandwall) { var healthpercent = (m.CurHealth / m.MaxHealth); bosstimer.Duration = 12.0 * healthpercent + 5.5 * (1 - healthpercent); } } else if (m.SnoMonster.NameEnglish == "Bone Warlock") { if (bosstimer.Name == "Wormhole") { bosstimer.Duration = 16.0; var wormhole = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_monsteraffix_teleportmines); // 337109 if (wormhole.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Orlash") { if (m.Animation == AnimSnoEnum._terrordemon_generic_cast && bosstimer.Name == "Orlash Summon") { var Clones = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_terrordemon_a_breathminion); // 337109 if (Clones.Count() <= 1) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 8) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (m.Animation == AnimSnoEnum._terrordemon_attack_firebreath && bosstimer.Name == "Lightning Breath") { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 6) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (m.SnoMonster.NameEnglish == "Bloodmaw") { if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); //DebugtextBuilder.AppendLine(); } bosstimer.Timer = Hud.Game.CurrentGameTick; } if (m.Animation == AnimSnoEnum._x1_westmarchbrute_taunt && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); //DebugtextBuilder.AppendLine(); } bosstimer.Timer = Hud.Game.CurrentGameTick; } /*if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_taunt) * { * var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; * if (TimeElapsed > 4) * { * DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); * DebugtextBuilder.AppendLine(); * bosstimer.LastTimer = bosstimer.Timer; * bosstimer.Timer = Hud.Game.CurrentGameTick; * } * }*/ } else if (m.SnoMonster.NameEnglish == "Rime") { if (bosstimer.Name == "Small Fields") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_cold_10foot); // 337109 if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Perendi") { if (bosstimer.Animation == 0 && bosstimer.Name == "Cave In") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_malletdemon_fallingrocks); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 5) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Blighter") { if (bosstimer.Animation == 0 && bosstimer.Name == "Good Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429291); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Animation == 0 && bosstimer.Name == "Bad Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 309921); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Animation == 0 && bosstimer.Name == "Line Attack") { var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429077); if (Attack > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 10) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Man Carver") { if (bosstimer.Name == "Ground Effect") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_fire_10foot); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 15) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } else if (bosstimer.Name == "Heavy Smash") { if (m.Animation == AnimSnoEnum._butcher_attack_05_telegraph) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 6) { //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.LastTimer = bosstimer.Timer; bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Erethon") { if (bosstimer.Name == "Poison Circle") { var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy); if (Circles.Count() > 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 7) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } else if (m.SnoMonster.NameEnglish == "Raiziel") { if (m.Animation == AnimSnoEnum._x1_sniperangel_firebomb_01) { var healthpercent = (m.CurHealth / m.MaxHealth); if (healthpercent > 0.75) { bosstimer.Duration = 7.5; } else { bosstimer.Duration = 4.0; } } } if (m.Animation == bosstimer.Animation && bosstimer.Animation != 0) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 4) { //DebugtextBuilder.Append(bosstimer.Name); //DebugtextBuilder.Append(" "); //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d); //DebugtextBuilder.AppendLine(); bosstimer.LastTimer = bosstimer.Timer; bosstimer.Timer = Hud.Game.CurrentGameTick; } } } } if (!BossSpawned) { return; } float ydelta = Hud.Window.Size.Height * 0.03f; int i = 0; foreach (var bosstimer in BossTimers) { var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d; if (TimeElapsed > 0 && TimeElapsed < 120.0d) { textBuilder.Clear(); textBuilder.AppendFormat("{0:0}", TimeElapsed); if (TimeElapsed > bosstimer.Duration) { TimeElapsed = bosstimer.Duration; } float x = Hud.Window.Size.Width * 0.14f; float y = Hud.Window.Size.Height * 0.05f; float sizex = Hud.Window.Size.Width * 0.16f; float sizey = Hud.Window.Size.Height * 0.02f; float textx = Hud.Window.Size.Width * (0.14f + 0.498f - 0.42f); float texty = Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f); y += i * ydelta; texty += i * ydelta; BackgroundBrush.DrawRectangle(x, y, sizex, sizey); BarBrush.DrawRectangle(x, y, sizex * (float)(TimeElapsed / bosstimer.Duration), sizey); //BorderBrush.DrawLine(x, y, x + sizex, y, 0.6f); BorderBrush.DrawLine(x + sizex, y, x + sizex, y + sizey, BorderSize); //BorderBrush.DrawLine(x, y + sizey, x + sizex, y + sizey, BorderSize); //BorderBrush.DrawLine(x, y, x, y + sizey, 0.6f); var layout = GreenFont.GetTextLayout(textBuilder.ToString()); GreenFont.DrawText(layout, textx, texty); textBuilder.Clear(); textBuilder.Append(bosstimer.Name); var layout2 = GreenFont.GetTextLayout(textBuilder.ToString()); GreenFont.DrawText(layout2, x, texty); //var layout3 = GreenFont.GetTextLayout(DebugtextBuilder.ToString()); //GreenFont.DrawText(layout3, Hud.Window.Size.Width * 0.35f, Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f)); i++; } } }