Наследование: MonoBehaviour
Пример #1
1
 public static void SaveDrawing(Drawing drawing, Stream stream)
 {
     using (var writer = XmlWriter.Create(stream, XmlSettings))
     {
         SaveDrawing(drawing, writer);
     }
 }
Пример #2
0
    public void Analyze(Drawing[] drawings)
    {
      Console.Write("Enter your numbers:");
      string s = Console.ReadLine();
      var nums = (from sP in s.Split(',')
                  select Int32.Parse(sP)).ToArray();

      var result =
        from drawing in drawings
        let matches = drawing.Where(d => nums.Contains(d))
        where matches.Count() > 2
        let matchedNums = 
          string.Join(",",
                      matches.OrderBy(i => i).Select(i => i.ToString()).ToArray())
        let elem = new {matches, matchedNums, drawing.DayOfDraw}
        group elem by elem.matchedNums
        into m
          orderby m.Key.Length descending
          let date = m.Count() > 1 ? 
            "Various" : m.FirstOrDefault().DayOfDraw.ToString("dd.MM.yyyy")
          select new
                   {
                     Numbers = "[" + m.Key + "]",
                     Hits = m.Count(),
                     DrawDate = date
                   };

      foreach (var a in result)
        Console.WriteLine("Numbers: {0} were drawn {1} times on {2}", a.Numbers, a.Hits, a.DrawDate);

    }
Пример #3
0
        public void ShowFilesViewer(Drawing drawing)
        {
            var filesController = Factory.GetFilesViewController();
            filesController.Files = drawing.Files;
            filesController.ShowFilesView();

        }
 public PieSlice(Drawing.Point p0, double r, double start, double end)
 {
     this.Center = p0;
     this.Radius = r;
     this.Start = start;
     this.End = end;
 }
Пример #5
0
 public static void SetViewRect(
     this IVisio.Window window,
     Drawing.Rectangle rect)
 {
     // MSDN: http://msdn.microsoft.com/en-us/library/office/ms367542(v=office.14).aspx
     window.SetViewRect(rect.Left, rect.Top, rect.Width, rect.Height);
 }
Пример #6
0
    public void Analyze(Drawing[] drawings)
    {
      var result =
        from d in drawings
        group d by d.DayOfDraw.Year
        into years
          select new
                   {
                     Year = years.Key,
                     Numbers =
                      (from d in years
                      from n in d
                      group d by n into numbers
                      orderby numbers.Count() descending
                        select new { Number = numbers.Key, Hits = numbers.Count() })
                        .Take(10)
                   };

      foreach (var a in result)
      {
        Console.WriteLine("In the year {0} the most popular numbers were", a.Year);
        foreach (var n in a.Numbers)
          Console.WriteLine("{0,2} : {1} hits", n.Number, n.Hits);
      }

    }
Пример #7
0
        public void WriteToDrawingsStandartsRates(Drawing drawing)
        {
            var finded =
                GetListCollection().FirstOrDefault(x => x.Equals(drawing));

            WriteToDrawingsStandartsRates(drawing, finded);
        }
Пример #8
0
 public override void OnAddingToDrawing(Drawing drawing)
 {
     // Recalculate in order to compile expressions and have accurate coordinates.
     // Needed when autoLabelPoints is on. -D.H.
     Recalculate();
     base.OnAddingToDrawing(drawing);
 }
Пример #9
0
 public TempDrawingsStorage ConvertSiemensProjectToDomainModel(SiemensProject siemensProject)
 {
     var drawSotrage = new TempDrawingsStorage();
     var project = new Drawing { Count = 1, CountAll = 1 };
     LoadFromArticle(siemensProject, project, drawSotrage);
     return drawSotrage;
 }
Пример #10
0
 public TempDrawingsStorage ConvertExcelProjectToDomainModel(ExcelProject excelProject)
 {
     var drawSotrage = new TempDrawingsStorage();
     var project = new Drawing { Count = 1, CountAll = 1 };
     LoadFromProject(excelProject, project, drawSotrage);
     return drawSotrage;
 }
Пример #11
0
 public override void GenerateColors(Drawing.Color[] outputColors, int startIndex, int x, int y, int len)
 {
     int bytesBetweenPixelsInclusive = srcRW.BytesBetweenPixelsInclusive;
     ISpanInterpolator spanInterpolator = Interpolator;
     spanInterpolator.Begin(x + dx, y + dy, len);
     int x_hr;
     int y_hr;
     spanInterpolator.GetCoord(out x_hr, out y_hr);
     int x_lr = x_hr >> img_subpix_const.SHIFT;
     int y_lr = y_hr >> img_subpix_const.SHIFT;
     int bufferIndex;
     bufferIndex = srcRW.GetBufferOffsetXY(x_lr, y_lr);
     byte[] srcBuff = srcRW.GetBuffer();
     unsafe
     {
         fixed (byte* pSource = srcBuff)
         {
             do
             {
                 outputColors[startIndex].red = pSource[bufferIndex];
                 outputColors[startIndex].green = pSource[bufferIndex];
                 outputColors[startIndex].blue = pSource[bufferIndex];
                 outputColors[startIndex].alpha = 255;
                 startIndex++;
                 bufferIndex += bytesBetweenPixelsInclusive;
             } while (--len != 0);
         }
     }
 }
Пример #12
0
 public override void AddTabBorder(Drawing.Drawing2D.GraphicsPath path, Drawing.Rectangle tabBounds)
 {
     switch (tabControl.Alignment)
     {
         case TabAlignment.Top:
             path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y);
             path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y);
             path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom);
             break;
         case TabAlignment.Bottom:
             path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom);
             path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom);
             path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y);
             break;
         case TabAlignment.Left:
             path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom);
             path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y);
             path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y);
             break;
         case TabAlignment.Right:
             path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y);
             path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom);
             path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom);
             break;
     }
 }
Пример #13
0
        public static void showPolygon()
        {
            Drawing d = new Drawing();
            d.MaximalVisibleX = 55;
            d.MinimalVisibleX = -5;
            d.MaximalVisibleY = 55;
            d.MinimalVisibleY = -5;

            List<Point<double>> points = new List<Point<double>>();
            points.Add(new Point<double>(16, 27));
            points.Add(new Point<double>(36, 18));
            points.Add(new Point<double>(39, 9));

            points.Add(new Point<double>(29, 4));
            points.Add(new Point<double>(17, 7));
            points.Add(new Point<double>(11, 12));

            points.Add(new Point<double>(7, 15));
            points.Add(new Point<double>(2, 14));
            points.Add(new Point<double>(2, 16));

            points.Add(new Point<double>(4, 23));
            points.Add(new Point<double>(26, 11));
            points.Add(new Point<double>(31, 16));

            d.Polygons.Add(points);

           // GeomXmlWriter.Save(d, @"C:\Users\thresh\Documents\e.lgf");
        }
Пример #14
0
        public static void ShowToolTip( Drawing.ColorTable colorTable, SuperToolTipInfo info, Control owner, Point p, bool balloon )
        {
            if( _suppressCount != 0 || WinFormsUtility.Events.MenuLoop.InMenuLoop )
            {
                return;
            }

            if( _existing != null )
            {
                if( object.Equals( _existing.Info, info ) )
                {
                    return;
                }
                else
                {
                    _existing.Close();
                    _existing = null;
                }
            }

            _mousePoint = Control.MousePosition;

            _existing = new SuperToolTip( colorTable, info, p, balloon );

            _existing.Show( owner );
        }
Пример #15
0
 public OpenTKImage(string filename, Drawing drawing)
     : base(filename, drawing)
 {
     InitializeTextureHandle();
     TryLoadBitmapFile("Content/" + filename + ".png");
     SetSamplerState();
 }
Пример #16
0
				public DrawLine(Drawing drawing, Window window)
				{
					this.drawing = drawing;
					this.window = window;
					testName = AssemblyExtensions.GetTestNameOrProjectName();
					material = new Material(ShaderFlags.Position2DColored, "");
				}
Пример #17
0
        public void ReadDrawing(Drawing drawing, string[] lines)
        {
            this.drawing = drawing;

            var ini = new IniFile(lines);

            foreach (var section in ini.Sections)
            {
                sectionLookup.Add(section.Title, section);
            }

            using (drawing.ActionManager.CreateTransaction())
            {
                drawing.ActionManager.RecordingTransaction.IsDelayed = false;
                foreach (var section in ini.Sections)
                {
                    ProcessSection(section);
                }
            }
            DrawingUpdater updater;
            #if TABULA
            updater = new TABDrawingUpdater();
            #else
            updater = new DrawingUpdater();
            #endif
            updater.UpdateIfNecessary(drawing);
            drawing.Recalculate();
        }
Пример #18
0
 public DwgEditor(Drawing dwg)
 {
     Dwg = dwg;
     Mode = EDwgMode.Line;
     ClipToBounds = true;
     Focusable = true;
 }
Пример #19
0
 public Arc(Drawing.Point p0, double ri, double ro, double start, double end)
 {
     this.Center = p0;
     this.InnerRadius = ri;
     this.OuterRadius = ro;
     this.StartAngle = start;
     this.EndAngle = end;
 }
Пример #20
0
		public void TwoEllipses ()
		{
			var d = new Drawing (new Size (50, 50), s => {
				s.DrawEllipse (new Point (10, 20), new Size (30, 40), Pens.Black);
				s.DrawEllipse (new Point (20, 30), new Size (40, 30), Pens.Black);
			}, Platform);
			Assert.AreEqual (2, d.Graphic.Children.Count);
		}
Пример #21
0
 public PieChart(Drawing.Rectangle rect)
 {
     var center = rect.Center;
     var radius = System.Math.Min(rect.Width,rect.Height)/2.0;
     this.DataPoints = new DataPointList();
     this.Center = center;
     this.Radius = radius;
 }
Пример #22
0
    public CastSpell()
    {
        templates = new GestureTemplates();

        points = new ArrayList();
        go = GameObject.Find("Draw");
        dw = go.GetComponent<Drawing>();
    }
Пример #23
0
 public static Drawing.Point XYToPage(this IVisio.Shape shape, Drawing.Point xy)
 {
     // MSDN: http://msdn.microsoft.com/en-us/library/office/ff766239.aspx
     double xprime;
     double yprime;
     shape.XYToPage(xy.X, xy.Y, out xprime, out yprime);
     return new Drawing.Point(xprime, yprime);
 }
Пример #24
0
		/// <summary>
		/// Adds a drawing to the main document book.
		/// </summary>
		public DrawingScene AddDrawing(Drawing drawing)
		{
			var scene = new DrawingScene(Viewport);
			scene.Drawing = drawing;
			_drawingBook.Add(scene);
			scene.MakeCurrent();
			return scene;
		}
Пример #25
0
 //--------------------------------------------------------------------
 public ImgSpanGenRGB_BilinearClip(IImageReaderWriter src,
                                   Drawing.Color back_color,
                                   ISpanInterpolator inter)
     : base(inter)
 {
     m_bgcolor = back_color;
     srcRW = (ImageReaderWriterBase)src;
 }
 public static IVisio.Shape Drop(
     this IVisio.Page page,
     IVisio.Master master,
     Drawing.Point point)
 {
     var surface = new Drawing.DrawingSurface(page);
     return surface.Drop(master, point);
 }
Пример #27
0
 public unsafe void DrawLineLoopWithVertexBuffer(float* polygon2dVertices, int nelements, Drawing.Color color)
 {
     SetCurrent();
     CheckViewMatrix();
     //--------------------------------------------
     u_solidColor.SetValue((float)color.R / 255f, (float)color.G / 255f, (float)color.B / 255f, (float)color.A / 255f);
     a_position.UnsafeLoadPureV2f(polygon2dVertices);
     GL.DrawArrays(BeginMode.LineLoop, 0, nelements);
 }
Пример #28
0
 // new world with the game
 public World(string filename, Drawing.DrawHandler drawHandler, GameEventHandler aiEventHandler, GameSession session, PlayMode playMode)
     : this(playMode)
 {
     this.DrawHandler = drawHandler;
     this.fileName = filename;
     this.aiEventHandler = aiEventHandler;
     this.session = session;
     Deserialize();
 }
 private static IVisio.VisUICmds _map_axis_to_uicmd(Drawing.Axis v)
 {
     switch (v)
     {
         case Drawing.Axis.XAxis: return IVisio.VisUICmds.visCmdDistributeHSpace;
         case Drawing.Axis.YAxis: return IVisio.VisUICmds.visCmdDistributeVSpace;
         default: throw new System.ArgumentOutOfRangeException();
     }
 }
Пример #30
0
		public Parallax(TextSection textsection, Drawing.SpriteManager spritemanager)
			: base(textsection)
		{
			if (spritemanager == null) throw new ArgumentNullException("spritemanager");

			m_spritemanager = spritemanager;
			m_spriteid = textsection.GetAttribute<SpriteId>("spriteno", SpriteId.Invalid);
			m_sprite = SpriteManager.GetSprite(SpriteId);
		}
Пример #31
0
        public static void TextCentered(Vector2 pos, Color color, string content)
        {
            var rec = Drawing.GetTextExtent(content);

            Drawing.DrawText(pos.X - rec.Width / 2f, pos.Y - rec.Height / 2f, color, content);
        }
