完善刷怪点Scene显示

This commit is contained in:
sin365 2023-08-09 20:17:37 +08:00
parent 78449200c3
commit 6952473feb
4 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,41 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(MapSpawnShow))]
public class MapSpawnShowGizmos : Editor
{
GUIStyle _style = null;
void OnSceneGUI()
{
if (!((MapSpawnShow)target).mapMonsterCfg)
return;
MapMonsterCfg mapMonsterCfg = ((MapSpawnShow)target).mapMonsterCfg;
//if (_style == null)
{
_style = new GUIStyle("Command")
{
fontSize = 12,
alignment = TextAnchor.MiddleCenter,
imagePosition = ImagePosition.ImageAbove,
fontStyle = FontStyle.Normal,
fixedWidth = 100,
fixedHeight = 60
};
}
float width = HandleUtility.GetHandleSize(Vector3.zero) * 0.5f;
string Msg = "";
foreach (var step in mapMonsterCfg.StepList)
{
foreach (var point in step.SpawnPoints)
{
Msg = $"Ë¢¹Öµã \n {point.SpawnPointID}¹ÖÎïID:{point.MonsterCfgID} \n ÊýÁ¿ {point.MonsterCount} \n ×ø±ê {point.Pos}";
Handles.Label(point.Pos, Msg, _style);
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eed6600572a1ca24e92e60ee7614f567
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,6 @@
using UnityEditor;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
public class MapSpawnTool : EditorWindow
{
@ -177,7 +178,7 @@ public class MapSpawnTool : EditorWindow
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
ShowSpanText();
}
void OpenAssetPath()
@ -194,4 +195,12 @@ public class MapSpawnTool : EditorWindow
GUIStyle _style = null;
void ShowSpanText()
{
}
}

View File

@ -15,7 +15,7 @@ public class MapSpawnShow : MonoBehaviour
{
Gizmos.color = Color.green;
Gizmos.DrawCube(point.Pos, new Vector3(0.5f, 0.5f, 0.5f));
Gizmos.DrawIcon(point.Pos, "myicon.png");
//Gizmos.DrawIcon(point.Pos, "myicon.png");
}
}