private void DrawGraphArea() { Vector2 v = Vector2.zero; if (Event.current.type != EventType.scrollWheel) { Vector2 vector = GUI.BeginScrollView(new Rect(this.mGraphRect.x, this.mGraphRect.y, this.mGraphRect.width + 15f, this.mGraphRect.height + 15f), this.mGraphScrollPosition, new Rect(0f, 0f, this.mGraphScrollSize.x, this.mGraphScrollSize.y), true, true); if (vector != this.mGraphScrollPosition && Event.current.type != EventType.DragUpdated && Event.current.type != EventType.Ignore) { v = (this.mGraphScrollPosition - vector) / this.mGraphZoom; this.mGraphOffset -= (vector - this.mGraphScrollPosition) / this.mGraphZoom; this.mGraphScrollPosition = vector; } GUI.EndScrollView(); } GUI.Box(this.mGraphRect, string.Empty, graphBackgroundGUIStyle); this.DrawGrid(); DataTreeEditTool.Begin(this.mGraphRect, this.mGraphZoom); this.DrawConnectionLines(); for (int i = 0; i < this.m_nodeList.Count; ++i) { this.m_nodeList[i].Show(v, true); } DataTreeEditTool.End(); }
private void OnLoadGUI() { DataTreeEditTool.GUILabelType(); GUILayout.Label("数据树选择"); DataTreeEditTool.GUILabelType(TextAnchor.UpperLeft); data = DataTreeEditTool.GUIobject_CaneditArea("加载数据树文件", data, true, LoadData); GUILayout.Space(2); }
public void InitData(string name) { this.mName = name; this.m_init = false; this.m_selectKey = -1; this.m_idx = -1; this.m_conDic.Clear(); this.m_conList.Clear(); this.m_nodeList.Clear(); DataTreeEditCtr.ClearAllData(); if (this.graphBackgroundGUIStyle == null) { this.InitGraphBackgroundGUIStyle(); } if (this.mGridMaterial == null) { this.mGridMaterial = new Material(Shader.Find("Hidden/Behavior Designer/Grid")); this.mGridMaterial.hideFlags = HideFlags.HideAndDontSave; this.mGridMaterial.shader.hideFlags = HideFlags.HideAndDontSave; } if (this.mLineMaterial == null) { this.mLineMaterial = new Material(Shader.Find("DataTreeEditor/Line")); this.mLineMaterial.hideFlags = HideFlags.HideAndDontSave; this.mLineMaterial.shader.hideFlags = HideFlags.HideAndDontSave; } if (name.Equals("Config") || name.Equals("ConfigTree")) { if (this.m_configDataList == null) { this.m_configDataList = new List <ConfigData>(); } else { this.m_configDataList.Clear(); } DataTreeEditTool.LoadCsv_List <ConfigData>("Config", this.m_configDataList); this.m_init = true; this.m_conDic.Add(-1, true); for (int i = 0; i < this.m_configDataList.Count; ++i) { if (!this.m_conDic.ContainsKey(this.m_configDataList[i].GetconfigDataCondition())) { this.m_conDic.Add(this.m_configDataList[i].GetconfigDataCondition(), false); } } this.m_conList = new List <int>(this.m_conDic.Keys); if (name.Equals("ConfigTree")) { this.LoadFileData(); } } }