This commit is contained in:
tangbin
2025-06-22 18:23:47 +08:00
parent 1cb6dc502f
commit b1c9facf3e
9 changed files with 297 additions and 22 deletions

View File

@@ -418,7 +418,7 @@ public partial class MapManager : MonoBehaviour
public void RemoveSpecialPoint(EditCellType cellType, int idx = 0)
{
Transform parentArea = mapAreaParent;
string cellName = string.Empty;
switch (cellType)
{
@@ -436,6 +436,7 @@ public partial class MapManager : MonoBehaviour
break;
case EditCellType.ReliveCell:
cellName = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curReliveCenterPoint.areaIdx}";
parentArea = mapReliveArea;
break;
case EditCellType.AudioTrigger:
cellName = $"<22><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>{_curAudioTriggerCenterPoint.areaIdx}";
@@ -448,6 +449,7 @@ public partial class MapManager : MonoBehaviour
break;
case EditCellType.MonsterArea:
cellName = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curMonsterPoint.areaIdx}";
parentArea = mapMonsterArea;
break;
case EditCellType.FuBenArea:
cellName = $"<22><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>{_curFuBenPoint.areaIdx}";
@@ -465,9 +467,9 @@ public partial class MapManager : MonoBehaviour
return;
}
if (mapAreaParent.Find(cellName))
if (parentArea.Find(cellName))
{
DestroyImmediate(mapAreaParent.Find(cellName).gameObject);
DestroyImmediate(parentArea.Find(cellName).gameObject);
}
}
public void CreateSpecialPoint(int x, int y, EditCellType cellType)
@@ -475,6 +477,7 @@ public partial class MapManager : MonoBehaviour
if (_curOpenMapId <= 0)
return;
UnityEngine.Object obj = null;
Transform parentArea = mapAreaParent;
if (cellType < EditCellType.AudioTrigger)
obj = null;
else if (cellType == EditCellType.AudioTrigger)
@@ -482,14 +485,19 @@ public partial class MapManager : MonoBehaviour
else if (cellType == EditCellType.TriggerCell)
obj = Resources.Load("Prefabs/triggerCenterPoint");
else if (cellType == EditCellType.ReliveCell)
{
obj = Resources.Load("Prefabs/reliveCenterPoint");
parentArea = mapReliveArea;
}
else if (cellType == EditCellType.MonsterArea)
{
obj = Resources.Load("Prefabs/monsterPoint");
parentArea = mapMonsterArea;
}
else if (cellType == EditCellType.FuBenArea)
obj = Resources.Load("Prefabs/fubenPoint");
else if (cellType == EditCellType.JuBaoArea)
obj = Resources.Load("Prefabs/jubaoPoint");
if (obj == null)
{
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>cell.prefabʧ<62><CAA7>");
@@ -530,6 +538,7 @@ public partial class MapManager : MonoBehaviour
case EditCellType.MonsterArea:
cellName = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curMonsterPoint.areaIdx}";
Idx = _curMonsterPoint.areaIdx;
if (Idx < 0) return;
break;
case EditCellType.FuBenArea:
cellName = $"<22><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>{_curFuBenPoint.areaIdx}";
@@ -550,14 +559,14 @@ public partial class MapManager : MonoBehaviour
}
GameObject go = null;
if (mapAreaParent.Find(cellName))
if (parentArea.Find(cellName))
{
go = mapAreaParent.Find(cellName).gameObject;
go = parentArea.Find(cellName).gameObject;
}
else
{
go = Instantiate(obj) as GameObject;
go.transform.SetParent(mapAreaParent, false);
go.transform.SetParent(parentArea, false);
}
var sceneArea = go.GetComponent<SceneArea>();
sceneArea.SetSceneAreaData(cellType, Idx);