当前位置: 首页>>代码示例>>C#>>正文


C# Geometry.Polygon.Rectangle.Draw方法代码示例

本文整理汇总了C#中LeagueSharp.Common.Geometry.Polygon.Rectangle.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.Polygon.Rectangle.Draw方法的具体用法?C# Geometry.Polygon.Rectangle.Draw怎么用?C# Geometry.Polygon.Rectangle.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LeagueSharp.Common.Geometry.Polygon.Rectangle的用法示例。


在下文中一共展示了Geometry.Polygon.Rectangle.Draw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Drawing_OnDraw

 public static void Drawing_OnDraw(EventArgs args)
 {
     try
     {
         if (Player.IsDead) return;
         if (Program.EndPos != null)
         {
             var Range = new Geometry.Polygon.Rectangle(Program.StartPos, Program.EndPos, 150);
             Range.Draw(Color.Red);
         }
     }
     catch (Exception e)
     {
         Console.Write(e);
         Game.PrintChat("FreshTahmKench is not working. plz send message by KorFresh (Code 5)");
     }
 }
开发者ID:qq2128969,项目名称:LeagueSharp,代码行数:17,代码来源:OnDraw.cs

示例2: Drawing_OnDraw

        private void Drawing_OnDraw(EventArgs args)
        {
            if (!EE["Enabled"].Cast<CheckBox>().CurrentValue)
            {
                return;
            }

            if (EE["VayneE"] != null)
            {
                foreach (var e in HeroManager.Enemies.Where(e => e.ChampionName.ToLower() == "vayne" && e.LSDistance(Program.Player.Position) < 900))
                {
                    for (var i = 1; i < 8; i++)
                    {
                        var championBehind = ObjectManager.Player.Position
                                             + Vector3.Normalize(e.ServerPosition - ObjectManager.Player.Position)
                                             * (-i * 50);
                        if (EE["drawline"].Cast<CheckBox>().CurrentValue)
                        {
                            Drawing.DrawCircle(championBehind, 35f, championBehind.LSIsWall() ? System.Drawing.Color.Red : System.Drawing.Color.Gray);
                        }
                    }
                }
            }

            foreach (var e in HeroManager.Enemies.Where(e => e.LSIsValidTarget(2000)))
            {
                foreach (var eList in this.EarlyList)
                {
                    if (eList.ChampionName == e.ChampionName)
                    {
                        if (EE[eList.ChampionName + eList.SpellName].Cast<CheckBox>().CurrentValue)
                        {
                            var xminions = 0;
                            if (e.LSIsValidTarget(eList.Range))
                            {
                                for (var i = 1;
                                     i < e.Position.LSDistance(ObjectManager.Player.Position) / eList.Width;
                                     i++)
                                {
                                    var championBehind = ObjectManager.Player.Position
                                                         + Vector3.Normalize(
                                                             e.ServerPosition - ObjectManager.Player.Position)
                                                         * (i * eList.Width);

                                    var list = eList;
                                    var allies = HeroManager.Allies.Where(a => a.LSDistance(ObjectManager.Player.Position) < list.Range);
                                    var minions = MinionManager.GetMinions(ObjectManager.Player.Position, eList.Range,MinionTypes.All, MinionTeam.Ally);
                                    var mobs = MinionManager.GetMinions(ObjectManager.Player.Position,eList.Range,MinionTypes.All,MinionTeam.Neutral);

                                    xminions += minions.Count(m => m.LSDistance(championBehind) < eList.Width)
                                                + allies.Count(a => a.LSDistance(championBehind) < eList.Width)
                                                + mobs.Count(m => m.LSDistance(championBehind) < eList.Width);
                                }

                                if (xminions == 0)
                                {
                                    if (EE["drawline"].Cast<CheckBox>().CurrentValue)
                                    {
                                        var rec = new Geometry.Polygon.Rectangle(ObjectManager.Player.Position, e.Position, eList.Width - 10);
                                        rec.Draw(eList.Color, 2);
                                    }

                                    if (EE["drawtext"].Cast<CheckBox>().CurrentValue)
                                    {
                                        Vector3[] x = new[] { ObjectManager.Player.Position, e.Position };
                                        var aX =
                                            Drawing.WorldToScreen(
                                                new Vector3(
                                                    Helper.CenterOfVectors(x).X,
                                                    Helper.CenterOfVectors(x).Y,
                                                    Helper.CenterOfVectors(x).Z));

                                        Drawing.DrawText(aX.X - 15, aX.Y - 15, eList.Color, eList.ChampionName + eList.SpellName);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:81,代码来源:EarlyEvade.cs

示例3: DrawingOnOnDraw

        private static void DrawingOnOnDraw(EventArgs args)
        {
            if (!Menu.Item("DrawSpell").IsActive())
            {
                return;
            }

            var rectangle = new Geometry.Polygon.Rectangle(new Vector3(), new Vector3(), 0);
            foreach (var missile in ObjectManager.Get<Obj_SpellMissile>().Where(x => x.SpellCaster.IsMe /*&& CastedSpellsNames.Any(y => y == x.SData.Name)*/))
            {
                var missilePosition = missile.Position.To2D();
                var unitPosition = missile.StartPosition.To2D();
                var endPos = missile.EndPosition.To2D();

                //Calculate the real end Point:
                var direction = (endPos - unitPosition).Normalized();
                if (unitPosition.Distance(endPos) > missile.SData.CastRange)
                {
                    endPos = unitPosition + direction * missile.SData.CastRange;
                }

                rectangle.Start = unitPosition;
                rectangle.End = endPos;
                rectangle.Width = missile.SData.LineWidth;

                rectangle.UpdatePolygon();
                rectangle.Draw(Color.LightYellow);

                // Draw Line
                var start = missilePosition + missile.SData.LineWidth * rectangle.Direction.Perpendicular();
                var end = missilePosition - missile.SData.LineWidth * rectangle.Direction.Perpendicular();

                Drawing.DrawLine(Drawing.WorldToScreen(start.To3D()), Drawing.WorldToScreen(end.To3D()), 3, Color.Chartreuse);
            }
        }
开发者ID:uio25371555,项目名称:ChewyMoonScripts,代码行数:35,代码来源:Program.cs

示例4: Drawing_OnDraw

        protected override void Drawing_OnDraw(EventArgs args)
        {
            if (menu.Item("Draw_Disabled", true).GetValue<bool>())
                return;

            if (menu.Item("Draw_Q", true).GetValue<bool>())
                if (Q.Level > 0)
                    Render.Circle.DrawCircle(Player.Position, Q.Range, Q.IsReady() ? Color.Green : Color.Red);
            if (menu.Item("Draw_QE", true).GetValue<bool>())
                if (Q.Level > 0 && E.Level > 0)
                    Render.Circle.DrawCircle(Player.Position, _qe.Range, Q.IsReady() && E.IsReady() ? Color.Green : Color.Red);
            if (menu.Item("Draw_W", true).GetValue<bool>())
                if (W.Level > 0)
                    Render.Circle.DrawCircle(Player.Position, W.Range, W.IsReady() ? Color.Green : Color.Red);

            if (menu.Item("Draw_E", true).GetValue<bool>())
                if (E.Level > 0)
                    Render.Circle.DrawCircle(Player.Position, E.Range, E.IsReady() ? Color.Green : Color.Red);

            if (menu.Item("Draw_R", true).GetValue<bool>())
                if (R.Level > 0)
                    Render.Circle.DrawCircle(Player.Position, R.Range, R.IsReady() ? Color.Green : Color.Red);

            if (Get_Current_Orb() != null)
                Render.Circle.DrawCircle(Get_Current_Orb().Position, W.Width, Color.Green);

            //draw EQ
            if (menu.Item("Draw_QE_Line", true).GetValue<bool>())
            {
                var qeTarget = TargetSelector.GetTarget(_qe.Range, TargetSelector.DamageType.Magical);
                if (qeTarget == null || !Q.IsReady() || !E.IsReady())
                    return;

                var qTarget = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Magical);
                if (qTarget.IsValidTarget(E.Range))
                {
                    var pred = Q.GetPrediction(qTarget);

                    if (pred.Hitchance >= HitChanceManager.GetQEHitChance("Combo"))
                    {
                        var poly = new Geometry.Polygon.Rectangle(pred.CastPosition, Player.ServerPosition.Extend(pred.CastPosition, _qe.Range), _qe.Width);
                        poly.Draw(Color.LawnGreen);
                        var line = new Geometry.Polygon.Line(Player.Position, Player.ServerPosition.Extend(pred.CastPosition, _qe.Range));
                        line.Draw(Color.LawnGreen);
                        Render.Circle.DrawCircle(pred.CastPosition, Q.Width / 2, Color.Aquamarine);
                        Render.Circle.DrawCircle(Player.ServerPosition.Extend(pred.CastPosition, _qe.Range), Q.Width / 2, Color.SpringGreen);
                    }
                }
                else
                {
                    var startPos = Player.ServerPosition.To2D().Extend(qeTarget.ServerPosition.To2D(), Q.Range).To3D();
                    double rangeLeft = 100 + (-0.6 * Player.Distance(startPos) + 950);
                    var endPos = startPos + Vector3.Normalize(startPos - Player.ServerPosition) * (float)rangeLeft;

                    _qe.From = startPos;
                    _qe.Delay = E.Delay + Q.Range / E.Speed;

                    var qePred = _qe.GetPrediction(qeTarget);

                    var poly = new Geometry.Polygon.Rectangle(startPos, endPos, _qe.Width);

                    if (!poly.IsInside(qePred.UnitPosition))
                        return;

                    if (qePred.Hitchance >= HitChanceManager.GetQEHitChance("Combo"))
                    {
                        poly.Draw(Color.LawnGreen);
                        var line = new Geometry.Polygon.Line(Player.Position, endPos);
                        line.Draw(Color.LawnGreen);
                        Render.Circle.DrawCircle(startPos, Q.Width/2, Color.Aquamarine);
                        Render.Circle.DrawCircle(endPos, Q.Width/2, Color.SpringGreen);
                    }
                }
            }

            if (menu.Item("Draw_R_Killable", true).GetValue<bool>() && R.IsReady())
            {
                foreach (var wts in from unit in ObjectManager.Get<Obj_AI_Hero>().Where(x => x.IsValidTarget(2000) && !x.IsDead && x.IsEnemy).OrderByDescending(GetComboDamage)
                                    let health = unit.Health + unit.HPRegenRate + 10
                                    where Get_Ult_Dmg(unit) > health
                                    select Drawing.WorldToScreen(unit.Position))
                {
                    Drawing.DrawText(wts[0] - 20, wts[1], Color.White, "KILL!!!");
                }
            }
        }
开发者ID:leenam0910,项目名称:LSharp,代码行数:86,代码来源:Syndra.cs

示例5: Cast_QE

        private void Cast_QE(string source, Obj_AI_Base target = null)
        {
            var qeTarget = TargetSelector.GetTarget(_qe.Range, TargetSelector.DamageType.Magical);
            if (qeTarget == null || !Q.IsReady() || !E.IsReady())
                return;

            var qTarget = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Magical);
            if (qTarget.IsValidTarget(E.Range))
            {
                var pred = Q.GetPrediction(qTarget);

                if (pred.Hitchance >= HitChanceManager.GetQEHitChance(source))
                {
                    Q.Cast(pred.CastPosition);
                    W.LastCastAttemptT = Utils.TickCount + 500;
                    _qe.LastCastAttemptT = Utils.TickCount;
                }
            }
            else
            {
                var startPos = Player.ServerPosition.To2D().Extend(qeTarget.ServerPosition.To2D(), Q.Range).To3D();
                double rangeLeft = 100 + (-0.6*Player.Distance(startPos) + 950);
                var endPos = startPos + Vector3.Normalize(startPos - Player.ServerPosition)*(float) rangeLeft;

                _qe.From = startPos;
                _qe.Delay = E.Delay + Q.Range / E.Speed;

                var qePred = _qe.GetPrediction(qeTarget);

                var poly = new Geometry.Polygon.Rectangle(startPos, endPos, _qe.Width);

                if (!poly.IsInside(qePred.UnitPosition))
                    return;

                poly.Draw(Color.LawnGreen);

                if (qePred.Hitchance >= HitChanceManager.GetQEHitChance(source))
                {
                    Q.Cast(startPos);
                    W.LastCastAttemptT = Utils.TickCount + 500;
                    _qe.LastCastAttemptT = Utils.TickCount;
                }
            }
        }
开发者ID:leenam0910,项目名称:LSharp,代码行数:44,代码来源:Syndra.cs

示例6: Drawing_OnDraw

        private static void Drawing_OnDraw(EventArgs args)
        {
            if (ObjectManager.Player.IsDead)
            {
                return;
            }

            if (!Config.Item("Enabled").GetValue<KeyBind>().Active)
            {
                return;
            }

            if (Config.Item("Draw.VayneE") != null && Config.Item("Draw.VayneE").GetValue<Circle>().Active)
            {
                foreach (
                    var e in
                        HeroManager.Enemies.Where(
                            e => e.ChampionName.ToLower() == "udyr" && e.Distance(ObjectManager.Player.Position) < 900))
                {
                    for (var i = 1; i < 8; i++)
                    {
                        var championBehind = ObjectManager.Player.Position
                                             + Vector3.Normalize(e.ServerPosition - ObjectManager.Player.Position)
                                             *(-i*50);
                        if (Config.Item("Draw.Line").GetValue<bool>())
                        {
                            Render.Circle.DrawCircle(championBehind, 35f,
                                championBehind.IsWall() ? System.Drawing.Color.Red : System.Drawing.Color.Gray, 3);
                        }
                    }
                }
            }

            foreach (var e in HeroManager.Enemies.Where(e => e.IsValidTarget(2000)))
            {
                foreach (var eList in EarlyList)
                {
                    if (eList.ChampionName == e.ChampionName)
                    {

                        var menuActive = Config.Item(eList.ChampionName + eList.SpellName).GetValue<Circle>();

                        if (menuActive.Active)
                        {
                            var xminions = 0;
                            if (e.IsValidTarget(eList.Range))
                            {
                                for (var i = 1;
                                    i < e.Position.Distance(ObjectManager.Player.Position)/eList.Width;
                                    i++)
                                {
                                    var championBehind = ObjectManager.Player.Position
                                                         + Vector3.Normalize(
                                                             e.ServerPosition - ObjectManager.Player.Position)
                                                         *(i*eList.Width);

                                    var list = eList;
                                    var allies =
                                        HeroManager.Allies.Where(
                                            a => a.Distance(ObjectManager.Player.Position) < list.Range);
                                    var minions = MinionManager.GetMinions(
                                        ObjectManager.Player.Position,
                                        eList.Range,
                                        MinionTypes.All,
                                        MinionTeam.Ally);
                                    var mobs = MinionManager.GetMinions(
                                        ObjectManager.Player.Position,
                                        eList.Range,
                                        MinionTypes.All,
                                        MinionTeam.Neutral);

                                    xminions += minions.Count(m => m.Distance(championBehind) < eList.Width)
                                                + allies.Count(a => a.Distance(championBehind) < eList.Width)
                                                + mobs.Count(m => m.Distance(championBehind) < eList.Width);
                                }

                                if (xminions == 0)
                                {
                                    if (Config.Item("Draw.Line").GetValue<bool>())
                                    {
                                        var rec = new Geometry.Polygon.Rectangle(ObjectManager.Player.Position,
                                            e.Position, eList.Width - 10);
                                        rec.Draw(eList.Color, 1);
                                    }

                                    if (Config.Item("Draw.Text").GetValue<bool>())
                                    {
                                        Vector3[] x = new[] {ObjectManager.Player.Position, e.Position};
                                        var aX =
                                            Drawing.WorldToScreen(
                                                new Vector3(
                                                    CenterOfVectors(x).X,
                                                    CenterOfVectors(x).Y,
                                                    CenterOfVectors(x).Z));
                                        DrawText(
                                            Text,
                                            vText: eList.ChampionName + " : " + eList.SpellName,
                                            vPosX: (int) aX.X - 15,
                                            vPosY: (int) aX.Y - 15,
                                            vColor: SharpDX.Color.GreenYellow);
//.........这里部分代码省略.........
开发者ID:jayblah,项目名称:xQx,代码行数:101,代码来源:Program.cs

示例7: DrawBestLine

        public static void DrawBestLine(Spell spell, Spell spell2, int midPointRange, float extraPrerange = 1, bool wallCheck = true)
        {
            //---------------------------------MEC----------------------------
            int maxHit = 0;
            Vector3 start = Vector3.Zero;
            Vector3 end = Vector3.Zero;

            //loop one
            foreach (var target in ObjectManager.Get<Obj_AI_Hero>().Where(x => x.IsValidTarget(spell.Range)))
            {
                //loop 2
                var target1 = target;
                var target2 = target;
                foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>().Where(x => x.IsValidTarget(spell.Range + spell2.Range) && x.NetworkId != target1.NetworkId
                    && x.Distance(target1.Position) < spell2.Range - 100).OrderByDescending(x => x.Distance(target2.Position)))
                {
                    int hit = 2;

                    var targetPred = Prediction.GetPrediction(target, spell.Delay);
                    var enemyPred = Prediction.GetPrediction(enemy, spell.Delay);

                    var midpoint = (enemyPred.CastPosition + targetPred.CastPosition) / 2;

                    var startpos = midpoint + Vector3.Normalize(enemyPred.CastPosition - targetPred.CastPosition) * midPointRange;
                    var endPos = midpoint - Vector3.Normalize(enemyPred.CastPosition - targetPred.CastPosition) * midPointRange;

                    Geometry.Polygon.Rectangle rec1 = new Geometry.Polygon.Rectangle(startpos, endPos, spell.Width);

                    if (!rec1.Points.Exists(Util.IsWall) && Player.CountEnemiesInRange(spell.Range + spell2.Range) > 2)
                    {
                        //loop 3
                        var target3 = target;
                        var enemy1 = enemy;
                        foreach (var enemy2 in ObjectManager.Get<Obj_AI_Hero>().Where(x => x.IsValidTarget(spell.Range + spell2.Range) && x.NetworkId != target3.NetworkId && x.NetworkId != enemy1.NetworkId && x.Distance(target3.Position) < spell2.Range))
                        {
                            var enemy2Pred = Prediction.GetPrediction(enemy2, spell.Delay);
                            Object[] obj = Util.VectorPointProjectionOnLineSegment(startpos.To2D(), endPos.To2D(), enemy2Pred.CastPosition.To2D());
                            var isOnseg = (bool)obj[2];
                            var pointLine = (Vector2)obj[1];

                            if (pointLine.Distance(enemy2Pred.CastPosition.To2D()) < spell.Width && isOnseg)
                            {
                                hit++;
                            }
                        }
                    }

                    if (hit > maxHit && hit > 1 && !rec1.Points.Exists(Util.IsWall))
                    {
                        maxHit = hit;
                        start = startpos;
                        end = endPos;
                    }
                }
            }

            if (maxHit >= 2)
            {
                Vector2 wts = Drawing.WorldToScreen(Player.Position);
                Drawing.DrawText(wts[0], wts[1], Color.Wheat, "Hit: " + maxHit);

                Geometry.Polygon.Rectangle rec1 = new Geometry.Polygon.Rectangle(start, end, spell.Width);
                rec1.Draw(Color.Blue, 4);
            }
            else { 

                //-------------------------------Single---------------------------
                var target = TargetSelector.GetTarget(spell.Range + spell2.Range, TargetSelector.DamageType.Magical);

                if (target == null)
                    return;

                var vector1 = Player.ServerPosition + Vector3.Normalize(target.ServerPosition - Player.ServerPosition) * (spell.Range * extraPrerange);

                var pred = Prediction.GetPrediction(target, spell.Delay);
                Geometry.Polygon.Rectangle rec1 = new Geometry.Polygon.Rectangle(vector1, vector1.Extend(pred.CastPosition, spell2.Range), spell.Width);

                if (Player.Distance(target) < spell.Range)
                {
                    vector1 = pred.CastPosition.Extend(target.ServerPosition, spell2.Range * .3f);
                    Geometry.Polygon.Rectangle rec2 = new Geometry.Polygon.Rectangle(vector1, vector1.Extend(pred.CastPosition, spell2.Range), spell.Width);

                    if ((!rec2.Points.Exists(Util.IsWall) || !wallCheck) && pred.Hitchance >= HitChance.Medium && target.IsMoving)
                    {
                        Vector2 wts = Drawing.WorldToScreen(Player.Position);
                        Drawing.DrawText(wts[0], wts[1], Color.Wheat, "Hit: " + 1);

                        rec2.Draw(Color.Blue, 4);
                    }

                }
                else if (!rec1.Points.Exists(Util.IsWall) || !wallCheck)
                   {
                    //wall check
                    if (pred.Hitchance >= HitChance.High)
                    {
                        Vector2 wts = Drawing.WorldToScreen(Player.Position);
                        Drawing.DrawText(wts[0], wts[1], Color.Wheat, "Hit: " + 1);

                        rec1.Draw(Color.Blue, 4);
//.........这里部分代码省略.........
开发者ID:leenam0910,项目名称:LSharp,代码行数:101,代码来源:SpellCastManager.cs


注:本文中的LeagueSharp.Common.Geometry.Polygon.Rectangle.Draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。