| | |
| | | using UnityEngine; |
| | | using LitJson; |
| | | |
| | | namespace vnxbqy.UI |
| | | { |
| | | |
| | | public class FuncOpen |
| | | { |
| | | private static FuncOpen _inst = null; |
| | |
| | | if (!Application.isPlaying) return; |
| | | } |
| | | |
| | | var allKeys = FuncOpenLVConfig.GetKeys(); |
| | | var allKeys = new List<int>(FuncOpenLVConfig.dic.Keys);//GetKeys(); |
| | | funcArray = new int[allKeys.Count]; |
| | | int _index = 0; |
| | | foreach (var key in allKeys) |
| | | { |
| | | int func = int.Parse(key); |
| | | int func = key; |
| | | funcOpenState[func] = false; |
| | | funcArray[_index] = func; |
| | | _index++; |
| | |
| | | } |
| | | } |
| | | |
| | | TaskModel m_TaskModel; |
| | | TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } } |
| | | // TaskModel m_TaskModel; |
| | | // TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } } |
| | | private static Dictionary<int, bool> funcOpenState = new Dictionary<int, bool>(); |
| | | private int[] funcArray; |
| | | |
| | |
| | | |
| | | private bool IsFuncOpen(int key, out int errorCode) |
| | | { |
| | | |
| | | errorCode = 0; |
| | | var config = FuncOpenLVConfig.Get(key); |
| | | if (config == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (config.LimitMagicWeapon > 0) |
| | | { |
| | | Treasure treasure = null; |
| | | var _stage = config.LimitMagicWeapon % 100; |
| | | ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(config.LimitMagicWeapon / 100, out treasure); |
| | | if (treasure == null || treasure.state != TreasureState.Collected || treasure.level < _stage) |
| | | { |
| | | errorCode = 2; |
| | | return false; |
| | | } |
| | | } |
| | | if (config.LimitMissionID > 0) |
| | | { |
| | | MissionDetailDates missionDetailDates = null; |
| | | taskmodel.allMissionDict.TryGetValue(config.LimitMissionID, out missionDetailDates); |
| | | if (missionDetailDates == null || missionDetailDates.MissionState != 3) |
| | | { |
| | | errorCode = 4; |
| | | return false; |
| | | } |
| | | } |
| | | if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV) |
| | | { |
| | | errorCode = 3; |
| | | return false; |
| | | } |
| | | // if (config.LimitMagicWeapon > 0) |
| | | // { |
| | | // Treasure treasure = null; |
| | | // var _stage = config.LimitMagicWeapon % 100; |
| | | // ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(config.LimitMagicWeapon / 100, out treasure); |
| | | // if (treasure == null || treasure.state != TreasureState.Collected || treasure.level < _stage) |
| | | // { |
| | | // errorCode = 2; |
| | | // return false; |
| | | // } |
| | | // } |
| | | // if (config.LimitMissionID > 0) |
| | | // { |
| | | // MissionDetailDates missionDetailDates = null; |
| | | // taskmodel.allMissionDict.TryGetValue(config.LimitMissionID, out missionDetailDates); |
| | | // if (missionDetailDates == null || missionDetailDates.MissionState != 3) |
| | | // { |
| | | // errorCode = 4; |
| | | // return false; |
| | | // } |
| | | // } |
| | | // if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV) |
| | | // { |
| | | // errorCode = 3; |
| | | // return false; |
| | | // } |
| | | if (config.LimitLV > 0 && PlayerDatas.Instance.baseData.LV < config.LimitLV) |
| | | { |
| | | errorCode = 1; |
| | | return false; |
| | | } |
| | | return true; |
| | | // return false; |
| | | } |
| | | |
| | | public bool IsFuncOpen(int key, bool tip = false) |
| | |
| | | case 1: |
| | | SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc4", config.LimitLV)); |
| | | break; |
| | | case 2: |
| | | var treasureConfig = TreasureConfig.Get(config.LimitMagicWeapon / 100); |
| | | SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc1", treasureConfig != null ? treasureConfig.Name : string.Empty)); |
| | | break; |
| | | case 3: |
| | | SysNotifyMgr.Instance.ShowTip(config.Tip, UIHelper.GetRealmName(config.LimiRealmLV, true)); |
| | | break; |
| | | // TODO YYL |
| | | // case 2: |
| | | // var treasureConfig = TreasureConfig.Get(config.LimitMagicWeapon / 100); |
| | | // SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc1", treasureConfig != null ? treasureConfig.Name : string.Empty)); |
| | | // break; |
| | | // case 3: |
| | | // SysNotifyMgr.Instance.ShowTip(config.Tip, UIHelper.GetRealmName(config.LimiRealmLV, true)); |
| | | // break; |
| | | case 4: |
| | | if (config.LimitLV > 0) |
| | | { |
| | |
| | | |
| | | public int GetLimitLv(int key) |
| | | { |
| | | FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key); |
| | | if (tagFuncOpenLVModel.LimitLV != 0) |
| | | { |
| | | return tagFuncOpenLVModel.LimitLV; |
| | | } |
| | | if (tagFuncOpenLVModel.LimitMissionID != 0) |
| | | { |
| | | var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID); |
| | | return TaskConfig.lv; |
| | | } |
| | | // FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key); |
| | | // if (tagFuncOpenLVModel.LimitLV != 0) |
| | | // { |
| | | // return tagFuncOpenLVModel.LimitLV; |
| | | // } |
| | | // if (tagFuncOpenLVModel.LimitMissionID != 0) |
| | | // { |
| | | // var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID); |
| | | // return TaskConfig.lv; |
| | | // } |
| | | |
| | | return 1; |
| | | } |
| | |
| | | public interface ICheckFuncOpen |
| | | { |
| | | bool CheckFunc(); |
| | | } |
| | | } |
| | | |
| | | } |