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);

View File

@@ -26,6 +26,10 @@ public partial class MapManager : MonoBehaviour
public Transform mapGridParent;
public Transform mapAreaParent;
public Transform mapMonsterArea;
public Transform mapNPCArea;
public Transform mapTeleportArea;
public Transform mapReliveArea;
public Dictionary<string, (int maxRow, int maxCol)> allMaps = new Dictionary<string, (int maxRow, int maxCol)>();
/// <summary>

View File

@@ -10,6 +10,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.UIElements;
public partial class MapManager : MonoBehaviour
{
@@ -132,6 +133,23 @@ public partial class MapManager : MonoBehaviour
{
if (_curOpenMapId <= 0)
return;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
foreach (Transform child in mapMonsterArea)
{
Destroy(child.gameObject);
}
foreach (Transform child in mapNPCArea)
{
Destroy(child.gameObject);
}
foreach (Transform child in mapTeleportArea)
{
Destroy(child.gameObject);
}
foreach (Transform child in mapReliveArea)
{
Destroy(child.gameObject);
}
UIWindow.Instance.uiCellInfo.CloseMap();
UIWindow.Instance.uiMonstersPanel.RemoveAll();
ClearMapRegions();

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static MapManager;
using static UnityEditor.PlayerSettings;
public class SceneArea : MonoBehaviour
{
@@ -18,12 +19,24 @@ public class SceneArea : MonoBehaviour
public void OnPointerClick()
{
Debug.Log($"ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
switch (editCellType)
{
case EditCellType.MonsterArea:
UIWindow.Instance.uiMonstersPanel.SelectMonsterPos(Idx);
break;
}
}
public void OnPointerDrag(Vector3 mousePosition)
{
Vector2Int pos = MapManager.Instance.map.selector.GetMouseByCell();
SetAreaPos(pos);
switch (editCellType)
{
case EditCellType.MonsterArea:
UIWindow.Instance.uiMonstersPanel.UpdateMonsterPos(Idx,pos);
break;
}
}
public void OnPointerUp()