示例#1
0
文件: MainForm.cs 项目: BaldMan82/iGL
        void sceneControl_OnNodeUnSelected(object sender, SceneControl.NodeUnSelected e)
        {
            if (e.NodeValue is GameObject)
            {
                var obj = e.NodeValue as GameObject;

                obj.OnComponentAdded -= gameObject_OnComponentAdded;
                obj.OnComponentRemoved -= gameObject_OnComponentRemoved;
            }
        }
示例#2
0
文件: MainForm.cs 项目: BaldMan82/iGL
        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;
            }
        }