Пример #32
0
 public static void Cross(Vector2 pos, float size, float thickness, Color color)
 {
     Drawing.DrawLine(pos.X - size, pos.Y - size, pos.X + size, pos.Y + size, thickness, color);
     Drawing.DrawLine(pos.X + size, pos.Y - size, pos.X - size, pos.Y + size, thickness, color);
 }
Пример #33
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (_config.Item("Drawsmite").GetValue <bool>())
            {
                if (_config.Item("Usesmite").GetValue <KeyBind>().Active)
                {
                    Drawing.DrawText(Drawing.Width * 0.90f, Drawing.Height * 0.68f, System.Drawing.Color.DarkOrange,
                                     "Smite Is On");
                }
                else
                {
                    Drawing.DrawText(Drawing.Width * 0.90f, Drawing.Height * 0.68f, System.Drawing.Color.DarkRed,
                                     "Smite Is Off");
                }
            }
            if (_config.Item("CircleLag").GetValue <bool>())
            {
                if (_config.Item("DrawQ").GetValue <bool>())
                {
                    Utility.DrawCircle(ObjectManager.Player.Position, _q.Range, System.Drawing.Color.Gray,
                                       _config.Item("CircleThickness").GetValue <Slider>().Value,
                                       _config.Item("CircleQuality").GetValue <Slider>().Value);
                }
                if (_config.Item("DrawW").GetValue <bool>())
                {
                    Utility.DrawCircle(ObjectManager.Player.Position, _w.Range, System.Drawing.Color.Gray,
                                       _config.Item("CircleThickness").GetValue <Slider>().Value,
                                       _config.Item("CircleQuality").GetValue <Slider>().Value);
                }
                if (_config.Item("DrawE").GetValue <bool>())
                {
                    Utility.DrawCircle(ObjectManager.Player.Position, _e.Range, System.Drawing.Color.Gray,
                                       _config.Item("CircleThickness").GetValue <Slider>().Value,
                                       _config.Item("CircleQuality").GetValue <Slider>().Value);
                }
                if (_config.Item("DrawR").GetValue <bool>())
                {
                    Utility.DrawCircle(ObjectManager.Player.Position, _r.Range, System.Drawing.Color.Gray,
                                       _config.Item("CircleThickness").GetValue <Slider>().Value,
                                       _config.Item("CircleQuality").GetValue <Slider>().Value);
                }
            }
            else
            {
                if (_config.Item("DrawQ").GetValue <bool>())
                {
                    Drawing.DrawCircle(ObjectManager.Player.Position, _q.Range, System.Drawing.Color.White);
                }
                if (_config.Item("DrawW").GetValue <bool>())
                {
                    Drawing.DrawCircle(ObjectManager.Player.Position, _w.Range, System.Drawing.Color.White);
                }
                if (_config.Item("DrawE").GetValue <bool>())
                {
                    Drawing.DrawCircle(ObjectManager.Player.Position, _e.Range, System.Drawing.Color.White);
                }

                if (_config.Item("DrawR").GetValue <bool>())
                {
                    Drawing.DrawCircle(ObjectManager.Player.Position, _r.Range, System.Drawing.Color.White);
                }
            }
        }
Пример #34
0
        private void RenderPath(WpfDrawingRenderer renderer)
        {
            WpfDrawingContext context = renderer.Context;

            SvgRenderingHint hint = _svgElement.RenderingHint;

            if (hint != SvgRenderingHint.Shape || hint == SvgRenderingHint.Clipping)
            {
                return;
            }
            var parentNode = _svgElement.ParentNode;

            // We do not directly render the contents of the clip-path, unless specifically requested...
            if (string.Equals(parentNode.LocalName, SvgConstants.TagClipPath) &&
                !context.RenderingClipRegion)
            {
                return;
            }

            SvgStyleableElement styleElm = (SvgStyleableElement)_svgElement;

            //string sVisibility = styleElm.GetPropertyValue(CssConstants.PropVisibility);
            //string sDisplay    = styleElm.GetPropertyValue(CssConstants.PropDisplay);
            //if (string.Equals(sVisibility, CssConstants.ValHidden) || string.Equals(sDisplay, CssConstants.ValNone))
            //{
            //    return;
            //}

            DrawingGroup drawGroup = context.Peek();

            Debug.Assert(drawGroup != null);

            Geometry geometry = CreateGeometry(_svgElement, context.OptimizePath);

            string elementId    = this.GetElementName();
            string elementClass = this.GetElementClass();

            GeometryDrawing drawing = null;

            if (geometry == null || geometry.IsEmpty())
            {
                return;
            }

            var bounds = geometry.Bounds;

            if (string.Equals(_svgElement.LocalName, SvgConstants.TagLine, StringComparison.Ordinal))
            {
                _isLineSegment = true;
            }
            else if (string.Equals(_svgElement.LocalName, SvgConstants.TagRect, StringComparison.Ordinal))
            {
                _isLineSegment = bounds.Width.Equals(0) || bounds.Height.Equals(0);
            }
            else if (string.Equals(_svgElement.LocalName, SvgConstants.TagPath, StringComparison.Ordinal))
            {
                _isLineSegment = bounds.Width.Equals(0) || bounds.Height.Equals(0);
            }

            context.UpdateBounds(geometry.Bounds);

//                SetClip(context);

            WpfSvgPaint fillPaint = new WpfSvgPaint(context, styleElm, CssConstants.PropFill);

//            string fileValue = styleElm.GetAttribute(CssConstants.PropFill);

            Brush brush = fillPaint.GetBrush(geometry, _setBrushOpacity);

            if (brush == null)
            {
                WpfSvgPaint fallbackPaint = fillPaint.WpfFallback;
                if (fallbackPaint != null)
                {
                    brush = fallbackPaint.GetBrush(geometry, _setBrushOpacity);
                }
            }
            bool isFillTransmable = fillPaint.IsFillTransformable;

            WpfSvgPaint strokePaint = new WpfSvgPaint(context, styleElm, CssConstants.PropStroke);
            Pen         pen         = strokePaint.GetPen(geometry, _setBrushOpacity);

            // By the SVG Specifications:
            // Keyword 'objectBoundingBox' should not be used when the geometry of the applicable
            // element has no width or no height, such as the case of a horizontal or vertical line,
            // even when the line has actual thickness when viewed due to having a non-zero stroke
            // width since stroke width is ignored for bounding box calculations. When the geometry
            // of the applicable element has no width or height and 'objectBoundingBox' is specified,
            // then the given effect (e.g., a gradient) will be ignored.
            if (pen != null && _isLineSegment && strokePaint.FillType == WpfFillType.Gradient)
            {
                WpfGradientFill gradientFill = (WpfGradientFill)strokePaint.PaintServer;
                if (gradientFill.IsUserSpace == false)
                {
                    bool invalidGrad = false;
                    if (string.Equals(_svgElement.LocalName, SvgConstants.TagLine, StringComparison.Ordinal))
                    {
                        LineGeometry lineGeometry = geometry as LineGeometry;
                        if (lineGeometry != null)
                        {
                            invalidGrad = SvgObject.IsEqual(lineGeometry.EndPoint.X, lineGeometry.StartPoint.X) ||
                                          SvgObject.IsEqual(lineGeometry.EndPoint.Y, lineGeometry.StartPoint.Y);
                        }
                    }
                    else
                    {
                        invalidGrad = true;
                    }
                    if (invalidGrad)
                    {
                        // Brush is not likely inherited, we need to support fallback too
                        WpfSvgPaint fallbackPaint = strokePaint.WpfFallback;
                        if (fallbackPaint != null)
                        {
                            pen.Brush = fallbackPaint.GetBrush(geometry, _setBrushOpacity);
                        }
                        else
                        {
                            var scopePaint = strokePaint.GetScopeStroke();
                            if (scopePaint != null)
                            {
                                if (scopePaint != strokePaint)
                                {
                                    pen.Brush = scopePaint.GetBrush(geometry, _setBrushOpacity);
                                }
                                else
                                {
                                    pen.Brush = null;
                                }
                            }
                            else
                            {
                                pen.Brush = null;
                            }
                        }
                    }
                }
            }

            if (_paintContext != null)
            {
                _paintContext.Fill   = fillPaint;
                _paintContext.Stroke = strokePaint;
                _paintContext.Tag    = geometry;
            }

            if (brush != null || pen != null)
            {
                Transform transform = this.Transform;
                if (transform != null && !transform.Value.IsIdentity)
                {
                    geometry.Transform = transform;
                    if (brush != null && isFillTransmable)
                    {
                        Transform brushTransform = brush.Transform;
                        if (brushTransform == null || brushTransform == Transform.Identity)
                        {
                            brush.Transform = transform;
                        }
                        else
                        {
                            TransformGroup groupTransform = new TransformGroup();
                            groupTransform.Children.Add(brushTransform);
                            groupTransform.Children.Add(transform);
                            brush.Transform = groupTransform;
                        }
                    }
                    if (pen != null && pen.Brush != null)
                    {
                        Transform brushTransform = pen.Brush.Transform;
                        if (brushTransform == null || brushTransform == Transform.Identity)
                        {
                            pen.Brush.Transform = transform;
                        }
                        else
                        {
                            TransformGroup groupTransform = new TransformGroup();
                            groupTransform.Children.Add(brushTransform);
                            groupTransform.Children.Add(transform);
                            pen.Brush.Transform = groupTransform;
                        }
                    }
                }
                else
                {
                    transform = null; // render any identity transform useless...
                }

                drawing = new GeometryDrawing(brush, pen, geometry);

                if (!string.IsNullOrWhiteSpace(elementId) && !context.IsRegisteredId(elementId))
                {
                    SvgObject.SetName(drawing, elementId);

                    context.RegisterId(elementId);

                    if (context.IncludeRuntime)
                    {
                        SvgObject.SetId(drawing, elementId);
                    }
                }

                if (!string.IsNullOrWhiteSpace(elementClass) && context.IncludeRuntime)
                {
                    SvgObject.SetClass(drawing, elementClass);
                }

                Brush    maskBrush = this.Masking;
                Geometry clipGeom  = this.ClipGeometry;
                if (clipGeom != null || maskBrush != null)
                {
                    //Geometry clipped = Geometry.Combine(geometry, clipGeom,
                    //    GeometryCombineMode.Exclude, null);

                    //if (clipped != null && !clipped.IsEmpty())
                    //{
                    //    geometry = clipped;
                    //}
                    DrawingGroup clipMaskGroup = new DrawingGroup();

                    Rect geometryBounds = geometry.Bounds;

                    if (clipGeom != null)
                    {
                        clipMaskGroup.ClipGeometry = clipGeom;

                        SvgUnitType clipUnits = this.ClipUnits;
                        if (clipUnits == SvgUnitType.ObjectBoundingBox)
                        {
                            Rect drawingBounds = geometryBounds;

                            if (transform != null)
                            {
                                drawingBounds = transform.TransformBounds(drawingBounds);
                            }

                            TransformGroup transformGroup = new TransformGroup();

                            // Scale the clip region (at (0, 0)) and translate to the top-left corner of the target.
                            transformGroup.Children.Add(new ScaleTransform(drawingBounds.Width, drawingBounds.Height));
                            transformGroup.Children.Add(new TranslateTransform(drawingBounds.X, drawingBounds.Y));

                            clipGeom.Transform = transformGroup;
                        }
                        else
                        {
                            if (transform != null)
                            {
                                clipGeom.Transform = transform;
                            }
                        }
                    }
                    if (maskBrush != null)
                    {
                        DrawingBrush drawingBrush = maskBrush as DrawingBrush;
                        if (drawingBrush != null)
                        {
                            SvgUnitType maskUnits        = this.MaskUnits;
                            SvgUnitType maskContentUnits = this.MaskContentUnits;
                            if (maskUnits == SvgUnitType.ObjectBoundingBox)
                            {
                                Rect drawingBounds = geometryBounds;

                                if (transform != null)
                                {
                                    drawingBounds = transform.TransformBounds(drawingBounds);
                                }
                                DrawingGroup maskGroup = drawingBrush.Drawing as DrawingGroup;
                                if (maskGroup != null)
                                {
                                    DrawingCollection maskDrawings = maskGroup.Children;
                                    for (int i = 0; i < maskDrawings.Count; i++)
                                    {
                                        Drawing         maskDrawing  = maskDrawings[i];
                                        GeometryDrawing maskGeomDraw = maskDrawing as GeometryDrawing;
                                        if (maskGeomDraw != null)
                                        {
                                            if (maskGeomDraw.Brush != null)
                                            {
                                                ConvertColors(maskGeomDraw.Brush);
                                            }
                                            if (maskGeomDraw.Pen != null)
                                            {
                                                ConvertColors(maskGeomDraw.Pen.Brush);
                                            }
                                        }
                                    }
                                }

                                if (maskContentUnits == SvgUnitType.ObjectBoundingBox)
                                {
                                    TransformGroup transformGroup = new TransformGroup();

                                    // Scale the clip region (at (0, 0)) and translate to the top-left corner of the target.
                                    var scaleTransform = new ScaleTransform(drawingBounds.Width, drawingBounds.Height);
                                    transformGroup.Children.Add(scaleTransform);
                                    var translateTransform = new TranslateTransform(drawingBounds.X, drawingBounds.Y);
                                    transformGroup.Children.Add(translateTransform);

                                    Matrix scaleMatrix     = new Matrix();
                                    Matrix translateMatrix = new Matrix();

                                    scaleMatrix.Scale(drawingBounds.Width, drawingBounds.Height);
                                    translateMatrix.Translate(drawingBounds.X, drawingBounds.Y);

                                    Matrix matrix = Matrix.Multiply(scaleMatrix, translateMatrix);
                                    //maskBrush.Transform = transformGroup;
                                    maskBrush.Transform = new MatrixTransform(matrix);
                                }
                                else
                                {
                                    drawingBrush.Viewbox      = drawingBounds;
                                    drawingBrush.ViewboxUnits = BrushMappingMode.Absolute;

                                    drawingBrush.Stretch = Stretch.Uniform;

                                    drawingBrush.Viewport      = drawingBounds;
                                    drawingBrush.ViewportUnits = BrushMappingMode.Absolute;
                                }
                            }
                            else
                            {
                                if (transform != null)
                                {
                                    maskBrush.Transform = transform;
                                }
                            }

                            clipMaskGroup.OpacityMask = maskBrush;
                        }
                        //else
                        //{
                        //    clipMaskGroup.Opacity = 0;
                        //}
                    }

                    clipMaskGroup.Children.Add(drawing);
                    drawGroup.Children.Add(clipMaskGroup);
                }
                else
                {
                    drawGroup.Children.Add(drawing);
                }
            }

            // If this is not the child of a "marker", then try rendering a marker...
            if (!string.Equals(parentNode.LocalName, SvgConstants.TagMarker))
            {
                RenderMarkers(renderer, styleElm, context);
            }

            // Register this drawing with the Drawing-Document...
            if (drawing != null)
            {
                this.Rendered(drawing);
            }
        }
