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

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<config>
<Settings mapID="1000" />
<MonsterAreas>
<MonsterArea itemIdx="1" groupId="-1" id="0" createMode="0" patrolMode="0" indexX="72" indexY="86" radius="1" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="2" groupId="-1" id="0" createMode="0" patrolMode="0" indexX="76" indexY="85" radius="1" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="3" groupId="-1" id="0" createMode="0" patrolMode="0" indexX="74" indexY="82" radius="1" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="-1" groupId="3" id="0" createMode="0" patrolMode="0" indexX="74" indexY="82" radius="0" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="-1" groupId="3" id="0" createMode="0" patrolMode="0" indexX="74" indexY="82" radius="0" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="-1" groupId="3" id="0" createMode="0" patrolMode="0" indexX="74" indexY="82" radius="0" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
<MonsterArea itemIdx="-1" groupId="3" id="0" createMode="0" patrolMode="0" indexX="74" indexY="82" radius="0" num="0" delayTime="0" day="0" time="0">
<MonsterPaths />
</MonsterArea>
</MonsterAreas>
</config>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 521040d6d88094b428ebf8c1a0dbac02
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3037,6 +3037,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 687449961}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_IsOn: 0
--- !u!1 &154101546
GameObject:
@@ -6623,6 +6635,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1286502938}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_IsOn: 0
--- !u!1 &350730894
GameObject:
@@ -10201,7 +10225,11 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 1287609758}
- {fileID: 687449962}
- {fileID: 1286502939}
- {fileID: 655392906}
m_Father: {fileID: 841691708}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &523688423
@@ -12788,6 +12816,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 654655632}
m_CullTransparentMesh: 1
--- !u!1 &655392905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 655392906}
m_Layer: 9
m_Name: ReliveArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &655392906
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 655392905}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 519310460}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &673641485
GameObject:
m_ObjectHideFlags: 0
@@ -13013,6 +13072,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 676414811}
m_CullTransparentMesh: 1
--- !u!1 &687449961
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 687449962}
m_Layer: 9
m_Name: NpcArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &687449962
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 687449961}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 519310460}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &694870550
GameObject:
m_ObjectHideFlags: 0
@@ -16559,12 +16649,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b7cce2a4c6c6cc14f876c47961979fb5, type: 3}
m_Name:
m_EditorClassIdentifier:
isDragging: 0
downPos: {x: 0, y: 0, z: 0}
currentComponent: {fileID: 0}
mapWidth: 0
mapHeight: 0
_curOpenMapId: 0
mapRegionParent: {fileID: 782149589}
mapGridParent: {fileID: 504155531}
mapAreaParent: {fileID: 519310460}
mapMonsterArea: {fileID: 1287609758}
mapNPCArea: {fileID: 687449962}
mapTeleportArea: {fileID: 1286502939}
mapReliveArea: {fileID: 655392906}
_curMapRegions:
regionRowNum: 0
regionColNum: 0
@@ -23935,6 +24032,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1283425210}
m_CullTransparentMesh: 1
--- !u!1 &1286502938
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1286502939}
m_Layer: 9
m_Name: TeleportArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1286502939
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1286502938}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 519310460}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1287609757
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1287609758}
m_Layer: 9
m_Name: MonsterArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1287609758
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1287609757}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 519310460}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1290605789
GameObject:
m_ObjectHideFlags: 0
@@ -24984,7 +25143,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1325607736
RectTransform:
m_ObjectHideFlags: 0
@@ -30459,6 +30618,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1287609757}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_IsOn: 0
--- !u!1 &1615225086
GameObject:
@@ -34973,6 +35144,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 655392905}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_IsOn: 0
--- !u!1 &1825064713
GameObject:
@@ -38941,10 +39124,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 16fab2e09ef3ffa4582b982dc9775080, type: 3}
m_Name:
m_EditorClassIdentifier:
curActiveInput: {fileID: 0}
curActiveList: []
itemParent: {fileID: 1454471842}
btnAdd: {fileID: 1644398427}
--- !u!1 &2007759514
GameObject:
m_ObjectHideFlags: 0

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

View File

@@ -78,7 +78,11 @@ public class UIMonsterItem : MonoBehaviour
MapManager.Instance.CreateSpecialPoint(monster.pos.x, monster.pos.y, MapManager.EditCellType.MonsterArea);
MapManager.Instance.SetCurMonsterPathIdx(pathIdx);
}
public void RefreshPos(Vector2Int newPos)
{
monster.pos = newPos;
txtPos.text = newPos.ToString() ;
}
public void RefreshItem()
{
txtMonsterID.text = monster.id.ToString();

View File

@@ -2,6 +2,7 @@ using HxGame.Data;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;
using static System.Net.Mime.MediaTypeNames;
@@ -42,13 +43,12 @@ public class UIMonsterPanel : MonoBehaviour
private UIMonsterItem _curMonsterItem;
//private Dictionary<int, List<UIMonsterItem>> _dicGroupItem;
private Dictionary<int, UIMonsterItem> _dicGroupItem; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item
private Dictionary<int, UIMonsterItem> _dicGroupItem = new(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item
private Dictionary<int, UIMonsterItem> _dicAllItem = new(); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>item
private void Awake()
{
itemIdx = 0;
//_dicGroupItem = new Dictionary<int, List<UIMonsterItem>>();
_dicGroupItem = new Dictionary<int, UIMonsterItem>();
btnClose.onClick.AddListener(OnClickClose);
btnAddGroup.onClick.AddListener(OnAddGroup);
btnDeleteGroup.onClick.AddListener(OnDeleteGroup);
@@ -145,8 +145,6 @@ public class UIMonsterPanel : MonoBehaviour
item.OnClick = OnClickItem;
item.OnCopyItem = OnCopyItem;
item.btnClickSelf.Select();
AddGroupMap(_curMonsterItem.monster.itemIdx, _curMonsterItem);
}
@@ -184,7 +182,7 @@ public class UIMonsterPanel : MonoBehaviour
_curMonsterItem.transform.parent.GetComponent<RectTransform>().sizeDelta -= Vector2Int.up * 30;
DestroyImmediate(_curMonsterItem.gameObject);
MapManager.Instance.RemoveMonsterPoint(_curMonsterItem.monster.itemIdx);
_curMonsterItem = null;
}
@@ -197,7 +195,6 @@ public class UIMonsterPanel : MonoBehaviour
UIWindow.Instance.ShowMessage("monsterItem.prefabʧ<62><CAA7>");
return;
}
GameObject go = Instantiate(obj) as GameObject; ;
go.transform.SetParent(itemParent, false);
UIMonsterItem item = go.transform.Find("monsterSubItem").GetComponent<UIMonsterItem>();
@@ -213,6 +210,7 @@ public class UIMonsterPanel : MonoBehaviour
item.OnCopyItem = OnCopyItem;
_curMonsterItem = item;
item.btnClickSelf.Select();
_dicAllItem.Add(monster.itemIdx, item);
}
public void LoadMonsterConfig(int mapId)
@@ -254,6 +252,7 @@ public class UIMonsterPanel : MonoBehaviour
item.OnClick = OnClickItem;
item.OnCopyItem = OnCopyItem;
_curMonsterItem = item;
_dicAllItem.Add(monster.itemIdx, item);
}
private void SaveItem()
@@ -440,8 +439,23 @@ public class UIMonsterPanel : MonoBehaviour
{
DestroyImmediate(itemParent.GetChild(0).gameObject);
}
_dicGroupItem?.Clear();
_dicAllItem?.Clear();
itemIdx = 0;
}
public void SelectMonsterPos(int Idx)
{
if (_dicAllItem.TryGetValue(Idx, out var monsterItem))
{
monsterItem.btnClickSelf.Select();
}
}
public void UpdateMonsterPos(int Idx, Vector2Int newPos)
{
if (_dicAllItem.TryGetValue(Idx, out var monsterItem))
{
monsterItem.RefreshPos(newPos);
monsterItem.btnClickSelf.Select();
}
}
}