/// <summary> /// Function to retrieve the currently active handle. /// </summary> /// <param name="clientMousePos">Client mouse position.</param> private void GetActiveHandle(DX.Vector2 clientMousePos) { _activeHandleIndex = -1; Cursor mouseCursor = Cursor.Current; for (int i = 0; i < _handles.Length; ++i) { DX.RectangleF handle = _handles[i]; if (handle.IsEmpty) { continue; } if (handle.Contains(clientMousePos)) { _activeHandleIndex = i; mouseCursor = Cursors.Cross; break; } } if (_activeHandleIndex == -1) { mouseCursor = Cursors.Default; } if (mouseCursor != Cursor.Current) { Cursor.Current = _activeHandleIndex == -1 ? Cursors.Default : mouseCursor; } }
private bool IsInsideRectangle(RectangleF rectangle, Vector2 checkPos) { return(rectangle.Contains(checkPos)); // return checkPos.X >= rectangle.Left && checkPos.Y >= rectangle.Top && // checkPos.X <= rectangle.Right && checkPos.Y <= rectangle.Bottom; }
/// <summary> /// Test if a point is in the bounding rectangle of the line. /// </summary> /// <param name="point">Test point.</param> /// <returns>True if in bounds, otherwise false.</returns> public bool InBounds(RawVector2 point) { if (Bounds.IsEmpty) { return(false); } return(Bounds.Contains(point)); }
static void Drawing_EndScene(EventArgs args) { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } try { #region right if (SidebarMenu.Item("Activate").GetValue <bool>()) //drawHUD { x = -Width + ((62 + 24 + 10) * scale); y = Height * -.10f; int zahler = 0; foreach (var enemie in enemyList) { x = x - 10; int z = 0; foreach (var sSlot in SummonerSpellSlots) { var spell = enemie.Hero.Spellbook.GetSpell(sSlot); var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; var ts = TimeSpan.FromSeconds((int)t); var s = t > 60 ? string.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds) : String.Format("{0:0}", t); if (t > 0) { medium.DrawText( null, s, Convert.ToInt32(-x - 4 - s.Length * 7), Convert.ToInt32(-y + 7 + z), new ColorBGRA(255, 255, 255, 255)); if (SummonerW.Item("Activate3").GetValue <bool>()) { var t2 = spell.CooldownExpires; var ts2 = TimeSpan.FromSeconds((int)t2); var s2 = t > 60 ? string.Format("{0}{1:D2}", ts2.Minutes, ts2.Seconds) : String.Format("{0:0}", t); SharpDX.RectangleF summoner = new SharpDX.RectangleF(-(x - 2), -(y - 7 - z), 24, 24); // SharpDX.RectangleF icon = new SharpDX.RectangleF(-(x - 23 - 5), -(y - 8), 55, 55); if (lastsay + 1 < Game.Time) //say it to the chat { if (doublepress) { if (summoner.Contains(Utils.GetCursorPos())) { lastsay = Game.Time; doublepress = false; if (SummonerW.Item("challenger").GetValue <bool>()) { Game.Say(nickname(enemie.Hero.BaseSkinName) + " " + realSummoner(spell.Name) + " " + s2); } else { Game.Say(nickname(enemie.Hero.BaseSkinName) + "has no" + realSummoner(spell.Name)); } } // if (icon.Contains(Utils.GetCursorPos())) // { // lastsay = Game.Time; // doublepress = false; // Game.Say(nickname(enemie.Hero.BaseSkinName)+ " no summoner"); // } } } } } Sprite.Begin(); Sprite.Draw(summonerTexture(spell.Name), new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 24 * n, 24, 24), new Vector3(x - 2, y - 7 - z, 0)); Sprite.End(); z = 24; #endregion } doublepress = false; x = x - 23;//fix wege i ha falsch agfange Sprite.Begin(); //DRAW icon 255, 255, 255, 255 Sprite.Draw(enemie.Icon, new ColorBGRA(255, 255, 255, 255), null, new Vector3(x - 5, y - 8, 0), null); Sprite.End(); if (enemie.Hero.IsDead && respawntime[zahler] < Game.ClockTime) { respawntime[zahler] = Game.ClockTime + enemie.Hero.DeathDuration; //todo get respawn timer } else if (enemie.Hero.IsDead && (respawntime[zahler] > Game.ClockTime)) { String timetorespawn = (Math.Round(respawntime[zahler] - Game.ClockTime)).ToString(); if (timetorespawn.Length == 1) { respawnfont.DrawText(null, timetorespawn, (int)x * -1 + 21, (int)y * -1 + 13, new ColorBGRA(248, 248, 255, 255)); } else { respawnfont.DrawText(null, timetorespawn, (int)x * -1 + 10, (int)y * -1 + 13, new ColorBGRA(248, 248, 255, 255)); } } String HP = Math.Round(enemie.Hero.Health) + "/" + Math.Round(enemie.Hero.MaxHealth); int hplength = ((58 - (HP.Length * 5)) / 2); //to center text hpwidth = Convert.ToInt32(((58f / 100f) * (enemie.Hero.HealthPercentage()))); Sprite.Begin(); //DRAW HUD // //ziel:-1617 / -124 //bild 1 -4/-26 55x55 x = x + 23 + 10; //fix wege i ha falsch agfange Sprite.Draw(HUD, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(1, 0, 62 + 23 + 10, 90), new Vector3(x, y, 0), null); //todo add % value for heigh x = x - 23 - 10; //fix wege i ha falsch agfange Sprite.End(); // //draw level weiss = 248-248-255 small.DrawText(null, enemie.Hero.Level.ToString(), (int)x * -1 + 48, (int)y * -1 + 52, new ColorBGRA(248, 248, 255, 255)); if (enemie.Hero.Spellbook.GetSpell(SpellSlot.R).CooldownExpires < Game.Time && enemie.Hero.Spellbook.GetSpell(SpellSlot.R).Level > 0) { Sprite.Begin(); Sprite.Draw(HUDult, new ColorBGRA(255, 255, 255, 255), null, new Vector3(x + -46, y + -2, 0), null); Sprite.End(); } if (!NoEnergie.Contains(enemie.Hero.ChampionName)) { String Mana = Math.Round(enemie.Hero.Mana) + "/" + Math.Round(enemie.Hero.MaxMana); int manawidth = Convert.ToInt32(((58f / 100f) * (enemie.Hero.ManaPercentage()))); int Manalength = ((58 - (Mana.Length * 5)) / 2); //to center t //draw MANA /Manabar Sprite.Begin(); if (!Energie.Contains(enemie.Hero.ChampionName)) { Sprite.Draw(manaTexture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 0, manawidth, 10), new Vector3(x - 2, y - 57 - 7 - 14, 0), null); } else { Sprite.Draw(energieTexture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 0, manawidth, 10), new Vector3(x - 2, y - 57 - 7 - 14, 0), null); } Sprite.End(); small.DrawText(null, Mana, (int)x * -1 + 2 + Manalength, (int)y * -1 + 65 + 14, new ColorBGRA(248, 248, 255, 255)); } int minionlength = 0; switch (enemie.Hero.MinionsKilled.ToString().Length)// zentriere { case 1: minionlength = 15; break; case 2: minionlength = 12; break; case 3: minionlength = 10; break; } x = x + 10 + 24; small.DrawText(null, enemie.Hero.MinionsKilled.ToString(), (int)x * -1 + minionlength, (int)y * -1 + 62, new ColorBGRA(248, 248, 255, 255)); x = x - 10 - 24; //draw HP/MAXHP Sprite.Begin(); Sprite.Draw(hpTexture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 0, hpwidth, 10), new Vector3(x - 2, y - 57 - 7, 0), null); Sprite.End(); small.DrawText(null, HP, (int)x * -1 + 2 + hplength, (int)y * -1 + 65, new ColorBGRA(248, 248, 255, 255)); if (!enemie.Hero.IsVisible || enemie.Hero.IsDead) //make it black :) { Sprite.Begin(); //DRAW icon 255, 255, 255, 255 Sprite.Draw(blackTexture, new ColorBGRA(255, 255, 255, 110), null, new Vector3(x + 24 + 10, y, 0), null); Sprite.End(); } if (enemie.Hero.Health < 350 && !enemie.Hero.IsDead)//eventuell && (int)hero.Spellbook.GetSpell(SpellSlot.R).SData.CastRange.GetValue(0) < 5000 && enemie.Hero.ServerPosition.Distance(hero.ServerPosition) < (int)hero.Spellbook.GetSpell(SpellSlot.R).SData.CastRange.GetValue(0) && hero.Spellbook.GetSpell(SpellSlot.R).Cooldown.Equals(0) && hero.Level >= 6) { //todo ping on enemie.Hero.ServerPosition { // LeagueSharp.Network..S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(enemie.Hero.Position.X, enemie.Hero.Position.Y,enemie.Hero.NetworkId,ObjectManager.Player.NetworkId, Packet.PingType.Danger)).Process(); } } x = x + 23 + 10; y = y - 94; zahler++; } } #region leftsidebar if (Leftbar.Item("Activate2").GetValue <bool>()) { x = (Leftbar.Item("offX5").GetValue <Slider>().Value * -1) - 50; y = Leftbar.Item("offY5").GetValue <Slider>().Value - 50; foreach (Obj_AI_Hero herosHero in ObjectManager.Get <Obj_AI_Hero>().Where(herosHero => herosHero != null && herosHero.Team == ObjectManager.Player.Team && hero.IsValid && herosHero.Name != hero.Name)) { int z = 0; foreach (var sSlot in SummonerSpellSlots) //Imeh again { var spell = herosHero.Spellbook.GetSpell(sSlot); var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; var ts = TimeSpan.FromSeconds((int)t); var s = t > 60 ? string.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds) : String.Format("{0:0}", t); if (t > 0) { medium.DrawText( null, s, Convert.ToInt32(-x + 30), Convert.ToInt32(-y + 10 + z), new ColorBGRA(255, 255, 255, 255)); } Sprite.Begin(); Sprite.Draw(summonerTexture(spell.Name), new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 24 * n, 24, 24), new Vector3(x - 2, y - 7 - z, 0)); Sprite.End(); z = 24; } y = y - 48 - Leftbar.Item("Distance").GetValue <Slider>().Value; } } #endregion } catch { Console.Write("Sidebar crashed at drawing?"); } }
public bool PointOnMap(RawVector2 pixel) { return(_viewLocation.Contains(pixel)); }