Пример #35
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            var drawQ = Config.Item("QRange").GetValue <Circle>();

            if (drawQ.Active && !myHero.IsDead)
            {
                Utility.DrawCircle(myHero.Position, Q.Range, drawQ.Color);
            }

            var drawWE = Config.Item("WERange").GetValue <Circle>();

            if (drawWE.Active && !myHero.IsDead)
            {
                Utility.DrawCircle(myHero.Position, W.Range, drawWE.Color);
            }
            try
            {
                if (Config.Item("drawDamage").GetValue <bool>())
                {
                    if (target != null && !target.IsDead && !myHero.IsDead)
                    {
                        var ts  = target;
                        var wts = Drawing.WorldToScreen(target.Position);
                        Drawing.DrawText(wts[0] - 40, wts[1] + 40, Color.OrangeRed, "Total damage: " + GetComboDamage(target) + "!");
                        if (GetComboDamage(target) >= ts.Health)
                        {
                            Drawing.DrawText(wts[0] - 40, wts[1] + 70, Color.OrangeRed, "Status: Killable");
                        }
                        else if (GetComboDamage(target) < ts.Health)
                        {
                            Drawing.DrawText(wts[0] - 40, wts[1] + 70, Color.OrangeRed, "Status: Needs harass!");
                        }
                    }
                    foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(ene => !ene.IsDead && ene.IsEnemy && ene.IsVisible))
                    {
                        hpi.unit = enemy;
                        if (GetComboDamage(enemy) >= enemy.Health)
                        {
                            hpi.drawDmg(GetComboDamage(enemy), Color.Red);
                        }
                        else
                        {
                            hpi.drawDmg(GetComboDamage(enemy), Color.Yellow);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Game.PrintChat("Failed to draw HP bar damage! => " + ex);
            }

            if (Config.Item("MapHack").GetValue <bool>())
            {
                try
                {
                    foreach (Hero hero in _heroes)
                    {
                        if (!hero.Dead && !hero.Visible)
                        {
                            Vector2 pos = Drawing.WorldToMinimap(hero.LastPosition);

                            var OutlineColor = Config.Item("OutlineColorMH").GetValue <Circle>();
                            var TextColor    = Config.Item("TextColorMH").GetValue <Circle>();

                            Drawing.DrawText(pos.X - Convert.ToInt32(hero.Name.Substring(0, 3).Length * 5 - 1), pos.Y - 6, OutlineColor.Color, hero.Name.Substring(0, 3));
                            Drawing.DrawText(pos.X - Convert.ToInt32(hero.Name.Substring(0, 3).Length * 5 + 1), pos.Y - 8, OutlineColor.Color, hero.Name.Substring(0, 3));
                            Drawing.DrawText(pos.X - Convert.ToInt32(hero.Name.Substring(0, 3).Length * 5 + 1), pos.Y - 6, OutlineColor.Color, hero.Name.Substring(0, 3));
                            Drawing.DrawText(pos.X - Convert.ToInt32(hero.Name.Substring(0, 3).Length * 5 - 1), pos.Y - 8, OutlineColor.Color, hero.Name.Substring(0, 3));

                            Drawing.DrawText(pos.X - Convert.ToInt32(hero.Name.Substring(0, 3).Length * 5), pos.Y - 7, TextColor.Color, hero.Name.Substring(0, 3));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }
Пример #36
0
        private void Drawing_OnDraw(EventArgs args)
        {
            if (Config.Item("qRange", true).GetValue <bool>())
            {
                if (Config.Item("onlyRdy", true).GetValue <bool>())
                {
                    if (Q.IsReady())
                    {
                        LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
                    }
                }
                else
                {
                    LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
                }
            }
            if (Config.Item("wRange", true).GetValue <bool>())
            {
                if (Config.Item("onlyRdy", true).GetValue <bool>())
                {
                    if (W.IsReady())
                    {
                        LeagueSharp.Common.Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
                    }
                }
                else
                {
                    LeagueSharp.Common.Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
                }
            }
            if (Config.Item("eRange", true).GetValue <bool>())
            {
                if (Config.Item("onlyRdy", true).GetValue <bool>())
                {
                    if (E.IsReady())
                    {
                        LeagueSharp.Common.Utility.DrawCircle(Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
                    }
                }
                else
                {
                    LeagueSharp.Common.Utility.DrawCircle(Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
                }
            }
            if (Config.Item("rRange", true).GetValue <bool>())
            {
                if (Config.Item("onlyRdy", true).GetValue <bool>())
                {
                    if (R.IsReady())
                    {
                        LeagueSharp.Common.Utility.DrawCircle(Player.Position, R.Range, System.Drawing.Color.Gray, 1, 1);
                    }
                }
                else
                {
                    LeagueSharp.Common.Utility.DrawCircle(Player.Position, R.Range, System.Drawing.Color.Gray, 1, 1);
                }
            }


            if (Config.Item("noti", true).GetValue <bool>())
            {
                var target = TargetSelector.GetTarget(1500, TargetSelector.DamageType.Physical);
                if (target.IsValidTarget())
                {
                    var poutput = Q.GetPrediction(target);
                    if ((int)poutput.Hitchance == 5)
                    {
                        Render.Circle.DrawCircle(poutput.CastPosition, 50, System.Drawing.Color.YellowGreen);
                    }
                    if (Q.GetDamage(target) > target.Health)
                    {
                        Render.Circle.DrawCircle(target.ServerPosition, 200, System.Drawing.Color.Red);
                        Drawing.DrawText(Drawing.Width * 0.1f, Drawing.Height * 0.4f, System.Drawing.Color.Red, "Q kill: " + target.ChampionName + " have: " + target.Health + "hp");
                    }
                    else if (Q.GetDamage(target) + W.GetDamage(target) > target.Health)
                    {
                        Render.Circle.DrawCircle(target.ServerPosition, 200, System.Drawing.Color.Red);
                        Drawing.DrawText(Drawing.Width * 0.1f, Drawing.Height * 0.4f, System.Drawing.Color.Red, "Q + W kill: " + target.ChampionName + " have: " + target.Health + "hp");
                    }
                    else if (Q.GetDamage(target) + W.GetDamage(target) + E.GetDamage(target) > target.Health)
                    {
                        Render.Circle.DrawCircle(target.ServerPosition, 200, System.Drawing.Color.Red);
                        Drawing.DrawText(Drawing.Width * 0.1f, Drawing.Height * 0.4f, System.Drawing.Color.Red, "Q + W + E kill: " + target.ChampionName + " have: " + target.Health + "hp");
                    }
                }
            }
        }
Пример #37
0
        private static void Game_OnDraw(EventArgs args)
        {
            if (comboMenu["2chainzz"].Cast <KeyBind>().CurrentValue)
            {
                Drawing.DrawText(Drawing.Width * 0.45f, Drawing.Height * 0.78f, Color.Red, "Double Stun Active!");
            }

            if (comboMenu["wqre"].Cast <KeyBind>().CurrentValue)
            {
                Drawing.DrawText(Drawing.Width * 0.45f, Drawing.Height * 0.78f, Color.Red, "Gapclose Combo Active!");
            }
            var t          = TargetSelector.GetTarget(_w.Range * 2, DamageType.Physical);
            var xComboText = "Combo Kill";

            if (t.IsValidTarget(_w.Range))
            {
                if (t.Health < GetComboDamage(t))
                {
                    LBcomboKillable = ComboKillable.OneShot;
                    Drawing.DrawText(t.HPBarPosition.X + 145, t.HPBarPosition.Y + 20, Color.Red, xComboText);
                }
            }

            else if (t.IsValidTarget(_w.Range * 2 - 30))
            {
                if (t.Health < GetComboDamage(t) - ObjectManager.Player.GetSpellDamage(t, SpellSlot.W))
                {
                    LBcomboKillable = ComboKillable.WithoutW;
                    xComboText      = "Jump + " + xComboText;
                    Drawing.DrawText(t.HPBarPosition.X + 145, t.HPBarPosition.Y + 20, Color.Beige, xComboText);
                }
            }

            var xtextx = "You need to be lvl 6 LUL";

            if (Player.Level < 6 && comboMenu["wqre"].Cast <KeyBind>().CurrentValue)
            {
                Drawing.DrawText(Player.HPBarPosition.X + 145, Player.HPBarPosition.Y + 20, Color.LightGreen, xtextx);
            }

            if (drawMenu["drawQ"].Cast <CheckBox>().CurrentValue&& _q.IsReady())
            {
                Circle.Draw(SharpDX.Color.Purple, 700, ObjectManager.Player.Position);
            }

            if (drawMenu["drawW"].Cast <CheckBox>().CurrentValue&& _w.IsReady())
            {
                Circle.Draw(SharpDX.Color.Purple, 600, ObjectManager.Player.Position);
            }
            if (drawMenu["drawE"].Cast <CheckBox>().CurrentValue&& _e.IsReady())
            {
                Circle.Draw(SharpDX.Color.Purple, 950, ObjectManager.Player.Position);
            }

            var heropos = Drawing.WorldToScreen(ObjectManager.Player.Position);

            if (drawMenu["showcombo"].Cast <CheckBox>().CurrentValue)
            {
                if (comboMenu["combomode"].Cast <ComboBox>().CurrentValue == 0)
                {
                    Drawing.DrawText(heropos.X - 15, heropos.Y + 40, System.Drawing.Color.White, "Selected Prio: Auto");
                }
                if (comboMenu["combomode"].Cast <ComboBox>().CurrentValue == 1)
                {
                    Drawing.DrawText(heropos.X - 15, heropos.Y + 40, System.Drawing.Color.White, "Selected Prio: Q + R");
                }
                if (comboMenu["combomode"].Cast <ComboBox>().CurrentValue == 2)
                {
                    Drawing.DrawText(heropos.X - 15, heropos.Y + 40, System.Drawing.Color.White, "Selected Prio: W + R");
                }
                if (comboMenu["combomode"].Cast <ComboBox>().CurrentValue == 3)
                {
                    Drawing.DrawText(heropos.X - 15, heropos.Y + 40, System.Drawing.Color.White, "Selected Prio: E + R");
                }
            }
        }
Пример #38
0
        public static void drawText2(string msg, Vector3 Hero, System.Drawing.Color color)
        {
            var wts = Drawing.WorldToScreen(Hero);

            Drawing.DrawText(wts[0] - (msg.Length) * 5, wts[1] - 200, color, msg);
        }
Пример #39
0
 public static void RectangleFilled(Vector2 pos, int width, int height, Color color)
 {
     pos.Y = pos.Y - height / 2f;
     Drawing.DrawLine(pos.X, pos.Y, pos.X + width, pos.Y, height, color);
 }
Пример #40
0
        private void OnDrawingEndScene(EventArgs args)
        {
            try
            {
                if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed ||
                    !this.Menu.Item("LastPosition.Enabled").IsActive())
                {
                    return;
                }

                var map             = this.Menu.Item("LastPosition.Map").IsActive();
                var minimap         = this.Menu.Item("LastPosition.Minimap").IsActive();
                var ssCircle        = this.Menu.Item("LastPosition.SSCircle").IsActive();
                var circleThickness = this.Menu.Item("LastPosition.CircleThickness").GetValue <Slider>().Value;
                var circleColor     = this.Menu.Item("LastPosition.CircleColor").GetValue <Circle>();
                var totalSeconds    = this.Menu.Item("LastPosition.TimeFormat").GetValue <StringList>().SelectedIndex == 1;
                var timerOffset     = this.Menu.Item("LastPosition.SSTimerOffset").GetValue <Slider>().Value;
                var timer           = this.Menu.Item("LastPosition.SSTimer").IsActive();


                this.sprite.Begin(SpriteFlags.AlphaBlend);
                foreach (var lp in this.lastPositions)
                {
                    if (!lp.Hero.IsDead && !lp.LastPosition.Equals(Vector3.Zero) &&
                        lp.LastPosition.Distance(lp.Hero.Position) > 500)
                    {
                        lp.Teleported = false;
                        lp.LastSeen   = Game.Time;
                    }
                    lp.LastPosition = lp.Hero.Position;
                    if (lp.Hero.IsVisible)
                    {
                        lp.Teleported = false;
                        if (!lp.Hero.IsDead)
                        {
                            lp.LastSeen = Game.Time;
                        }
                    }
                    if (!lp.Hero.IsVisible && !lp.Hero.IsDead)
                    {
                        var pos   = lp.Teleported ? this.spawnPoint : lp.LastPosition;
                        var mpPos = Drawing.WorldToMinimap(pos);
                        var mPos  = Drawing.WorldToScreen(pos);

                        if (ssCircle && !lp.LastSeen.Equals(0f) && Game.Time - lp.LastSeen > 3f)
                        {
                            var radius = Math.Abs((Game.Time - lp.LastSeen - 1) * lp.Hero.MoveSpeed * 0.9f);
                            if (radius <= 8000)
                            {
                                if (map && pos.IsOnScreen(50))
                                {
                                    Render.Circle.DrawCircle(
                                        pos,
                                        radius,
                                        circleColor.Color,
                                        circleThickness,
                                        true);
                                }
                                if (minimap)
                                {
                                    this.DrawCircleMinimap(pos, radius, circleColor.Color, circleThickness);
                                }
                            }
                        }

                        if (map && pos.IsOnScreen(50))
                        {
                            this.sprite.DrawCentered(this.heroTextures[lp.Hero.NetworkId], mPos);
                        }
                        if (minimap)
                        {
                            this.sprite.DrawCentered(this.heroTextures[lp.Hero.NetworkId], mpPos);
                        }

                        if (lp.IsTeleporting)
                        {
                            if (map && pos.IsOnScreen(50))
                            {
                                this.sprite.DrawCentered(this.teleportTexture, mPos);
                            }
                            if (minimap)
                            {
                                this.sprite.DrawCentered(this.teleportTexture, mpPos);
                            }
                        }

                        if (timer && !lp.LastSeen.Equals(0f) && Game.Time - lp.LastSeen > 3f)
                        {
                            var time = (Game.Time - lp.LastSeen).FormatTime(totalSeconds);
                            if (map && pos.IsOnScreen(50))
                            {
                                this.text.DrawTextCentered(
                                    time,
                                    new Vector2(mPos.X, mPos.Y + 15 + timerOffset),
                                    Color.White);
                            }
                            if (minimap)
                            {
                                this.text.DrawTextCentered(
                                    time,
                                    new Vector2(mpPos.X, mpPos.Y + 15 + timerOffset),
                                    Color.White);
                            }
                        }
                    }
                }
                this.sprite.End();
            }
            catch (Exception e)
            {
                Logging.AddEntry(LoggingEntryType.Error, "@LastPositionTracker.cs: An error occurred: {0}", e);
            }
        }
Пример #41
0
        private static void Game_OnUpdate(EventArgs args)
        {
            var me = ObjectMgr.LocalHero;

            if (!_loaded)
            {
                if (!Game.IsInGame || me == null)
                {
                    return;
                }
                _loaded = true;
                Game.PrintMessage(
                    "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + "SpawnBox" +
                    " By Jumpering" +
                    " loaded!</font> <font color='#aa0000'>v" + Assembly.GetExecutingAssembly().GetName().Version,
                    MessageType.LogMessage);
            }
            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Spawn Box unLoaded");
                Effect.Clear();
                Effect2.Clear();
                Effect3.Clear();
                Effect4.Clear();
                return;
            }
            if (!Game.IsInGame || !_loaded || !Utils.SleepCheck("Refer"))
            {
                return;
            }
            Utils.Sleep(500, "Refer");
            for (var i = 0; i < 14; i++)
            {
                var            coint1 = Math.Floor(Math.Floor((decimal)(Spots[i, 2] - Spots[i, 0])) / 50);
                var            coint2 = Math.Abs(Math.Floor(Math.Floor((decimal)(Spots[i, 3] - Spots[i, 1])) / 50));
                ParticleEffect effect;
                Vector2        screen;

                if (Drawing.WorldToScreen(new Vector3(Spots[i, 0], Spots[i, 1], 0), out screen))
                {
                    for (var a = 1; a < coint1; a++)
                    {
                        var first  = new Vector3(Spots[i, 0] + a * 50, Spots[i, 1], 500);
                        var second = new Vector3(Spots[i, 2] - a * 50, Spots[i, 3], 500);
                        if (!Effect.ContainsKey(string.Format("{0} / {1}", i, a)))
                        {
                            effect = new ParticleEffect(EffectPath,
                                                        first);
                            effect.SetControlPoint(0, first);
                            Effect.Add(string.Format("{0} / {1}", i, a), effect);
                        }
                        if (!Effect2.ContainsKey(string.Format("{0} / {1}", i, a)))
                        {
                            effect = new ParticleEffect(EffectPath,
                                                        second);
                            effect.SetControlPoint(0, second);
                            Effect2.Add(string.Format("{0} / {1}", i, a), effect);
                        }
                    }
                    for (var a = 1; a < coint2; a++)
                    {
                        var first  = new Vector3(Spots[i, 0], Spots[i, 1] - a * 50, 500);
                        var second = new Vector3(Spots[i, 2], Spots[i, 3] + a * 50, 500);
                        if (!Effect3.ContainsKey(string.Format("{0} / {1}", i, a)))
                        {
                            effect = new ParticleEffect(EffectPath,
                                                        first);
                            effect.SetControlPoint(0, first);
                            Effect3.Add(string.Format("{0} / {1}", i, a), effect);
                        }
                        if (!Effect4.ContainsKey(string.Format("{0} / {1}", i, a)))
                        {
                            effect = new ParticleEffect(EffectPath,
                                                        second);
                            effect.SetControlPoint(0, second);
                            Effect4.Add(string.Format("{0} / {1}", i, a), effect);
                        }
                    }
                }
                else
                {
                    for (var a = 1; a < coint1; a++)
                    {
                        if (Effect.TryGetValue(string.Format("{0} / {1}", i, a), out effect))
                        {
                            effect.Dispose();
                            Effect.Remove(string.Format("{0} / {1}", i, a));
                        }
                        if (Effect2.TryGetValue(string.Format("{0} / {1}", i, a), out effect))
                        {
                            effect.Dispose();
                            Effect2.Remove(string.Format("{0} / {1}", i, a));
                        }
                    }
                    for (var a = 1; a < coint2; a++)
                    {
                        if (Effect3.TryGetValue(string.Format("{0} / {1}", i, a), out effect))
                        {
                            effect.Dispose();
                            Effect3.Remove(string.Format("{0} / {1}", i, a));
                        }
                        if (Effect4.TryGetValue(string.Format("{0} / {1}", i, a), out effect))
                        {
                            effect.Dispose();
                            Effect4.Remove(string.Format("{0} / {1}", i, a));
                        }
                    }
                }
            }
        }
Пример #42
0
        private void OnDrawingEndScene(EventArgs args)
        {
            try
            {
                if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed)
                {
                    return;
                }

                var totalSeconds    = Menu.Item(Name + "DrawingTimeFormat").GetValue <StringList>().SelectedIndex == 1;
                var circleRadius    = Menu.Item(Name + "DrawingCircleRadius").GetValue <Slider>().Value;
                var circleThickness = Menu.Item(Name + "DrawingCircleThickness").GetValue <Slider>().Value;
                var visionRange     = Menu.Item(Name + "DrawingVisionRange").GetValue <bool>();
                var minimap         = Menu.Item(Name + "DrawingMinimap").GetValue <bool>();
                var greenCircle     = Menu.Item(Name + "DrawingGreenCircle").GetValue <bool>();
                var hotkey          = Menu.Item(Name + "Hotkey").GetValue <KeyBind>().Active;
                var permaShow       = Menu.Item(Name + "PermaShow").GetValue <bool>();

                _sprite.Begin(SpriteFlags.AlphaBlend);
                foreach (var ward in _wardObjects)
                {
                    var color =
                        Menu.Item(
                            Name + "Drawing" +
                            (ward.Data.Type == WardType.Green
                                ? "Green"
                                : (ward.Data.Type == WardType.Pink ? "Pink" : "Trap")) + "Color").GetValue <Color>();
                    if (ward.Position.IsOnScreen())
                    {
                        if (greenCircle || ward.Data.Type != WardType.Green)
                        {
                            if (ward.Object == null || !ward.Object.IsValid ||
                                (ward.Object != null && ward.Object.IsValid && !ward.Object.IsVisible))
                            {
                                Render.Circle.DrawCircle(ward.Position, circleRadius, color, circleThickness);
                            }
                        }
                        if (ward.Data.Type == WardType.Green && !ward.Data.Duration.Equals(int.MaxValue))
                        {
                            _text.DrawTextCentered(
                                string.Format(
                                    "{0} {1} {0}", ward.IsFromMissile ? (ward.Corrected ? "?" : "??") : string.Empty,
                                    (ward.EndTime - Game.Time).FormatTime(totalSeconds)),
                                Drawing.WorldToScreen(ward.Position),
                                new SharpDX.Color(color.R, color.G, color.B, color.A));
                        }
                    }
                    if (minimap && ward.Data.Type != WardType.Trap)
                    {
                        _sprite.DrawCentered(
                            ward.Data.Type == WardType.Green ? _greenWardTexture : _pinkWardTexture,
                            ward.MinimapPosition.To2D());
                    }
                    if (hotkey || permaShow)
                    {
                        if (visionRange)
                        {
                            Render.Circle.DrawCircle(
                                ward.Position, ward.Data.Range, Color.FromArgb(30, color), circleThickness);
                        }
                        if (ward.IsFromMissile)
                        {
                            _line.Begin();
                            _line.Draw(
                                new[]
                                { Drawing.WorldToScreen(ward.StartPosition), Drawing.WorldToScreen(ward.EndPosition) },
                                SharpDX.Color.White);
                            _line.End();
                        }
                    }
                }
                _sprite.End();
            }
            catch (Exception ex)
            {
                //Global.Logger.AddItem(new LogItem(ex));
            }
        }
Пример #43
0
        public static void DrawFontTextMap(Font vFont, string vText, Vector3 Pos, ColorBGRA vColor)
        {
            var wts = Drawing.WorldToScreen(Pos);

            vFont.DrawText(null, vText, (int)wts[0], (int)wts[1], vColor);
        }
Пример #44
0
        public ChampionInfo(AIHeroClient hero, bool ally)
        {
            index++;
            int textoffset = index * 50;

            _hero = hero;
            Render.Text text = new Render.Text(
                new Vector2(), _hero.ChampionName, 20,
                ally
                    ? new Color {
                R = 205, G = 255, B = 205, A = 255
            }
                    : new Color {
                R = 255, G = 205, B = 205, A = 255
            })
            {
                PositionUpdate =
                    () =>
                    Drawing.WorldToScreen(
                        ObjectManager.Player.Position.LSExtend(_hero.Position, 300 + textoffset)),
                VisibleCondition = delegate
                {
                    float dist = _hero.LSDistance(ObjectManager.Player.Position);
                    return(Program.Instance().ShowChampionNames&& !_hero.IsDead &&
                           Game.Time - _lineStart < Program.Instance().LineDuration&&
                           (!_hero.IsVisible || !Render.OnScreen(Drawing.WorldToScreen(_hero.Position))) &&
                           dist < Program.Instance().Radius&& dist > 300 + textoffset);
                },
                Centered = true,
                OutLined = true,
            };
            text.Add(1);
            _line = new Render.Line(
                new Vector2(), new Vector2(), 5,
                ally ? new Color {
                R = 0, G = 255, B = 0, A = 125
            } : new Color {
                R = 255, G = 0, B = 0, A = 125
            })
            {
                StartPositionUpdate = () => Drawing.WorldToScreen(ObjectManager.Player.Position),
                EndPositionUpdate   = () => Drawing.WorldToScreen(_hero.Position),
                VisibleCondition    =
                    delegate
                {
                    return(!_hero.IsDead && Game.Time - _lineStart < Program.Instance().LineDuration&&
                           _hero.LSDistance(ObjectManager.Player.Position) < (Program.Instance().Radius + 1000));
                }
            };
            _line.Add(0);
            Render.Line minimapLine = new Render.Line(
                new Vector2(), new Vector2(), 2,
                ally ? new Color {
                R = 0, G = 255, B = 0, A = 255
            } : new Color {
                R = 255, G = 0, B = 0, A = 255
            })
            {
                StartPositionUpdate = () => Drawing.WorldToMinimap(ObjectManager.Player.Position),
                EndPositionUpdate   = () => Drawing.WorldToMinimap(_hero.Position),
                VisibleCondition    =
                    delegate
                {
                    return(Program.Instance().DrawMinimapLines&& !_hero.IsDead && Game.Time - _lineStart < Program.Instance().LineDuration);
                }
            };
            minimapLine.Add(0);
            Game.OnUpdate += Game_OnGameUpdate;
            OnEnterRange  += ChampionInfo_OnEnterRange;
        }
Пример #45
0
        public void CreateRenderObjects()
        {
            //Create the minimap sprite.

            if (Range == 1100)
            {
                _minimapSprite       = new Render.Sprite(WardData.Bitmap, MinimapPosition);
                _minimapSprite.Scale = new Vector2(_scale, _scale);
                _minimapSprite.Add(0);
            }

            //Create the circle:
            _defaultCircle = new Render.Circle(Position, WardData.Type == WardType.Trap ? WardData.Range : 200, Color, 5, true);
            _defaultCircle.VisibleCondition +=
                sender =>
                Program.getCheckBoxItem(Program.ward, "Enabled") &&
                !Program.getKeyBindItem(Program.ward, "Details") &&
                Render.OnScreen(Drawing.WorldToScreen(Position));
            _defaultCircle.Add(0);
            _defaultCircleFilled = new Render.Circle(Position, WardData.Type == WardType.Trap ? WardData.Range : 200, Color.FromArgb(25, Color), -142857, true);
            _defaultCircleFilled.VisibleCondition +=
                sender =>
                Program.getCheckBoxItem(Program.ward, "Enabled") &&
                !Program.getKeyBindItem(Program.ward, "Details") &&
                Render.OnScreen(Drawing.WorldToScreen(Position));
            _defaultCircleFilled.Add(-1);

            //Create the circle that shows the range
            _rangeCircle = new Render.Circle(Position, Range, Color, 10, false);
            _rangeCircle.VisibleCondition +=
                sender =>
                Program.getCheckBoxItem(Program.ward, "Enabled") &&
                Program.getKeyBindItem(Program.ward, "Details");
            _rangeCircle.Add(0);

            _rangeCircleFilled = new Render.Circle(Position, Range, Color.FromArgb(25, Color), -142857, true);
            _rangeCircleFilled.VisibleCondition +=
                sender =>
                Program.getCheckBoxItem(Program.ward, "Enabled") &&
                Program.getKeyBindItem(Program.ward, "Details");
            _rangeCircleFilled.Add(-1);


            //Missile line;
            if (IsFromMissile)
            {
                _missileLine = new Render.Line(new Vector2(), new Vector2(), 2, new ColorBGRA(255, 255, 255, 255));
                _missileLine.EndPositionUpdate   = () => Drawing.WorldToScreen(Position);
                _missileLine.StartPositionUpdate = () => Drawing.WorldToScreen(StartPosition);
                _missileLine.VisibleCondition   +=
                    sender =>
                    Program.getCheckBoxItem(Program.ward, "Enabled") &&
                    Program.getKeyBindItem(Program.ward, "Details");
                _missileLine.Add(0);
            }


            //Create the timer text:
            if (Duration != int.MaxValue)
            {
                _timerText                   = new Render.Text(10, 10, "t", 18, new ColorBGRA(255, 255, 255, 255));
                _timerText.OutLined          = true;
                _timerText.PositionUpdate    = () => Drawing.WorldToScreen(Position);
                _timerText.Centered          = true;
                _timerText.VisibleCondition +=
                    sender =>
                    Program.getCheckBoxItem(Program.ward, "Enabled") &&
                    Render.OnScreen(Drawing.WorldToScreen(Position));

                _timerText.TextUpdate =
                    () =>
                    (IsFromMissile ? "?? " : "") + Utils.FormatTime((EndT - Utils.TickCount) / 1000f) +
                    (IsFromMissile ? " ??" : "");
                _timerText.Add(2);
            }
        }
Пример #46
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            if (Game.GameState == GameState.PostGame)
            {
                return;
            }
            Vector2 startPos = new Vector2(PosX.Value.Value, PosY.Value.Value);
            var     size     = new Vector2(Size * 10 * _main.Invoker.AbilityInfos.Count, Size * 10);

            if (Movable)
            {
                var tempSize = size;//new Vector2(200, 200);
                if (CanMoveWindow(ref startPos, tempSize, true))
                {
                    PosX.Item.SetValue(new Slider((int)startPos.X, 0, 2000));
                    PosY.Item.SetValue(new Slider((int)startPos.Y, 0, 2000));
                }
            }
            var pos      = startPos;
            var iconSize = new Vector2(Size * 10);
            var list     = OderBy
                ? _main.Invoker.AbilityInfos.OrderBy(x => x.Ability.Cooldown)
                : (IEnumerable <AbilityInfo>)_main.Invoker.AbilityInfos;

            foreach (var info in list)
            {
                var ability = info.Ability;
                Drawing.DrawRect(pos, iconSize, Textures.GetSpellTexture(ability.StoredName()));
                var miniIconSize = iconSize / 3;
                var miniIconPos  = pos + new Vector2(0, iconSize.Y);
                Drawing.DrawRect(miniIconPos, miniIconSize, Textures.GetSpellTexture(info.One.StoredName()));
                Drawing.DrawRect(miniIconPos + new Vector2(miniIconSize.X, 0), miniIconSize, Textures.GetSpellTexture(info.Two.StoredName()));
                Drawing.DrawRect(miniIconPos + new Vector2(miniIconSize.X * 2, 0), miniIconSize, Textures.GetSpellTexture(info.Three.StoredName()));
                var cd = ability.Cooldown;
                if (cd > 0)
                {
                    var text = ((int)(cd + 1)).ToString(CultureInfo.InvariantCulture);
                    Drawing.DrawText(
                        text,
                        pos, size * ConfigSize / 100 / 10,
                        new Color(ColorR, ColorG, ColorB),
                        FontFlags.AntiAlias | FontFlags.StrikeOut);
                }
                else
                {
                    var key = KeyInterop.KeyFromVirtualKey((int)info.Key);
                    if (key != Key.None && key != Key.D0)
                    {
                        var text = key.ToString();
                        Drawing.DrawText(
                            text,
                            pos, size * ConfigSize / 100 / 10,
                            new Color(ColorR, ColorG, ColorB),
                            FontFlags.AntiAlias | FontFlags.StrikeOut);
                    }
                }
                pos += new Vector2(iconSize.X, 0);
            }

            //Drawing.DrawRect(startPos, size, new Color(155, 155, 155, 50));
            Drawing.DrawRect(startPos, size, new Color(0, 0, 0, 255), true);
        }
Пример #47
0
 internal static DrawingImage DrawingToImage(Drawing drawing)
 {
     return(new DrawingImage(drawing));
 }
Пример #48
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Player.IsDead)
            {
                return;
            }

            if (Menu.Item("nightmoon.draw.e").GetValue <bool>() && !E.IsReady())
            {
                var ETurret = ObjectManager.Get <Obj_AI_Turret>().FirstOrDefault(t => !t.IsDead && t.HasBuff("TristanaECharge"));
                var ETarget = HeroManager.Enemies.FirstOrDefault(e => !e.IsDead && e.HasBuff("TristanaECharge"));

                if (ETurret != null)
                {
                    var eturretstacks = ETurret.Buffs.Find(buff => buff.Name == "TristanaECharge").Count;

                    if (ETurret.Health < (E.GetDamage(ETurret) + (((eturretstacks * 0.30)) * E.GetDamage(ETurret))))
                    {
                        Drawing.DrawCircle(ETurret.Position, 300 + ETurret.BoundingRadius, Color.Red);
                    }
                    else if (ETurret.Health > (E.GetDamage(ETurret) + (((eturretstacks * 0.30)) * E.GetDamage(ETurret))))
                    {
                        Drawing.DrawCircle(ETurret.Position, 300 + ETurret.BoundingRadius, Color.Orange);
                    }
                }

                if (ETarget != null)
                {
                    var etargetstacks = ETarget.Buffs.Find(buff => buff.Name == "TristanaECharge").Count;

                    if (ETarget.Health < (E.GetDamage(ETarget) + (((etargetstacks * 0.30)) * E.GetDamage(ETarget))))
                    {
                        Drawing.DrawCircle(ETarget.Position, 150 + ETarget.BoundingRadius, Color.Red);
                    }
                    else if (ETarget.Health > (E.GetDamage(ETarget) + (((etargetstacks * 0.30)) * E.GetDamage(ETarget))))
                    {
                        Drawing.DrawCircle(ETarget.Position, 150 + ETarget.BoundingRadius, Color.Orange);
                    }
                }
            }

            if (Menu.Item("nightmoon.draw.eks").GetValue <Circle>().Active)
            {
                foreach (var Target in HeroManager.Enemies.Where(x => x.IsValidTarget() && x.ECanKill()))
                {
                    var TargetPos = Drawing.WorldToScreen(Target.Position);
                    Render.Circle.DrawCircle(Target.Position, Target.BoundingRadius, Menu.Item("nightmoon.draw.eks").GetValue <Circle>().Color);
                    Drawing.DrawText(TargetPos.X, TargetPos.Y - 50, Menu.Item("nightmoon.draw.eks").GetValue <Circle>().Color, "Kill For E");
                }
            }

            if (Menu.Item("nightmoon.draw.rks").GetValue <Circle>().Active&& CanCastR())
            {
                foreach (var Target in HeroManager.Enemies.Where(x => x.isKillableAndValidTarget(R.GetDamage(x), TargetSelector.DamageType.Magical)))
                {
                    var TargetPos = Drawing.WorldToScreen(Target.Position);
                    Render.Circle.DrawCircle(Target.Position, Target.BoundingRadius, Menu.Item("nightmoon.draw.rks").GetValue <Circle>().Color);
                    Drawing.DrawText(TargetPos.X, TargetPos.Y - 20, Menu.Item("nightmoon.draw.rks").GetValue <Circle>().Color, "Kill For R");
                }
            }
        }
Пример #49
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            // Wait for Game Load
            if (Game.Time <= 10)
            {
                return;
            }

            // No Responce While Dead
            if (Champion.IsDead)
            {
                return;
            }


            System.Drawing.Color color;
            System.Drawing.Color color2;

            // Setup Designer Coloration
            switch (Champion.SkinId)
            {
            default:
                color  = System.Drawing.Color.Transparent;
                color2 = System.Drawing.Color.Transparent;
                break;

            case 0:
                color  = System.Drawing.Color.SpringGreen;
                color2 = System.Drawing.Color.Firebrick;
                break;

            case 1:
                color  = System.Drawing.Color.DarkOrange;
                color2 = System.Drawing.Color.Tomato;
                break;

            case 2:
                color  = System.Drawing.Color.ForestGreen;
                color2 = System.Drawing.Color.Red;
                break;

            case 3:
                color  = System.Drawing.Color.LimeGreen;
                color2 = System.Drawing.Color.OrangeRed;
                break;
            }

            // Apply Designer Color into Circle
            if (!MenuManager.DrawerMode)
            {
                return;
            }
            if (MenuManager.DrawQ && SpellManager.Q.IsLearned)
            {
                Drawing.DrawCircle(Champion.Position, SpellManager.Q.Range, color);
                Drawing.DrawCircle(Champion.Position, SpellManager.Q2.Range, color2);
            }
            if (MenuManager.DrawE && SpellManager.E.IsLearned)
            {
                Drawing.DrawCircle(Champion.Position, SpellManager.E.Range, color);
            }
            if (MenuManager.DrawR && SpellManager.R.IsLearned)
            {
                Drawing.DrawCircle(Champion.Position, SpellManager.R.Range, color);
            }
        }
