Пример #1
0
        public static void CreateTreeView()
        {
            _treeViewControl = TreeViewInspector.AddTreeView();
            _treeViewControl.DisplayInInspector = false;
            _treeViewControl.DisplayOnScene     = false;
            _treeViewControl.DisplayOnGame      = false;

            SkillEditorManager.InitTree(_treeViewControl);
        }
Пример #2
0
        private void OnGUI()
        {
            if (_treeViewControl == null)
            {
                return;
            }

            wantsMouseMove = true;
            if (Event.current != null && Event.current.type == EventType.MouseMove)
            {
                Repaint();
            }
            _treeViewControl.DisplayTreeView(TreeViewControl.DisplayTypes.USE_SCROLL_VIEW);

            if (SkillEditorManager.SelectedItem == null)
            {
                return;
            }

            //根据选择的不同标签,显示不同的button
            var data = SkillEditorManager.SelectedItem.DataContext as ItemData;

            switch (data.SelectedType)
            {
            case SelectedType.Root:
                if (GUILayout.Button("AddSkill"))
                {
                    SkillEditorManager.CreateSkill();
                }
                break;

            case SelectedType.Skill:

                GUILayout.BeginHorizontal();
                //1.获得当前的种类

                var list = GetActionTypes();
                _index = EditorGUILayout.Popup("Choice Action", _index, list.ToArray());
                GUILayout.EndHorizontal();
                if (GUILayout.Button("AddAction"))
                {
                    var actionType = (from type in Assembly.GetAssembly(typeof(ActionBase)).GetTypes()
                                      where type.Name == list[_index]
                                      select type).ToList()[0];

                    SkillEditorManager.CreateAction(actionType);
                }
                break;

            case SelectedType.Action:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }