Esempio n. 1
0
        protected override void Initialize()
        {
            base.Initialize();

            ECSCore.systemPool.Add <System_Process_WASDMovement>();
            ECSCore.systemPool.Add <System_Process_DebugHack>();
            ECSCore.systemPool.Add <System_UIDisplay_DebugHack>();

            DeftDebug.ActivateDebugColliders();

            var e = Maker.Make("Blank", new Vector2(200, 200), new Vector2(50, 50));

            e.Add <Component_Display_Box>();
            e.Get <Component_Display_Box>().color = Color.Blue;
            e.Add <Component_Collision_AABox>();
            //e.Add<Component_WASDMovement>();

            var e2 = Maker.Make("Blank", new Vector2(350, 200), new Vector2(50, 50));

            e2.Add <Component_Display_Circle>();
            e2.Get <Component_Display_Circle>().color = Color.Blue;
            e2.Add <Component_Collision_Circle>();
            //e2.Add<Component_WASDMovement>();

            var e3 = Maker.Make("Blank", new Vector2(500, 500), new Vector2(50, 75));

            e3.Add <Component_Collision_Box>();
            e3.Add <Component_WASDMovement>();

            var e4 = Maker.Make("Blank", new Vector2(280, 180), new Vector2(84, 25));

            e4.Add <Component_Collision_Box>();

            ComponentEditorPanel cPanel = new ComponentEditorPanel();

            cPanel.Label    = "Component Editor";
            cPanel.fontSize = 16;
            cPanel.MoveTo(new Vector2(5, 5));
            cPanel.SetComponent(e.Get <Component_Display_Box>());

            DeftUI.Subscribe(cPanel);

            DeftUI.Subscribe(new DropDownList {
                Label   = "Dicks",
                Options = new List <String> {
                    "ASDS", "ASDSAD", "ASDSADASDSAD"
                }
            });
        }
Esempio n. 2
0
        public void SetComponent(IComponent component)
        {
            _component = component;

            // Remove previous gadgets.
            foreach (var child in _children)
            {
                DeftUI.Unsubscribe(child);
            }
            _children.Clear();

            // Generate new gadgets.
            foreach (var field in GetComponentFields(component))
            {
                Type    gadgetType  = DeftEditor.GetGadgetType(field.FieldType);
                dynamic fieldGadget = Add(gadgetType, field.Name);

                var fieldValue = field.GetValue(_component);
                gadgetType.GetProperty("Value").SetValue(fieldGadget, fieldValue);
            }
        }
Esempio n. 3
0
        public void Process()
        {
            if (Input.KeyDown(Keys.R))
            {
                var entities = ECSCore.pool.GetEntities <Component_Collision_Box>();

                foreach (var e in entities)
                {
                    e.Rotation += 1;
                }
            }

            var ent    = ECSCore.pool.GetEntities <Component_Display_Box>()[0];
            var cPanel = DeftUI.Get <ComponentEditorPanel>("Component Editor");

            if (Input.KeyDown(Keys.Space))
            {
                ent.Get <Component_Display_Box>().color.R += 1;
                cPanel.SetComponent(ent.Get <Component_Display_Box>());
            }
        }