彻底换一下
This commit is contained in:
@@ -50,6 +50,13 @@ public partial class MapManager : MonoBehaviour
|
||||
public int num; //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
public struct NpcPoint
|
||||
{
|
||||
public int areaIdx;
|
||||
public int id;
|
||||
public int dir;
|
||||
}
|
||||
|
||||
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ɵĵ<C9B5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
private List<string> _activeTerrainCells = new List<string>();
|
||||
private const int IGNORECELLSIZE = 15;
|
||||
@@ -67,10 +74,6 @@ public partial class MapManager : MonoBehaviour
|
||||
private int _triggerPointSize = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
private int _curTriggerPointIdx = 0; //<2F><>ǰ<EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//npc·<63><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>map
|
||||
private Dictionary<int, int> _dicNpcPathPointSize = new Dictionary<int, int>();
|
||||
//<2F><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>map
|
||||
private Dictionary<int, int> _dicMonsterPathPointSize = new Dictionary<int, int>();
|
||||
|
||||
private CenterPoint _curAudioTriggerCenterPoint = new CenterPoint(); //<2F><>ǰ<EFBFBD>༭<EFBFBD><E0BCAD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
private TriggerPoint _curTriggerCenterPoint = new TriggerPoint(); //<2F><>ǰ<EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -79,7 +82,7 @@ public partial class MapManager : MonoBehaviour
|
||||
private MonsterPoint _curMonsterPoint = new MonsterPoint(); //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
private MonsterPoint _curFuBenPoint = new MonsterPoint(); //<2F><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
private MonsterPoint _curJuBaoPoint = new MonsterPoint(); //<2F>۱<EFBFBD><DBB1><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
private NpcPoint _curNpcPoint = new NpcPoint(); //Npc<70><63><EFBFBD><EFBFBD>
|
||||
public CellNode[] cellsNode;
|
||||
|
||||
private Dictionary<CellType, List<GameObject>> _layCellsMap = new Dictionary<CellType, List<GameObject>>();
|
||||
@@ -110,17 +113,6 @@ public partial class MapManager : MonoBehaviour
|
||||
{
|
||||
return ++_npcPointSize;
|
||||
}
|
||||
public void RemoveNpcPointSize(int idx)
|
||||
{
|
||||
_curNpcPointIdx = idx;
|
||||
RemoveSpecialPoint(EditCellType.NpcCell);
|
||||
//<2F><>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>npc·<63><C2B7>
|
||||
int size = _dicNpcPathPointSize[_curNpcPointIdx];
|
||||
for (int i = 1; i <= size; i++)
|
||||
{
|
||||
RemoveSpecialPoint(EditCellType.NpcPath, i);
|
||||
}
|
||||
}
|
||||
public void SetCurNpcPointIdx(int idx)
|
||||
{
|
||||
_curNpcPointIdx = idx;
|
||||
@@ -219,19 +211,17 @@ public partial class MapManager : MonoBehaviour
|
||||
_curMonsterPoint.num = num;
|
||||
}
|
||||
|
||||
public void SetNpcPoint(int idx,int id,int dir)
|
||||
{
|
||||
_curNpcPoint.areaIdx= idx;
|
||||
_curNpcPoint.id = id;
|
||||
_curNpcPoint.dir = dir;
|
||||
}
|
||||
|
||||
public void RemoveMonsterPoint(int idx)
|
||||
{
|
||||
_curMonsterPoint.areaIdx = idx;
|
||||
RemoveSpecialPoint(EditCellType.MonsterArea);
|
||||
//<2F><>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>npc·<63><C2B7>
|
||||
if (!_dicMonsterPathPointSize.ContainsKey(_curMonsterPoint.areaIdx))
|
||||
return;
|
||||
|
||||
int size = _dicMonsterPathPointSize[_curMonsterPoint.areaIdx];
|
||||
for (int i = 1; i <= size; i++)
|
||||
{
|
||||
RemoveSpecialPoint(EditCellType.MonsterPath, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowMonsterPoint(int idx)
|
||||
@@ -270,53 +260,6 @@ public partial class MapManager : MonoBehaviour
|
||||
t.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
//npcѲ<63><D1B2>·<EFBFBD><C2B7>
|
||||
public int AddNpcPathSize()
|
||||
{
|
||||
if (!_dicNpcPathPointSize.ContainsKey(_curNpcPointIdx))
|
||||
return 1;
|
||||
|
||||
return _dicNpcPathPointSize[_curNpcPointIdx]++;
|
||||
}
|
||||
public void SetCurNpcPathIdx(int idx)
|
||||
{
|
||||
if (_dicNpcPathPointSize.ContainsKey(_curNpcPointIdx))
|
||||
return;
|
||||
|
||||
_dicNpcPathPointSize.Add(_curNpcPointIdx, idx);
|
||||
}
|
||||
public int GetCurNpcPathIdx()
|
||||
{
|
||||
if (!_dicNpcPathPointSize.ContainsKey(_curNpcPointIdx))
|
||||
return 0;
|
||||
|
||||
return _dicNpcPathPointSize[_curNpcPointIdx];
|
||||
}
|
||||
|
||||
//monsterѲ<72><D1B2>·<EFBFBD><C2B7>
|
||||
public int AddMonsterPathSize()
|
||||
{
|
||||
if (!_dicMonsterPathPointSize.ContainsKey(_curMonsterPoint.areaIdx))
|
||||
return 1;
|
||||
|
||||
return _dicMonsterPathPointSize[_curMonsterPoint.areaIdx]++;
|
||||
}
|
||||
public void SetCurMonsterPathIdx(int idx)
|
||||
{
|
||||
if (_dicMonsterPathPointSize.ContainsKey(_curMonsterPoint.areaIdx))
|
||||
return;
|
||||
|
||||
_dicMonsterPathPointSize.Add(_curMonsterPoint.areaIdx, idx);
|
||||
}
|
||||
public int GetCurMonsterPathIdx()
|
||||
{
|
||||
if (!_dicMonsterPathPointSize.ContainsKey(_curMonsterPoint.areaIdx))
|
||||
return 0;
|
||||
|
||||
return _dicMonsterPathPointSize[_curMonsterPoint.areaIdx];
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>
|
||||
public void SetCurFuBenCenterPoint(int idx, int radius, int id, int num)
|
||||
{
|
||||
@@ -472,129 +415,14 @@ public partial class MapManager : MonoBehaviour
|
||||
DestroyImmediate(parentArea.Find(cellName).gameObject);
|
||||
}
|
||||
}
|
||||
public void CreateSpecialPoint(int x, int y, EditCellType cellType)
|
||||
public void CreateSpecialPoint(Vector2Int pos,UIBaseItem uIBaseItem)
|
||||
{
|
||||
if (_curOpenMapId <= 0)
|
||||
return;
|
||||
UnityEngine.Object obj = null;
|
||||
Transform parentArea = mapAreaParent;
|
||||
if (cellType < EditCellType.AudioTrigger)
|
||||
obj = null;
|
||||
else if (cellType == EditCellType.AudioTrigger)
|
||||
obj = Resources.Load("Prefabs/audioTriggerCenterPoint");
|
||||
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>");
|
||||
return;
|
||||
}
|
||||
string cellName = string.Empty;
|
||||
Vector3 localScale = Vector3.zero;
|
||||
int Idx = 0;
|
||||
switch (cellType)
|
||||
{
|
||||
case EditCellType.ReturnCell:
|
||||
cellName = "<22>سǵ<D8B3>";
|
||||
break;
|
||||
case EditCellType.TeleportCell:
|
||||
cellName = $"<22><><EFBFBD>͵<EFBFBD>{_curTeleportPointIdx}";
|
||||
Idx = _curTeleportPointIdx;
|
||||
break;
|
||||
case EditCellType.NpcCell:
|
||||
cellName = $"Npc{_curNpcPointIdx}";
|
||||
Idx = _curNpcPointIdx;
|
||||
break;
|
||||
case EditCellType.PathNodeCell:
|
||||
cellName = $"PathNode{_curPathNodePointIdx}";
|
||||
Idx = _curPathNodePointIdx;
|
||||
break;
|
||||
case EditCellType.AudioTrigger:
|
||||
cellName = $"<22><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>{_curAudioTriggerCenterPoint.areaIdx}";
|
||||
Idx = _curAudioTriggerCenterPoint.areaIdx;
|
||||
break;
|
||||
case EditCellType.TriggerCell:
|
||||
cellName = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curTriggerCenterPoint.areaIdx}";
|
||||
Idx = _curTriggerCenterPoint.areaIdx;
|
||||
break;
|
||||
case EditCellType.ReliveCell:
|
||||
cellName = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curReliveCenterPoint.areaIdx}";
|
||||
Idx = _curReliveCenterPoint.areaIdx;
|
||||
break;
|
||||
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}";
|
||||
Idx = _curMonsterPoint.areaIdx;
|
||||
break;
|
||||
case EditCellType.JuBaoArea:
|
||||
cellName = $"<22>۱<EFBFBD><DBB1><EFBFBD>{_curJuBaoPoint.areaIdx}";
|
||||
Idx = _curJuBaoPoint.areaIdx;
|
||||
break;
|
||||
case EditCellType.NpcPath:
|
||||
cellName = $"NpcPath{_curNpcPointIdx}{GetCurNpcPathIdx()}";
|
||||
Idx = _curNpcPointIdx;
|
||||
break;
|
||||
case EditCellType.MonsterPath:
|
||||
cellName = $"MonsterPath{_curMonsterPoint.areaIdx}{GetCurMonsterPathIdx()}";
|
||||
Idx = _curMonsterPoint.areaIdx;
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject go = null;
|
||||
if (parentArea.Find(cellName))
|
||||
{
|
||||
go = parentArea.Find(cellName).gameObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
go = Instantiate(obj) as GameObject;
|
||||
go.transform.SetParent(parentArea, false);
|
||||
}
|
||||
var sceneArea = go.GetComponent<SceneArea>();
|
||||
sceneArea.SetSceneAreaData(cellType, Idx);
|
||||
sceneArea.SetAreaPos(new Vector2Int(x, y));
|
||||
go.name = cellName;
|
||||
if(cellType == EditCellType.MonsterArea)
|
||||
{
|
||||
go.transform.Find("Name").GetComponent<TextMeshPro>().text = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{_curMonsterPoint.areaIdx}";
|
||||
go.transform.Find("ID").GetComponent<TextMeshPro>().text = "ID:" + _curMonsterPoint.id.ToString();
|
||||
go.transform.Find("Num").GetComponent<TextMeshPro>().text = "Num:" + _curMonsterPoint.num.ToString();
|
||||
float scaleX = MapManager.Instance.map.sideWidth * _curMonsterPoint.radius * 2;
|
||||
float scaleY = MapManager.Instance.map.sideHeight * _curMonsterPoint.radius * 2;
|
||||
go.transform.localScale = new Vector3(scaleX,scaleY,1);
|
||||
}
|
||||
else if (cellType == EditCellType.FuBenArea)
|
||||
{
|
||||
go.transform.Find("Order").GetComponent<TextMeshPro>().text = _curFuBenPoint.areaIdx.ToString();
|
||||
go.transform.Find("ID").GetComponent<TextMeshPro>().text = "ID:" + _curFuBenPoint.id.ToString();
|
||||
go.transform.Find("Num").GetComponent<TextMeshPro>().text = "Num:" + _curFuBenPoint.num.ToString();
|
||||
}
|
||||
else if (cellType == EditCellType.JuBaoArea)
|
||||
{
|
||||
go.transform.Find("ID").GetComponent<TextMeshPro>().text = "ID:" + _curJuBaoPoint.id.ToString();
|
||||
}
|
||||
else if(cellType == EditCellType.TriggerCell)
|
||||
{
|
||||
go.transform.GetChild(0).GetComponent<TextMeshPro>().text = _curTriggerCenterPoint.text;
|
||||
}
|
||||
if (uIBaseItem.sceneArea != null) return;
|
||||
var sceneArea = SceneArea.CreateSceneArea(uIBaseItem);
|
||||
if (sceneArea == null) return;
|
||||
sceneArea.SetAreaPos(pos);
|
||||
}
|
||||
|
||||
public int GetLayCellCount(CellType lay)
|
||||
|
||||
Reference in New Issue
Block a user