| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 06, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using TableConfig; |
| | | using System; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class MapModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk |
| | | { |
| | | int m_SelectedLocalMapEventPoint; |
| | | public int selectedLocalMapEventPoint { |
| | | get { return this.m_SelectedLocalMapEventPoint; } |
| | | set { |
| | | if (m_SelectedLocalMapEventPoint != value) |
| | | { |
| | | m_SelectedLocalMapEventPoint = value; |
| | | if (selectLocalMapEventPointEvent != null) |
| | | { |
| | | selectLocalMapEventPointEvent(this.m_SelectedLocalMapEventPoint); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | Dictionary<int, WorldMapArea> worldMapAreas = new Dictionary<int, WorldMapArea>(); |
| | | Dictionary<int, bool> worldMapUnLockStates = new Dictionary<int, bool>(); |
| | | Dictionary<int, List<int>> localMapEventPoints = new Dictionary<int, List<int>>(); |
| | | Dictionary<int, List<string>> mapFunctionNPCsToRefreshID = new Dictionary<int, List<string>>(); |
| | | Dictionary<int, List<string>> mapCollectNPCsToRefreshID = new Dictionary<int, List<string>>(); |
| | | Dictionary<int, List<MapLine>> mapLines = new Dictionary<int, List<MapLine>>(); |
| | | List<int> sortedMapEventPoints = new List<int>(); |
| | | List<int> sortedHangUpPoints = new List<int>(); |
| | | List<int> sortedMaps = new List<int>(); |
| | | |
| | | int m_NewUnLockedMap = 0; |
| | | public int newUnLockedMap { |
| | | get { return m_NewUnLockedMap; } |
| | | set { m_NewUnLockedMap = value; } |
| | | } |
| | | |
| | | public int newUnLockMapsTip { |
| | | get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip")); } |
| | | set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip"), value); } |
| | | } |
| | | |
| | | public int wannaLookLocalMap { get; set; } |
| | | int mapUnLockIndex = 0; |
| | | |
| | | PlayerTaskDatas taskModel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } } |
| | | |
| | | public event Action<int> selectLocalMapEventPointEvent; |
| | | public event Action<int> mapLinesUpdateEvent; |
| | | |
| | | public override void Init() |
| | | { |
| | | ParseWorldMaps(); |
| | | ParseLocalMaps(); |
| | | |
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayerLevelChange; |
| | | PlayerTaskDatas.Event_TaskInformation += OnMainLineTaskInfoUpdate; |
| | | } |
| | | |
| | | public override void UnInit() |
| | | { |
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayerLevelChange; |
| | | PlayerTaskDatas.Event_TaskInformation -= OnMainLineTaskInfoUpdate; |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | mapUnLockIndex = 0; |
| | | newUnLockedMap = 0; |
| | | } |
| | | |
| | | public void OnAfterPlayerDataInitialize() |
| | | { |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | UpdateMapsUnLockedState(); |
| | | newUnLockedMap = 0; |
| | | } |
| | | |
| | | public void OnMapInitOk() |
| | | { |
| | | if (newUnLockMapsTip == PlayerDatas.Instance.baseData.MapID) |
| | | { |
| | | newUnLockMapsTip = 0; |
| | | } |
| | | } |
| | | |
| | | public void RequestMapTransport(int _mapId, int _lineId = 255) |
| | | { |
| | | if (PlayerDatas.Instance.extersion.pkState == 1) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("PK_Leave"); |
| | | return; |
| | | } |
| | | |
| | | var currentMapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(PlayerDatas.Instance.baseData.MapID); |
| | | if (currentMapConfig.MapFBType != 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("DungeonNoGO"); |
| | | return; |
| | | } |
| | | |
| | | if (worldMapUnLockStates.ContainsKey(_mapId)) |
| | | { |
| | | if (!worldMapUnLockStates[_mapId]) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("Map_Delivery"); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //未知的地图 |
| | | return; |
| | | } |
| | | |
| | | var map = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId); |
| | | var position = new Vector3(map.BornPoints[0].x, 0, map.BornPoints[0].y); |
| | | MapTransferUtility.Send_WorldTransfer(_mapId, position, MapTransferType.WorldTransport, (byte)_lineId, 0); |
| | | } |
| | | |
| | | public void RequestFlyToEventPoint(int _eventPoint) |
| | | { |
| | | GA_Hero _hero = PlayerDatas.Instance.hero; |
| | | if (_hero != null) |
| | | { |
| | | _hero.Behaviour.StopHandupAI(); |
| | | _hero.Behaviour.StopKillUntilDieAI(); |
| | | } |
| | | |
| | | var mapNPCConfig = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(_eventPoint); |
| | | MapTransferUtility.Instance.MissionFlyTo(wannaLookLocalMap, mapNPCConfig.NPCID); |
| | | } |
| | | |
| | | public void RequestSelectedLine(int _lineId) |
| | | { |
| | | GA_Hero _hero = PlayerDatas.Instance.hero; |
| | | if (_hero != null) |
| | | { |
| | | _hero.Behaviour.StopHandupAI(); |
| | | _hero.Behaviour.StopKillUntilDieAI(); |
| | | } |
| | | |
| | | if (PlayerDatas.Instance.baseData.FBID != _lineId) |
| | | { |
| | | var sendInfo = new C010B_tagCChangeLine(); |
| | | sendInfo.Line = (short)_lineId; |
| | | GameNetSystem.Instance.SendInfo(sendInfo); |
| | | } |
| | | } |
| | | |
| | | public void RequestQueryMapLineState(int _mapId, int _lineId = 0, bool _isAllLine = true) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId); |
| | | if (config.MapFBType == (int)MapType.OpenCountry) |
| | | { |
| | | var lineState = new CA003_tagPyGetLineState(); |
| | | lineState.MapID = (uint)_mapId; |
| | | GameNetSystem.Instance.SendInfo(lineState); |
| | | } |
| | | else |
| | | { |
| | | var lineState = new CA004_tagCGGetFBLinePlayerCnt(); |
| | | lineState.MapID = (uint)_mapId; |
| | | lineState.IsAllLine = (byte)(_isAllLine ? 1 : 0); |
| | | if (_isAllLine) |
| | | { |
| | | lineState.FBLineID = (byte)_lineId; |
| | | } |
| | | GameNetSystem.Instance.SendInfo(lineState); |
| | | } |
| | | } |
| | | |
| | | public List<MapLine> GetMapLines(int _mapId) |
| | | { |
| | | if (mapLines.ContainsKey(_mapId)) |
| | | { |
| | | return mapLines[_mapId]; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public void UpdateMapLines(HA006_tagGCPyServerMapState _serverInfo) |
| | | { |
| | | for (int i = 0; i < _serverInfo.MapCount; i++) |
| | | { |
| | | var mapState = _serverInfo.MapStateList[i]; |
| | | var mapId = (int)mapState.MapID; |
| | | var lines = mapLines[mapId] = new List<MapLine>(); |
| | | for (int j = 0; j < mapState.LineCnt; j++) |
| | | { |
| | | lines.Add(new MapLine(mapId, j + 1, (int)mapState.LineCurPlayerCntList[j], (int)mapState.LineMaxPlayerCntList[j])); |
| | | } |
| | | |
| | | if (mapLinesUpdateEvent != null) |
| | | { |
| | | mapLinesUpdateEvent(mapId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void UpdateDungeonMapLines(HA007_tagGCFBLinePlayerCnt _serverInfo) |
| | | { |
| | | var mapId = (int)_serverInfo.MapID; |
| | | var lines = mapLines[mapId] = new List<MapLine>(); |
| | | |
| | | for (int i = 0; i < _serverInfo.Count; i++) |
| | | { |
| | | var mapState = _serverInfo.FBLineInfoList[i]; |
| | | lines.Add(new MapLine(mapId, mapState.FBLineID, mapState.PlayerCnt)); |
| | | } |
| | | |
| | | if (mapLinesUpdateEvent != null) |
| | | { |
| | | mapLinesUpdateEvent(mapId); |
| | | } |
| | | } |
| | | |
| | | public bool TryGetWorldMapArea(int _id, out WorldMapArea _area) |
| | | { |
| | | return worldMapAreas.TryGetValue(_id, out _area); |
| | | } |
| | | |
| | | public List<int> GetWorldMapAreas() |
| | | { |
| | | return new List<int>(worldMapAreas.Keys); |
| | | } |
| | | |
| | | public List<int> GetMapEventPoints(int _mapId) |
| | | { |
| | | if (localMapEventPoints.ContainsKey(_mapId)) |
| | | { |
| | | return localMapEventPoints[_mapId]; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public List<string> GetMapNPCRefreshIds(int _mapId) |
| | | { |
| | | if (mapFunctionNPCsToRefreshID.ContainsKey(_mapId)) |
| | | { |
| | | return mapFunctionNPCsToRefreshID[_mapId]; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public List<string> GetMapCollectNPCRefreshIds(int _mapId) |
| | | { |
| | | if (mapCollectNPCsToRefreshID.ContainsKey(_mapId)) |
| | | { |
| | | return mapCollectNPCsToRefreshID[_mapId]; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public int GetNextMap(int _mapId) |
| | | { |
| | | for (int i = sortedMaps.Count - 1; i >= 0; i--) |
| | | { |
| | | int mapId = sortedMaps[i]; |
| | | if (_mapId == mapId) |
| | | { |
| | | var nextMap = sortedMaps[Mathf.Clamp(i - 1, 0, sortedMaps.Count - 1)]; |
| | | return nextMap; |
| | | } |
| | | } |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | public int GetLatestUnLockHangUpMap() |
| | | { |
| | | for (int i = 0; i < sortedMaps.Count; i++) |
| | | { |
| | | int mapId = sortedMaps[i]; |
| | | if (GeneralConfig.Instance.autoOnHookMap.Contains(mapId) && IsMapUnLocked(mapId)) |
| | | { |
| | | return mapId; |
| | | } |
| | | } |
| | | |
| | | return GeneralConfig.Instance.autoOnHookMap[GeneralConfig.Instance.autoOnHookMap.Count - 1]; |
| | | } |
| | | |
| | | public int GetRecommendHangPoint(int _mapId) |
| | | { |
| | | var eventPoints = new List<int>(GetMapEventPoints(_mapId)); |
| | | for (int i = eventPoints.Count - 1; i >= 0; i--) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[i]); |
| | | if (config.IsShowInfo == 0) |
| | | { |
| | | eventPoints.RemoveAt(i); |
| | | } |
| | | } |
| | | |
| | | eventPoints.Sort((int a, int b) => |
| | | { |
| | | var configA = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(a); |
| | | var configB = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(b); |
| | | return configA.LowLV < configB.LowLV ? -1 : 1; |
| | | }); |
| | | |
| | | var playerLevel = PlayerDatas.Instance.baseData.LV; |
| | | var eventPointsPool = new List<int>(); |
| | | var levelMatchPointIndex = 0; |
| | | for (int i = eventPoints.Count - 1; i >= 0; i--) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[i]); |
| | | if (playerLevel >= config.LowLV) |
| | | { |
| | | levelMatchPointIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (int i = levelMatchPointIndex; i < eventPoints.Count; i++) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[i]); |
| | | if (config.LowLV <= playerLevel + 20) |
| | | { |
| | | eventPointsPool.Add(eventPoints[i]); |
| | | } |
| | | |
| | | if (eventPointsPool.Count >= 3) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var recommendPoint = 0; |
| | | if (eventPointsPool.Count > 0) |
| | | { |
| | | recommendPoint = eventPointsPool[0]; |
| | | for (int i = eventPointsPool.Count - 1; i >= 0; i--) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPointsPool[i]); |
| | | if (PlayerDatas.Instance.extersion.DEF >= config.Defense) |
| | | { |
| | | recommendPoint = eventPointsPool[i]; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var lowest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[0]); |
| | | if (playerLevel < lowest.LowLV) |
| | | { |
| | | recommendPoint = lowest.Key; |
| | | } |
| | | else |
| | | { |
| | | var hightest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[eventPoints.Count - 1]); |
| | | recommendPoint = hightest.Key; |
| | | } |
| | | } |
| | | |
| | | return recommendPoint; |
| | | } |
| | | |
| | | public int GetRecommendHangPoint() |
| | | { |
| | | var unLockedHangeUpPoints = new List<int>(); |
| | | |
| | | for (int i = 0; i < sortedHangUpPoints.Count; i++) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(sortedHangUpPoints[i]); |
| | | if (IsMapUnLocked(config.MapID)) |
| | | { |
| | | unLockedHangeUpPoints.Add(sortedHangUpPoints[i]); |
| | | } |
| | | } |
| | | |
| | | var playerLevel = PlayerDatas.Instance.baseData.LV; |
| | | var eventPointsPool = new List<int>(); |
| | | var levelMatchPointIndex = 0; |
| | | for (int i = unLockedHangeUpPoints.Count - 1; i >= 0; i--) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[i]); |
| | | if (playerLevel >= config.LowLV) |
| | | { |
| | | levelMatchPointIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (int i = levelMatchPointIndex; i < unLockedHangeUpPoints.Count; i++) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[i]); |
| | | if (config.LowLV <= playerLevel + 20) |
| | | { |
| | | eventPointsPool.Add(unLockedHangeUpPoints[i]); |
| | | } |
| | | |
| | | if (eventPointsPool.Count >= 3) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var recommendPoint = 0; |
| | | if (eventPointsPool.Count > 0) |
| | | { |
| | | recommendPoint = eventPointsPool[0]; |
| | | for (int i = eventPointsPool.Count - 1; i >= 0; i--) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPointsPool[i]); |
| | | if (PlayerDatas.Instance.extersion.DEF >= config.Defense) |
| | | { |
| | | recommendPoint = eventPointsPool[i]; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var lowest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[0]); |
| | | if (playerLevel < lowest.LowLV) |
| | | { |
| | | recommendPoint = lowest.Key; |
| | | } |
| | | else |
| | | { |
| | | var count = unLockedHangeUpPoints.Count; |
| | | var hightest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[count - 1]); |
| | | recommendPoint = hightest.Key; |
| | | } |
| | | } |
| | | |
| | | return recommendPoint; |
| | | } |
| | | |
| | | public void ConfirmNewMap(int _mapId) |
| | | { |
| | | } |
| | | |
| | | public bool IsMapUnLocked(int _mapId) |
| | | { |
| | | if (worldMapUnLockStates.ContainsKey(_mapId)) |
| | | { |
| | | return worldMapUnLockStates[_mapId]; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | private void UpdateMapsUnLockedState() |
| | | { |
| | | foreach (var mapId in worldMapAreas.Keys) |
| | | { |
| | | var unLocked = CheckMapUnLocked(mapId); |
| | | if (worldMapUnLockStates.ContainsKey(mapId) && !worldMapUnLockStates[mapId] && unLocked && mapId != 10010) |
| | | { |
| | | newUnLockedMap = mapId; |
| | | newUnLockMapsTip = mapId; |
| | | } |
| | | |
| | | worldMapUnLockStates[mapId] = unLocked; |
| | | } |
| | | } |
| | | |
| | | private bool CheckMapUnLocked(int _mapId) |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId); |
| | | var playerLevel = PlayerDatas.Instance.baseData.LV; |
| | | |
| | | if (playerLevel >= config.LV) |
| | | { |
| | | if (config.MainTaskID > 0) |
| | | { |
| | | return mapUnLockIndex >= config.MainTaskID; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | private void OnPlayerLevelChange(PlayerDataRefresh refreshType) |
| | | { |
| | | switch (refreshType) |
| | | { |
| | | case PlayerDataRefresh.LV: |
| | | UpdateMapsUnLockedState(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void OnMainLineTaskInfoUpdate(int _id, Dictionary<int, Dictionary<string, string>> _Dic) |
| | | { |
| | | if (_id == 1) |
| | | { |
| | | if (taskModel._DicTaskInformation.ContainsKey(1) && taskModel._DicTaskInformation[1].ContainsKey("OpenMap")) |
| | | { |
| | | int.TryParse(taskModel._DicTaskInformation[1]["OpenMap"], out mapUnLockIndex); |
| | | } |
| | | else |
| | | { |
| | | mapUnLockIndex = 0; |
| | | } |
| | | |
| | | UpdateMapsUnLockedState(); |
| | | } |
| | | } |
| | | |
| | | private void ParseWorldMaps() |
| | | { |
| | | var mapConfigs = ConfigManager.Instance.GetAllValues<MapConfig>(); |
| | | foreach (var mapConfig in mapConfigs) |
| | | { |
| | | if (mapConfig.MapFBType == 0) |
| | | { |
| | | worldMapAreas.Add(mapConfig.MapID, new WorldMapArea(mapConfig.MapID, true, WorldMapCamp.Neutral)); |
| | | sortedMaps.Add(mapConfig.MapID); |
| | | } |
| | | } |
| | | |
| | | sortedMaps.Sort( |
| | | (int a, int b) => |
| | | { |
| | | var configA = ConfigManager.Instance.GetTemplate<MapConfig>(a); |
| | | var configB = ConfigManager.Instance.GetTemplate<MapConfig>(b); |
| | | |
| | | return configA.LV > configB.LV ? -1 : 1; |
| | | } |
| | | ); |
| | | } |
| | | |
| | | private void ParseLocalMaps() |
| | | { |
| | | var mapEventConfigs = ConfigManager.Instance.GetAllValues<MapEventPointConfig>(); |
| | | foreach (var config in mapEventConfigs) |
| | | { |
| | | var mapId = config.MapID; |
| | | List<int> eventPointIds = null; |
| | | if (!localMapEventPoints.ContainsKey(mapId)) |
| | | { |
| | | localMapEventPoints[mapId] = eventPointIds = new List<int>(); |
| | | } |
| | | else |
| | | { |
| | | eventPointIds = localMapEventPoints[mapId]; |
| | | } |
| | | |
| | | eventPointIds.Add(config.Key); |
| | | |
| | | if (config.IsShowInfo == 1 && GeneralConfig.Instance.autoOnHookMap.Contains(config.MapID)) |
| | | { |
| | | sortedMapEventPoints.Add(config.Key); |
| | | } |
| | | } |
| | | |
| | | sortedMapEventPoints.Sort((int a, int b) => |
| | | { |
| | | var configA = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(a); |
| | | var configB = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(b); |
| | | |
| | | return configA.LowLV < configB.LowLV ? -1 : 1; |
| | | }); |
| | | |
| | | for (int i = 0; i < sortedMapEventPoints.Count; i++) |
| | | { |
| | | var eventPoint = sortedMapEventPoints[i]; |
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoint); |
| | | if (GeneralConfig.Instance.autoOnHookMap.Contains(config.MapID)) |
| | | { |
| | | sortedHangUpPoints.Add(eventPoint); |
| | | } |
| | | } |
| | | |
| | | var mapNpcConfigs = ConfigManager.Instance.GetAllValues<mapnpcConfig>(); |
| | | foreach (var config in mapNpcConfigs) |
| | | { |
| | | var mapId = config.MapID; |
| | | if (config.NPCType == (int)E_NpcType.Func) |
| | | { |
| | | List<string> npcRefreshIs; |
| | | if (!mapFunctionNPCsToRefreshID.ContainsKey(mapId)) |
| | | { |
| | | mapFunctionNPCsToRefreshID[mapId] = npcRefreshIs = new List<string>(); |
| | | } |
| | | else |
| | | { |
| | | npcRefreshIs = mapFunctionNPCsToRefreshID[mapId]; |
| | | } |
| | | |
| | | npcRefreshIs.Add(config.RefreshID.ToString()); |
| | | } |
| | | else if (config.NPCType == (int)E_NpcType.Flag) |
| | | { |
| | | List<string> npcRefreshIs; |
| | | if (!mapCollectNPCsToRefreshID.ContainsKey(mapId)) |
| | | { |
| | | mapCollectNPCsToRefreshID[mapId] = npcRefreshIs = new List<string>(); |
| | | } |
| | | else |
| | | { |
| | | npcRefreshIs = mapCollectNPCsToRefreshID[mapId]; |
| | | } |
| | | |
| | | npcRefreshIs.Add(config.RefreshID.ToString()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public struct WorldMapArea |
| | | { |
| | | public int id; |
| | | public bool unLocked; |
| | | public WorldMapCamp camp; |
| | | |
| | | public WorldMapArea(int _id, bool _unLocked, WorldMapCamp _camp) |
| | | { |
| | | this.id = _id; |
| | | this.unLocked = _unLocked; |
| | | this.camp = _camp; |
| | | } |
| | | |
| | | } |
| | | |
| | | public struct MapLine |
| | | { |
| | | public int mapId; |
| | | public int lineIndex; |
| | | public int playerCount; |
| | | public int playerMaxCount; |
| | | |
| | | public MapLine(int _mapId, int _lineIndex, int _playerCount, int _playerMaxCount) |
| | | { |
| | | this.mapId = _mapId; |
| | | this.lineIndex = _lineIndex; |
| | | this.playerCount = _playerCount; |
| | | this.playerMaxCount = _playerMaxCount; |
| | | } |
| | | |
| | | public MapLine(int _mapId, int _lineId, int _playerCount) |
| | | { |
| | | this.mapId = _mapId; |
| | | this.lineIndex = _lineId; |
| | | this.playerCount = _playerCount; |
| | | this.playerMaxCount = 99999; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Wednesday, September 06, 2017
|
| | | //--------------------------------------------------------
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using TableConfig;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class MapModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk
|
| | | {
|
| | | int m_SelectedLocalMapEventPoint;
|
| | | public int selectedLocalMapEventPoint {
|
| | | get { return this.m_SelectedLocalMapEventPoint; }
|
| | | set {
|
| | | if (m_SelectedLocalMapEventPoint != value)
|
| | | {
|
| | | m_SelectedLocalMapEventPoint = value;
|
| | | if (selectLocalMapEventPointEvent != null)
|
| | | {
|
| | | selectLocalMapEventPointEvent(this.m_SelectedLocalMapEventPoint);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | Dictionary<int, WorldMapArea> worldMapAreas = new Dictionary<int, WorldMapArea>();
|
| | | Dictionary<int, bool> worldMapUnLockStates = new Dictionary<int, bool>();
|
| | | Dictionary<int, List<int>> localMapEventPoints = new Dictionary<int, List<int>>();
|
| | | Dictionary<int, List<string>> mapFunctionNPCsToRefreshID = new Dictionary<int, List<string>>();
|
| | | Dictionary<int, List<string>> mapCollectNPCsToRefreshID = new Dictionary<int, List<string>>();
|
| | | Dictionary<int, List<MapLine>> mapLines = new Dictionary<int, List<MapLine>>();
|
| | | List<int> sortedMapEventPoints = new List<int>();
|
| | | List<int> sortedHangUpPoints = new List<int>();
|
| | | List<int> sortedMaps = new List<int>();
|
| | |
|
| | | int m_NewUnLockedMap = 0;
|
| | | public int newUnLockedMap {
|
| | | get { return m_NewUnLockedMap; }
|
| | | set { m_NewUnLockedMap = value; }
|
| | | }
|
| | |
|
| | | public int newUnLockMapsTip {
|
| | | get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip")); }
|
| | | set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip"), value); }
|
| | | }
|
| | |
|
| | | public int wannaLookLocalMap { get; set; }
|
| | | int mapUnLockIndex = 0;
|
| | |
|
| | | PlayerTaskDatas taskModel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } }
|
| | |
|
| | | public event Action<int> selectLocalMapEventPointEvent;
|
| | | public event Action<int> mapLinesUpdateEvent;
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | ParseWorldMaps();
|
| | | ParseLocalMaps();
|
| | |
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayerLevelChange;
|
| | | PlayerTaskDatas.Event_TaskInformation += OnMainLineTaskInfoUpdate;
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayerLevelChange;
|
| | | PlayerTaskDatas.Event_TaskInformation -= OnMainLineTaskInfoUpdate;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | mapUnLockIndex = 0;
|
| | | newUnLockedMap = 0;
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | | {
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | UpdateMapsUnLockedState();
|
| | | newUnLockedMap = 0;
|
| | | }
|
| | |
|
| | | public void OnMapInitOk()
|
| | | {
|
| | | if (newUnLockMapsTip == PlayerDatas.Instance.baseData.MapID)
|
| | | {
|
| | | newUnLockMapsTip = 0;
|
| | | }
|
| | | }
|
| | |
|
| | | public void RequestMapTransport(int _mapId, int _lineId = 255)
|
| | | {
|
| | | if (PlayerDatas.Instance.extersion.pkState == 1)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("PK_Leave");
|
| | | return;
|
| | | }
|
| | |
|
| | | var currentMapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | if (currentMapConfig.MapFBType != 0)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("DungeonNoGO");
|
| | | return;
|
| | | }
|
| | |
|
| | | if (worldMapUnLockStates.ContainsKey(_mapId))
|
| | | {
|
| | | if (!worldMapUnLockStates[_mapId])
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("Map_Delivery");
|
| | | return;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //未知的地图
|
| | | return;
|
| | | }
|
| | |
|
| | | var map = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId);
|
| | | var position = new Vector3(map.BornPoints[0].x, 0, map.BornPoints[0].y);
|
| | | MapTransferUtility.Send_WorldTransfer(_mapId, position, MapTransferType.WorldTransport, (byte)_lineId, 0);
|
| | | }
|
| | |
|
| | | public void RequestFlyToEventPoint(int _eventPoint)
|
| | | {
|
| | | GA_Hero _hero = PlayerDatas.Instance.hero;
|
| | | if (_hero != null)
|
| | | {
|
| | | _hero.Behaviour.StopHandupAI();
|
| | | _hero.Behaviour.StopKillUntilDieAI();
|
| | | }
|
| | |
|
| | | var mapNPCConfig = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(_eventPoint);
|
| | | MapTransferUtility.Instance.MissionFlyTo(wannaLookLocalMap, mapNPCConfig.NPCID);
|
| | | }
|
| | |
|
| | | public void RequestSelectedLine(int _lineId)
|
| | | {
|
| | | GA_Hero _hero = PlayerDatas.Instance.hero;
|
| | | if (_hero != null)
|
| | | {
|
| | | _hero.Behaviour.StopHandupAI();
|
| | | _hero.Behaviour.StopKillUntilDieAI();
|
| | | }
|
| | |
|
| | | if (PlayerDatas.Instance.baseData.FBID != _lineId)
|
| | | {
|
| | | var sendInfo = new C010B_tagCChangeLine();
|
| | | sendInfo.Line = (short)_lineId;
|
| | | GameNetSystem.Instance.SendInfo(sendInfo);
|
| | | }
|
| | | }
|
| | |
|
| | | public void RequestQueryMapLineState(int _mapId, int _lineId = 0, bool _isAllLine = true)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId);
|
| | | if (config.MapFBType == (int)MapType.OpenCountry)
|
| | | {
|
| | | var lineState = new CA003_tagPyGetLineState();
|
| | | lineState.MapID = (uint)_mapId;
|
| | | GameNetSystem.Instance.SendInfo(lineState);
|
| | | }
|
| | | else
|
| | | {
|
| | | var lineState = new CA004_tagCGGetFBLinePlayerCnt();
|
| | | lineState.MapID = (uint)_mapId;
|
| | | lineState.IsAllLine = (byte)(_isAllLine ? 1 : 0);
|
| | | if (_isAllLine)
|
| | | {
|
| | | lineState.FBLineID = (byte)_lineId;
|
| | | }
|
| | | GameNetSystem.Instance.SendInfo(lineState);
|
| | | }
|
| | | }
|
| | |
|
| | | public List<MapLine> GetMapLines(int _mapId)
|
| | | {
|
| | | if (mapLines.ContainsKey(_mapId))
|
| | | {
|
| | | return mapLines[_mapId];
|
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateMapLines(HA006_tagGCPyServerMapState _serverInfo)
|
| | | {
|
| | | for (int i = 0; i < _serverInfo.MapCount; i++)
|
| | | {
|
| | | var mapState = _serverInfo.MapStateList[i];
|
| | | var mapId = (int)mapState.MapID;
|
| | | var lines = mapLines[mapId] = new List<MapLine>();
|
| | | for (int j = 0; j < mapState.LineCnt; j++)
|
| | | {
|
| | | lines.Add(new MapLine(mapId, j + 1, (int)mapState.LineCurPlayerCntList[j], (int)mapState.LineMaxPlayerCntList[j]));
|
| | | }
|
| | |
|
| | | if (mapLinesUpdateEvent != null)
|
| | | {
|
| | | mapLinesUpdateEvent(mapId);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateDungeonMapLines(HA007_tagGCFBLinePlayerCnt _serverInfo)
|
| | | {
|
| | | var mapId = (int)_serverInfo.MapID;
|
| | | var lines = mapLines[mapId] = new List<MapLine>();
|
| | |
|
| | | for (int i = 0; i < _serverInfo.Count; i++)
|
| | | {
|
| | | var mapState = _serverInfo.FBLineInfoList[i];
|
| | | lines.Add(new MapLine(mapId, mapState.FBLineID, mapState.PlayerCnt));
|
| | | }
|
| | |
|
| | | if (mapLinesUpdateEvent != null)
|
| | | {
|
| | | mapLinesUpdateEvent(mapId);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TryGetWorldMapArea(int _id, out WorldMapArea _area)
|
| | | {
|
| | | return worldMapAreas.TryGetValue(_id, out _area);
|
| | | }
|
| | |
|
| | | public List<int> GetWorldMapAreas()
|
| | | {
|
| | | return new List<int>(worldMapAreas.Keys);
|
| | | }
|
| | |
|
| | | public List<int> GetMapEventPoints(int _mapId)
|
| | | {
|
| | | if (localMapEventPoints.ContainsKey(_mapId))
|
| | | {
|
| | | return localMapEventPoints[_mapId];
|
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
|
| | | public List<string> GetMapNPCRefreshIds(int _mapId)
|
| | | {
|
| | | if (mapFunctionNPCsToRefreshID.ContainsKey(_mapId))
|
| | | {
|
| | | return mapFunctionNPCsToRefreshID[_mapId];
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | public List<string> GetMapCollectNPCRefreshIds(int _mapId)
|
| | | {
|
| | | if (mapCollectNPCsToRefreshID.ContainsKey(_mapId))
|
| | | {
|
| | | return mapCollectNPCsToRefreshID[_mapId];
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | public int GetNextMap(int _mapId)
|
| | | {
|
| | | for (int i = sortedMaps.Count - 1; i >= 0; i--)
|
| | | {
|
| | | int mapId = sortedMaps[i];
|
| | | if (_mapId == mapId)
|
| | | {
|
| | | var nextMap = sortedMaps[Mathf.Clamp(i - 1, 0, sortedMaps.Count - 1)];
|
| | | return nextMap;
|
| | | }
|
| | | }
|
| | |
|
| | | return -1;
|
| | | }
|
| | |
|
| | | public int GetLatestUnLockHangUpMap()
|
| | | {
|
| | | for (int i = 0; i < sortedMaps.Count; i++)
|
| | | {
|
| | | int mapId = sortedMaps[i];
|
| | | if (GeneralConfig.Instance.autoOnHookMap.Contains(mapId) && IsMapUnLocked(mapId))
|
| | | {
|
| | | return mapId;
|
| | | }
|
| | | }
|
| | |
|
| | | return GeneralConfig.Instance.autoOnHookMap[GeneralConfig.Instance.autoOnHookMap.Count - 1];
|
| | | }
|
| | |
|
| | | public int GetRecommendHangPoint(int _mapId)
|
| | | {
|
| | | var eventPoints = new List<int>(GetMapEventPoints(_mapId));
|
| | | for (int i = eventPoints.Count - 1; i >= 0; i--)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[i]);
|
| | | if (config.IsShowInfo == 0)
|
| | | {
|
| | | eventPoints.RemoveAt(i);
|
| | | }
|
| | | }
|
| | |
|
| | | eventPoints.Sort((int a, int b) =>
|
| | | {
|
| | | var configA = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(a);
|
| | | var configB = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(b);
|
| | | return configA.LowLV < configB.LowLV ? -1 : 1;
|
| | | });
|
| | |
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV;
|
| | | var eventPointsPool = new List<int>();
|
| | | var levelMatchPointIndex = 0;
|
| | | for (int i = eventPoints.Count - 1; i >= 0; i--)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[i]);
|
| | | if (playerLevel >= config.LowLV)
|
| | | {
|
| | | levelMatchPointIndex = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (levelMatchPointIndex < eventPoints.Count - 1)
|
| | | {
|
| | | eventPointsPool.Add(eventPoints[levelMatchPointIndex + 1]);
|
| | | }
|
| | |
|
| | | eventPointsPool.Add(eventPoints[levelMatchPointIndex]);
|
| | |
|
| | | if (levelMatchPointIndex > 0)
|
| | | {
|
| | | eventPointsPool.Add(eventPoints[levelMatchPointIndex - 1]);
|
| | | }
|
| | |
|
| | | var recommendPoint = 0;
|
| | | if (eventPointsPool.Count > 0)
|
| | | {
|
| | | recommendPoint = eventPointsPool[eventPointsPool.Count - 1];
|
| | | for (int i = 0; i < eventPointsPool.Count; i++)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPointsPool[i]);
|
| | | if (PlayerDatas.Instance.extersion.DEF >= config.Defense)
|
| | | {
|
| | | recommendPoint = eventPointsPool[i];
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var lowest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[0]);
|
| | | if (playerLevel < lowest.LowLV)
|
| | | {
|
| | | recommendPoint = lowest.Key;
|
| | | }
|
| | | else
|
| | | {
|
| | | var hightest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoints[eventPoints.Count - 1]);
|
| | | recommendPoint = hightest.Key;
|
| | | }
|
| | | }
|
| | |
|
| | | return recommendPoint;
|
| | | }
|
| | |
|
| | | public int GetRecommendHangPoint()
|
| | | {
|
| | | var unLockedHangeUpPoints = new List<int>();
|
| | |
|
| | | for (int i = 0; i < sortedHangUpPoints.Count; i++)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(sortedHangUpPoints[i]);
|
| | | if (IsMapUnLocked(config.MapID))
|
| | | {
|
| | | unLockedHangeUpPoints.Add(sortedHangUpPoints[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV;
|
| | | var eventPointsPool = new List<int>();
|
| | | var levelMatchPointIndex = 0;
|
| | | for (int i = unLockedHangeUpPoints.Count - 1; i >= 0; i--)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[i]);
|
| | | if (playerLevel >= config.LowLV)
|
| | | {
|
| | | levelMatchPointIndex = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (levelMatchPointIndex < unLockedHangeUpPoints.Count - 1)
|
| | | {
|
| | | eventPointsPool.Add(unLockedHangeUpPoints[levelMatchPointIndex + 1]);
|
| | | }
|
| | |
|
| | | eventPointsPool.Add(unLockedHangeUpPoints[levelMatchPointIndex]);
|
| | | if (levelMatchPointIndex > 0)
|
| | | {
|
| | | eventPointsPool.Add(unLockedHangeUpPoints[levelMatchPointIndex - 1]);
|
| | | }
|
| | |
|
| | | var recommendPoint = 0;
|
| | | if (eventPointsPool.Count > 0)
|
| | | {
|
| | | recommendPoint = eventPointsPool[eventPointsPool.Count - 1];
|
| | | for (int i = 0; i < eventPointsPool.Count; i++)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPointsPool[i]);
|
| | | if (PlayerDatas.Instance.extersion.DEF >= config.Defense)
|
| | | {
|
| | | recommendPoint = eventPointsPool[i];
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var lowest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[0]);
|
| | | if (playerLevel < lowest.LowLV)
|
| | | {
|
| | | recommendPoint = lowest.Key;
|
| | | }
|
| | | else
|
| | | {
|
| | | var count = unLockedHangeUpPoints.Count;
|
| | | var hightest = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(unLockedHangeUpPoints[count - 1]);
|
| | | recommendPoint = hightest.Key;
|
| | | }
|
| | | }
|
| | |
|
| | | return recommendPoint;
|
| | | }
|
| | |
|
| | | public void ConfirmNewMap(int _mapId)
|
| | | {
|
| | | }
|
| | |
|
| | | public bool IsMapUnLocked(int _mapId)
|
| | | {
|
| | | if (worldMapUnLockStates.ContainsKey(_mapId))
|
| | | {
|
| | | return worldMapUnLockStates[_mapId];
|
| | | }
|
| | | else
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateMapsUnLockedState()
|
| | | {
|
| | | foreach (var mapId in worldMapAreas.Keys)
|
| | | {
|
| | | var unLocked = CheckMapUnLocked(mapId);
|
| | | if (worldMapUnLockStates.ContainsKey(mapId) && !worldMapUnLockStates[mapId] && unLocked && mapId != 10010)
|
| | | {
|
| | | newUnLockedMap = mapId;
|
| | | newUnLockMapsTip = mapId;
|
| | | }
|
| | |
|
| | | worldMapUnLockStates[mapId] = unLocked;
|
| | | }
|
| | | }
|
| | |
|
| | | private bool CheckMapUnLocked(int _mapId)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<MapConfig>(_mapId);
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV;
|
| | |
|
| | | if (playerLevel >= config.LV)
|
| | | {
|
| | | if (config.MainTaskID > 0)
|
| | | {
|
| | | return mapUnLockIndex >= config.MainTaskID;
|
| | | }
|
| | | else
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnPlayerLevelChange(PlayerDataRefresh refreshType)
|
| | | {
|
| | | switch (refreshType)
|
| | | {
|
| | | case PlayerDataRefresh.LV:
|
| | | UpdateMapsUnLockedState();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnMainLineTaskInfoUpdate(int _id, Dictionary<int, Dictionary<string, string>> _Dic)
|
| | | {
|
| | | if (_id == 1)
|
| | | {
|
| | | if (taskModel._DicTaskInformation.ContainsKey(1) && taskModel._DicTaskInformation[1].ContainsKey("OpenMap"))
|
| | | {
|
| | | int.TryParse(taskModel._DicTaskInformation[1]["OpenMap"], out mapUnLockIndex);
|
| | | }
|
| | | else
|
| | | {
|
| | | mapUnLockIndex = 0;
|
| | | }
|
| | |
|
| | | UpdateMapsUnLockedState();
|
| | | }
|
| | | }
|
| | |
|
| | | private void ParseWorldMaps()
|
| | | {
|
| | | var mapConfigs = ConfigManager.Instance.GetAllValues<MapConfig>();
|
| | | foreach (var mapConfig in mapConfigs)
|
| | | {
|
| | | if (mapConfig.MapFBType == 0)
|
| | | {
|
| | | worldMapAreas.Add(mapConfig.MapID, new WorldMapArea(mapConfig.MapID, true, WorldMapCamp.Neutral));
|
| | | sortedMaps.Add(mapConfig.MapID);
|
| | | }
|
| | | }
|
| | |
|
| | | sortedMaps.Sort(
|
| | | (int a, int b) =>
|
| | | {
|
| | | var configA = ConfigManager.Instance.GetTemplate<MapConfig>(a);
|
| | | var configB = ConfigManager.Instance.GetTemplate<MapConfig>(b);
|
| | |
|
| | | return configA.LV > configB.LV ? -1 : 1;
|
| | | }
|
| | | );
|
| | | }
|
| | |
|
| | | private void ParseLocalMaps()
|
| | | {
|
| | | var mapEventConfigs = ConfigManager.Instance.GetAllValues<MapEventPointConfig>();
|
| | | foreach (var config in mapEventConfigs)
|
| | | {
|
| | | var mapId = config.MapID;
|
| | | List<int> eventPointIds = null;
|
| | | if (!localMapEventPoints.ContainsKey(mapId))
|
| | | {
|
| | | localMapEventPoints[mapId] = eventPointIds = new List<int>();
|
| | | }
|
| | | else
|
| | | {
|
| | | eventPointIds = localMapEventPoints[mapId];
|
| | | }
|
| | |
|
| | | eventPointIds.Add(config.Key);
|
| | |
|
| | | if (config.IsShowInfo == 1 && GeneralConfig.Instance.autoOnHookMap.Contains(config.MapID))
|
| | | {
|
| | | sortedMapEventPoints.Add(config.Key);
|
| | | }
|
| | | }
|
| | |
|
| | | sortedMapEventPoints.Sort((int a, int b) =>
|
| | | {
|
| | | var configA = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(a);
|
| | | var configB = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(b);
|
| | |
|
| | | return configA.LowLV < configB.LowLV ? -1 : 1;
|
| | | });
|
| | |
|
| | | for (int i = 0; i < sortedMapEventPoints.Count; i++)
|
| | | {
|
| | | var eventPoint = sortedMapEventPoints[i];
|
| | | var config = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(eventPoint);
|
| | | if (GeneralConfig.Instance.autoOnHookMap.Contains(config.MapID))
|
| | | {
|
| | | sortedHangUpPoints.Add(eventPoint);
|
| | | }
|
| | | }
|
| | |
|
| | | var mapNpcConfigs = ConfigManager.Instance.GetAllValues<mapnpcConfig>();
|
| | | foreach (var config in mapNpcConfigs)
|
| | | {
|
| | | var mapId = config.MapID;
|
| | | if (config.NPCType == (int)E_NpcType.Func)
|
| | | {
|
| | | List<string> npcRefreshIs;
|
| | | if (!mapFunctionNPCsToRefreshID.ContainsKey(mapId))
|
| | | {
|
| | | mapFunctionNPCsToRefreshID[mapId] = npcRefreshIs = new List<string>();
|
| | | }
|
| | | else
|
| | | {
|
| | | npcRefreshIs = mapFunctionNPCsToRefreshID[mapId];
|
| | | }
|
| | |
|
| | | npcRefreshIs.Add(config.RefreshID.ToString());
|
| | | }
|
| | | else if (config.NPCType == (int)E_NpcType.Flag)
|
| | | {
|
| | | List<string> npcRefreshIs;
|
| | | if (!mapCollectNPCsToRefreshID.ContainsKey(mapId))
|
| | | {
|
| | | mapCollectNPCsToRefreshID[mapId] = npcRefreshIs = new List<string>();
|
| | | }
|
| | | else
|
| | | {
|
| | | npcRefreshIs = mapCollectNPCsToRefreshID[mapId];
|
| | | }
|
| | |
|
| | | npcRefreshIs.Add(config.RefreshID.ToString());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | public struct WorldMapArea
|
| | | {
|
| | | public int id;
|
| | | public bool unLocked;
|
| | | public WorldMapCamp camp;
|
| | |
|
| | | public WorldMapArea(int _id, bool _unLocked, WorldMapCamp _camp)
|
| | | {
|
| | | this.id = _id;
|
| | | this.unLocked = _unLocked;
|
| | | this.camp = _camp;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public struct MapLine
|
| | | {
|
| | | public int mapId;
|
| | | public int lineIndex;
|
| | | public int playerCount;
|
| | | public int playerMaxCount;
|
| | |
|
| | | public MapLine(int _mapId, int _lineIndex, int _playerCount, int _playerMaxCount)
|
| | | {
|
| | | this.mapId = _mapId;
|
| | | this.lineIndex = _lineIndex;
|
| | | this.playerCount = _playerCount;
|
| | | this.playerMaxCount = _playerMaxCount;
|
| | | }
|
| | |
|
| | | public MapLine(int _mapId, int _lineId, int _playerCount)
|
| | | {
|
| | | this.mapId = _mapId;
|
| | | this.lineIndex = _lineId;
|
| | | this.playerCount = _playerCount;
|
| | | this.playerMaxCount = 99999;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|