public void Draw(string appendTitle, Action drawContent) { GUILayout.Space(3f); var cBgOrigin = GUI.backgroundColor; GUI.backgroundColor = BgColor; var text = SGen.New[State ? "\u25B2 " : "\u25BC "][Title][' '][appendTitle].End; //["<b> <size=11>"]["</size></b>"] State = GUILayout.Toggle(State, text, TabStyle, GUILayout.MinWidth(20f)); var rectA = GUILayoutUtility.GetLastRect(); // EditorGUI.DrawRect(rectA, GUI.backgroundColor); GUILayout.Space(2f); GUI.backgroundColor = cBgOrigin; if (State && null != drawContent) { if (null != ScrollPanel) { ScrollPanel.Draw(drawContent); } else { drawContent(); } } else { GUILayout.Space(3f); } }
public void Draw(string appendTitle, Action drawContent) { GUILayout.Space(3f); var cBgOrigin = GUI.backgroundColor; GUI.backgroundColor = new Color(2f, 2f, 0.9f); state = GUILayout.Toggle(state, SGen.New[state ? "\u25B2" : "\u25BC"]["<b> <size=11>"][title][' '][appendTitle]["</size></b>"].End, "dragtab", GUILayout.MinWidth(20f)); GUILayout.Space(2f); GUI.backgroundColor = cBgOrigin; if (state && null != drawContent) { if (null != scrollPanel) { scrollPanel.Draw(drawContent); } else { drawContent(); } } else { GUILayout.Space(3f); } }
public override void GUIProc(Event e) { if (latestCollectTick < 0) { if (!Application.isPlaying) { EditorUtils.Render.SetColor(colorAlert); EditorUtils.Render.Space(16f); EditorGUILayout.LabelField( "UniKh/CSP can only be accessed while the program is running ...", labelStyle ); return; } if (!CSP.Inst) { EditorUtils.Render.SetColor(colorAlert); EditorUtils.Render.Space(16f); EditorGUILayout.LabelField("UniKh/CSP cre not loaded ...", labelStyle); return; } } DrawRuntime(); var array = new int[procStatistics.Count]; procStatistics.Keys.CopyTo(array, 0); var disabledProcs = new List <int>(array); scrollProcsInfo.Draw( () => { if (Application.isPlaying) { DrawActiveProcs(); disabledProcs = disabledProcs.Filter(procID => !CSP.Inst.procLst.Exists(proc => proc.ID == procID)); } else { EditorGUILayout.LabelField( "UniKh/CSP is not running. Here's the data of procs from the last run.", labelStyle ); } disabledProcs.Reverse(); DrawFinishedProcs(disabledProcs); } ); }
// public GUILayoutTextEditor textEditor = new GUILayoutTextEditor(new []{ "public", "namespace"}); public override void OnInspectorGUI() { var scriptObj = target as MonoScript; var classObj = scriptObj.GetClass(); if (null == classObj) { base.OnInspectorGUI(); } else { if (classObj.Namespace.Exists()) { EditorGUILayout.LabelField("namespace " + classObj.Namespace); } // draw class var strClass = SGen.New["class "]; var classTemp = classObj; while (classTemp != null) { if (classTemp == typeof(object)) { strClass.Append("object"); } else { strClass.Append(classTemp.Name).Append(" <"); } classTemp = classTemp.BaseType; } EditorGUILayout.LabelField(strClass.End); // draw objects if (classObj.IsInherits(typeof(Object))) { var objects = Resources.FindObjectsOfTypeAll(classObj); pToggleObjects.Draw("[" + objects.Length + "]", () => { var inAssets = objects.Filter(obj => EditorUtility.IsPersistent(obj)); var inScene = objects.Filter(obj => !EditorUtility.IsPersistent(obj)); EditorGUI.indentLevel += 1; if (inScene.Count > 0) { EditorGUILayout.LabelField("In Scene"); EditorGUI.indentLevel += 1; inScene.ForEach(obj => { EditorGUILayout.ObjectField(obj, obj.GetType(), true); }); EditorGUI.indentLevel -= 1; } if (inAssets.Count > 0) { EditorGUILayout.LabelField("In Assets"); EditorGUI.indentLevel += 1; inAssets.ForEach(obj => { EditorGUILayout.ObjectField(obj, obj.GetType(), false); }); EditorGUI.indentLevel -= 1; } EditorGUILayout.Space(); EditorGUI.indentLevel -= 1; }); } } pScript.Draw(() => { var style = new GUIStyle(GUI.skin.textArea); GUILayout.TextArea( scriptObj.text.Replace("\r\n", "\n"), style ); // var kbc = GUIUtility.keyboardControl; // textEditor.DrawColoredTextArea(EditorUtils.GetLastControlID(), style); }); }