Пример #50
0
        private static void OnDraw(EventArgs args)
        {
            if (!_drawing)
            {
                return;
            }

            if (Menu.Item("orb_Draw_AARange").GetValue <Circle>().Active)
            {
                Render.Circle.DrawCircle(MyHero.Position, GetAutoAttackRange(), Menu.Item("orb_Draw_AARange").GetValue <Circle>().Color);
            }

            if (Menu.Item("orb_Draw_AARange_Enemy").GetValue <Circle>().Active ||
                Menu.Item("orb_Draw_hitbox").GetValue <Circle>().Active)
            {
                foreach (var enemy in AllEnemys.Where(enemy => enemy.IsValidTarget(1500)))
                {
                    if (Menu.Item("orb_Draw_AARange_Enemy").GetValue <Circle>().Active)
                    {
                        Render.Circle.DrawCircle(enemy.Position, GetAutoAttackRange(enemy, MyHero), Menu.Item("orb_Draw_AARange_Enemy").GetValue <Circle>().Color);
                    }
                    if (Menu.Item("orb_Draw_hitbox").GetValue <Circle>().Active)
                    {
                        Render.Circle.DrawCircle(enemy.Position, enemy.BoundingRadius, Menu.Item("orb_Draw_hitbox").GetValue <Circle>().Color);
                    }
                }
            }

            if (Menu.Item("orb_Draw_AARange_Enemy").GetValue <Circle>().Active)
            {
                foreach (var enemy in AllEnemys.Where(enemy => enemy.IsValidTarget(1500)))
                {
                    Render.Circle.DrawCircle(enemy.Position, GetAutoAttackRange(enemy, MyHero), Menu.Item("orb_Draw_AARange_Enemy").GetValue <Circle>().Color);
                }
            }

            if (Menu.Item("orb_Draw_Holdzone").GetValue <Circle>().Active)
            {
                Render.Circle.DrawCircle(MyHero.Position, Menu.Item("orb_Misc_Holdzone").GetValue <Slider>().Value, Menu.Item("orb_Draw_Holdzone").GetValue <Circle>().Color);
            }

            if (Menu.Item("orb_Draw_MinionHPBar").GetValue <Circle>().Active ||
                Menu.Item("orb_Draw_Lasthit").GetValue <Circle>().Active ||
                Menu.Item("orb_Draw_nearKill").GetValue <Circle>().Active)
            {
                var minionList = MinionManager.GetMinions(MyHero.Position, GetAutoAttackRange() + 500, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.MaxHealth);
                foreach (var minion in minionList.Where(minion => minion.IsValidTarget(GetAutoAttackRange() + 500)))
                {
                    var attackToKill  = Math.Ceiling(minion.MaxHealth / MyHero.GetAutoAttackDamage(minion, true));
                    var hpBarPosition = minion.HPBarPosition;
                    var barWidth      = minion.IsMelee() ? 75 : 80;
                    if (minion.HasBuff("turretshield", true))
                    {
                        barWidth = 70;
                    }
                    var barDistance = (float)(barWidth / attackToKill);
                    if (Menu.Item("orb_Draw_MinionHPBar").GetValue <Circle>().Active)
                    {
                        for (var i = 1; i < attackToKill; i++)
                        {
                            var startposition = hpBarPosition.X + 45 + barDistance * i;
                            Drawing.DrawLine(
                                new Vector2(startposition, hpBarPosition.Y + 18),
                                new Vector2(startposition, hpBarPosition.Y + 23),
                                Menu.Item("orb_Draw_MinionHPBar_thickness").GetValue <Slider>().Value,
                                Menu.Item("orb_Draw_MinionHPBar").GetValue <Circle>().Color);
                        }
                    }
                    if (Menu.Item("orb_Draw_Lasthit").GetValue <Circle>().Active&&
                        minion.Health <= MyHero.GetAutoAttackDamage(minion, true))
                    {
                        Render.Circle.DrawCircle(minion.Position, minion.BoundingRadius, Menu.Item("orb_Draw_Lasthit").GetValue <Circle>().Color);
                    }
                    else if (Menu.Item("orb_Draw_nearKill").GetValue <Circle>().Active&&
                             minion.Health <= MyHero.GetAutoAttackDamage(minion, true) * 2)
                    {
                        Render.Circle.DrawCircle(minion.Position, minion.BoundingRadius, Menu.Item("orb_Draw_nearKill").GetValue <Circle>().Color);
                    }
                }
            }
        }
