Pārlūkot izejas kodu

表格怪物和波次顺序填写有误会弹窗相应错误提示

wgl 5 mēneši atpakaļ
vecāks
revīzija
46b3a4e5d1

+ 23 - 3
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/Editor/GameMapEdPopup.cs

@@ -265,6 +265,21 @@ public class GameMapEdPopup : PopupWindowContent
 			}
 			if(mapId == mapIdx - 1)
             {
+				if(cfgCreateEnemy[i-1].WaveID == -1)
+                {
+					if(cfgCreateEnemy[i].WaveID != 1)
+                    {
+						EditorUtility.DisplayDialog("Error", $"\"{excelWorksheets[mapIdx - 1]}\"关卡第\"{cfgCreateEnemy[i].WaveID}\"波顺序有误", "OK");
+					}
+                }
+                else
+                {
+					if(cfgCreateEnemy[i].WaveID - cfgCreateEnemy[i-1].WaveID > 1 
+						|| cfgCreateEnemy[i].WaveID < cfgCreateEnemy[i - 1].WaveID)
+                    {
+						EditorUtility.DisplayDialog("Error", $"\"{excelWorksheets[mapIdx - 1]}\"关卡第\"{cfgCreateEnemy[i].WaveID}\"波顺序有误", "OK");
+					}
+                }
 				if(cfgCreateEnemy[i].WaveID > gameMap.layers.Length)
                 {
 					//波次第一行的波次数据
@@ -280,12 +295,12 @@ public class GameMapEdPopup : PopupWindowContent
 					gameMapLayer.attack = singleCreateEnemyConfig.AttackRatio;
 
 					//波次第一行怪物数据
-					ReloadEnemyInWave(gameMapLayer, cfgCreateEnemy[i]);
+					ReloadEnemyInWave(gameMapLayer, cfgCreateEnemy[i],excelWorksheets[mapIdx - 1]);
 				}
                 else
                 {
 					GameMapLayer gameMapLayer = gameMap.layers[gameMap.layers.Length - 1];
-					ReloadEnemyInWave(gameMapLayer, cfgCreateEnemy[i]);
+					ReloadEnemyInWave(gameMapLayer, cfgCreateEnemy[i], excelWorksheets[mapIdx - 1]);
 				}
 			}
             else
@@ -303,8 +318,13 @@ public class GameMapEdPopup : PopupWindowContent
 	}
 
 
-	public void ReloadEnemyInWave(GameMapLayer layer, SingleCreateEnemyConfig cfgData)
+	public void ReloadEnemyInWave(GameMapLayer layer, SingleCreateEnemyConfig cfgData, string SheetName)
     {
+		if (cfgData.EnemyName == "")
+		{
+			EditorUtility.DisplayDialog("Error", $"\"{SheetName}\"关卡\"{layer.name}\"波次中有怪物名称为空", "OK");
+			return;
+		}
 		int spawnTimeId = layer.spawnTimes.FindIndex(x => GameMapEditor.asset.tileAsset.GetTile(x.id).name == cfgData.EnemyName);
 		if (layer.spawnTimes.Count == 0 || spawnTimeId == -1)
         {