From 8722a9920c1f6119bf6e769cba270e63097f8e25 Mon Sep 17 00:00:00 2001
From: chai <215380520@qq.com>
Date: Thu, 23 May 2024 10:08:29 +0800
Subject: + astar project
---
.../Drawing/Editor/DrawingSettingsEditor.cs | 60 ++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/Editor/DrawingSettingsEditor.cs
(limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/Editor/DrawingSettingsEditor.cs')
diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/Editor/DrawingSettingsEditor.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/Editor/DrawingSettingsEditor.cs
new file mode 100644
index 0000000..56acb6d
--- /dev/null
+++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/Editor/DrawingSettingsEditor.cs
@@ -0,0 +1,60 @@
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+namespace Pathfinding.Drawing {
+ /// Helper for adding project settings
+ static class ALINESettingsRegister {
+ const string PROVIDER_PATH = "Project/AstarGizmos";
+ const string SETTINGS_LABEL = "A* Gizmos";
+
+
+ [SettingsProvider]
+ public static SettingsProvider CreateMyCustomSettingsProvider () {
+ // First parameter is the path in the Settings window.
+ // Second parameter is the scope of this setting: it only appears in the Project Settings window.
+ var provider = new SettingsProvider(PROVIDER_PATH, SettingsScope.Project) {
+ // By default the last token of the path is used as display name if no label is provided.
+ label = SETTINGS_LABEL,
+ guiHandler = (searchContext) =>
+ {
+ var settings = new SerializedObject(DrawingSettings.GetSettingsAsset());
+ EditorGUILayout.HelpBox("Opacity of lines, solid objects and text drawn using ALINE. When drawing behind other objects, an additional opacity multiplier is applied.", MessageType.None);
+ EditorGUILayout.Separator();
+ EditorGUILayout.LabelField("Lines", EditorStyles.boldLabel);
+ EditorGUILayout.Slider(settings.FindProperty("settings.lineOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of lines when in front of objects"));
+ EditorGUILayout.Slider(settings.FindProperty("settings.lineOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of lines when behind or inside objects"));
+ EditorGUILayout.Separator();
+ EditorGUILayout.LabelField("Solids", EditorStyles.boldLabel);
+ EditorGUILayout.Slider(settings.FindProperty("settings.solidOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of solid objects when in front of other objects"));
+ EditorGUILayout.Slider(settings.FindProperty("settings.solidOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of solid objects when behind or inside other objects"));
+ EditorGUILayout.Separator();
+ EditorGUILayout.LabelField("Text", EditorStyles.boldLabel);
+ EditorGUILayout.Slider(settings.FindProperty("settings.textOpacity"), 0, 1, new GUIContent("Opacity", "Opacity of text when in front of other objects"));
+ EditorGUILayout.Slider(settings.FindProperty("settings.textOpacityBehindObjects"), 0, 1, new GUIContent("Opacity (occluded)", "Additional opacity multiplier of text when behind or inside other objects"));
+ EditorGUILayout.Separator();
+ EditorGUILayout.Slider(settings.FindProperty("settings.curveResolution"), 0.1f, 3f, new GUIContent("Curve resolution", "Higher values will make curves smoother, but also a bit slower to draw."));
+
+ settings.ApplyModifiedProperties();
+ if (GUILayout.Button("Reset to default")) {
+ var def = DrawingSettings.DefaultSettings;
+ var current = DrawingSettings.GetSettingsAsset();
+ current.settings.lineOpacity = def.lineOpacity;
+ current.settings.lineOpacityBehindObjects = def.lineOpacityBehindObjects;
+ current.settings.solidOpacity = def.solidOpacity;
+ current.settings.solidOpacityBehindObjects = def.solidOpacityBehindObjects;
+ current.settings.textOpacity = def.textOpacity;
+ current.settings.textOpacityBehindObjects = def.textOpacityBehindObjects;
+ current.settings.curveResolution = def.curveResolution;
+ EditorUtility.SetDirty(current);
+ }
+ },
+
+ // Populate the search keywords to enable smart search filtering and label highlighting:
+ keywords = new HashSet(new[] { "Drawing", "Wire", "aline", "opacity" })
+ };
+
+ return provider;
+ }
+ }
+}
--
cgit v1.1-26-g67d0