|
@@ -968,8 +968,7 @@ public class GameMapEditor : EditorWindow
|
|
|
duration = EditorGUILayout.IntField("下一波时间", layer.duration);
|
|
duration = EditorGUILayout.IntField("下一波时间", layer.duration);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- List<SpawnTime> spawnTimes = layer.spawnTimes;
|
|
|
|
|
- List<SpawnTime> newSpawnTimes = new List<SpawnTime>();
|
|
|
|
|
|
|
+ List<SpawnTime> newSpawnTimes = new List<SpawnTime>(layer.spawnTimes);
|
|
|
EditorGUILayout.BeginVertical("box");
|
|
EditorGUILayout.BeginVertical("box");
|
|
|
{
|
|
{
|
|
|
EditorGUILayout.LabelField("Spawn Times", EditorStyles.boldLabel);
|
|
EditorGUILayout.LabelField("Spawn Times", EditorStyles.boldLabel);
|
|
@@ -995,38 +994,6 @@ public class GameMapEditor : EditorWindow
|
|
|
newSpawnTimes.Add(spawnTime);
|
|
newSpawnTimes.Add(spawnTime);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- for (int i = 0; i < spawnTimes.Count; i++)
|
|
|
|
|
- {
|
|
|
|
|
- SpawnTime spawnTime = spawnTimes[i];
|
|
|
|
|
- if (newSpawnTimes.Exists(x => x.id == spawnTime.id))
|
|
|
|
|
- {
|
|
|
|
|
- SpawnTime newSpawnTime = newSpawnTimes.First(x => x.id == spawnTime.id);
|
|
|
|
|
- spawnTime.id = newSpawnTime.id;
|
|
|
|
|
- spawnTime.pos = newSpawnTime.pos;
|
|
|
|
|
-
|
|
|
|
|
- EditorGUILayout.LabelField($"{asset.tileAsset.GetTile(spawnTime.id).name} - {spawnTime.pos.Count}", EditorStyles.boldLabel);
|
|
|
|
|
- spawnTime.startTime = EditorGUILayout.IntField("Start Time", spawnTime.startTime);
|
|
|
|
|
- spawnTime.endTime = EditorGUILayout.IntField("End Time", spawnTime.endTime);
|
|
|
|
|
- spawnTime.num = EditorGUILayout.IntField("Number", spawnTime.num);
|
|
|
|
|
- spawnTimes[i] = spawnTime;
|
|
|
|
|
- if (GUILayout.Button("Remove"))
|
|
|
|
|
- {
|
|
|
|
|
- for (int j = 0; j < spawnTime.pos.Count; j++)
|
|
|
|
|
- {
|
|
|
|
|
- layer.grid[spawnTime.pos[j]] = -1;
|
|
|
|
|
- }
|
|
|
|
|
- spawnTimes.RemoveAt(i);
|
|
|
|
|
- i--;
|
|
|
|
|
- }
|
|
|
|
|
- newSpawnTimes.Remove(newSpawnTime);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- spawnTimes.RemoveAt(i);
|
|
|
|
|
- i--;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
if (newSpawnTimes.Count >= 1)
|
|
if (newSpawnTimes.Count >= 1)
|
|
|
{
|
|
{
|
|
|
for(int i = 0; i < newSpawnTimes.Count; i++)
|
|
for(int i = 0; i < newSpawnTimes.Count; i++)
|
|
@@ -1038,20 +1005,13 @@ public class GameMapEditor : EditorWindow
|
|
|
newSpawnTime.endTime = EditorGUILayout.IntField("End Time", newSpawnTime.endTime);
|
|
newSpawnTime.endTime = EditorGUILayout.IntField("End Time", newSpawnTime.endTime);
|
|
|
newSpawnTime.num = EditorGUILayout.IntField("Number", newSpawnTime.num);
|
|
newSpawnTime.num = EditorGUILayout.IntField("Number", newSpawnTime.num);
|
|
|
|
|
|
|
|
- bool isRemove = false;
|
|
|
|
|
if (GUILayout.Button("Remove"))
|
|
if (GUILayout.Button("Remove"))
|
|
|
{
|
|
{
|
|
|
for (int j = 0; j < newSpawnTime.pos.Count; j++)
|
|
for (int j = 0; j < newSpawnTime.pos.Count; j++)
|
|
|
{
|
|
{
|
|
|
layer.grid[newSpawnTime.pos[j]] = -1;
|
|
layer.grid[newSpawnTime.pos[j]] = -1;
|
|
|
}
|
|
}
|
|
|
- isRemove = true;
|
|
|
|
|
}
|
|
}
|
|
|
- if (!isRemove)
|
|
|
|
|
- {
|
|
|
|
|
- spawnTimes.Add(newSpawnTime);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1075,8 +1035,7 @@ public class GameMapEditor : EditorWindow
|
|
|
layer.buildingId = buildingId;
|
|
layer.buildingId = buildingId;
|
|
|
layer.buildingHp = buildingHp;
|
|
layer.buildingHp = buildingHp;
|
|
|
layer.isTowerWave = isTowerWave;
|
|
layer.isTowerWave = isTowerWave;
|
|
|
- layer.spawnTimes = spawnTimes;
|
|
|
|
|
- EditorUtility.SetDirty(asset);
|
|
|
|
|
|
|
+ layer.spawnTimes = newSpawnTimes;
|
|
|
AssetDatabase.SaveAssets();
|
|
AssetDatabase.SaveAssets();
|
|
|
}
|
|
}
|
|
|
// 标记资源为脏数据,以便保存更改
|
|
// 标记资源为脏数据,以便保存更改
|