private void Init() { Render.Rectangle rec = new Render.Rectangle(Drawing.Width / 2 - 200 / 2, (int)(Drawing.Height / 1.5f), 200, 10, SharpDX.Color.Black); rec.VisibleCondition = delegate { return(IsActive() && _recalls.Any(x => x.Recall.Status == Packet.S2C.Teleport.Status.Start && (x.Recall.Start + x.Recall.Duration - Environment.TickCount) > 0)); }; rec.Add(0); }
public TextBox(int x, int y, string value, Color color, int width = 200) { this.width = width; rect = new Render.Rectangle(x, y, width, 20, new ColorBGRA(.4f, .4f, .4f, .5f)); curs = new Render.Rectangle(x + 1, y + 2, 1, 16, new ColorBGRA(1f, 1f, 1f, 1f)); rect.Layer = 1; SetPosition(x, y); SetText(value); this.color = color; Drawing.OnDraw += Drawing_OnDraw; }
/// <summary> /// Initializes a static instance of the <see cref="ColorPicker" /> class. /// </summary> static ColorPicker() { LuminityBitmap = new Bitmap(9, 238); OpacityBitmap = new Bitmap(9, 238); UpdateLuminosityBitmap(Color.White, true); UpdateOpacityBitmap(Color.White, true); BackgroundSprite = (Render.Sprite) new Render.Sprite(Resources.CPForm, new Vector2(X, Y)).Add(1); LuminitySprite = (Render.Sprite) new Render.Sprite(LuminityBitmap, new Vector2(X + 285, Y + 40)).Add(0); OpacitySprite = (Render.Sprite) new Render.Sprite(OpacityBitmap, new Vector2(X + 349, Y + 40)).Add(0); PreviewRectangle = (Render.Rectangle) new Render.Rectangle(X + 375, Y + 44, 54, 80, new ColorBGRA(255, 255, 255, 255)).Add(0); LuminositySlider = new CPSlider(285 - Resources.SliderActive.Width / 3, 35, 248); AlphaSlider = new CPSlider(350 - Resources.SliderActive.Width / 3, 35, 248); Game.OnWndProc += args => OnWndProc(new WndEventComposition(args)); }
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN && message != WindowsMessages.WM_MOUSEMOVE && message != WindowsMessages.WM_LBUTTONUP || (!moveActive && message == WindowsMessages.WM_MOUSEMOVE) ) { return; } if (message == WindowsMessages.WM_LBUTTONDOWN) { lastCursorPos = cursorPos; } if (message == WindowsMessages.WM_LBUTTONUP) { lastCursorPos = new Vector2(); moveActive = false; return; } Render.Rectangle bgRec = (Render.Rectangle)drawings[Lane.Top].Drawings[0]; if (Common.IsInside(cursorPos, new System.Drawing.Point(bgRec.X, bgRec.Y - 10), bgRec.Width, (bgRec.Height * 3) + (50 * 3) + 20)) { moveActive = true; if (message == WindowsMessages.WM_MOUSEMOVE) { var curSliderX = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionX").GetValue <Slider>(); var curSliderY = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionY").GetValue <Slider>(); LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionX").SetValue <Slider>( new Slider(curSliderX.Value + (int)cursorPos.X - (int)lastCursorPos.X, curSliderX.MinValue, curSliderX.MaxValue)); LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionY").SetValue <Slider>( new Slider(curSliderY.Value + (int)cursorPos.Y - (int)lastCursorPos.Y, curSliderY.MinValue, curSliderY.MaxValue)); lastCursorPos = cursorPos; } } }
/// <summary> /// Loads the sprites. /// </summary> private static void LoadSprites() { foreach (var player in ObjectManager.Get <Obj_AI_Hero>().Where(h => !h.IsMe)) { try { var player_Ex = player; var Summoner1Bitmap = TrackerVariables.summonerSpells[player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).Name.ToLower()]; var Summoner2Bitmap = TrackerVariables.summonerSpells[player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).Name.ToLower()]; Render.Sprite SummonerSpell1 = new Render.Sprite(Resources.empty, new Vector2()); Render.Sprite SummonerSpell2 = new Render.Sprite(Resources.empty, new Vector2()); var member = new TrackerWrapper(); var scale = 0.94f; var offset = 8 * scale; var offsetX = 0; var Hudsprite = new Render.Sprite(TrackerVariables.TrackerHud, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 14 * scale, player_Ex.HPBarPosition.Y + offset + 6 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; try { Hudsprite.Add(0); } catch (Exception e) { Console.WriteLine(e); } #region Summoner Spells if (Summoner1Bitmap != null) { SummonerSpell1 = new Render.Sprite(Summoner1Bitmap, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 8 * scale, player_Ex.HPBarPosition.Y + offset + 8 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; SummonerSpell1.Add(0); member.Summoner1 = SummonerSpell1; var Summoner1Rectangle = new Render.Rectangle((int)player_Ex.HPBarPosition.X - 7, (int)player_Ex.HPBarPosition.Y + 8, 13, 13, new ColorBGRA(0, 0, 0, 175)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 7 * scale, (int)player_Ex.HPBarPosition.Y + offset + 8 * scale), }; Summoner1Rectangle.Add(0); member.SummonerSpell1Rectangle = Summoner1Rectangle; var spellCooldown = player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time; var Summoner1Text = new Render.Text((int)player_Ex.HPBarPosition.X - 31, (int)player_Ex.HPBarPosition.Y + 6, ((int)spellCooldown).ToString(), 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time) > 0 ? ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time)).ToString() : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 31 * scale, (int)player_Ex.HPBarPosition.Y + offset + 6 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; Summoner1Text.Add(0); member.SummonerSpell1Text = Summoner1Text; } if (Summoner2Bitmap != null) { SummonerSpell2 = new Render.Sprite(Summoner2Bitmap, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 8 * scale, player_Ex.HPBarPosition.Y + offset + 25 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; SummonerSpell2.Add(0); member.Summoner2 = SummonerSpell2; var Summoner2Rectangle = new Render.Rectangle((int)player_Ex.HPBarPosition.X - 7, (int)player_Ex.HPBarPosition.Y + 26, 13, 13, new ColorBGRA(0, 0, 0, 175)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 7 * scale, (int)player_Ex.HPBarPosition.Y + offset + 26 * scale), }; Summoner2Rectangle.Add(0); var spellCooldown = player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time; var Summoner2Text = new Render.Text((int)player_Ex.HPBarPosition.X - 31, (int)player_Ex.HPBarPosition.Y + 24, ((int)spellCooldown).ToString(), 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time) > 0 ? ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time)).ToString() : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 31 * scale, (int)player_Ex.HPBarPosition.Y + offset + 24 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; Summoner2Text.Add(0); member.SummonerSpell2Text = Summoner2Text; member.SummonerSpell2Rectangle = Summoner2Rectangle; } #endregion #region Normal Spells #region Spell1 var slot1 = SpellSlot.Q; var Spell1Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 13, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 13.2f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell1Rectangle = Spell1Rectangle; Spell1Rectangle.Add(0); var Spell1Text = new Render.Text((int)player_Ex.HPBarPosition.X + 16, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 16 * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell1Text = Spell1Text; Spell1Text.Add(0); #endregion #region Spell2 var slot2 = SpellSlot.W; var Spell2Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 41f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell2Rectangle = Spell2Rectangle; Spell2Rectangle.Add(0); var Spell2Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 43.8f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell2Text = Spell2Text; Spell2Text.Add(0); #endregion #region Spell3 var slot3 = SpellSlot.E; var Spell3Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 69f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell3Rectangle = Spell3Rectangle; Spell3Rectangle.Add(0); var Spell3Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 73.8f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell3Text = Spell3Text; Spell3Text.Add(0); #endregion #region Spell4 var slot4 = SpellSlot.R; var Spell4Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 96f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell4Rectangle = Spell4Rectangle; Spell4Rectangle.Add(0); var Spell4Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 101f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue <bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell4Text = Spell4Text; Spell4Text.Add(0); #endregion #endregion member.Hero = player_Ex; member.Hud = Hudsprite; member.Summoner1 = SummonerSpell1; member.Summoner2 = SummonerSpell2; TrackerWrappers.Add(member); } catch (Exception e) { LogHelper.AddToLog(new LogItem("Tracker_Drawings", e, LogSeverity.Severe)); } } }
public RecallRender(Packet.S2C.Teleport.Struct recall) { var recWidth = 200; Recall = recall; Rectangle = new Render.Rectangle(Drawing.Width / 2, Drawing.Height / 4, recWidth, 10, SharpDX.Color.Green); Rectangle.PositionUpdate += delegate { float percent = RecallStatusPercent(); var newWidth = (int)(recWidth - (recWidth * percent)); if (!Rectangle.Width.Equals(newWidth)) { Rectangle.Width = newWidth; } SharpDX.Color newCol = Common.PercentColorRedToGreen(percent); if (!Equals(newCol, Rectangle.Color)) { Rectangle.Color = newCol; } return(new Vector2(Drawing.Width / 2 - recWidth / 2, Drawing.Height / 1.5f)); }; Rectangle.VisibleCondition = delegate { return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0); }; Rectangle.Add(1); Line = new Render.Line(new Vector2(0, 0), new Vector2(0, 0), 1, SharpDX.Color.WhiteSmoke); Line.StartPositionUpdate += delegate { return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y - 5)); }; Line.EndPositionUpdate += delegate { return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y)); }; Line.VisibleCondition = delegate { SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (255 * RecallStatusPercent()))); if (!Equals(newCol, Line.Color)) { Line.Color = newCol; } return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0); }; Line.Add(1); Text = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke); Text.PositionUpdate += delegate { return(new Vector2(Line.Start.X, Line.Start.Y - 15)); }; Text.TextUpdate = delegate { SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent()))); if (!Equals(newCol, Text.Color)) { Text.Color = newCol; } return(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName); }; Text.Centered = true; Text.VisibleCondition = delegate { return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0); }; Text.Add(1); Text2 = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke); Text2.PositionUpdate += delegate { return(new Vector2(Line.Start.X, Line.Start.Y - 5)); }; Text2.TextUpdate = delegate { SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent()))); if (!Equals(newCol, Text2.Color)) { Text2.Color = newCol; } TimeSpan t = TimeSpan.FromMilliseconds(Recall.Start + Recall.Duration - Environment.TickCount); return(string.Format("{0}.{1}", t.Seconds, t.Milliseconds.ToString("D3").Remove(1, 2))); }; Text2.Centered = true; Text2.VisibleCondition = delegate { return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0); }; Text2.Add(1); }
private void Init() { int posX = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionX").GetValue <Slider>().Value; int posY = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionY").GetValue <Slider>().Value; for (int i = 1; i <= (int)Lane.Bot; i++) { List <Render.RenderObject> recs = new List <Render.RenderObject>(); Render.Rectangle bgRec = new Render.Rectangle(posX, posY + (i * 50), 202, 12, Color.Black); bgRec.VisibleCondition = delegate { return(this.IsActive()); }; bgRec.Add(1); Render.Rectangle greenRec = new Render.Rectangle(posX + 1, posY + 1 + (i * 50), 100, 10, Color.GreenYellow); greenRec.VisibleCondition = delegate { return(this.IsActive()); }; greenRec.Add(1); Render.Rectangle redRec = new Render.Rectangle(posX + 101, posY + 1 + (i * 50), 100, 10, Color.Red); redRec.VisibleCondition = delegate { return(this.IsActive()); }; redRec.Add(1); Render.Text nameText = new Render.Text(((Lane)i).ToString(), posX + 100, posY - 10 + (i * 50), 16, Color.Orange); nameText.OutLined = true; nameText.Centered = true; nameText.VisibleCondition = delegate { return(this.IsActive()); }; nameText.Add(1); Render.Text directionText = new Render.Text("→", posX + 100, posY + 3 + (i * 50), 20, Color.Peru); directionText.OutLined = true; directionText.Centered = true; directionText.Add(2); Render.Text percentText = new Render.Text("Power 50 %", posX + 100, posY + 20 + (i * 50), 16, Color.Orange); percentText.OutLined = true; percentText.Centered = true; percentText.VisibleCondition = delegate { return(this.IsActive()); }; percentText.Add(1); recs.Add(bgRec); recs.Add(greenRec); recs.Add(redRec); recs.Add(nameText); recs.Add(percentText); recs.Add(directionText); drawings.Add((Lane)i, new DrawingsClass() { Drawings = recs }); } this.lowHpHero = new Render.Text("", new Vector2(posX + 100, posY + 20 + (4 * 50)), 16, Color.Orange); this.lowHpHero.OutLined = true; this.lowHpHero.Centered = true; this.lowHpHero.Add(1); }
private void Game_OnUpdate(EventArgs args) { if (!IsActive()) { return; } foreach (KeyValuePair <Obj_AI_Minion, MinionStruct> minion in minions.ToArray()) { if (!minion.Key.IsValid) { this.minions.Remove(minion.Key); } } int posX = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionX").GetValue <Slider>().Value; int posY = LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerPositionY").GetValue <Slider>().Value; int i = 0; foreach (KeyValuePair <Lane, DrawingsClass> drawing in drawings) { PowerDiff diff = GetPowerDifference(drawing.Key); diff.Ally = MaxDiff(diff.Ally); diff.Enemy = MaxDiff(diff.Enemy); float sumDiff = 10 + (float)(diff.Ally - diff.Enemy); Render.Rectangle bgRec = (Render.Rectangle)drawing.Value.Drawings[0]; bgRec.X = posX; bgRec.Y = posY + (i * 50); Render.Rectangle greenRec = (Render.Rectangle)drawing.Value.Drawings[1]; greenRec.X = posX + 1; greenRec.Y = posY + 1 + (i * 50); greenRec.Width = (int)(10 * sumDiff); Render.Rectangle redRec = (Render.Rectangle)drawing.Value.Drawings[2]; redRec.X = (int)(greenRec.X + 10 * sumDiff); redRec.Y = posY + 1 + (i * 50); redRec.Width = 200 - (int)(10 * sumDiff); Render.Text nameText = (Render.Text)drawing.Value.Drawings[3]; nameText.X = posX + 100; nameText.Y = posY - 10 + (i * 50); Render.Text percentText = (Render.Text)drawing.Value.Drawings[4]; percentText.X = posX + 100; percentText.Y = posY + 20 + (i * 50); percentText.text = "Power " + (100f / 20f * sumDiff).ToString("0.00") + " %"; Render.Text directionText = (Render.Text)drawing.Value.Drawings[5]; directionText.Y = posY + 3 + (i * 50); i++; if (this.IsActive()) { directionText.Visible = true; } if (!LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerShowAnimation").GetValue <bool>()) { drawing.Value.AnimArrowLeft.Stop(); drawing.Value.AnimArrowRight.Stop(); drawing.Value.CurrentDirection = PowerDiff.Orientation.None; directionText.X = posX + 100; } if (diff.Direction == PowerDiff.Orientation.None) { drawing.Value.CurrentDirection = PowerDiff.Orientation.None; directionText.X = posX + 100; directionText.Visible = false; } else if (diff.Direction == PowerDiff.Orientation.Ally) { if (drawing.Value.CurrentDirection != PowerDiff.Orientation.Ally) { directionText.X = posX + 100; drawing.Value.AnimArrowRight.Start(new Vector2(directionText.X, directionText.Y)); } if (drawing.Value.AnimArrowRight.IsWorking) { directionText.X = (int)drawing.Value.AnimArrowRight.GetCurrentValue().X; } else { directionText.X = posX + 100; drawing.Value.AnimArrowRight.Start(new Vector2(directionText.X, directionText.Y)); directionText.X = (int)drawing.Value.AnimArrowRight.GetCurrentValue().X; } drawing.Value.CurrentDirection = PowerDiff.Orientation.Ally; directionText.text = "→"; directionText.Visible = true; } else if (diff.Direction == PowerDiff.Orientation.Enemy) { if (drawing.Value.CurrentDirection != PowerDiff.Orientation.Enemy) { directionText.X = posX + 110; drawing.Value.AnimArrowLeft.Start(new Vector2(directionText.X, directionText.Y)); } if (drawing.Value.AnimArrowLeft.IsWorking) { directionText.X = (int)drawing.Value.AnimArrowLeft.GetCurrentValue().X; } else { directionText.X = posX + 110; drawing.Value.AnimArrowLeft.Start(new Vector2(directionText.X, directionText.Y)); directionText.X = (int)drawing.Value.AnimArrowLeft.GetCurrentValue().X; } drawing.Value.CurrentDirection = PowerDiff.Orientation.Enemy; directionText.text = "←"; directionText.Visible = true; } } if (lowHpHero != null) { if (LanePowerMisc.GetMenuItem("SAssembliesMiscsLanePowerShowLowHP").GetValue <bool>()) { Obj_AI_Hero heroLowHp = heroes.FirstOrDefault(x => x.IsEnemy && x.IsVisible); if (heroLowHp != null) { foreach (Obj_AI_Hero hero in heroes) { if (hero.IsEnemy && hero.IsVisible) { if (heroLowHp.Health > hero.Health) { heroLowHp = hero; } } } lowHpHero.text = "Visible low HP: " + heroLowHp.ChampionName + " (" + heroLowHp.Health.ToString("0") + " HP)"; lowHpHero.X = posX + 100; lowHpHero.Y = posY + 20 + (3 * 50); lowHpHero.Visible = true; } else { lowHpHero.Visible = false; } } else { lowHpHero.Visible = false; } } }