Пример #51
0
        public override void Game_OnGameUpdate(EventArgs args)
        {
            if (GetValue <Circle>("DrawJumpPos").Active)
            {
                fillPositions();
            }

            if (GetValue <KeyBind>("JumpTo").Active)
            {
                JumpTo();
            }

            foreach (
                var myBoddy in
                ObjectManager.Get <Obj_AI_Minion>()
                .Where(
                    obj => obj.Name == "RobotBuddy" &&
                    obj.IsAlly && ObjectManager.Player.Distance(obj) < 1500))

            {
                Render.Circle.DrawCircle(myBoddy.Position, 75f, Color.Red);
            }
            if (CoopStrikeAlly == null)
            {
                foreach (
                    var ally in
                    from ally in ObjectManager.Get <Obj_AI_Hero>().Where(tx => tx.IsAlly && !tx.IsDead && !tx.IsMe)
                    where ObjectManager.Player.Distance(ally) <= CoopStrikeAllyRange
                    from buff in ally.Buffs
                    where buff.Name.Contains("kalistacoopstrikeally")
                    select ally)
                {
                    CoopStrikeAlly = ally;
                }
                if (W.Level != 0)
                {
                    Drawing.DrawText(Drawing.Width * 0.44f, Drawing.Height * 0.80f, Color.Red, "Searching Your Friend...");
                }
            }
            else
            {
                var drawConnText = GetValue <Circle>("DrawConnText");
                if (drawConnText.Active)
                {
                    Drawing.DrawText(Drawing.Width * 0.44f, Drawing.Height * 0.80f, drawConnText.Color,
                                     "You Connected with " + CoopStrikeAlly.ChampionName);
                }

                var drawConnSignal = GetValue <bool>("DrawConnSignal");
                if (drawConnSignal)
                {
                    if (ObjectManager.Player.Distance(CoopStrikeAlly) > 800 &&
                        ObjectManager.Player.Distance(CoopStrikeAlly) < CoopStrikeAllyRange)
                    {
                        Drawing.DrawText(Drawing.Width * 0.45f, Drawing.Height * 0.82f, Color.Gold,
                                         "Connection Signal: Low");
                    }
                    else if (ObjectManager.Player.Distance(CoopStrikeAlly) < 800)
                    {
                        Drawing.DrawText(Drawing.Width * 0.45f, Drawing.Height * 0.82f, Color.GreenYellow,
                                         "Connection Signal: Good");
                    }
                    else if (ObjectManager.Player.Distance(CoopStrikeAlly) > CoopStrikeAllyRange)
                    {
                        Drawing.DrawText(Drawing.Width * 0.45f, Drawing.Height * 0.82f, Color.Red,
                                         "Connection Signal: None");
                    }
                }
            }
            var drawEStackCount = GetValue <Circle>("DrawEStackCount");

            if (drawEStackCount.Active)
            {
                xEnemyMarker.Clear();
                foreach (
                    var xEnemy in
                    ObjectManager.Get <Obj_AI_Hero>()
                    .Where(tx => tx.IsEnemy && !tx.IsDead && ObjectManager.Player.Distance(tx) < E.Range))
                {
                    foreach (var buff in xEnemy.Buffs.Where(buff => buff.Name.Contains("kalistaexpungemarker")))
                    {
                        xEnemyMarker.Add(new EnemyMarker
                        {
                            ChampionName = xEnemy.ChampionName,
                            ExpireTime   = Game.Time + 4,
                            BuffCount    = buff.Count
                        });
                    }
                }

                foreach (var markedEnemies in xEnemyMarker)
                {
                    foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>())
                    {
                        if (enemy.IsEnemy && !enemy.IsDead && ObjectManager.Player.Distance(enemy) <= E.Range &&
                            enemy.ChampionName == markedEnemies.ChampionName)
                        {
                            if (!(markedEnemies.ExpireTime > Game.Time))
                            {
                                continue;
                            }
                            var xCoolDown = TimeSpan.FromSeconds(markedEnemies.ExpireTime - Game.Time);
                            var display   = string.Format("E:{0}", markedEnemies.BuffCount);
                            Drawing.DrawText(enemy.HPBarPosition.X + 145, enemy.HPBarPosition.Y + 20,
                                             drawEStackCount.Color,
                                             display);
                        }
                    }
                }
            }

            Obj_AI_Hero t;

            if (Q.IsReady() && GetValue <KeyBind>("UseQTH").Active)
            {
                if (ObjectManager.Player.HasBuff("Recall"))
                {
                    return;
                }
                t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
                if (t != null)
                {
                    Q.Cast(t);
                }
            }

            if (ComboActive || HarassActive)
            {
                var useQ = GetValue <bool>("UseQ" + (ComboActive ? "C" : "H"));
                var useE = GetValue <bool>("UseE" + (ComboActive ? "C" : "H"));

                if (Orbwalking.CanMove(100))
                {
                    if (Q.IsReady() && useQ)
                    {
                        t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
                        if (t != null)
                        {
                            Q.Cast(t);
                        }
                    }

                    if (E.IsReady() && useE)
                    {
                        t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
                        if (t != null)
                        {
                            if (t.Health < ObjectManager.Player.GetSpellDamage(t, SpellSlot.E))
                            {
                                E.Cast();
                            }
                        }
                    }
                }
            }

            if (!R.IsReady() || !GetValue <KeyBind>("CastR").Active)
            {
                return;
            }
            t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
            if (t != null)
            {
                R.Cast(t);
            }
        }
