浏览代码

Base Window

/main
Thomas ICHÉ 5 年前
当前提交
6d090cd8
共有 4 个文件被更改,包括 103 次插入0 次删除
  1. 8
      Editor/CallTree.meta
  2. 84
      Editor/CallTree/CallTreeWindow.cs
  3. 11
      Editor/CallTree/CallTreeWindow.cs.meta

8
Editor/CallTree.meta


fileFormatVersion: 2
guid: 37d3d697167f89145a81aa7bb6c0acc4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

84
Editor/CallTree/CallTreeWindow.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
namespace GameplayIngredients
{
public class CallTreeWindow : EditorWindow
{
CallTreeView m_TreeView;
[MenuItem("Window/Callable Tree Explorer")]
static void OpenWindow()
{
GetWindow<CallTreeWindow>();
}
protected List<MonoBehaviour> m_Watches;
private void OnEnable()
{
m_Watches = new List<MonoBehaviour>();
m_TreeView = new CallTreeView(m_Watches);
m_TreeView.Reload();
titleContent = new GUIContent("Callable Tree Explorer");
}
private void OnGUI()
{
int tbHeight = 24;
using(new GUILayout.HorizontalScope(EditorStyles.toolbar, GUILayout.Height(tbHeight)))
{
if(GUILayout.Button("Get",EditorStyles.toolbarButton))
{
Debug.Log("Get");
}
GUILayout.FlexibleSpace();
}
Rect r = GUILayoutUtility.GetRect(position.width, position.height - tbHeight);
m_TreeView.OnGUI(r);
}
class CallTreeNode
{
public string Name;
public Texture Icon;
public GameObject Target;
public List<CallTreeNode> Children;
public enum CallTreeNodeType
{
Callable,
Event,
Logic,
Action,
Message,
StateMachine,
State
}
}
class CallTreeView : TreeView
{
List<MonoBehaviour> m_Roots;
public CallTreeView(List<MonoBehaviour> roots) : base(new TreeViewState())
{
m_Roots = roots;
}
protected override TreeViewItem BuildRoot()
{
int id = 0;
var treeRoot = new TreeViewItem(id++, -1, "~Root");
foreach(var bh in m_Roots)
{
var root_item = new TreeViewItem(id++, 0, bh.name);
treeRoot.AddChild(root_item);
}
return treeRoot;
}
}
}
}

11
Editor/CallTree/CallTreeWindow.cs.meta


fileFormatVersion: 2
guid: 07aa515d40867f64686276ce5db0e51d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存