| Lua/Gen/SnxxzUIHazyGrassModelWrap.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/DungeonFightWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HazyRegion/ClientHazyGrassStage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HazyRegion/HazyGrassDungeonWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HazyRegion/HazyGrassModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HazyRegion/HazyMapNpcScriptableObject.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HazyRegion/HazyRegionModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Lua/Gen/SnxxzUIHazyGrassModelWrap.cs
@@ -30,7 +30,6 @@ Utils.RegisterFunc(L, Utils.METHOD_IDX, "IsInGrassDungeon", _m_IsInGrassDungeon); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetClientMapId", _m_GetClientMapId); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetGrassMapId", _m_GetGrassMapId); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetGrassNpcInfos", _m_GetGrassNpcInfos); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetMapNpcCount", _m_GetMapNpcCount); Utils.RegisterFunc(L, Utils.METHOD_IDX, "CanCollectClientNpc", _m_CanCollectClientNpc); Utils.RegisterFunc(L, Utils.METHOD_IDX, "DisplayCollectErrorTip", _m_DisplayCollectErrorTip); @@ -40,11 +39,8 @@ Utils.RegisterFunc(L, Utils.METHOD_IDX, "RequestExitClientDungeon", _m_RequestExitClientDungeon); Utils.RegisterFunc(L, Utils.METHOD_IDX, "onMapNpcCountRefresh", _e_onMapNpcCountRefresh); Utils.RegisterFunc(L, Utils.METHOD_IDX, "dugeonTargetStateRefresh", _e_dugeonTargetStateRefresh); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsInDungeon", _g_get_IsInDungeon); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsDungeonTargetDone", _g_get_IsDungeonTargetDone); Utils.EndObjectRegister(type, L, translator, null, null, @@ -290,35 +286,6 @@ } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetGrassNpcInfos(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.HazyGrassModel gen_to_be_invoked = (Snxxz.UI.HazyGrassModel)translator.FastGetCSObj(L, 1); { int _mapId = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.List<Snxxz.UI.HazyGrassNpcInfo> gen_ret = gen_to_be_invoked.GetGrassNpcInfos( _mapId ); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetMapNpcCount(RealStatePtr L) { try { @@ -532,24 +499,6 @@ } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsDungeonTargetDone(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Snxxz.UI.HazyGrassModel gen_to_be_invoked = (Snxxz.UI.HazyGrassModel)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsDungeonTargetDone); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_onMapNpcCountRefresh(RealStatePtr L) { try { @@ -582,42 +531,5 @@ LuaAPI.luaL_error(L, "invalid arguments to Snxxz.UI.HazyGrassModel.onMapNpcCountRefresh!"); return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _e_dugeonTargetStateRefresh(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); Snxxz.UI.HazyGrassModel gen_to_be_invoked = (Snxxz.UI.HazyGrassModel)translator.FastGetCSObj(L, 1); System.Action gen_delegate = translator.GetDelegate<System.Action>(L, 3); if (gen_delegate == null) { return LuaAPI.luaL_error(L, "#3 need System.Action!"); } if (gen_param_count == 3) { if (LuaAPI.xlua_is_eq_str(L, 2, "+")) { gen_to_be_invoked.dugeonTargetStateRefresh += gen_delegate; return 0; } if (LuaAPI.xlua_is_eq_str(L, 2, "-")) { gen_to_be_invoked.dugeonTargetStateRefresh -= gen_delegate; return 0; } } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } LuaAPI.luaL_error(L, "invalid arguments to Snxxz.UI.HazyGrassModel.dugeonTargetStateRefresh!"); return 0; } } } System/Dungeon/DungeonFightWin.cs
@@ -81,7 +81,8 @@ var dataMapId = model.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID); m_ExitDungeon.gameObject.SetActive(dataMapId != DemonJarModel.DEMONJAR_MAPID && !CrossServerUtility.IsCrossServerOneVsOne() && !hazyDemonKingModel.IsInDungeon); && !hazyDemonKingModel.IsInDungeon && !hazyGrassModel.IsInDungeon); m_ContainerAncient.gameObject.SetActive(dataMapId == 31160); m_BossInfosContainer.gameObject.SetActive( dataMapId == ElderGodAreaModel.ELDERGODAREA_MAPID @@ -270,27 +271,6 @@ language = Language.Get(config.ExitDescription); } if (dataMapId == HazyGrassModel.FairyGrassMapId || dataMapId == HazyGrassModel.ReikiGrassMapId || dataMapId == HazyGrassModel.Client_ReikiGrassMapID) { if (hazyGrassModel.IsDungeonTargetDone) { switch (dataMapId) { case HazyGrassModel.FairyGrassMapId: case HazyGrassModel.ReikiGrassMapId: var crossServerBossModel = ModelCenter.Instance.GetModel<CrossServerBossModel>(); crossServerBossModel.RequestExit(); break; case HazyGrassModel.Client_ReikiGrassMapID: ModelCenter.Instance.GetModel<HazyGrassModel>().RequestExitClientDungeon(); break; } return; } } ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), language, @@ -301,18 +281,8 @@ switch (dataMapId) { case CrossServerBossModel.DATA_MAPID: case HazyGrassModel.FairyGrassMapId: case HazyGrassModel.ReikiGrassMapId: case HazyDemonKingModel.DEMONKINGMAPID2: var crossServerBossModel = ModelCenter.Instance.GetModel<CrossServerBossModel>(); crossServerBossModel.RequestExit(); break; case HazyDemonKingModel.Client_MapID: ModelCenter.Instance.GetModel<HazyDemonKingModel>().RequestExitClientDungeon(); break; case HazyGrassModel.Client_FairyGrassMapID: case HazyGrassModel.Client_ReikiGrassMapID: ModelCenter.Instance.GetModel<HazyGrassModel>().RequestExitClientDungeon(); break; case ClientTreasureDungeon.Client_DataMap: ClientTreasureDungeon.RequestExit(); System/HazyRegion/ClientHazyGrassStage.cs
@@ -7,17 +7,12 @@ { static readonly Vector3 PlayerBornPosition1 = new Vector3(19.401f, 4.985f, 5.494f); static List<HazyMapNpcScriptableObject.NpcInfo> s_NpcInfos = new List<HazyMapNpcScriptableObject.NpcInfo>(); static Dictionary<Vector3, GA_NpcClientCollect> s_CollectNpcs = new Dictionary<Vector3, GA_NpcClientCollect>(); static Dictionary<uint, Vector3> s_Sid2NpcPos = new Dictionary<uint, Vector3>(); static List<Vector3> s_NpcPositions = new List<Vector3>(); static Dictionary<uint, GA_NpcClientCollect> s_CollectNpcs = new Dictionary<uint, GA_NpcClientCollect>(); static Dictionary<uint, int> s_Sid2NpcIds = new Dictionary<uint, int>(); //static List<GA_NpcClientFightNorm> s_ClientFightNpcs = new List<GA_NpcClientFightNorm>(); static List<HazyGrassNpcInfo> s_NpcRefreshInfos = new List<HazyGrassNpcInfo>(); static Dictionary<int, int> s_NpcRefreshTimes = new Dictionary<int, int>(); bool mapLoadFinish = false; bool initedFightNpc = false; static Dictionary<uint, int> s_Sid2NpcIndexs = new Dictionary<uint, int>(); static Dictionary<int, int> s_NpcCounts = new Dictionary<int, int>(); HazyRegionIncidentType incidentType; @@ -28,24 +23,12 @@ { base.Initialize(); s_NpcInfos.Clear(); s_NpcPositions.Clear(); s_Sid2NpcIds.Clear(); s_Sid2NpcPos.Clear(); s_NpcRefreshTimes.Clear(); mapLoadFinish = false; initedFightNpc = false; var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId); if (config != null) { incidentType = (HazyRegionIncidentType)config.incidentType; s_NpcRefreshInfos = model.GetGrassNpcInfos(config.dungeonId); foreach (var npcInfo in s_NpcRefreshInfos) { s_NpcRefreshTimes.Add(npcInfo.npcId, GetNpcRefreshCount(npcInfo)); } } s_CollectNpcs.Clear(); s_Sid2NpcIndexs.Clear(); s_NpcCounts.Clear(); localNpcJsons.Clear(); UnloadAllNpc(); @@ -56,34 +39,8 @@ { base.OnStageLoadFinish(); mapLoadFinish = true; InitialPlayer(); InitializeNpc(); initedFightNpc = true; model.dugeonTargetStateRefresh -= DugeonTargetStateRefresh; model.dugeonTargetStateRefresh += DugeonTargetStateRefresh; } protected override void OnUpdate() { base.OnUpdate(); if (mapLoadFinish) { foreach (var npcInfo in s_NpcRefreshInfos) { var _lastCount = s_NpcRefreshTimes[npcInfo.npcId]; var count = GetNpcRefreshCount(npcInfo); if (_lastCount != count) { RebornCollectedNpc(npcInfo.npcId); s_NpcRefreshTimes[npcInfo.npcId] = count; } } } } public override void UnInitialize() @@ -93,25 +50,6 @@ UnloadAllNpc(); ClientCollectUtility.OnCollectFinished -= OnCollectFinished; model.dugeonTargetStateRefresh -= DugeonTargetStateRefresh; } private void DugeonTargetStateRefresh() { if (model.IsDungeonTargetDone) { if (!NewBieCenter.Instance.IsGuideCompleted(51)) { NewBieCenter.Instance.StartNewBieGuide(51); } } } int GetNpcRefreshCount(HazyGrassNpcInfo npcInfo) { var used = TimeUtility.Minute * 60 + TimeUtility.Second; var refreshSeconds = npcInfo.refreshMinute * 60; return used / refreshSeconds; } private void OnCollectFinished(uint _sid) @@ -124,30 +62,27 @@ GameNetSystem.Instance.SendInfo(pak); s_Sid2NpcIds.Remove(_sid); } if (s_Sid2NpcPos.ContainsKey(_sid)) { var pos = s_Sid2NpcPos[_sid]; if (s_CollectNpcs.ContainsKey(pos)) if (s_Sid2NpcIndexs.ContainsKey(_sid)) { s_CollectNpcs.Remove(pos); var index = s_Sid2NpcIndexs[_sid]; localNpcJsons.RemoveAll((x) => { return x.npcId == npcId && x.index == index; }); s_Sid2NpcIndexs.Remove(_sid); SaveNpcData(); } if (s_NpcCounts.ContainsKey(npcId)) { s_NpcCounts[npcId] = Mathf.Max(0, s_NpcCounts[npcId] - 1); } } RefreshMapNpcCount(); } void InitializeNpc() { s_NpcInfos.Clear(); var config = ScriptableObjectLoader.LoadSoHazyMapNpc(ClientDungeonStageUtility.clientMapId); var npcInfos = config.GetAllNpcInfos(); if (npcInfos != null) if (s_CollectNpcs.ContainsKey(_sid)) { s_NpcInfos.AddRange(npcInfos); RebornCollectedNpc(); s_CollectNpcs.Remove(_sid); } } @@ -159,72 +94,86 @@ CameraController.Instance.Apply(); } void RebornCollectedNpc(int npcId = 0) void InitializeNpc() { foreach (var npcInfo in s_NpcInfos) var config = ScriptableObjectLoader.LoadSoHazyMapNpc(ClientDungeonStageUtility.clientMapId); s_NpcPositions.AddRange(config.GetNpcPositions()); var mapId = model.GetGrassMapId(hazyRegionModel.processingIncidentId); var npcInfos = model.GetGrassNpcInfos(mapId); var npcJsonDatas = GetLocalNpcData(); if (npcJsonDatas != null && npcJsonDatas.Count > 0) { if (npcId != 0 && npcInfo.npcId != npcId) for (int i = 0; i < npcInfos.Count; i++) { continue; } switch (npcInfo.npcType) { case E_NpcType.Collect: GA_NpcClientCollect _npc = null; if (!s_CollectNpcs.TryGetValue(npcInfo.position, out _npc) || _npc == null || _npc.ActorInfo.serverDie) { _npc = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientCollect>((uint)npcInfo.npcId, E_ActorGroup.FuncNpc); if (_npc != null) { _npc.Pos = npcInfo.position; s_CollectNpcs[npcInfo.position] = _npc; var npcId = npcInfos[i]; var count = model.GetMapNpcCount(npcId); s_Sid2NpcIds[_npc.ServerInstID] = npcInfo.npcId; s_Sid2NpcPos[_npc.ServerInstID] = npcInfo.position; } } break; case E_NpcType.Fight: //if (!initedFightNpc) //{ // var fightNpc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>((uint)npcInfo.npcId, // E_ActorGroup.Enemy); // if (fightNpc != null) // { // fightNpc.Pos = npcInfo.position; // fightNpc.OnAttacked -= OnAttackNpc; // fightNpc.OnAttacked += OnAttackNpc; // } // s_ClientFightNpcs.Add(fightNpc); //} break; } } RefreshMapNpcCount(); } void RefreshMapNpcCount() { foreach (var npcInfo in s_NpcRefreshInfos) { var count = 0; foreach (var npcId in s_Sid2NpcIds.Values) { if (npcId == npcInfo.npcId) for (int j = 0; j < count; j++) { count++; var index = -1; var jsonInfoIndex = npcJsonDatas.FindIndex((x) => { return x.npcId == npcId; }); if (jsonInfoIndex != -1) { index = npcJsonDatas[jsonInfoIndex].index; } if (index == -1) { break; } InitializeNpc(npcId, index); } } model.RefreshMapNpcCount(npcInfo.npcId, count); } for (int i = 0; i < npcInfos.Count; i++) { var npcId = npcInfos[i]; var count = model.GetMapNpcCount(npcId) - (s_NpcCounts.ContainsKey(npcId) ? s_NpcCounts[npcId] : 0); for (int j = 0; j < count; j++) { var index = UnityEngine.Random.Range(0, s_NpcPositions.Count); InitializeNpc(npcId, index); } } SaveNpcData(); } private void OnAttackNpc() void InitializeNpc(int npcId, int index) { Debug.Log("攻击了宝箱怪"); var position = s_NpcPositions[index]; GA_NpcClientCollect _npc = GAMgr.Instance.ReqClntNoFightNpc<GA_NpcClientCollect>((uint)npcId, E_ActorGroup.FuncNpc); _npc.Pos = position; s_CollectNpcs[_npc.ServerInstID] = _npc; s_Sid2NpcIds[_npc.ServerInstID] = npcId; s_Sid2NpcIndexs[_npc.ServerInstID] = index; if (!s_NpcCounts.ContainsKey(npcId)) { s_NpcCounts.Add(npcId, 1); } else { s_NpcCounts[npcId] += 1; } s_NpcPositions.RemoveAt(index); localNpcJsons.Add(new NpcJsonInfo() { npcId = npcId, index = index, }); } void UnloadAllNpc() @@ -240,21 +189,33 @@ } } //foreach (var _npc in s_ClientFightNpcs) //{ // if (_npc != null) // { // _npc.OnAttacked -= OnAttackNpc; // _npc.ActorInfo.serverDie = true; // GAMgr.Instance.ServerDie(_npc.ServerInstID); // GAMgr.Instance.Release(_npc); // } //} // //s_ClientFightNpcs.Clear(); s_CollectNpcs.Clear(); } #region 本地Npc数据 List<NpcJsonInfo> localNpcJsons = new List<NpcJsonInfo>(); public struct NpcJsonInfo { public int npcId; public int index; } void SaveNpcData() { LocalSave.SetString(model.GetLocalSaveKey(ClientDungeonStageUtility.clientMapId), LitJson.JsonMapper.ToJson(localNpcJsons)); } List<NpcJsonInfo> GetLocalNpcData() { var key = model.GetLocalSaveKey(ClientDungeonStageUtility.clientMapId); if (LocalSave.HasKey(key)) { return LitJson.JsonMapper.ToObject<List<NpcJsonInfo>>(LocalSave.GetString(key)); } return null; } #endregion #if UNITY_EDITOR private void OnGUI() { System/HazyRegion/HazyGrassDungeonWin.cs
@@ -19,8 +19,6 @@ [SerializeField] HazyGrassCountBeha[] m_GrassCountBehas; [SerializeField] Text[] m_GrassTimes; float timer = 0f; DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } } HazyGrassModel hazyGrassModel { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } } @@ -37,10 +35,6 @@ { Display(); timer = 0f; //RequestGrassCount(); GlobalTimeEvent.Instance.secondEvent += PerSecond; hazyGrassModel.onMapNpcCountRefresh += OnMapNpcCountRefresh; } @@ -50,7 +44,6 @@ protected override void OnPreClose() { GlobalTimeEvent.Instance.secondEvent -= PerSecond; hazyGrassModel.onMapNpcCountRefresh -= OnMapNpcCountRefresh; } @@ -61,19 +54,8 @@ protected override void LateUpdate() { base.LateUpdate(); timer += Time.deltaTime; if (timer >= 5f) { timer = 0f; //RequestGrassCount(); } } #endregion private void PerSecond() { DisplayGrassRefreshTime(); } void Display() { @@ -109,8 +91,7 @@ if (npcInfos != null && i < npcInfos.Count) { m_GrassCountBehas[i].SetActive(true); m_GrassCountBehas[i].Display(npcInfos[i].npcId, hazyGrassModel.GetMapNpcCount(npcInfos[i].npcId)); m_GrassCountBehas[i].Display(npcInfos[i], hazyGrassModel.GetMapNpcCount(npcInfos[i])); } else { @@ -121,64 +102,9 @@ void DisplayGrassRefreshTime() { var mapId = 0; if (ClientDungeonStageUtility.isClientDungeon) { mapId = hazyGrassModel.GetGrassMapId(hazyRegionModel.processingIncidentId); } else { mapId = PlayerDatas.Instance.baseData.MapID; } var npcInfos = hazyGrassModel.GetGrassNpcInfos(mapId); for (int i = 0; i < m_GrassTimes.Length; i++) { if (npcInfos != null && i < npcInfos.Count) { m_GrassTimes[i].gameObject.SetActive(true); var used = 0; if (ClientDungeonStageUtility.isClientDungeon) { used = TimeUtility.Minute * 60 + TimeUtility.Second; } else { used = TimeUtility.CrossServerNow.Minute * 60 + TimeUtility.CrossServerNow.Second; } var refreshSeconds = npcInfos[i].refreshMinute * 60; var seconds = refreshSeconds - used % refreshSeconds; var npcConfig = NPCConfig.Get(npcInfos[i].npcId); m_GrassTimes[i].text = Language.Get("HazyGrassRefresh", npcConfig.charName, TimeUtility.SecondsToMS(seconds)); } else { m_GrassTimes[i].gameObject.SetActive(false); } } } void RequestGrassCount() { if (!ClientDungeonStageUtility.isClientDungeon) { var mapId = PlayerDatas.Instance.baseData.MapID; var npcInfos = hazyGrassModel.GetGrassNpcInfos(mapId); if (npcInfos != null) { int[] npcs = new int[npcInfos.Count]; for (int i = 0; i < npcInfos.Count; i++) { npcs[i] = npcInfos[i].npcId; } var pak = new CA227_tagCMQueryNPCCntInfo(); pak.MapID = (uint)mapId; pak.LineID = (ushort)PlayerDatas.Instance.baseData.dungeonLineId; pak.NPCIDList = LitJson.JsonMapper.ToJson(npcs); pak.NPCIDListLen = (byte)pak.NPCIDList.Length; GameNetSystem.Instance.SendToCrossServer(pak); } m_GrassTimes[i].gameObject.SetActive(false); } } System/HazyRegion/HazyGrassModel.cs
@@ -7,7 +7,7 @@ [XLua.LuaCallCSharp] public class HazyGrassModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { Dictionary<int, List<HazyGrassNpcInfo>> mapNpcs = new Dictionary<int, List<HazyGrassNpcInfo>>(); Dictionary<int, List<int>> m_MapNpcs = new Dictionary<int, List<int>>(); Dictionary<int, int> m_MapNpcCount = new Dictionary<int, int>(); public const int ReikiGrassMapId = 32040; @@ -19,25 +19,7 @@ bool requireExitClientDungeon = false; bool m_IsDungeonTargetDone = false; public bool IsDungeonTargetDone { get { return m_IsDungeonTargetDone; } private set { if (m_IsDungeonTargetDone != value) { m_IsDungeonTargetDone = value; if (dugeonTargetStateRefresh != null) { dugeonTargetStateRefresh(); } } } } public event Action onMapNpcCountRefresh; public event Action dugeonTargetStateRefresh; HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } @@ -47,7 +29,6 @@ ParseConfig(); StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish; GlobalTimeEvent.Instance.secondEvent += PerSecond; } public void OnBeforePlayerDataInitialize() @@ -61,15 +42,6 @@ public override void UnInit() { StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish; GlobalTimeEvent.Instance.secondEvent -= PerSecond; } private void PerSecond() { if (IsInDungeon) { IsDungeonTargetDone = GetDungeonTargetDone(); } } void ParseConfig() @@ -80,19 +52,15 @@ if (config.MapID == ReikiGrassMapId || config.MapID == FairyGrassMapId) { List<HazyGrassNpcInfo> _npcs = null; if (!mapNpcs.TryGetValue(config.MapID, out _npcs)) List<int> _npcs = null; if (!m_MapNpcs.TryGetValue(config.MapID, out _npcs)) { _npcs = new List<HazyGrassNpcInfo>(); mapNpcs.Add(config.MapID, _npcs); _npcs = new List<int>(); m_MapNpcs.Add(config.MapID, _npcs); } for (int i = 0; i < config.NPCIDList.Length; i++) { _npcs.Add(new HazyGrassNpcInfo() { npcId = config.NPCIDList[i], refreshMinute = config.RefreshPerMinutes, }); _npcs.Add(config.NPCIDList[i]); } } } @@ -111,7 +79,6 @@ } IsInDungeon = false; m_IsDungeonTargetDone = false; if (IsInGrassDungeon(mapId)) { IsInDungeon = true; @@ -234,11 +201,11 @@ return 0; } public List<HazyGrassNpcInfo> GetGrassNpcInfos(int mapId) public List<int> GetGrassNpcInfos(int mapId) { if (mapNpcs.ContainsKey(mapId)) if (m_MapNpcs.ContainsKey(mapId)) { return mapNpcs[mapId]; return m_MapNpcs[mapId]; } return null; } @@ -249,7 +216,18 @@ { return m_MapNpcCount[npcId]; } return 0; return 5; } public string GetLocalSaveKey(int mapId) { return StringUtility.Contact("HazyGrassMap", mapId, "_", PlayerDatas.Instance.PlayerId); } public void DeleteLocalSaveKey() { LocalSave.DeleteKey(GetLocalSaveKey(Client_FairyGrassMapID)); LocalSave.DeleteKey(GetLocalSaveKey(Client_ReikiGrassMapID)); } public bool CanCollectClientNpc(int npcId) @@ -365,12 +343,6 @@ refreshPlayerDatas=true }); } } public struct HazyGrassNpcInfo { public int npcId; public int refreshMinute; } } System/HazyRegion/HazyMapNpcScriptableObject.cs
@@ -7,35 +7,22 @@ #endif public class HazyMapNpcScriptableObject : ScriptableObject { [SerializeField] NpcInfo[] m_MapNpcInfos; [SerializeField] List<Vector3> m_NpcPositions; public NpcInfo[] GetAllNpcInfos() public List<Vector3> GetNpcPositions() { return m_MapNpcInfos; return m_NpcPositions; } #if UNITY_EDITOR public void Save(int index, Vector3 position) { if (m_MapNpcInfos != null && index < m_MapNpcInfos.Length) if (m_NpcPositions != null && index < m_NpcPositions.Count) { m_MapNpcInfos[index] = new NpcInfo() { npcId = m_MapNpcInfos[index].npcId, npcType = m_MapNpcInfos[index].npcType, position = position, }; m_NpcPositions[index] = position; } } #endif [Serializable] public struct NpcInfo { public int npcId; public E_NpcType npcType; public Vector3 position; } } #if UNITY_EDITOR System/HazyRegion/HazyRegionModel.cs
@@ -583,6 +583,11 @@ m_Incidents.Clear(); } if (package.State != 1) { hazyGrassModel.DeleteLocalSaveKey(); } for (int i = 0; i < package.Count; i++) { var data = package.InfoList[i];