Procházet zdrojové kódy

再次更新一版波次编辑器

wgl před 7 měsíci
rodič
revize
990e856c5e

+ 24 - 3
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/Editor/GameMapEditor.cs

@@ -713,7 +713,16 @@ public class GameMapEditor : EditorWindow
 				if (GUI.Button(r, GC_rem, EditorStyles.miniButtonRight))
 				{
 					Undo.RecordObject(asset, "Remove Layer");
+					foreach (GameMapTile tile in asset.tileAsset.tiles)
+					{
+						if (mapIdx<tile.spawnTime.Count && tile.spawnTime[mapIdx].curLayer == asset.maps[mapIdx].layers[currLayer].name)
+						{
+							tile.spawnTime.RemoveAt(mapIdx);
+						}
+
+					}
 					ArrayUtility.RemoveAt(ref asset.maps[mapIdx].layers, currLayer);
+
 					EditorUtility.SetDirty(asset);
 					currLayer--;
 					doRepaint = true;
@@ -722,9 +731,14 @@ public class GameMapEditor : EditorWindow
 				GUI.enabled = true;
 				if (GUI.Button(r, GC_add, EditorStyles.miniButtonLeft))
 				{
+
 					Undo.RecordObject(asset, "Add Layer");
 					ArrayUtility.Add(ref asset.maps[mapIdx].layers, new GameMapLayer());
 					asset.maps[mapIdx].InitLayer(asset.maps[mapIdx].layers.Length);
+					foreach (GameMapTile tile in asset.tileAsset.tiles)
+					{
+						tile.spawnTime.Add(new SpawnTimeList());
+					}
 					EditorUtility.SetDirty(asset);
 					doRepaint = true;
 				}
@@ -769,7 +783,7 @@ public class GameMapEditor : EditorWindow
 			layerHidden[idx + 1] = !GUILayout.Toggle(!layerHidden[idx + 1], GC_Viz, EditorStyles.miniButton, GUILayout.Width(25));
 
 			// 选择图层
-			if (GUILayout.Toggle((idx == currLayer), asset.maps[mapIdx].layers[idx].id.ToString(), EditorStyles.miniButton))
+			if (GUILayout.Toggle((idx == currLayer), asset.maps[mapIdx].layers[idx].name, EditorStyles.miniButton))
 			{
 				currLayer = idx;
 				doRepaint = true; // 触发重绘以显示图层信息
@@ -819,7 +833,8 @@ public class GameMapEditor : EditorWindow
 
 		// 显示并编辑图层名称
 		EditorGUI.BeginChangeCheck();
-		int addId = EditorGUILayout.IntField("Id", layer.id);
+		string addName = EditorGUILayout.TextField("Name", layer.name);
+		
 		int duration = EditorGUILayout.IntField("Duration", layer.duration);
 		float addHp = EditorGUILayout.FloatField("Hp", layer.Hp);
 		float addMoveSpeed = EditorGUILayout.FloatField("MoveSpeed", layer.moveSpeed);
@@ -827,7 +842,13 @@ public class GameMapEditor : EditorWindow
 		if (EditorGUI.EndChangeCheck())
 		{
 			Undo.RecordObject(asset, "Change Layer Information");
-			layer.id = addId;
+			foreach (GameMapTile tile in asset.tileAsset.tiles)
+			{
+				SpawnTimeList spawnTimeList = tile.spawnTime[currLayer];
+				spawnTimeList.curLayer = addName;
+				tile.spawnTime[currLayer] = spawnTimeList;
+			}
+			layer.name = addName;
 			layer.duration = duration;
 			layer.Hp = addHp;
 			layer.moveSpeed = addMoveSpeed;

+ 1 - 1
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapLayer.cs

@@ -12,7 +12,7 @@ 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 int duration;
-	public int id;
+	public string name;
 	public float Hp = 1;
 	public float moveSpeed = 1;
 	public float attack = 1;

+ 2 - 1
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapTile.cs

@@ -14,7 +14,8 @@ public struct SpawnTime
 [Serializable]
 public struct SpawnTimeList
 {
-	public int curLayer;
+	[HideInInspector]
+	public string curLayer;
 	public SpawnTime[] spawnTimes;
 }
 

+ 1 - 1
ActionTowerDefense/Assets/GameLevelEditor/GameMap/Sample/Scripts/Main.cs

@@ -178,7 +178,7 @@ public class Main : MonoBehaviour
 						buttonTest.AddSwimLane(t);
 						foreach(SpawnTimeList spawnTimes in t.spawnTime)
                         {
-							if(spawnTimes.curLayer == map.layers[i - 1].id)
+							if(spawnTimes.curLayer == map.layers[i - 1].name)
                             {
 								for (int j = 0; j < spawnTimes.spawnTimes.Length; j++)
 								{

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
ActionTowerDefense/Assets/GameLevelEditor/maps.asset


+ 62 - 282
ActionTowerDefense/Assets/GameLevelEditor/tiles.asset

@@ -21,7 +21,9 @@ MonoBehaviour:
     color: {r: 0.17626214, g: 1, b: 0, a: 0.39215687}
     radius: {x: 0, y: 0}
     name: "\u9632\u5FA1\u5854"
-    spawnTime: []
+    spawnTime:
+    - curLayer: 111
+      spawnTimes: []
     index: -1
     hasOut: 0
     parameter:
@@ -38,7 +40,15 @@ MonoBehaviour:
     color: {r: 1, g: 0, b: 0, a: 0.39215687}
     radius: {x: 0, y: 0}
     name: "\u654C\u65B9\u9632\u5FA1\u5854"
-    spawnTime: []
+    spawnTime:
+    - curLayer: 111
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
     index: -1
     hasOut: 1
     parameter:
@@ -56,7 +66,7 @@ MonoBehaviour:
     radius: {x: 1, y: 1}
     name: "\u5C0F\u732A"
     spawnTime:
-    - curLayer: 2
+    - curLayer: 111
       spawnTimes:
       - startTime: 3
         endTime: 5
@@ -66,6 +76,20 @@ MonoBehaviour:
       - startTime: 3
         endTime: 5
         num: 2
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
     index: -1
     hasOut: 1
     parameter:
@@ -83,7 +107,21 @@ MonoBehaviour:
     radius: {x: 1, y: 2}
     name: "\u9053\u58EB"
     spawnTime:
-    - curLayer: 0
+    - curLayer: 111
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
       spawnTimes: []
     index: -1
     hasOut: 1
@@ -101,7 +139,15 @@ MonoBehaviour:
     color: {r: 1, g: 1, b: 1, a: 1}
     radius: {x: 2, y: 1}
     name: "\u80D6\u5B50"
-    spawnTime: []
+    spawnTime:
+    - curLayer: 111
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
     index: -1
     hasOut: 0
     parameter:
@@ -118,7 +164,15 @@ MonoBehaviour:
     color: {r: 0.1495924, g: 1, b: 0, a: 1}
     radius: {x: 2, y: 2}
     name: "\u5F13\u7BAD\u624B2"
-    spawnTime: []
+    spawnTime:
+    - curLayer: 111
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
+    - curLayer: 
+      spawnTimes: []
     index: -1
     hasOut: 0
     parameter:
@@ -127,280 +181,6 @@ MonoBehaviour:
       MaxMoveSpeed: 0
       Attack_summon: 0
       Attack_march: 0
-  autoTiles:
-  - id: 1
-    tiles:
-    - id: 31
-      sprite: {fileID: 21300094, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 32
-      sprite: {fileID: 21300086, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 33
-      sprite: {fileID: 21300092, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 34
-      sprite: {fileID: 21300084, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 35
-      sprite: {fileID: 21300088, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 36
-      sprite: {fileID: 21300008, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 37
-      sprite: {fileID: 21300090, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 38
-      sprite: {fileID: 21300010, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 39
-      sprite: {fileID: 21300004, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 40
-      sprite: {fileID: 21300082, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 41
-      sprite: {fileID: 21300076, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 42
-      sprite: {fileID: 21300080, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 43
-      sprite: {fileID: 21300000, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 44
-      sprite: {fileID: 21300078, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 45
-      sprite: {fileID: 21300002, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
-    - id: 46
-      sprite: {fileID: 21300006, guid: 40d48dc34acd41044a366ee03841e848, type: 3}
-      _aid: 1
-      type: 3
-      ch: 0
-      color: {r: 1, g: 1, b: 1, a: 1}
-      radius: {x: 0, y: 0}
-      name: 
-      spawnTime: []
-      index: 0
-      hasOut: 0
-      parameter:
-        HP: 0
-        MinMoveSpeed: 0
-        MaxMoveSpeed: 0
-        Attack_summon: 0
-        Attack_march: 0
+  autoTiles: []
   nextTileId: 169
-  nextAutoTileId: 7
+  nextAutoTileId: 1

+ 1 - 1
ActionTowerDefense/Assets/Scripts/EnemyCreater.cs

@@ -85,7 +85,7 @@ public class EnemyCreater : MonoBehaviour
                     if (t == null) continue;
                     foreach (SpawnTimeList spawnTimes in t.spawnTime)
                     {
-                        if (spawnTimes.curLayer == map.layers[i - 1].id)
+                        if (spawnTimes.curLayer == map.layers[i - 1].name)
                         {
                             for (int j = 0; j < spawnTimes.spawnTimes.Length; j++)
                             {

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů