Browse Source

图层数据显示,修复切换顺序bug

wgl 7 months ago
parent
commit
7c39ac9e38

+ 14 - 8
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/Editor/GameMapEditor.cs

@@ -815,22 +815,28 @@ public class GameMapEditor : EditorWindow
 
 	private void DrawLayerInfo(GameMapLayer layer)
 	{
-		EditorGUILayout.LabelField("Layer Information", EditorStyles.boldLabel);
+		EditorGUILayout.LabelField("Wave Information", EditorStyles.boldLabel);
 
-		// 显示图层名称
+		// 显示并编辑图层名称
 		EditorGUI.BeginChangeCheck();
-		string layerName = EditorGUILayout.TextField("Name", layer.name);
+		string addName = EditorGUILayout.TextField("Name", layer.name);
+		float addHp = EditorGUILayout.FloatField("Hp", layer.Hp);
+		float addMoveSpeed = EditorGUILayout.FloatField("MoveSpeed", layer.moveSpeed);
+		float addAttack = EditorGUILayout.FloatField("Attack", layer.attack);
 		if (EditorGUI.EndChangeCheck())
 		{
-			Undo.RecordObject(asset, "Change Layer Name");
-			layer.name = layerName;
+			Undo.RecordObject(asset, "Change Layer Information");
+			layer.name = addName;
+			layer.Hp = addHp;
+			layer.moveSpeed = addMoveSpeed;
+			layer.attack = addAttack;
 			EditorUtility.SetDirty(asset);
 		}
 
 		// 显示其他图层信息(根据需求扩展)
-		EditorGUILayout.LabelField("Other Properties:");
-		EditorGUILayout.LabelField($"Grid Size: {layer.gridSize}");
-		EditorGUILayout.LabelField($"Is Visible: {layer.isVisible}");
+		//EditorGUILayout.LabelField("Other Properties:");
+		//EditorGUILayout.LabelField($"Grid Size: {layer.gridSize}");
+		//EditorGUILayout.LabelField($"Is Visible: {layer.isVisible}");
 	}
 
 	private void DrawTileProperties(Event ev)

+ 3 - 2
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapLayer.cs

@@ -12,8 +12,9 @@ public class GameMapLayer
 	/// <summary> The layer's grid of tile values. -1 is an empty tile, else a value related to GameMapTile.id will be present </summary>
 	public int[] grid = new int[0];
 	public string name;
-	public int gridSize;
-	public bool isVisible;
+	public float Hp;
+	public float moveSpeed;
+	public float attack;
 
 
 	// ----------------------------------------------------------------------------------------------------------------