Пример #52
0
        private void Drawing_OnDraw(EventArgs args)
        {
            if (Config.Item("showcd", true).GetValue <bool>())
            {
                string msg = " ";

                if (Range)
                {
                    msg = "Q " + (int)Q2cd + "   W " + (int)W2cd + "   E " + (int)E2cd;
                    Drawing.DrawText(Drawing.Width * 0.5f - 50, Drawing.Height * 0.3f, System.Drawing.Color.Orange, msg);
                }
                else
                {
                    msg = "Q " + (int)Qcd + "   W " + (int)Wcd + "   E " + (int)Ecd;
                    Drawing.DrawText(Drawing.Width * 0.5f - 50, Drawing.Height * 0.3f, System.Drawing.Color.Aqua, msg);
                }
            }


            if (Config.Item("qRange", true).GetValue <bool>())
            {
                if (Config.Item("onlyRdy", true).GetValue <bool>())
                {
                    if (Q.IsReady())
                    {
                        if (Range)
                        {
                            if (CanUseQE())
                            {
                                LeagueSharp.Common.Utility.DrawCircle(Player.Position, Qext.Range, System.Drawing.Color.Cyan, 1, 1);
                            }
                            else
                            {
                                LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
                            }
                        }
                        else
                        {
                            LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q2.Range, System.Drawing.Color.Orange, 1, 1);
                        }
                    }
                }
                else
                {
                    if (Range)
                    {
                        if (CanUseQE())
                        {
                            LeagueSharp.Common.Utility.DrawCircle(Player.Position, Qext.Range, System.Drawing.Color.Cyan, 1, 1);
                        }
                        else
                        {
                            LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
                        }
                    }
                    else
                    {
                        LeagueSharp.Common.Utility.DrawCircle(Player.Position, Q2.Range, System.Drawing.Color.Cyan, 1, 1);
                    }
                }
            }

            if (Config.Item("noti", true).GetValue <bool>())
            {
                var t = TargetSelector.GetTarget(1600, TargetSelector.DamageType.Physical);

                if (t.IsValidTarget())
                {
                    var damageCombo = GetComboDMG(t);
                    if (damageCombo > t.Health)
                    {
                        Drawing.DrawText(Drawing.Width * 0.1f, Drawing.Height * 0.5f, System.Drawing.Color.Red, "Combo deal  " + damageCombo + " to " + t.ChampionName);
                        drawLine(t.Position, Player.Position, 10, System.Drawing.Color.Yellow);
                    }
                }
            }
        }
Пример #53
0
        // Process specified image trying to recognize counter's image
        public void Process(Bitmap image, IImageProcessingLog log)
        {
            log.AddMessage("Image size: " + image.Width + " x " + image.Height);

            // 1 - Grayscale
            Bitmap grayImage = Grayscale.CommonAlgorithms.BT709.Apply(image);

            log.AddImage("Grayscale", grayImage);

            // 2 - Edge detection
            DifferenceEdgeDetector edgeDetector = new DifferenceEdgeDetector( );
            Bitmap edges = edgeDetector.Apply(grayImage);

            log.AddImage("Edges", edges);

            // 3 - Threshold edges
            Threshold thresholdFilter = new Threshold(40);

            thresholdFilter.ApplyInPlace(edges);
            log.AddImage("Thresholded Edges", edges);

            // 4 - Blob Counter
            BlobCounter blobCounter = new BlobCounter( );

            blobCounter.MinHeight    = 32;
            blobCounter.MinWidth     = 32;
            blobCounter.FilterBlobs  = true;
            blobCounter.ObjectsOrder = ObjectsOrder.Size;

            blobCounter.ProcessImage(edges);
            Blob[] blobs = blobCounter.GetObjectsInformation( );

            // create unmanaged copy of source image, so we could draw on it
            UnmanagedImage imageData = UnmanagedImage.FromManagedImage(image);

            // Get unmanaged copy of grayscale image, so we could access it's pixel values
            UnmanagedImage grayUI = UnmanagedImage.FromManagedImage(grayImage);

            // list of found dark/black quadrilaterals surrounded by white area
            List <List <IntPoint> > foundObjects = new List <List <IntPoint> >( );
            // shape checker for checking quadrilaterals
            SimpleShapeChecker shapeChecker = new SimpleShapeChecker( );

            // 5 - check each blob
            for (int i = 0, n = blobs.Length; i < n; i++)
            {
                List <IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
                List <IntPoint> corners    = null;

                // does it look like a quadrilateral ?
                if (shapeChecker.IsQuadrilateral(edgePoints, out corners))
                {
                    // do some more checks to filter so unacceptable shapes
                    // if ( CheckIfShapeIsAcceptable( corners ) )
                    {
                        log.AddMessage("Blob size: " + blobs[i].Rectangle.Width + " x " + blobs[i].Rectangle.Height);

                        // get edge points on the left and on the right side
                        List <IntPoint> leftEdgePoints, rightEdgePoints;
                        blobCounter.GetBlobsLeftAndRightEdges(blobs[i], out leftEdgePoints, out rightEdgePoints);

                        // calculate average difference between pixel values from outside of the shape and from inside
                        float diff = this.CalculateAverageEdgesBrightnessDifference(
                            leftEdgePoints, rightEdgePoints, grayUI);

                        log.AddMessage("Avg Diff: " + diff);

                        // check average difference, which tells how much outside is lighter than inside on the average
                        if (diff > 20)
                        {
                            Drawing.Polygon(imageData, corners, Color.FromArgb(255, 255, 0, 0));
                            // add the object to the list of interesting objects for further processing
                            foundObjects.Add(corners);
                        }
                    }
                }
            }


            log.AddImage("Potential glyps", imageData.ToManagedImage());

            int counter = 1;

            // further processing of each potential glyph
            foreach (List <IntPoint> corners in foundObjects)
            {
                log.AddMessage("Glyph #" + counter);

                log.AddMessage(string.Format("Corners: ({0}), ({1}), ({2}), ({3})",
                                             corners[0], corners[1], corners[2], corners[3]));

                // 6 - do quadrilateral transformation
                QuadrilateralTransformation quadrilateralTransformation =
                    new QuadrilateralTransformation(corners, 250, 250);

                Bitmap transformed = quadrilateralTransformation.Apply(grayImage);

                log.AddImage("Transformed #" + counter, transformed);

                // 7 - otsu thresholding
                OtsuThreshold otsuThresholdFilter = new OtsuThreshold( );
                Bitmap        transformedOtsu     = otsuThresholdFilter.Apply(transformed);
                log.AddImage("Transformed Otsu #" + counter, transformedOtsu);

                int glyphSize = 5;
                SquareBinaryGlyphRecognizer gr = new SquareBinaryGlyphRecognizer(glyphSize);

                bool[,] glyphValues = gr.Recognize(ref transformedOtsu,
                                                   new Rectangle(0, 0, 250, 250));

                log.AddImage("Glyph lines #" + counter, transformedOtsu);

                // output recognize glyph to log
                log.AddMessage(string.Format("glyph: {0:F2}%", gr.confidence * 100));
                for (int i = 0; i < glyphSize; i++)
                {
                    StringBuilder sb = new StringBuilder("   ");

                    for (int j = 0; j < glyphSize; j++)
                    {
                        sb.Append((glyphValues[i, j]) ? "1 " : "0 ");
                    }

                    log.AddMessage(sb.ToString( ));
                }

                counter++;
            }
        }
Пример #54
0
        private void OnDraw(EventArgs args)
        {
            if (getCheckBoxItem("disableDraws"))
            {
                return;
            }

            if (getCheckBoxItem("showWards"))
            {
                var circleSize = 30;
                foreach (var obj in OKTWward.HiddenObjList.Where(obj => Render.OnScreen(Drawing.WorldToScreen(obj.pos))))
                {
                    if (obj.type == 1)
                    {
                        OktwCommon.DrawTriangleOKTW(circleSize, obj.pos, System.Drawing.Color.Yellow);
                        DrawFontTextMap(Tahoma13, "" + (int)(obj.endTime - Game.Time), obj.pos, SharpDX.Color.Yellow);
                    }

                    if (obj.type == 2)
                    {
                        OktwCommon.DrawTriangleOKTW(circleSize, obj.pos, System.Drawing.Color.HotPink);
                        DrawFontTextMap(Tahoma13, "VW", obj.pos, SharpDX.Color.HotPink);
                    }
                    if (obj.type == 3)
                    {
                        OktwCommon.DrawTriangleOKTW(circleSize, obj.pos, System.Drawing.Color.Orange);
                        DrawFontTextMap(Tahoma13, "! " + (int)(obj.endTime - Game.Time), obj.pos, SharpDX.Color.Orange);
                    }
                }
            }


            bool blink = true;

            if ((int)(Game.Time * 10) % 2 == 0)
            {
                blink = false;
            }

            var   HpBar        = getCheckBoxItem("HpBar");
            var   championInfo = getCheckBoxItem("championInfo");
            var   GankAlert    = getCheckBoxItem("GankAlert");
            var   ShowKDA      = getCheckBoxItem("ShowKDA");
            var   ShowRecall   = getCheckBoxItem("ShowRecall");
            var   ShowClicks   = getCheckBoxItem("ShowClicks");
            float posY         = ((float)getSliderItem("posY") * 0.01f) * Drawing.Height;
            float posX         = ((float)getSliderItem("posX") * 0.01f) * Drawing.Width;
            float positionDraw = 0;
            float positionGang = 500;
            int   Width        = 103;
            int   Height       = 8;
            int   XOffset      = 10;
            int   YOffset      = 20;
            var   FillColor    = System.Drawing.Color.GreenYellow;
            var   Color        = System.Drawing.Color.Azure;
            float offset       = 0;

            foreach (var enemy in Program.Enemies)
            {
                if (getCheckBoxItem("SS"))
                {
                    offset += 0.15f;
                    if (!enemy.IsVisible && !enemy.IsDead)
                    {
                        var ChampionInfoOne = OKTWtracker.ChampionInfoList.Find(x => x.NetworkId == enemy.NetworkId);
                        if (ChampionInfoOne != null && enemy != Program.jungler)
                        {
                            if ((int)(Game.Time * 10) % 2 == 0 && Game.Time - ChampionInfoOne.LastVisableTime > 3 && Game.Time - ChampionInfoOne.LastVisableTime < 7)
                            {
                                DrawFontTextScreen(TextBold, "SS " + enemy.ChampionName + " " + (int)(Game.Time - ChampionInfoOne.LastVisableTime), Drawing.Width * offset, Drawing.Height * 0.02f, SharpDX.Color.OrangeRed);
                            }
                            if (Game.Time - ChampionInfoOne.LastVisableTime >= 7)
                            {
                                DrawFontTextScreen(TextBold, "SS " + enemy.ChampionName + " " + (int)(Game.Time - ChampionInfoOne.LastVisableTime), Drawing.Width * offset, Drawing.Height * 0.02f, SharpDX.Color.OrangeRed);
                            }
                        }
                    }
                }

                if (enemy.IsValidTarget() && ShowClicks)
                {
                    var lastWaypoint = enemy.GetWaypoints().Last().To3D();
                    if (lastWaypoint.IsValid())
                    {
                        drawLine(enemy.Position, lastWaypoint, 1, System.Drawing.Color.Red);

                        if (enemy.GetWaypoints().Count() > 1)
                        {
                            DrawFontTextMap(Tahoma13, enemy.ChampionName, lastWaypoint, SharpDX.Color.WhiteSmoke);
                        }
                    }
                }

                if (HpBar && enemy.IsHPBarRendered && Render.OnScreen(Drawing.WorldToScreen(enemy.Position)))
                {
                    var barPos = enemy.HPBarPosition;

                    float QdmgDraw = 0, WdmgDraw = 0, EdmgDraw = 0, RdmgDraw = 0, damage = 0;;

                    if (Q.IsReady())
                    {
                        damage = damage + Q.GetDamage(enemy);
                    }

                    if (W.IsReady() && Player.ChampionName != "Kalista")
                    {
                        damage = damage + W.GetDamage(enemy);
                    }

                    if (E.IsReady())
                    {
                        damage = damage + E.GetDamage(enemy);
                    }

                    if (R.IsReady())
                    {
                        damage = damage + R.GetDamage(enemy);
                    }

                    if (Q.IsReady())
                    {
                        QdmgDraw = (Q.GetDamage(enemy) / damage);
                    }

                    if (W.IsReady() && Player.ChampionName != "Kalista")
                    {
                        WdmgDraw = (W.GetDamage(enemy) / damage);
                    }

                    if (E.IsReady())
                    {
                        EdmgDraw = (E.GetDamage(enemy) / damage);
                    }

                    if (R.IsReady())
                    {
                        RdmgDraw = (R.GetDamage(enemy) / damage);
                    }

                    var percentHealthAfterDamage = Math.Max(0, enemy.Health - damage) / enemy.MaxHealth;

                    var yPos                     = barPos.Y + YOffset;
                    var xPosDamage               = barPos.X + XOffset + Width * percentHealthAfterDamage;
                    var xPosCurrentHp            = barPos.X + XOffset + Width * enemy.Health / enemy.MaxHealth;

                    float differenceInHP = xPosCurrentHp - xPosDamage;
                    var   pos1           = barPos.X + XOffset + (107 * percentHealthAfterDamage);

                    for (int i = 0; i < differenceInHP; i++)
                    {
                        if (Q.IsReady() && i < QdmgDraw * differenceInHP)
                        {
                            Drawing.DrawLine(pos1 + i, yPos, pos1 + i, yPos + Height, 1, System.Drawing.Color.Cyan);
                        }
                        else if (W.IsReady() && i < (QdmgDraw + WdmgDraw) * differenceInHP)
                        {
                            Drawing.DrawLine(pos1 + i, yPos, pos1 + i, yPos + Height, 1, System.Drawing.Color.Orange);
                        }
                        else if (E.IsReady() && i < (QdmgDraw + WdmgDraw + EdmgDraw) * differenceInHP)
                        {
                            Drawing.DrawLine(pos1 + i, yPos, pos1 + i, yPos + Height, 1, System.Drawing.Color.Yellow);
                        }
                        else if (R.IsReady() && i < (QdmgDraw + WdmgDraw + EdmgDraw + RdmgDraw) * differenceInHP)
                        {
                            Drawing.DrawLine(pos1 + i, yPos, pos1 + i, yPos + Height, 1, System.Drawing.Color.YellowGreen);
                        }
                    }
                }

                var kolor = System.Drawing.Color.GreenYellow;

                if (enemy.IsDead)
                {
                    kolor = System.Drawing.Color.Gray;
                }
                else if (!enemy.IsVisible)
                {
                    kolor = System.Drawing.Color.OrangeRed;
                }

                var kolorHP = System.Drawing.Color.GreenYellow;

                if (enemy.IsDead)
                {
                    kolorHP = System.Drawing.Color.GreenYellow;
                }
                else if ((int)enemy.HealthPercent < 30)
                {
                    kolorHP = System.Drawing.Color.Red;
                }
                else if ((int)enemy.HealthPercent < 60)
                {
                    kolorHP = System.Drawing.Color.Orange;
                }

                if (championInfo)
                {
                    positionDraw += 15;
                    DrawFontTextScreen(Tahoma13, "" + enemy.Level, posX - 25, posY + positionDraw, SharpDX.Color.White);
                    DrawFontTextScreen(Tahoma13, enemy.ChampionName, posX, posY + positionDraw, SharpDX.Color.White);

                    if (true)
                    {
                        var ChampionInfoOne = Core.OKTWtracker.ChampionInfoList.Find(x => x.NetworkId == enemy.NetworkId);
                        if (Game.Time - ChampionInfoOne.FinishRecallTime < 4)
                        {
                            DrawFontTextScreen(Tahoma13, "FINISH", posX - 90, posY + positionDraw, SharpDX.Color.GreenYellow);
                        }
                        else if (ChampionInfoOne.StartRecallTime <= ChampionInfoOne.AbortRecallTime && Game.Time - ChampionInfoOne.AbortRecallTime < 4)
                        {
                            DrawFontTextScreen(Tahoma13, "ABORT", posX - 90, posY + positionDraw, SharpDX.Color.Yellow);
                        }
                        else if (Game.Time - ChampionInfoOne.StartRecallTime < 8)
                        {
                            int   recallPercent = (int)(((Game.Time - ChampionInfoOne.StartRecallTime) / 8) * 100);
                            float recallX1      = posX - 90;
                            float recallY1      = posY + positionDraw + 3;
                            float recallX2      = (recallX1 + ((int)recallPercent / 2)) + 1;
                            float recallY2      = posY + positionDraw + 3;
                            Drawing.DrawLine(recallX1, recallY1, recallX1 + 50, recallY2, 8, System.Drawing.Color.Red);
                            Drawing.DrawLine(recallX1, recallY1, recallX2, recallY2, 8, System.Drawing.Color.White);
                        }
                    }

                    if (ShowKDA)
                    {
                        var fSlot = enemy.Spellbook.Spells[4];

                        if (fSlot.Name != "SummonerFlash")
                        {
                            fSlot = enemy.Spellbook.Spells[5];
                        }

                        if (fSlot.Name == "SummonerFlash")
                        {
                            var fT = fSlot.CooldownExpires - Game.Time;
                            if (fT < 0)
                            {
                                DrawFontTextScreen(Tahoma13, "F rdy", posX + 110, posY + positionDraw, SharpDX.Color.GreenYellow);
                            }
                            else
                            {
                                DrawFontTextScreen(Tahoma13, "F " + (int)fT, posX + 110, posY + positionDraw, SharpDX.Color.Yellow);
                            }
                        }

                        if (enemy.Level > 5)
                        {
                            var rSlot = enemy.Spellbook.Spells[3];
                            var t     = rSlot.CooldownExpires - Game.Time;

                            if (t < 0)
                            {
                                DrawFontTextScreen(Tahoma13, "R rdy", posX + 145, posY + positionDraw, SharpDX.Color.GreenYellow);
                            }
                            else
                            {
                                DrawFontTextScreen(Tahoma13, "R " + (int)t, posX + 145, posY + positionDraw, SharpDX.Color.Yellow);
                            }
                        }
                        else
                        {
                            DrawFontTextScreen(Tahoma13, "R ", posX + 145, posY + positionDraw, SharpDX.Color.Yellow);
                        }
                    }

                    //Drawing.DrawText(posX - 70, posY + positionDraw, kolor, enemy.Level + " lvl");
                }

                var Distance = Player.Distance(enemy.Position);
                if (GankAlert && !enemy.IsDead && Distance > 1200)
                {
                    var wts = Drawing.WorldToScreen(ObjectManager.Player.Position.Extend(enemy.Position, positionGang).To3D());

                    wts[0] = wts[0];
                    wts[1] = wts[1] + 15;

                    if ((int)enemy.HealthPercent > 0)
                    {
                        Drawing.DrawLine(wts[0], wts[1], (wts[0] + ((int)enemy.HealthPercent) / 2) + 1, wts[1], 8, kolorHP);
                    }

                    if ((int)enemy.HealthPercent < 100)
                    {
                        Drawing.DrawLine((wts[0] + ((int)enemy.HealthPercent) / 2), wts[1], wts[0] + 50, wts[1], 8, System.Drawing.Color.White);
                    }

                    if (Distance > 3500 && enemy.IsVisible)
                    {
                        DrawFontTextMap(Tahoma13, enemy.ChampionName, Player.Position.Extend(enemy.Position, positionGang).To3D(), SharpDX.Color.White);
                    }
                    else if (!enemy.IsVisible)
                    {
                        var ChampionInfoOne = Core.OKTWtracker.ChampionInfoList.Find(x => x.NetworkId == enemy.NetworkId);
                        if (ChampionInfoOne != null)
                        {
                            if (Game.Time - ChampionInfoOne.LastVisableTime > 3 && Game.Time - ChampionInfoOne.LastVisableTime < 7)
                            {
                                if (blink)
                                {
                                    DrawFontTextMap(Tahoma13, "SS " + enemy.ChampionName + " " + (int)(Game.Time - ChampionInfoOne.LastVisableTime), Player.Position.Extend(enemy.Position, positionGang).To3D(), SharpDX.Color.Yellow);
                                }
                            }
                            else
                            {
                                DrawFontTextMap(Tahoma13, "SS " + enemy.ChampionName + " " + (int)(Game.Time - ChampionInfoOne.LastVisableTime), Player.Position.Extend(enemy.Position, positionGang).To3D(), SharpDX.Color.Yellow);
                            }
                        }
                        else
                        {
                            DrawFontTextMap(Tahoma13, "SS " + enemy.ChampionName, Player.Position.Extend(enemy.Position, positionGang).To3D(), SharpDX.Color.Yellow);
                        }
                    }
                    else if (blink)
                    {
                        DrawFontTextMap(Tahoma13B, enemy.ChampionName, Player.Position.Extend(enemy.Position, positionGang).To3D(), SharpDX.Color.OrangeRed);
                    }

                    if (Distance < 3500 && enemy.IsVisible && !Render.OnScreen(Drawing.WorldToScreen(Player.Position.Extend(enemy.Position, Distance + 500).To3D())))
                    {
                        drawLine(Player.Position.Extend(enemy.Position, 100).To3D(), Player.Position.Extend(enemy.Position, positionGang - 100).To3D(), (int)((3500 - Distance) / 300), System.Drawing.Color.OrangeRed);
                    }
                    else if (Distance < 3500 && !enemy.IsVisible && !Render.OnScreen(Drawing.WorldToScreen(Player.Position.Extend(enemy.Position, Distance + 500).To3D())))
                    {
                        var need = Core.OKTWtracker.ChampionInfoList.Find(x => x.NetworkId == enemy.NetworkId);
                        if (need != null && Game.Time - need.LastVisableTime < 5)
                        {
                            drawLine(Player.Position.Extend(enemy.Position, 100).To3D(), Player.Position.Extend(enemy.Position, positionGang - 100).To3D(), (int)((3500 - Distance) / 300), System.Drawing.Color.Gray);
                        }
                    }
                }
                positionGang = positionGang + 100;
            }

            if (Program.AIOmode == 2)
            {
                Drawing.DrawText(Drawing.Width * 0.2f, Drawing.Height * 1f, System.Drawing.Color.Cyan, "OKTW AIO only utility mode ON");
            }
        }
