Beispiel #1
0
        void gameObject_OnComponentAdded(object sender, Engine.Events.ComponentAddedEvent e)
        {
            var componentPanel = new ComponentPanel();
            componentPanel.LoadComponent(e.Component);

            flowLayoutPanel1.Controls.Add(componentPanel);
        }
Beispiel #2
0
        void sceneControl_OnNodeSelected(object sender, SceneControl.NodeSelected e)
        {
            tabControl1.SelectedTab = propertiesTab;

            foreach (var control in flowLayoutPanel1.Controls)
            {
                if (control is GameObjectDlg) ((GameObjectDlg)control).Unload();
            }

            flowLayoutPanel1.Controls.Clear();

            if (e.NodeValue is Scene)
            {
                var scene = e.NodeValue as Scene;

                var control = new SceneControlDlg();

                control.Scene = openTKControl.Game.Scene;
                flowLayoutPanel1.Controls.Add(control);
            }
            else
            {
                flowLayoutPanel1.Visible = false;
                var obj = e.NodeValue as GameObject;

                obj.OnComponentAdded += gameObject_OnComponentAdded;
                obj.OnComponentRemoved += gameObject_OnComponentRemoved;

                var control = new GameObjectDlg();
                control.GameObject = obj;

                flowLayoutPanel1.Controls.Add(control);

                foreach (var component in obj.Components)
                {
                    var componentPanel = new ComponentPanel();
                    componentPanel.LoadComponent(component);

                    flowLayoutPanel1.Controls.Add(componentPanel);
                }

                flowLayoutPanel1.Visible = true;
            }
        }