예제 #1
0
        internal static void Render(object sender, DrawingEventArgs e)
        {
            if (!Settings.Instance.DebugRender)
            {
                return;
            }

            if (!Constants.InDeepDungeon)
            {
                return;
            }

            try
            {
                I3DDrawer drawer = e.Drawer;

                //if (_path != null)
                //{
                //    var start = (Vector3)_path.First();
                //    foreach (var x in _path)
                //    {
                //        drawer.DrawLine(start, (Vector3)x, Color.Black);
                //        start = (Vector3)x;
                //    }
                //}

                if (Walls == null)
                {
                    return;
                }

                //List<uint> active = new List<uint>();
                //active.AddRange(_hit.Keys);

                //foreach (var x in active)
                //{
                //    var extents = Bound(_walls[x][2], _walls[x][1]);
                //    drawer.DrawBox(_walls[x][0], extents, Color.FromArgb(150, Color.Goldenrod));
                //}

                List <BoundingBox3> service = new List <BoundingBox3>();
                service.AddRange(wallList);

                foreach (BoundingBox3 x in service)
                {
                    Vector3 extents = Bound(x.Min, x.Max);
                    drawer.DrawBox(Vector3.Lerp(x.Min, x.Max, 0.5f), extents, Color.FromArgb(100, Color.Turquoise));
                }

                List <BoundingCircle> tarp = new List <BoundingCircle>();
                tarp.AddRange(trapList);
                foreach (BoundingCircle t in tarp)
                {
                    drawer.DrawCircleOutline(t.Center, t.Radius, Color.FromArgb(100, Color.Red));
                }
            }
            catch (Exception)
            {
            }
        }
예제 #2
0
        protected override void Draw(DrawingEventArgs e)
        {
            if (sprite == null)
            {
                sprite = GetComponent <Sprite>();
            }

            TextureAsset asset = AssetManager.GetTexture(sprite.Texture);

            Vector2f scale = transform.LossyScale;

            scale.X *= flipX ? -1 : 1;
            scale.Y *= flipY ? -1 : 1;
            e.SpriteBatch.Draw(AssetManager.GetTexture(sprite.Texture), transform.Position, sprite.Color, transform.Rotation, scale, sprite.GetOrigin());
        }
예제 #3
0
 private void Draw(DrawingEventArgs e)
 {
     Drawed?.Invoke(e);
 }
예제 #4
0
 protected abstract void Draw(DrawingEventArgs e);
예제 #5
0
        void Draw(object sender, DrawingEventArgs e)
        {
            if (HeightFieldProperty.GetValue(null) == null)
            {
                return;
            }

            var dd = e.Drawer;


            var   heightField = HeightFieldProperty.GetValue(null);
            float cs          = (float)CellSize.GetValue(heightField);
            float ch          = (float)CellHeight.GetValue(heightField);
            Array Spans       = (Array)SpansProp.GetValue(heightField);

            BoundingBox3 bounds = (BoundingBox3)Bounds.GetValue(heightField);
            //var cpl = Core.Player.Location;

            var td = new Dictionary <Color, List <Vector3> >();

            for (int y = 0; y < (int)NumCellsZ.GetValue(heightField); ++y)
            {
                for (int x = 0; x < (int)NumCellsX.GetValue(heightField); ++x)
                {
                    float fx = bounds.Min.X + x * cs;
                    float fz = bounds.Min.Z + y * cs;
                    var   c  = GetCell.Invoke(heightField, new object[] { x, y }); // chf.GetCell(x, y);

                    uint Index = (uint)CellIndexProp.GetValue(c);
                    uint Count = (uint)CellCountProp.GetValue(c);

                    for (uint i = Index, ni = Index + Count; i < ni; ++i)
                    {
                        var s = Spans.GetValue(i);


                        var    area   = (byte)SpansAreaProp.GetValue(s);
                        ushort bottom = (ushort)SpansBottomField.GetValue(s);

                        Color color;
                        if (area == 1)
                        {
                            color = Color.FromArgb(128, 128, 255, 64);
                        }
                        else if (area == 0)
                        {
                            color = Color.FromArgb(128, 0, 0, 64);
                        }
                        else
                        {
                            color = duIntToCol(area, 64);
                        }

                        float fy = bounds.Min.Y + (bottom + 1) * ch;

                        if (!td.TryGetValue(color, out var tl))
                        {
                            tl        = new List <Vector3>();
                            td[color] = tl;
                        }
                        tl.AddRange(new[]
                        {
                            new Vector3(fx, fy, fz),
                            new Vector3(fx, fy, fz + cs),
                            new Vector3(fx + cs, fy, fz + cs),
                            new Vector3(fx + cs, fy, fz + cs),
                            new Vector3(fx + cs, fy, fz),
                            new Vector3(fx, fy, fz)
                        });
                    }
                }
            }

            foreach (var k in td)
            {
                dd.DrawTriangles(k.Value.ToArray(), k.Key);
            }
        }
예제 #6
0
	private void OnDrawing (object sender, DrawingEventArgs e) {
		if (e.DrawingState == DrawingState.Began) {
			CrossFadeCanvasGroup(colorMenu, 0, 0.3f);
			CrossFadeCanvasGroup(uinterface, 0, 0.3f);
		} else if (e.DrawingState == DrawingState.Ended) {
			CrossFadeCanvasGroup(uinterface, 1, 0.3f);
			if (paintingController.IsEmpty) submitButton.interactable = false;
			else submitButton.interactable = true;
		}
	}