Пример #55
0
        public static bool IsOnScreen(this Vector3 position)
        {
            var pos = Drawing.WorldToScreen(position);

            return(pos.X > 0 && pos.X <= Drawing.Width && pos.Y > 0 && pos.Y <= Drawing.Height);
        }
Пример #56
0
 protected override void Draw(AlphaBlendContext alphaBlendContext, int depth, int childIndex)
 {
     Drawing?.Invoke();
 }
Пример #57
0
 public static Vector2 toScreen(this Vector3 pos)
 {
     return(Drawing.WorldToScreen(pos));
 }
Пример #58
0
        public static void Main(string[] args)
        {
            Loading.OnLoadingComplete += delegate
            {
                if (Player.Instance.Hero != Champion.Blitzcrank)
                {
                    return;
                }

                #region Menu Stuff

                var menu = MainMenu.AddMenu("Blitzcrank", "blitziii");

                menu.AddGroupLabel("İsabet Oranı");
                var hitchances = new List <HitChance>();
                for (var i = (int)HitChance.Medium; i <= (int)HitChance.Immobile; i++)
                {
                    hitchances.Add((HitChance)i);
                }
                var slider = new Slider(hitchances[0].ToString(), 0, 0, hitchances.Count - 1);
                slider.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs changeArgs) { slider.DisplayName = hitchances[changeArgs.NewValue].ToString(); };
                menu.Add("hitchance", slider);

                if (EntityManager.Heroes.Enemies.Count > 0)
                {
                    menu.AddSeparator();
                    menu.AddGroupLabel("Aktif Hedefler");
                    var addedChamps = new List <string>();
                    foreach (var enemy in EntityManager.Heroes.Enemies.Where(enemy => !addedChamps.Contains(enemy.ChampionName)))
                    {
                        addedChamps.Add(enemy.ChampionName);
                        menu.Add(enemy.ChampionName, new CheckBox(string.Format("{0} ({1})", enemy.ChampionName, enemy.Name)));
                    }
                }

                menu.AddSeparator();
                menu.AddGroupLabel("Göstergeler");
                var qRange      = menu.Add("rangeQ", new CheckBox("Q Menzili"));
                var predictions = menu.Add("predictions", new CheckBox("Görsel İsabetGörünümü"));

                #endregion

                var Q = new Spell.Skillshot(SpellSlot.Q, 925, SkillShotType.Linear, 250, 1800, 70);
                var predictedPositions = new Dictionary <int, Tuple <int, PredictionResult> >();

                Game.OnTick += delegate
                {
                    if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && Q.IsReady())
                    {
                        foreach (
                            var enemy in
                            EntityManager.Heroes.Enemies.Where(
                                enemy => ((TargetSelector.SeletedEnabled && TargetSelector.SelectedTarget == enemy) || menu[enemy.ChampionName].Cast <CheckBox>().CurrentValue) &&
                                enemy.IsValidTarget(Q.Range + 150) &&
                                !enemy.HasBuffOfType(BuffType.SpellShield)))
                        {
                            var prediction = Q.GetPrediction(enemy);
                            if (prediction.HitChance >= hitchances[0])
                            {
                                predictedPositions[enemy.NetworkId] = new Tuple <int, PredictionResult>(Environment.TickCount, prediction);

                                // Cast if hitchance is high enough
                                if (prediction.HitChance >= hitchances[slider.CurrentValue])
                                {
                                    Q.Cast(prediction.CastPosition);
                                }
                            }
                        }
                    }
                };

                Drawing.OnDraw += delegate
                {
                    if (qRange.CurrentValue && Q.IsLearned)
                    {
                        Circle.Draw(Q.IsReady() ? Color.Blue : Color.Red, Q.Range, Player.Instance);
                    }

                    if (!predictions.CurrentValue)
                    {
                        return;
                    }

                    foreach (var prediction in predictedPositions.ToArray())
                    {
                        if (Environment.TickCount - prediction.Value.Item1 > 2000)
                        {
                            predictedPositions.Remove(prediction.Key);
                            continue;
                        }

                        Circle.Draw(Color.Red, 75, prediction.Value.Item2.CastPosition);
                        Line.DrawLine(System.Drawing.Color.GreenYellow, Player.Instance.Position, prediction.Value.Item2.CastPosition);
                        Line.DrawLine(System.Drawing.Color.CornflowerBlue, EntityManager.Heroes.Enemies.Find(o => o.NetworkId == prediction.Key).Position, prediction.Value.Item2.CastPosition);
                        Drawing.DrawText(prediction.Value.Item2.CastPosition.WorldToScreen() + new Vector2(0, -20), System.Drawing.Color.LimeGreen,
                                         string.Format("Hitchance: {0}%", Math.Ceiling(prediction.Value.Item2.HitChancePercent)), 10);
                    }
                };
            };
        }
Пример #59
0
    void OnGUI()
    {
        if (position.width != _oldPosition.width && Event.current.type == EventType.Layout)
        {
            Drawings     = null;
            _oldPosition = position;
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Toggle(_showingStyles, "Styles", EditorStyles.toolbarButton) != _showingStyles)
        {
            _showingStyles = !_showingStyles;
            _showingIcons  = !_showingStyles;
            Drawings       = null;
        }

        if (GUILayout.Toggle(_showingIcons, "Icons", EditorStyles.toolbarButton) != _showingIcons)
        {
            _showingIcons  = !_showingIcons;
            _showingStyles = !_showingIcons;
            Drawings       = null;
        }

        GUILayout.EndHorizontal();

        string newSearch = GUILayout.TextField(_search);

        if (newSearch != _search)
        {
            _search  = newSearch;
            Drawings = null;
        }

        float top = 36;

        if (Drawings == null)
        {
            string lowerSearch = _search.ToLower();

            Drawings = new List <Drawing>();

            GUIContent inactiveText = new GUIContent("inactive");
            GUIContent activeText   = new GUIContent("active");

            float x = 5.0f;
            float y = 5.0f;

            if (_showingStyles)
            {
                foreach (GUIStyle ss in GUI.skin.customStyles)
                {
                    if (lowerSearch != "" && !ss.name.ToLower().Contains(lowerSearch))
                    {
                        continue;
                    }

                    GUIStyle thisStyle = ss;

                    Drawing draw = new Drawing();

                    float width = Mathf.Max(
                        100.0f,
                        GUI.skin.button.CalcSize(new GUIContent(ss.name)).x,
                        ss.CalcSize(inactiveText).x + ss.CalcSize(activeText).x
                        ) + 16.0f;

                    float height = 60.0f;

                    if (x + width > position.width - 32 && x > 5.0f)
                    {
                        x  = 5.0f;
                        y += height + 10.0f;
                    }

                    draw.Rect = new Rect(x, y, width, height);

                    width -= 8.0f;

                    draw.Draw = () => {
                        if (GUILayout.Button(thisStyle.name, GUILayout.Width(width)))
                        {
                            CopyText("(GUIStyle)\"" + thisStyle.name + "\"");
                        }

                        GUILayout.BeginHorizontal();
                        GUILayout.Toggle(false, inactiveText, thisStyle, GUILayout.Width(width / 2));
                        GUILayout.Toggle(false, activeText, thisStyle, GUILayout.Width(width / 2));
                        GUILayout.EndHorizontal();
                    };

                    x += width + 18.0f;

                    Drawings.Add(draw);
                }
            }
            else if (_showingIcons)
            {
                if (_objects == null)
                {
                    _objects = new List <UnityEngine.Object>(Resources.FindObjectsOfTypeAll(typeof(Texture)));
                    _objects.Sort((pA, pB) => System.String.Compare(pA.name, pB.name, System.StringComparison.OrdinalIgnoreCase));
                }

                float rowHeight = 0.0f;

                foreach (UnityEngine.Object oo in _objects)
                {
                    Texture texture = (Texture)oo;

                    if (texture.name == "")
                    {
                        continue;
                    }

                    if (lowerSearch != "" && !texture.name.ToLower().Contains(lowerSearch))
                    {
                        continue;
                    }

                    Drawing draw = new Drawing();

                    float width = Mathf.Max(
                        GUI.skin.button.CalcSize(new GUIContent(texture.name)).x,
                        texture.width
                        ) + 8.0f;

                    float height = texture.height + GUI.skin.button.CalcSize(new GUIContent(texture.name)).y + 8.0f;

                    if (x + width > position.width - 32.0f)
                    {
                        x         = 5.0f;
                        y        += rowHeight + 8.0f;
                        rowHeight = 0.0f;
                    }

                    draw.Rect = new Rect(x, y, width, height);

                    rowHeight = Mathf.Max(rowHeight, height);

                    width -= 8.0f;

                    draw.Draw = () => {
                        if (GUILayout.Button(texture.name, GUILayout.Width(width)))
                        {
                            CopyText("EditorGUIUtility.FindTexture( \"" + texture.name + "\" )");
                        }

                        Rect textureRect = GUILayoutUtility.GetRect(texture.width, texture.width, texture.height, texture.height, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false));
                        EditorGUI.DrawTextureTransparent(textureRect, texture);
                    };

                    x += width + 8.0f;

                    Drawings.Add(draw);
                }
            }

            _maxY = y;
        }

        Rect r = position;

        r.y       = top;
        r.height -= r.y;
        r.x       = r.width - 16;
        r.width   = 16;

        float areaHeight = position.height - top;

        _scrollPos = GUI.VerticalScrollbar(r, _scrollPos, areaHeight, 0.0f, _maxY);

        Rect area = new Rect(0, top, position.width - 16.0f, areaHeight);

        GUILayout.BeginArea(area);

        int count = 0;

        foreach (Drawing draw in Drawings)
        {
            Rect newRect = draw.Rect;
            newRect.y -= _scrollPos;

            if (newRect.y + newRect.height > 0 && newRect.y < areaHeight)
            {
                GUILayout.BeginArea(newRect, GUI.skin.textField);
                draw.Draw();
                GUILayout.EndArea();

                count++;
            }
        }

        GUILayout.EndArea();
    }
Пример #60
0
        public static void drawText(string msg, Obj_AI_Hero Hero, System.Drawing.Color color)
        {
            var wts = Drawing.WorldToScreen(Hero.Position);

            Drawing.DrawText(wts[0] - (msg.Length) * 5, wts[1], color, msg);
        }