Esempio n. 1
0
        public override void OnDraw(GraphicContext gc)
        {
            gc.AddMargin(Margin);

            if (IsVisible)
            {
                if (StartPosition == WindowStartPosition.CenterScreen)
                {
                    Location = new Point(gc.Size.Width / 2 - Size.Width / 2, gc.Size.Height / 2 - Size.Height / 2);
                }

                if (IsTitleBarVisible)
                {
                    // draw titlebar
                    gc.FillRectangle(new Rectangle(Location, new Size(Size.Width, 30)), TitleBarColor);
                }
                else
                {
                    // remove title bar offset
                    Location -= new Point(0, 30);
                }

                // draw content area
                gc.FillRectangle(new Rectangle(Location + new Point(0, 30), Size), Background);
                //draw children on new GraphicContext for ContentArea
                foreach (var w in Children)
                {
                    var cgc = new GraphicContext();
                    cgc.SetParent(gc);
                    cgc.OffSet = Location;

                    w.OnDraw(cgc);
                }
            }
        }
        public virtual void Draw(GraphicContext context, Pen pen)
        {
            if (Points == default)
            {
                return;
            }
            if (Points.Count <= 1)
            {
                return;
            }
            for (var i = 1; i < Points.Count; i++)
            {
                if (Removed.Contains(Points[i - 1]))
                {
                    continue;
                }
                if (Removed.Contains(Points[i]))
                {
                    continue;
                }
                context.Graphics.DrawLine(pen, Points[i - 1], Points[i]);
            }

            if (ClosePolygon)
            {
                if (Removed.Contains(Points[0]))
                {
                    return;
                }
                if (Removed.Contains(Points[^ 1]))
Esempio n. 3
0
        private static void ScanConvertLine(GraphicContext gc, List <MinMaxPair> scanBuffer, Point minYVert, Point maxYVert, int whichSide)
        {
            int yStart = (int)minYVert.Y;
            int yEnd   = (int)maxYVert.Y;
            int xStart = (int)minYVert.X;
            int xEnd   = (int)maxYVert.X;

            int yDist = yEnd - yStart;
            int xDist = xEnd - xStart;

            if (yDist <= 0)
            {
                return;
            }

            float xStep = (float)xDist / (float)yDist;
            float curX  = (float)xStart;

            for (int j = yStart; j < yEnd; j++)
            {
                if (j >= 0 && j < gc.Size.Height)
                {
                    if (whichSide == 0)
                    {
                        scanBuffer[j].Min = (int)curX;
                    }
                    else
                    {
                        scanBuffer[j].Max = (int)curX;
                    }
                }

                curX += xStep;
            }
        }
Esempio n. 4
0
        public void Draw(GraphicContext gpCtx)
        {
            Debug.Assert(gpCtx != null);
            if (null == gpCtx) return;

               m_SelectedNode.Draw(gpCtx);
        }
Esempio n. 5
0
        public Main()
        {
            InitializeComponent();
            CreatePlayground();

            Load += (s, e) =>
            {
                _context = new GraphicContext();
                _context.Reset(_bitmap);
                _projectors.AddRange(AssemblyExtensions.FindAllImplementationsAndActivate <IProjectorEngine>());

                _projectors.InitializeAll(_context);

                _extensions.AddRange(AssemblyExtensions.FindAllImplementationsAndActivate <IGraphicExtension>());

                _projectors.Use <PerspectiveProjectorEngine>();
                BindExtensionControls();
                InitModelAndFrameTick();
            };

            playground.MouseWheel += CG_MouseWheel;
            playground.KeyPress   += Main_KeyPress;
            playground.Paint      += (s, e) => e.Graphics.DrawImage(_bitmap, 0, 0);
            _testOutputBuilder     = new StringBuilder();
            _testOutputWriter      = new StringWriter(_testOutputBuilder);
        }
        public GraphicDeviceProxy(GraphicContext GpCtx)
        {
            m_GraphicContext = GpCtx;
            m_Device = GpCtx.GetGraphicDevice();

            m_WorldToDevice = GpCtx.WorldToDevice;
        }
Esempio n. 7
0
        public override void OnPaint(IScriptEngine se, GraphicContext g)
        {
            g.SetColor(new Color(0.3f, 0.3f, 0.3f, 1.0f));
            g.FillRect(15, 100, 265, 210);
            g.SetColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
            g.DrawString("http://ennui.ninja - Simple AIO Gatherer", 20, 100);
            g.DrawString(string.Format("Runtime: {0}", Time.FormatElapsed(timer.ElapsedMs)), 20, 115);
            g.DrawString(string.Format("State: {0}", context.State), 20, 130);
            g.DrawString(string.Format("Max hold weight: {0}", config.MaxHoldWeight), 20, 145);
            g.DrawString(string.Format("Bank cluster: {0}", config.VaultClusterName), 20, 160);
            g.DrawString(string.Format("Repair cluster: {0}", config.RepairClusterName), 20, 175);
            g.DrawString(string.Format("Resource cluster: {0}", config.ResourceClusterName), 20, 190);

            if (config.ResourceClusterName == Game.ClusterName)
            {
                foreach (var p in config.RoamPoints)
                {
                    p.RealVector3().Expand(3, 3, 3).Render(Api, Color.Red, Color.Red.MoreTransparent());
                }
            }

            if (config.VaultArea != null && config.VaultClusterName == Game.ClusterName)
            {
                config.VaultArea.RealArea(Api).Render(Api, Color.Cyan, Color.Cyan.MoreTransparent());
            }

            if (config.RepairArea != null && config.RepairClusterName == Game.ClusterName)
            {
                config.RepairArea.RealArea(Api).Render(Api, Color.Purple, Color.Purple.MoreTransparent());
            }
        }
Esempio n. 8
0
 private static void ScanConvertTriangle(GraphicContext gc, List <MinMaxPair> scanBuffer, Point minYVert, Point midYVert,
                                         Point maxYVert, int handedness)
 {
     ScanConvertLine(gc, scanBuffer, minYVert, maxYVert, 0 + handedness);
     ScanConvertLine(gc, scanBuffer, minYVert, midYVert, 1 - handedness);
     ScanConvertLine(gc, scanBuffer, midYVert, maxYVert, 1 - handedness);
 }
Esempio n. 9
0
        //ToDo: fix drawline algorythm
        public static void DrawLine(this GraphicContext gc, Point p1, Point p2, Color color)
        {
            uint dx, dy, p, x = 0, y = 0, x0, y0, x1, y1;

            x0 = p1.X;
            y0 = p1.Y;
            x1 = p2.X;
            y1 = p2.Y;

            dx = x1 - x0;
            dy = y1 - y0;
            p  = 2 * dy - dx;

            while (x < x1)
            {
                if (p >= 0)
                {
                    gc.SetPixel(color, new Point(x, y));
                    y = y + 1;
                    p = p + 2 * dy - 2 * dx;
                }
                else
                {
                    gc.SetPixel(color, new Point(x, y));
                    p = p + 2 * dy;
                }
                x = x + 1;
            }
        }
Esempio n. 10
0
        public static void DrawCircle(this GraphicContext gc, Point loc, uint radius, Color color)
        {
            uint x   = radius;
            uint y   = 0;
            uint err = 0;

            while (x >= y)
            {
                gc.SetPixel(color, new Point(loc.X + x, loc.Y + y));
                gc.SetPixel(color, new Point(loc.X + y, loc.Y + x));

                gc.SetPixel(color, new Point(loc.X - y, loc.Y + x));
                gc.SetPixel(color, new Point(loc.X - x, loc.Y + y));

                gc.SetPixel(color, new Point(loc.X - x, loc.Y - y));
                gc.SetPixel(color, new Point(loc.X - y, loc.Y - x));

                gc.SetPixel(color, new Point(loc.X + y, loc.Y - x));
                gc.SetPixel(color, new Point(loc.X + x, loc.Y - y));

                if (err <= 0)
                {
                    y   = y + 1;
                    err = err + 2 * x + 1;
                }
                if (err > 0)
                {
                    x   = x - 1;
                    err = err - 2 * x + 1;
                }
            }
        }
Esempio n. 11
0
        public static void DrawRectangle(this GraphicContext gc, int x, int y, int w, int h, Color c)
        {
            DrawLine(gc, new Point(x, y), new Point(x + w, y), c);
            DrawLine(gc, new Point(x, y + h), new Point(x + w, y + h), c);

            DrawLine(gc, new Point(x, y), new Point(x, y + h), c);
            DrawLine(gc, new Point(x + w, y), new Point(x + w, y + h), c);
        }
Esempio n. 12
0
        /// <summary>
        /// ToDo: convert to real DrawGlyph Method
        /// </summary>
        /// <param name="gr"></param>
        public static void DrawGlyph(this GraphicContext gr, FontGlyph g, Point loc, Color color)
        {
            //var scale = 22f / font.UnitsPerEm;

            foreach (var gTriangle in g.Triangles)
            {
                gr.FillTriangle(loc, gTriangle.A, gTriangle.B, gTriangle.C, color);
            }
        }
Esempio n. 13
0
        /// <inheritdoc/>
        public override void OnPaint(IScriptEngine se, GraphicContext g)
        {
            var tmp = current;

            if (tmp != null)
            {
                tmp.OnPaint(scriptEngine, g);
            }
        }
Esempio n. 14
0
        public void Draw(GraphicContext gpCtx, Matrix44 parentTrans)
        {
            ApplyAttributes(gpCtx.GetGraphicDevice());

            if (gpCtx != null)
                OnDraw(gpCtx, parentTrans);

            UnApplyAttributes(gpCtx.GetGraphicDevice());
        }
Esempio n. 15
0
 public override void Render(GraphicContext context, Widget widget)
 {
     if (widget.IsVisible)
     {
         //Draw Background if Widget is visible
         var rec = new Rectangle(widget.Location, widget.Size);
         context.FillRectangle(rec, widget.Background);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Draw An Image on the Screen
 /// </summary>
 /// <param name="gc">The GraphicContext to draw</param>
 /// <param name="location">The Location to start Drawing</param>
 /// <param name="img">The Image to draw</param>
 public static void DrawImage(this GraphicContext gc, Point location, Image img)
 {
     for (uint x1 = 0; x1 < img.Width; x1++)
     {
         for (uint y1 = 0; y1 < img.Height; y1++)
         {
             gc.SetPixel(img.GetPixel(x1, y1), new Point(location.X + x1, location.Y + y1));
         }
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Draws an filled Rectangle on the Display
 /// </summary>
 /// <param name="rec">The Location and Bounds of the Rectangle</param>
 /// <param name="color">The color of the Rectangle</param>
 public static void FillRectangle(this GraphicContext gc, Rectangle rec, Color color)
 {
     for (int x = 0; x < rec.Size.Width; x++)
     {
         for (int y = 0; y < rec.Size.Height; y++)
         {
             gc.SetPixel(color, rec.Location + new Point(x, y));
         }
     }
 }
Esempio n. 18
0
        public static void DrawString(this GraphicContext gc, string src, Font font, Point loc, Color color)
        {
            Point basePos = loc;

            foreach (var c in src)
            {
                gc.DrawGlyph(font.Glyphs[25], basePos, color);
                basePos += new Point(font.Glyphs[0].XMax, 0);
            }
        }
Esempio n. 19
0
        protected override void OnDraw(GraphicContext gpCtx, Matrix44 parentTrans)
        {
            if (gpCtx != null)
            {
                GePoint worldCenterPoint = MathUtil.GetTransformedPoint(m_CenterPoint, parentTrans);

                GraphicDeviceProxy Device =
                    gpCtx.CreateGraphicDeviceProxy();
                Device.DrawCircle(worldCenterPoint, Convert.ToSingle(m_dRadius));
            }
        }
Esempio n. 20
0
        protected override void OnDraw(GraphicContext gpCtx, Matrix44 parentTrans)
        {
            if (gpCtx != null)
            {
                GePoint worldPosition = MathUtil.GetTransformedPoint(m_Position, parentTrans);

                GraphicDeviceProxy Device =
                    gpCtx.CreateGraphicDeviceProxy();
                Device.DrawText(m_String, worldPosition, m_Font);
            }
        }
Esempio n. 21
0
        public override void Render(GraphicContext context, Widget widget)
        {
            var w = widget as Progressbar;

            if (w != null)
            {
                if (CheckValue(w))
                {
                    const uint tileWidth       = 20;
                    uint       tileCount       = (w.Size.Width / tileWidth) / 2;
                    Point      lastPos         = w.Location;
                    uint       actualTileCount = 0;

                    double progvalue = 100.0 / w.Maximum * w.Value;

                    //ToDo: fix actualTileCount, based on tilecount
                    if (w.Value > 0 && w.Value < 10)
                    {
                        actualTileCount = 1;
                    }
                    if (w.Value > 10 && w.Value < 25)
                    {
                        actualTileCount = 2;
                    }
                    if (w.Value > 25 && w.Value < 50)
                    {
                        actualTileCount = 3;
                    }
                    if (w.Value > 50 && w.Value < 75)
                    {
                        actualTileCount = 4;
                    }
                    if (w.Value > 75 && w.Value <= 100)
                    {
                        actualTileCount = tileCount;
                    }

                    for (int i = 0; i < actualTileCount; i++)
                    {
                        var tileRec = new Rectangle(lastPos, new Size(tileWidth, w.Size.Height));

                        context.FillRectangle(tileRec, w.IndicatorColor);

                        lastPos = new Point(lastPos.X + tileWidth * 2, w.Location.Y);
                    }

                    if (w.Value == 100)
                    {
                        w.OnFinish?.Invoke(w);
                    }
                }
            }
        }
Esempio n. 22
0
        public override void Render(GraphicContext context, Widget widget)
        {
            var pb = widget as PictureBox;

            if (pb != null)
            {
                if (pb.Image != null)
                {
                    context.DrawImage(pb.Location, pb.Image);
                }
            }
        }
Esempio n. 23
0
        public override void OnDraw(GraphicContext gc)
        {
            base.OnDraw(gc);

            var g = new GraphicContext();

            g.OffSet = Location;
            g.SetParent(gc);

            foreach (var w in Children)
            {
                w.OnDraw(g);
            }
        }
Esempio n. 24
0
        public virtual void OnDraw(GraphicContext gc)
        {
            gc.AddMargin(Margin);
            CheckSize();

            if (Renderer == null)
            {
                Renderer = new DefaultWidgetRenderer();
            }

            BeforeRender?.Invoke(Renderer);

            Renderer.Render(gc, this);
        }
Esempio n. 25
0
        public static void DrawPolygon(this GraphicContext gc, Point[] points, Color c)
        {
            for (int i = 0; i < points.Length - 1; i++)
            {
                var a = points[i];
                var b = points[i + 1];

                DrawLine(gc, new Point(a.X, a.Y), new Point(b.X, b.Y), c);
            }

            var f = points[0];
            var t = points[points.Length - 1];

            DrawLine(gc, new Point(f.X, f.Y), new Point(t.X, t.Y), c);
        }
Esempio n. 26
0
        public static void FillTriangle(this GraphicContext gc, Point loc, Point v0, Point v1, Point v2, Color c)
        {
            var scanBuffer = new List <MinMaxPair>();

            for (int i = 0; i < gc.Size.Height; i++)
            {
                scanBuffer.Add(new MinMaxPair(0, 0));
            }

            Point minYVert = v0;
            Point midYVert = v1;
            Point maxYVert = v2;

            if (maxYVert.Y < midYVert.Y)
            {
                Point temp = maxYVert;
                maxYVert = midYVert;
                midYVert = temp;
            }

            if (midYVert.Y < minYVert.Y)
            {
                Point temp = midYVert;
                midYVert = minYVert;
                minYVert = temp;
            }

            if (maxYVert.Y < midYVert.Y)
            {
                Point temp = maxYVert;
                maxYVert = midYVert;
                midYVert = temp;
            }

            float area       = minYVert.TriangleArea(maxYVert, midYVert);
            int   handedness = area >= 0 ? 1 : 0;

            ScanConvertTriangle(gc, scanBuffer, minYVert, midYVert, maxYVert, handedness);

            for (var j = 0; j < scanBuffer.Count; j++)
            {
                var minMaxPair = scanBuffer[j];
                for (int i = minMaxPair.Min; i < minMaxPair.Max; i++)
                {
                    gc.SetPixel(c, new Point((uint)(loc.X + i), (uint)(loc.Y + j)));
                }
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Change Screen and Draw the new Screen. Calls OnScreenChanged Signal
        /// </summary>
        /// <param name="id">The new Screen to Draw</param>
        public static void ChangeScreen(ScreenIds id)
        {
            var screen = GetScreen(id);

            OnScreenChanged?.Invoke(CurrentScreen);

            CurrentScreen = screen;

            if (screen != null)
            {
                screen.Init();
                Clear(0x00555555);

                var gc = GraphicContext.FromBuffer(VBEDisplay.Framebuffer);

                screen.Draw(gc);
            }
        }
Esempio n. 28
0
        public override void Draw(GraphicContext gc)
        {
            ScreenManager.Clear(Colors.CornflowerBlue);

            var raw  = Britanic.GetFont();
            var font = new Graphics.Fonts.Formats.CFLFontFormat();

            gc.DrawGlyph(font.GetFont(raw), new Point(5, 5), Colors.Black);

            gc.DrawLine(new Point(10, 10), new Point(150, 10), Colors.Black);

            /* var w = new Window();
             * w.Size = new Size(250, 250);
             * w.Background = Colors.Blue;
             * w.TitleBarColor = Colors.Yellow;
             * w.StartPosition = WindowStartPosition.CenterScreen;
             *
             * w.SetGraphics(gc);
             *
             * w.Show();*/
        }
Esempio n. 29
0
        public override void Draw(GraphicContext gc)
        {
            var m = Image.FromBytes(TestImage.GetImage());

            m = m.ResizeImage(gc.Size);

            gc.DrawImage(new Point(0, 0), m);

            var y = BootLogo.Draw(gc.GetBuffer(), 10);

            var p = new Progressbar
            {
                Size     = new Size(280, 25),
                Location = new Point(195, y + 100),

                Maximum = 100
            };

            p.OnLoad();

            p.OnFinish += (e) =>
            {
                ScreenManager.ChangeScreen(ScreenIds.Login);
            };

            p.Value = 20;
            p.OnDraw(gc);

            Utils.Pause(20);

            p.Value = 99;
            p.OnDraw(gc);

            Utils.Pause(20);
            p.Value = 100;
            p.OnDraw(gc);
        }
 public void InitializeAll(GraphicContext context)
 {
     ForEach(x => x.Use(context));
 }
 public SelectionGraphicDeviceProxy(GraphicContext GpCtx)
     : base(GpCtx)
 {
 }
 public DrawGraphicDeviceProxy(GraphicContext GpCtx)
     : base(GpCtx)
 {
 }
Esempio n. 33
0
        public override void OnPaint(IScriptEngine se, GraphicContext g)
        {
            if (Players.LocalPlayer == null)
            {
                return;
            }


            if (_configuration.ESPActivatedPlayers)
            {
                var otherPlayers = Players.RemotePlayers;
                foreach (var otherPlayer in otherPlayers)
                {
                    if (otherPlayer?.ScreenLocation != null)
                    {
                        if (otherPlayer.IsPvpEnabled)
                        {
                            g.SetColor(Color.Orange);
                        }
                        else
                        {
                            g.SetColor(Color.Green);
                        }


                        g.DrawLine(Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X),
                                   Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y),
                                   Convert.ToInt32(otherPlayer.ScreenLocation.X),
                                   Convert.ToInt32(otherPlayer.ScreenLocation.Y));
                    }
                }
            }

            if (_configuration.ESPActivatedResources)
            {
                var harvestables      = Objects.AllHarvestables.FindAll(x => !x.Depleted && x.ScreenLocation != null);
                var harvestablesValid = new List <ObjectHarvestable>();
                foreach (var harvestable in harvestables)
                {
                    if (harvestable != null)
                    {
                        if ((_configuration.ResFiber && harvestable.Type == Ennui.Api.Meta.ResourceType.Fiber) ||
                            (_configuration.ResOre && harvestable.Type == Ennui.Api.Meta.ResourceType.Ore) ||
                            (_configuration.ResStone && harvestable.Type == Ennui.Api.Meta.ResourceType.Rock) ||
                            (_configuration.ResTree && harvestable.Type == Ennui.Api.Meta.ResourceType.Wood) ||
                            (_configuration.ResLeather && harvestable.Type == Ennui.Api.Meta.ResourceType.Hide))
                        {
                            if ((harvestable.Tier == 2 && _configuration.ResT2) ||
                                (harvestable.Tier == 3 && _configuration.ResT3) ||
                                (harvestable.Tier == 4 && harvestable.RareState == 0 && _configuration.ResT4) ||
                                (harvestable.Tier == 4 && harvestable.RareState == 1 && _configuration.ResT4_1) ||
                                (harvestable.Tier == 4 && harvestable.RareState == 2 && _configuration.ResT4_2) ||
                                (harvestable.Tier == 4 && harvestable.RareState == 3 && _configuration.ResT4_3) ||
                                (harvestable.Tier == 5 && harvestable.RareState == 0 && _configuration.ResT5) ||
                                (harvestable.Tier == 5 && harvestable.RareState == 1 && _configuration.ResT5_1) ||
                                (harvestable.Tier == 5 && harvestable.RareState == 2 && _configuration.ResT5_2) ||
                                (harvestable.Tier == 5 && harvestable.RareState == 3 && _configuration.ResT5_3) ||
                                (harvestable.Tier == 6 && harvestable.RareState == 0 && _configuration.ResT6) ||
                                (harvestable.Tier == 6 && harvestable.RareState == 1 && _configuration.ResT6_1) ||
                                (harvestable.Tier == 6 && harvestable.RareState == 2 && _configuration.ResT6_2) ||
                                (harvestable.Tier == 6 && harvestable.RareState == 3 && _configuration.ResT6_3) ||
                                (harvestable.Tier == 7 && harvestable.RareState == 0 && _configuration.ResT7) ||
                                (harvestable.Tier == 7 && harvestable.RareState == 1 && _configuration.ResT7_1) ||
                                (harvestable.Tier == 7 && harvestable.RareState == 2 && _configuration.ResT7_2) ||
                                (harvestable.Tier == 7 && harvestable.RareState == 3 && _configuration.ResT7_3) ||
                                (harvestable.Tier == 8 && harvestable.RareState == 0 && _configuration.ResT8) ||
                                (harvestable.Tier == 8 && harvestable.RareState == 1 && _configuration.ResT8_1) ||
                                (harvestable.Tier == 8 && harvestable.RareState == 2 && _configuration.ResT8_2) ||
                                (harvestable.Tier == 8 && harvestable.RareState == 3 && _configuration.ResT8_3))
                            {
                                harvestablesValid.Add(new ObjectHarvestable(harvestable));
                            }
                        }
                    }
                }

                if (_configuration.ResLeather)
                {
                    var mobsWithDrops = Entities.Mobs.FindAll(x => x.HarvestableDrops.Count > 0 && x.ScreenLocation != null);
                    foreach (var mob in mobsWithDrops)
                    {
                        if ((_configuration.ResT2 && mob.HarvestableDrops.Any(x => x.Tier == 2)) ||
                            (_configuration.ResT3 && mob.HarvestableDrops.Any(x => x.Tier == 3)) ||
                            (_configuration.ResT4 && mob.HarvestableDrops.Any(x => x.Tier == 4 && x.Rarity == 0)) ||
                            (_configuration.ResT4_1 && mob.HarvestableDrops.Any(x => x.Tier == 4 && x.Rarity == 1)) ||
                            (_configuration.ResT4_2 && mob.HarvestableDrops.Any(x => x.Tier == 4 && x.Rarity == 2)) ||
                            (_configuration.ResT4_3 && mob.HarvestableDrops.Any(x => x.Tier == 4 && x.Rarity == 3)) ||
                            (_configuration.ResT5_1 && mob.HarvestableDrops.Any(x => x.Tier == 5 && x.Rarity == 1)) ||
                            (_configuration.ResT5_2 && mob.HarvestableDrops.Any(x => x.Tier == 5 && x.Rarity == 2)) ||
                            (_configuration.ResT5_3 && mob.HarvestableDrops.Any(x => x.Tier == 5 && x.Rarity == 3)) ||
                            (_configuration.ResT6_1 && mob.HarvestableDrops.Any(x => x.Tier == 6 && x.Rarity == 1)) ||
                            (_configuration.ResT6_2 && mob.HarvestableDrops.Any(x => x.Tier == 6 && x.Rarity == 2)) ||
                            (_configuration.ResT6_3 && mob.HarvestableDrops.Any(x => x.Tier == 6 && x.Rarity == 3)) ||
                            (_configuration.ResT7_1 && mob.HarvestableDrops.Any(x => x.Tier == 7 && x.Rarity == 1)) ||
                            (_configuration.ResT7_2 && mob.HarvestableDrops.Any(x => x.Tier == 7 && x.Rarity == 2)) ||
                            (_configuration.ResT7_3 && mob.HarvestableDrops.Any(x => x.Tier == 7 && x.Rarity == 3)) ||
                            (_configuration.ResT8_1 && mob.HarvestableDrops.Any(x => x.Tier == 8 && x.Rarity == 1)) ||
                            (_configuration.ResT8_2 && mob.HarvestableDrops.Any(x => x.Tier == 8 && x.Rarity == 2)) ||
                            (_configuration.ResT8_3 && mob.HarvestableDrops.Any(x => x.Tier == 8 && x.Rarity == 3)))
                        {
                            harvestablesValid.Add(new ObjectHarvestable(mob));
                        }
                    }
                }

                foreach (var harvestable in harvestablesValid)
                {
                    switch (harvestable.Type)
                    {
                    case Ennui.Api.Meta.ResourceType.Fiber:
                        g.SetColor(Color.Yellow);
                        break;

                    case Ennui.Api.Meta.ResourceType.Ore:
                        g.SetColor(Color.Black);
                        break;

                    case Ennui.Api.Meta.ResourceType.Hide:
                        g.SetColor(Color.Orange);
                        break;

                    case Ennui.Api.Meta.ResourceType.Wood:
                        g.SetColor(Color.Purple);
                        break;

                    case Ennui.Api.Meta.ResourceType.Rock:
                        g.SetColor(Color.Cyan);
                        break;

                    default:
                        g.SetColor(Color.Blue);
                        break;
                    }
                    g.DrawLine(Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X),
                               Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y),
                               harvestable.ScreenX,
                               harvestable.ScreenY);

                    // Calculate distance
                    var absX     = Math.Abs(Players.LocalPlayer.ScreenLocation.X - harvestable.ScreenX);
                    var absY     = Math.Abs(Players.LocalPlayer.ScreenLocation.Y - harvestable.ScreenY);
                    var distance = absX + absY;

                    if (distance > 500)
                    {
                        if (Math.Abs(harvestable.ScreenX) >= Math.Abs(harvestable.ScreenY))
                        {
                            if (Players.LocalPlayer.ScreenLocation.X < harvestable.ScreenX)
                            {
                                var y = ((harvestable.ScreenY - Players.LocalPlayer.ScreenLocation.Y) / (harvestable.ScreenX - Players.LocalPlayer.ScreenLocation.X)) * 100;
                                g.DrawString(distance.ToString(), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X + 100), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y + y));
                            }
                            else if (Players.LocalPlayer.ScreenLocation.X > harvestable.ScreenX)
                            {
                                var y = ((harvestable.ScreenY - Players.LocalPlayer.ScreenLocation.Y) / (harvestable.ScreenX - Players.LocalPlayer.ScreenLocation.X)) * -100;
                                g.DrawString(distance.ToString(), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X - 100), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y + y));
                            }
                        }
                        else
                        {
                            if (Players.LocalPlayer.ScreenLocation.Y < harvestable.ScreenY)
                            {
                                var x = (harvestable.ScreenX - Players.LocalPlayer.ScreenLocation.X) * 100 / (harvestable.ScreenY - Players.LocalPlayer.ScreenLocation.Y);
                                g.DrawString(distance.ToString(), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X + x), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y + 100));
                            }
                            else if (Players.LocalPlayer.ScreenLocation.Y > harvestable.ScreenY)
                            {
                                var x = (harvestable.ScreenX - Players.LocalPlayer.ScreenLocation.X) * -100 / (harvestable.ScreenY - Players.LocalPlayer.ScreenLocation.Y);
                                g.DrawString(distance.ToString(), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.X + x), Convert.ToInt32(Players.LocalPlayer.ScreenLocation.Y - 100));
                            }
                        }
                    }
                }
            }
        }
Esempio n. 34
0
 /// <summary>
 /// Called when the game attempts to paint the game screen.
 /// </summary>
 /// <param name="se">The script engine executing this script.</param>
 /// <param name="g">The graphic context to render on.</param>
 public virtual void OnPaint(IScriptEngine se, GraphicContext g)
 {
 }
Esempio n. 35
0
 protected abstract void OnDraw(GraphicContext gpCtx, Matrix44 parentTrans);
Esempio n. 36
0
 public void SetGraphics(GraphicContext gc)
 {
     _gc = gc;
 }
Esempio n. 37
0
        public void Draw(GraphicContext gpCtx)
        {
            Debug.Assert(gpCtx != null);
            if (null == gpCtx) return;

            foreach (Selection item in m_SelectionList)
                item.Draw(gpCtx);
        }
Esempio n. 38
0
        // For showing the graphics
        public void Draw(GraphicContext gpCtx)
        {
            Debug.Assert(gpCtx != null && m_Visible
                && m_Instance != null);

            if (!Visible) return;

            if (gpCtx != null && m_Visible && m_ItemList != null)
                m_ItemList.Draw(gpCtx, null);
        }
Esempio n. 39
0
 protected override void OnDraw(GraphicContext gpCtx, Matrix44 parentTrans)
 {
     for (int i = 0; i < m_ItemList.Count; i++)
         m_ItemList[i].Draw(gpCtx, GetChildrenTransformation(parentTrans));
 }
 public PointRepository(GraphicContext graphicContext)
 {
     this.db = graphicContext;
 }
Esempio n. 41
0
 public EFUnitOfWork(string connectionString)
 {
     db = new GraphicContext(connectionString);
 }