| | |
| | |
|
| | | 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>>();
|
| | | Dictionary<int, List<MapLine>> allMapLines = new Dictionary<int, List<MapLine>>();
|
| | | List<int> sortedMapEventPoints = new List<int>();
|
| | | List<int> sortedHangUpPoints = new List<int>();
|
| | | List<int> sortedMaps = new List<int>();
|
| | | List<MapLine> sortedMapLines = new List<MapLine>();
|
| | |
|
| | | int m_NewUnLockedMap = 0;
|
| | | public int newUnLockedMap {
|
| | | get { return m_NewUnLockedMap; }
|
| | | set { m_NewUnLockedMap = value; }
|
| | | PlayerTaskDatas taskModel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } }
|
| | | FairyGrabBossModel fairyGrabBossModel { get { return ModelCenter.Instance.GetModel<FairyGrabBossModel>(); } }
|
| | |
|
| | | int m_NewUnlockedMap = 0;
|
| | | public int newUnlockedMap {
|
| | | get { return m_NewUnlockedMap; }
|
| | | set { m_NewUnlockedMap = value; }
|
| | | }
|
| | |
|
| | | public int newUnLockMapsTip {
|
| | | public int newUnlockMapTip {
|
| | | get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip")); }
|
| | | set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "NewUnLockMapsTip"), value); }
|
| | | }
|
| | |
|
| | | int m_SelectedMapEventPoint;
|
| | | public int selectedMapEventPoint {
|
| | | get { return this.m_SelectedMapEventPoint; }
|
| | | set {
|
| | | if (m_SelectedMapEventPoint != value)
|
| | | {
|
| | | m_SelectedMapEventPoint = value;
|
| | | if (selectMapEventPointEvent != null)
|
| | | {
|
| | | selectMapEventPointEvent(this.m_SelectedMapEventPoint);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public int wannaLookLocalMap { get; set; }
|
| | | int mapUnLockIndex = 0;
|
| | |
|
| | | PlayerTaskDatas taskModel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } }
|
| | | FairyGrabBossModel fairyGrabBossModel { get { return ModelCenter.Instance.GetModel<FairyGrabBossModel>(); } }
|
| | |
|
| | | public event Action<int> selectLocalMapEventPointEvent;
|
| | | public event Action<int> selectMapEventPointEvent;
|
| | | public event Action<int> mapLinesUpdateEvent;
|
| | |
|
| | | public override void Init()
|
| | |
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | mapUnLockIndex = 0;
|
| | | newUnLockedMap = 0;
|
| | | newUnlockedMap = 0;
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | UpdateMapsUnLockedState();
|
| | | newUnLockedMap = 0;
|
| | | UpdateMapsUnlockedState();
|
| | | newUnlockedMap = 0;
|
| | | }
|
| | |
|
| | | public void OnMapInitOk()
|
| | | {
|
| | | if (newUnLockMapsTip == PlayerDatas.Instance.baseData.MapID)
|
| | | if (newUnlockMapTip == PlayerDatas.Instance.baseData.MapID)
|
| | | {
|
| | | newUnLockMapsTip = 0;
|
| | | newUnlockMapTip = 0;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (worldMapUnLockStates.ContainsKey(_mapId))
|
| | | if (!worldMapUnLockStates.ContainsKey(_mapId))
|
| | | {
|
| | | if (!worldMapUnLockStates[_mapId])
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("Map_Delivery");
|
| | | return;
|
| | | }
|
| | | return;
|
| | | }
|
| | | else
|
| | |
|
| | | if (!worldMapUnLockStates[_mapId])
|
| | | {
|
| | | //未知的地图
|
| | | SysNotifyMgr.Instance.ShowTip("Map_Delivery");
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | 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 = Config.Instance.Get<MapEventPointConfig>(_eventPoint);
|
| | | MapTransferUtility.Instance.MissionFlyTo(wannaLookLocalMap, mapNPCConfig.NPCID);
|
| | | }
|
| | |
|
| | | public void RequestSelectedLine(int _lineId)
|
| | | {
|
| | | GA_Hero _hero = PlayerDatas.Instance.hero;
|
| | | if (_hero != null)
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | if (hero != null)
|
| | | {
|
| | | _hero.Behaviour.StopHandupAI();
|
| | | _hero.Behaviour.StopKillUntilDieAI();
|
| | | hero.Behaviour.StopHandupAI();
|
| | | hero.Behaviour.StopKillUntilDieAI();
|
| | | }
|
| | |
|
| | | if (PlayerDatas.Instance.baseData.FBID != _lineId)
|
| | |
| | |
|
| | | public List<MapLine> GetMapLines(int _mapId)
|
| | | {
|
| | | sortedMapLines.Clear();
|
| | | if (mapLines.ContainsKey(_mapId))
|
| | | var mapLines = new List<MapLine>();
|
| | | if (allMapLines.ContainsKey(_mapId))
|
| | | {
|
| | | sortedMapLines.AddRange(mapLines[_mapId]);
|
| | | CheckActivityLine(_mapId);
|
| | | sortedMapLines.Sort(SortMaplines);
|
| | | return sortedMapLines;
|
| | | mapLines.AddRange(allMapLines[_mapId]);
|
| | | CheckActivityLine(_mapId, mapLines);
|
| | | mapLines.Sort(SortMaplines);
|
| | | return mapLines;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | void CheckActivityLine(int _mapId)
|
| | | void CheckActivityLine(int _mapId, List<MapLine> mapLines)
|
| | | {
|
| | | var activityLine = 0;
|
| | | fairyGrabBossModel.TryGetFairyGrabBossLine(out activityLine);
|
| | | if (activityLine != 0)
|
| | | {
|
| | | var index = sortedMapLines.FindIndex((x) =>
|
| | | var index = mapLines.FindIndex((x) =>
|
| | | {
|
| | | return activityLine + 1 == x.lineIndex;
|
| | | });
|
| | |
|
| | | if (fairyGrabBossModel.InActivityTime ||
|
| | | PlayerDatas.Instance.baseData.FBID == activityLine)
|
| | | {
|
| | | if (index == -1)
|
| | | {
|
| | | sortedMapLines.Add(new MapLine(_mapId, activityLine + 1, 0, 0));
|
| | | mapLines.Add(new MapLine(_mapId, activityLine + 1, 0, 0));
|
| | | }
|
| | | }
|
| | | else if (index != -1)
|
| | | {
|
| | | sortedMapLines.RemoveAt(index);
|
| | | mapLines.RemoveAt(index);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | var mapState = _serverInfo.MapStateList[i];
|
| | | var mapId = (int)mapState.MapID;
|
| | | var lines = mapLines[mapId] = new List<MapLine>();
|
| | | var lines = allMapLines[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]));
|
| | | var playerCount = (int)mapState.LineCurPlayerCntList[j];
|
| | | var playerMaxCount = (int)mapState.LineMaxPlayerCntList[j];
|
| | | lines.Add(new MapLine(mapId, j + 1, playerCount, playerMaxCount));
|
| | | }
|
| | |
|
| | | if (mapLinesUpdateEvent != null)
|
| | |
| | | public void UpdateDungeonMapLines(HA007_tagGCFBLinePlayerCnt _serverInfo)
|
| | | {
|
| | | var mapId = (int)_serverInfo.MapID;
|
| | | var lines = mapLines[mapId] = new List<MapLine>();
|
| | | var lines = allMapLines[mapId] = new List<MapLine>();
|
| | |
|
| | | for (int i = 0; i < _serverInfo.Count; i++)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | 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)
|
| | |
| | | for (int i = 0; i < sortedHangUpPoints.Count; i++)
|
| | | {
|
| | | var config = Config.Instance.Get<MapEventPointConfig>(sortedHangUpPoints[i]);
|
| | | if (IsMapUnLocked(config.MapID))
|
| | | if (IsMapUnlocked(config.MapID))
|
| | | {
|
| | | unLockedHangeUpPoints.Add(sortedHangUpPoints[i]);
|
| | | }
|
| | |
| | | return recommendPoint;
|
| | | }
|
| | |
|
| | | public void ConfirmNewMap(int _mapId)
|
| | | {
|
| | | }
|
| | |
|
| | | public bool IsMapUnLocked(int _mapId)
|
| | | public bool IsMapUnlocked(int _mapId)
|
| | | {
|
| | | if (worldMapUnLockStates.ContainsKey(_mapId))
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void UpdateMapsUnLockedState()
|
| | | private void UpdateMapsUnlockedState()
|
| | | {
|
| | | foreach (var mapId in worldMapAreas.Keys)
|
| | | {
|
| | | var unLocked = CheckMapUnLocked(mapId);
|
| | | if (worldMapUnLockStates.ContainsKey(mapId) && !worldMapUnLockStates[mapId] && unLocked && mapId != 10010)
|
| | | var canUnlock = CanMapUnlock(mapId);
|
| | | if (worldMapUnLockStates.ContainsKey(mapId)
|
| | | && !worldMapUnLockStates[mapId]
|
| | | && canUnlock && mapId != 10010)
|
| | | {
|
| | | newUnLockedMap = mapId;
|
| | | newUnLockMapsTip = mapId;
|
| | | newUnlockedMap = mapId;
|
| | | newUnlockMapTip = mapId;
|
| | | }
|
| | |
|
| | | worldMapUnLockStates[mapId] = unLocked;
|
| | | worldMapUnLockStates[mapId] = canUnlock;
|
| | | }
|
| | | }
|
| | |
|
| | | private bool CheckMapUnLocked(int _mapId)
|
| | | private bool CanMapUnlock(int _mapId)
|
| | | {
|
| | | var config = Config.Instance.Get<MapConfig>(_mapId);
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV;
|
| | | var level = PlayerDatas.Instance.baseData.LV;
|
| | |
|
| | | if (playerLevel >= config.LV)
|
| | | if (level >= config.LV)
|
| | | {
|
| | | if (config.MainTaskID > 0)
|
| | | {
|
| | |
| | | switch (refreshType)
|
| | | {
|
| | | case PlayerDataRefresh.LV:
|
| | | UpdateMapsUnLockedState();
|
| | | UpdateMapsUnlockedState();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | mapUnLockIndex = 0;
|
| | | }
|
| | |
|
| | | UpdateMapsUnLockedState();
|
| | | UpdateMapsUnlockedState();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | if (mapConfig.MapFBType == 0)
|
| | | {
|
| | | worldMapAreas.Add(mapConfig.MapID, new WorldMapArea(mapConfig.MapID, true, WorldMapCamp.Neutral));
|
| | | worldMapAreas.Add(mapConfig.MapID, new WorldMapArea(mapConfig.MapID, true));
|
| | | sortedMaps.Add(mapConfig.MapID);
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | var activityline = 0;
|
| | | fairyGrabBossModel.TryGetFairyGrabBossLine(out activityline);
|
| | | bool _isActivityLinex = activityline != 0 && x.lineIndex == activityline + 1;
|
| | | bool _isActivityLiney = activityline != 0 && y.lineIndex == activityline + 1;
|
| | | if (_isActivityLinex != _isActivityLiney)
|
| | | var isActivityLinex = activityline != 0 && x.lineIndex == activityline + 1;
|
| | | var isActivityLiney = activityline != 0 && y.lineIndex == activityline + 1;
|
| | |
|
| | | if (isActivityLinex != isActivityLiney)
|
| | | {
|
| | | return -_isActivityLinex.CompareTo(_isActivityLiney);
|
| | | return -isActivityLinex.CompareTo(isActivityLiney);
|
| | | }
|
| | | return x.lineIndex.CompareTo(y.lineIndex);
|
| | | }
|
| | |
| | | {
|
| | | public int id;
|
| | | public bool unLocked;
|
| | | public WorldMapCamp camp;
|
| | |
|
| | | public WorldMapArea(int _id, bool _unLocked, WorldMapCamp _camp)
|
| | | public WorldMapArea(int _id, bool _unLocked)
|
| | | {
|
| | | this.id = _id;
|
| | | this.unLocked = _unLocked;
|
| | | this.camp = _camp;
|
| | | }
|
| | |
|
| | | }
|