private void OnGUI() { var rect = new Rect(0, 0, position.width, position.height); GUICustomUtils.DrawTitle("Dash Debug Console"); GUI.backgroundColor = Color.white; GUILayout.BeginHorizontal(); if (GUILayout.Button("Clear", GUILayout.Width(120))) { DashEditorDebug.DebugList?.Clear(); } EditorGUIUtility.labelWidth = 35; _search = EditorGUILayout.TextField(new GUIContent("Filter:"), _search, GUILayout.ExpandWidth(true)); GUILayout.Space(4); _forceLowerCase = GUILayout.Toggle(_forceLowerCase, new GUIContent("Lower Case"), GUILayout.Width(100)); GUILayout.Space(8); EditorGUIUtility.labelWidth = 55; DashEditorCore.EditorConfig.maxLog = EditorGUILayout.IntField(new GUIContent("Max Log:"), DashEditorCore.EditorConfig.maxLog, GUILayout.Width(120)); GUILayout.Space(4); _showTime = GUILayout.Toggle(_showTime, new GUIContent("Show Time"), GUILayout.Width(100)); // GUILayout.Space(4); // _showController = GUILayout.Toggle(_showController, new GUIContent("Controller"), GUILayout.ExpandWidth(false)); // GUILayout.Space(4); // _showGraph = GUILayout.Toggle(_showGraph, new GUIContent("GraphPath"), GUILayout.ExpandWidth(false)); // GUILayout.Space(4); // _showNode = GUILayout.Toggle(_showNode, new GUIContent("NodeId"), GUILayout.ExpandWidth(false)); // GUILayout.Space(4); // _showTarget = GUILayout.Toggle(_showTarget, new GUIContent("Target"), GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.BeginArea(new Rect(rect.x, rect.y + 60, rect.width, rect.height - 60)); if (_isDirty) { _scrollPosition = new Vector2(0, int.MaxValue); } _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, false); GUILayout.BeginVertical(); if (DashEditorDebug.DebugList != null) { int start = DashEditorCore.EditorConfig.maxLog < DashEditorDebug.DebugList.Count ? DashEditorDebug.DebugList.Count - DashEditorCore.EditorConfig.maxLog : 0; for (int i = start; i < DashEditorDebug.DebugList.Count; i++) { var debug = DashEditorDebug.DebugList[i]; bool found = false; if (!string.IsNullOrWhiteSpace(_search)) { found = found || debug.Search(_forceLowerCase ? _search.ToLower() : _search, _forceLowerCase); if (!found) { continue; } } GUILayout.BeginHorizontal(); debug.Draw(_showTime); GUILayout.Space(4); GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndArea(); if (_isDirty) { _isDirty = false; Repaint(); } }
private void OnGUI() { var rect = new Rect(0, 0, position.width, position.height); GUICustomUtils.DrawTitle("Dash AOT Scanner/Generator"); var titleStyle = new GUIStyle(); titleStyle.alignment = TextAnchor.MiddleLeft; titleStyle.padding.left = 5; titleStyle.normal.textColor = new Color(1, .5f, 0); titleStyle.fontStyle = FontStyle.Bold; titleStyle.fontSize = 16; var infoStyle = new GUIStyle(); infoStyle.normal.textColor = Color.gray; infoStyle.alignment = TextAnchor.MiddleLeft; infoStyle.padding.left = 5; var scrollViewStyle = new GUIStyle(); scrollViewStyle.normal.background = TextureUtils.GetColorTexture(new Color(.1f, .1f, .1f)); GUILayout.Space(4); GUILayout.Label("Scanned types", titleStyle, GUILayout.ExpandWidth(true)); GUILayout.Label( "Last scan found " + (DashEditorCore.EditorConfig.scannedAOTTypes == null ? 0 : DashEditorCore.EditorConfig.scannedAOTTypes.Count) + " types", infoStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(2); _scrollPositionScanned = GUILayout.BeginScrollView(_scrollPositionScanned, scrollViewStyle, GUILayout.ExpandWidth(true), GUILayout.Height(rect.height / 2 - 100)); GUILayout.BeginVertical(); if (DashEditorCore.EditorConfig.scannedAOTTypes != null) { foreach (Type type in DashEditorCore.EditorConfig.scannedAOTTypes) { GUILayout.BeginHorizontal(); GUILayout.Label((string.IsNullOrEmpty(type.Namespace) ? "" : type.Namespace + ".") + type.GetReadableTypeName()); if (GUILayout.Button("Remove", GUILayout.Width(120))) { DashAOTScanner.RemoveScannedAOTType(type); break; } GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(4); GUILayout.Label("Explicit Types", titleStyle, GUILayout.ExpandWidth(true)); GUILayout.Label( "You have " + (DashEditorCore.EditorConfig.explicitAOTTypes == null ? 0 : DashEditorCore.EditorConfig.explicitAOTTypes.Count) + " explicitly defined types.", infoStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(2); _scrollPositionExplicit = GUILayout.BeginScrollView(_scrollPositionExplicit, scrollViewStyle, GUILayout.ExpandWidth(true), GUILayout.Height(rect.height / 2 - 100)); GUILayout.BeginVertical(); if (DashEditorCore.EditorConfig.explicitAOTTypes != null) { int index = 0; foreach (Type type in DashEditorCore.EditorConfig.explicitAOTTypes) { GUILayout.BeginHorizontal(); GUILayout.Label((string.IsNullOrEmpty(type.Namespace) ? "" : type.Namespace + ".") + type.GetReadableTypeName()); if (type.IsGenericType && type.GetGenericArguments()[0].FullName == null) { if (GUILayout.Button("Inflate", GUILayout.Width(120))) { AddTypeContextMenu.ShowAsPopup((p) => InflateType(p, type, index)); } } if (GUILayout.Button("Remove", GUILayout.Width(120))) { DashAOTScanner.RemoveExplicitAOTType(type); break; } GUILayout.EndHorizontal(); index++; } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(4); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); _generateLinkXml = GUILayout.Toggle(_generateLinkXml, new GUIContent("Generate Link Xml"), GUILayout.Width(140)); _includeOdin = GUILayout.Toggle(_includeOdin, new GUIContent("Include Odin Assembly")); GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.BeginHorizontal(); bool generate = GUILayout.Button("Generate AOT DLL", GUILayout.Height(40)); bool scan = GUILayout.Button("Scan Types", GUILayout.Height(40)); if (GUILayout.Button("Add Explicit Type", GUILayout.Height(40))) { AddTypeContextMenu.ShowAsPopup(AddType); } GUILayout.EndHorizontal(); var dll = PluginImporter.GetAtPath(DashEditorCore.EditorConfig.AOTAssemblyPath + "/" + DashEditorCore.EditorConfig.AOTAssemblyName + ".dll"); if (dll != null) { GUILayout.Label("Assembly generated in " + DashEditorCore.EditorConfig.AOTAssemblyPath + "/" + DashEditorCore.EditorConfig.AOTAssemblyName + ".dll" + " last generated on " + DashEditorCore.EditorConfig.AOTAssemblyGeneratedTime); } else { GUILayout.Label("No generated Dash AOT Assembly found."); } GUILayout.EndVertical(); if (scan) { DashAOTScanner.Scan(); } else if (generate) { DashAOTScanner.GenerateDLL(_generateLinkXml, _includeOdin); } }
private void OnGUI() { var rect = new Rect(0, 0, position.width, position.height); GUICustomUtils.DrawTitle("Dash Prefab Editor"); var scrollViewStyle = new GUIStyle(); scrollViewStyle.normal.background = TextureUtils.GetColorTexture(new Color(.1f, .1f, .1f)); GUILayout.BeginArea(new Rect(5, 35, rect.width - 400, rect.height - 40)); _scrollPositionPrefabs = GUILayout.BeginScrollView(_scrollPositionProperties, scrollViewStyle, GUILayout.ExpandWidth(true)); GUILayout.BeginVertical(); if (DashEditorCore.RuntimeConfig.prefabs != null) { foreach (var pair in DashEditorCore.RuntimeConfig.prefabs) { GUILayout.BeginHorizontal(); GUILayout.Label(pair.Key.name, GUILayout.Width(120)); EditorGUI.BeginChangeCheck(); var newValue = EditorGUILayout.ObjectField(pair.Value, typeof(GameObject), false); if (EditorGUI.EndChangeCheck()) { if (newValue != null) { DashEditorCore.RuntimeConfig.prefabs[pair.Key] = (GameObject)newValue; break; } } if (GUILayout.Button("Remove", GUILayout.Width(100))) { DashEditorCore.RuntimeConfig.prefabs.Remove(pair.Key); break; } if (GUILayout.Button("Edit", GUILayout.Width(100))) { _selectedPrefabInfo = pair.Key; break; } GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); if (GUILayout.Button("Add Prefab", GUILayout.Height(40))) { if (DashEditorCore.RuntimeConfig.prefabs == null) { DashEditorCore.RuntimeConfig.prefabs = new Dictionary <PrefabInfo, GameObject>(); } DashEditorCore.RuntimeConfig.prefabs.Add(PrefabInfo.GetDefault(), null); } GUILayout.EndArea(); var propertyRect = new Rect(rect.width - 390, 35, 385, rect.height - 45); DrawBoxGUI(propertyRect, "Properties", TextAnchor.UpperRight, Color.white); GUILayout.BeginArea(new Rect(propertyRect.x + 5, propertyRect.y + 30, propertyRect.width - 10, propertyRect.height - 35)); _scrollPositionProperties = GUILayout.BeginScrollView(_scrollPositionProperties, false, false); if (_selectedPrefabInfo != null && DashEditorCore.RuntimeConfig.prefabs != null && DashEditorCore.RuntimeConfig.prefabs.ContainsKey(_selectedPrefabInfo)) { GUILayout.BeginHorizontal(); GUILayout.Label("Name", GUILayout.Width(100)); _selectedPrefabInfo.name = GUILayout.TextField(_selectedPrefabInfo.name); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Enable Pooling", GUILayout.Width(100)); _selectedPrefabInfo.enablePooling = EditorGUILayout.Toggle(_selectedPrefabInfo.enablePooling); GUILayout.EndHorizontal(); GUI.enabled = _selectedPrefabInfo.enablePooling; GUILayout.BeginHorizontal(); GUILayout.Label("Count", GUILayout.Width(100)); _selectedPrefabInfo.count = EditorGUILayout.IntField(_selectedPrefabInfo.count); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Prewarm", GUILayout.Width(100)); _selectedPrefabInfo.prewarm = EditorGUILayout.Toggle(_selectedPrefabInfo.prewarm); GUILayout.EndHorizontal(); GUI.enabled = true; var asset = DashEditorCore.RuntimeConfig.prefabs[_selectedPrefabInfo]; if (asset != null) { var style = new GUIStyle(); style.alignment = TextAnchor.MiddleCenter; style.normal.textColor = Color.white; style.fontStyle = FontStyle.Bold; GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f); style.normal.background = Texture2D.whiteTexture; GUI.Label(new Rect(0, propertyRect.height - 400, propertyRect.width, 20), asset.name, style); GUI.DrawTexture(new Rect(10, propertyRect.height - 380, 360, 360), AssetPreview.GetMiniThumbnail(asset)); GUI.backgroundColor = Color.white; } } GUILayout.EndScrollView(); GUILayout.EndArea(); }
private void OnGUI() { var rect = new Rect(0, 0, position.width, position.height); GUICustomUtils.DrawTitle("Dash Expressions Editor"); DashEditorCore.RuntimeConfig.enableCustomExpressionClasses = GUILayout.Toggle(DashEditorCore.RuntimeConfig.enableCustomExpressionClasses, new GUIContent("Enable Custom Expression Classes (has small runtime impact)")); var titleStyle = new GUIStyle(); titleStyle.alignment = TextAnchor.MiddleLeft; titleStyle.padding.left = 5; titleStyle.normal.textColor = new Color(1, .5f, 0); titleStyle.fontStyle = FontStyle.Bold; titleStyle.fontSize = 16; var infoStyle = new GUIStyle(); infoStyle.normal.textColor = Color.gray; infoStyle.alignment = TextAnchor.MiddleLeft; infoStyle.padding.left = 5; var scrollViewStyle = new GUIStyle(); scrollViewStyle.normal.background = TextureUtils.GetColorTexture(new Color(.1f, .1f, .1f)); GUI.enabled = DashEditorCore.RuntimeConfig.enableCustomExpressionClasses; GUILayout.Space(4); GUILayout.Label("Expression classes", titleStyle, GUILayout.ExpandWidth(true)); GUILayout.Label( "You have " + (DashEditorCore.RuntimeConfig.expressionClasses == null ? 0 : DashEditorCore.RuntimeConfig.expressionClasses.Count) + " expression classes defined.", infoStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(2); _scrollPositionScanned = GUILayout.BeginScrollView(_scrollPositionScanned, scrollViewStyle, GUILayout.ExpandWidth(true), GUILayout.Height(rect.height / 2 - 140)); GUILayout.BeginVertical(); if (DashEditorCore.RuntimeConfig.expressionClasses != null) { foreach (Type type in DashEditorCore.RuntimeConfig.expressionClasses) { GUILayout.BeginHorizontal(); GUILayout.Label((string.IsNullOrEmpty(type.Namespace) ? "" : type.Namespace + ".") + type.GetReadableTypeName()); if (GUILayout.Button("Remove", GUILayout.Width(120))) { RemoveExpressionClass(type); break; } GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(4); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add Expression Class", GUILayout.Height(40))) { AddTypeContextMenu.ShowAsPopup(AddExpressionClass); } GUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.Space(4); GUILayout.Label("Expression macros", titleStyle, GUILayout.ExpandWidth(true)); GUILayout.Label( "You have " + (DashEditorCore.RuntimeConfig.expressionMacros == null ? 0 : DashEditorCore.RuntimeConfig.expressionMacros.Count) + " expression macros defined.", infoStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(2); _scrollPositionScanned = GUILayout.BeginScrollView(_scrollPositionScanned, scrollViewStyle, GUILayout.ExpandWidth(true), GUILayout.Height(rect.height / 2 - 100)); GUILayout.BeginVertical(); if (DashEditorCore.RuntimeConfig.expressionMacros != null) { foreach (var pair in DashEditorCore.RuntimeConfig.expressionMacros) { GUILayout.BeginHorizontal(); string strippedName = pair.Key.Substring(1, pair.Key.Length - 2); string newName = GUILayout.TextField(strippedName, GUILayout.Width(160)).ToUpper(); newName = Regex.Replace(newName, @"[^a-zA-Z0-9 _]", ""); if (newName != strippedName) { DashEditorCore.RuntimeConfig.expressionMacros.Remove(pair.Key); DashEditorCore.RuntimeConfig.expressionMacros.Add("{" + GetUniqueName(newName) + "}", pair.Value); break; } string newValue = GUILayout.TextField(pair.Value); if (newValue != pair.Value) { DashEditorCore.RuntimeConfig.expressionMacros[pair.Key] = newValue; break; } if (GUILayout.Button("Remove", GUILayout.Width(120))) { RemoveExpressionMacro(pair.Key); break; } GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(4); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add Expression Macro", GUILayout.Height(40))) { AddExpressionMacro(); } GUILayout.EndHorizontal(); }