yyl
2025-06-13 eb1efcaa9be0e2340fc49b38dab8df18e36526c9
Main/Component/UI/Common/FuncOpen.cs
@@ -4,9 +4,6 @@
using UnityEngine;
using LitJson;
namespace vnxbqy.UI
{
    public class FuncOpen
    {
        private static FuncOpen _inst = null;
@@ -27,12 +24,12 @@
                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++;
@@ -69,8 +66,8 @@
            }
        }
        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;
@@ -121,44 +118,46 @@
        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)
@@ -190,13 +189,14 @@
                        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)
                            {
@@ -214,16 +214,16 @@
        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;
        }
@@ -250,6 +250,4 @@
    public interface ICheckFuncOpen
    {
        bool CheckFunc();
    }
}
    }