地图边缘相关优化
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using IndianOceanAssets.Engine2_5D;
|
||||
|
||||
namespace IndianOceanAssets.EditorTools
|
||||
{
|
||||
[CustomEditor(typeof(GroundBuilder))]
|
||||
public class GroundBuilderEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
var builder = (GroundBuilder)target;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("操作", EditorStyles.boldLabel);
|
||||
|
||||
if (GUILayout.Button("Build Ground", GUILayout.Height(32)))
|
||||
{
|
||||
Undo.RecordObject(builder, "Build Ground");
|
||||
builder.Build();
|
||||
EditorUtility.SetDirty(builder);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Clear Generated", GUILayout.Height(24)))
|
||||
{
|
||||
Undo.RecordObject(builder, "Clear Generated");
|
||||
builder.ClearGenerated();
|
||||
EditorUtility.SetDirty(builder);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// 显示边界信息
|
||||
var paths = builder.GetBoundaryPaths();
|
||||
if (paths.Count > 0)
|
||||
{
|
||||
EditorGUILayout.LabelField("边界信息", EditorStyles.boldLabel);
|
||||
int total = 0;
|
||||
for (int i = 0; i < paths.Count; i++)
|
||||
{
|
||||
int count = paths[i].Count;
|
||||
total += count;
|
||||
EditorGUILayout.LabelField($" 路径 {i}: {count} 个点");
|
||||
}
|
||||
EditorGUILayout.LabelField($" 合计: {paths.Count} 条路径, {total} 个点");
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(
|
||||
"未检测到边界数据。\n" +
|
||||
"请指定 groundSprite(地面 SpriteRenderer)或 polygonCollider。",
|
||||
MessageType.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f4a22b278b94f918a6884f8dc26b9ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user