예제 #1
0
        public bool CheckUnlock(uint id)
        {
            bool flag = false;
            ResUnlockCondition dataByKey = GameDataMgr.unlockConditionDatabin.GetDataByKey(id);

            object[] inParameters = new object[] { id };
            DebugHelper.Assert(dataByKey != null, "ResUnlockCondition[{0}] can not be find.", inParameters);
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "roleinfo can't be null in CheckUnlock");
            if ((masterRoleInfo != null) && (dataByKey != null))
            {
                switch (dataByKey.wUnlockType)
                {
                case 1:
                    return(masterRoleInfo.PvpLevel >= dataByKey.UnlockParam[0]);

                case 2:
                {
                    int             num       = (int)dataByKey.UnlockParam[0];
                    int             num2      = (int)dataByKey.UnlockParam[1];
                    int             index     = 0;
                    ResLevelCfgInfo info2     = GameDataMgr.levelDatabin.GetDataByKey((long)num);
                    object[]        objArray2 = new object[] { num };
                    DebugHelper.Assert(info2 != null, "can't find level = {0}", objArray2);
                    flag = false;
                    if (((info2 != null) && (info2 != null)) && ((masterRoleInfo.pveLevelDetail[index] != null) && (masterRoleInfo.pveLevelDetail[index].ChapterDetailList[info2.iChapterId - 1] != null)))
                    {
                        PVE_CHAPTER_COMPLETE_INFO pve_chapter_complete_info = masterRoleInfo.pveLevelDetail[index].ChapterDetailList[info2.iChapterId - 1];
                        for (int i = 0; i < pve_chapter_complete_info.LevelDetailList.Length; i++)
                        {
                            PVE_LEVEL_COMPLETE_INFO pve_level_complete_info = pve_chapter_complete_info.LevelDetailList[i];
                            if ((pve_level_complete_info != null) && (pve_level_complete_info.iLevelID == num))
                            {
                                flag = (pve_level_complete_info.levelStatus == 1) && (num2 <= CAdventureSys.GetStarNum(pve_level_complete_info.bStarBits));
                                break;
                            }
                        }
                    }
                    return(true);
                }

                case 3:
                    return(flag);

                case 4:
                {
                    uint num5 = 0;
                    if (masterRoleInfo.pvpDetail != null)
                    {
                        num5 = (masterRoleInfo.pvpDetail.stOneVsOneInfo.dwTotalNum + masterRoleInfo.pvpDetail.stTwoVsTwoInfo.dwTotalNum) + masterRoleInfo.pvpDetail.stThreeVsThreeInfo.dwTotalNum;
                    }
                    return((dataByKey.UnlockParam[0] <= num5) && (dataByKey.UnlockParam[1] <= masterRoleInfo.PvpLevel));
                }
                }
            }
            return(flag);
        }
        public uint[] GetConditionParam(RES_SPECIALFUNCUNLOCK_TYPE type, RES_UNLOCKCONDITION_TYPE conditionType)
        {
            uint[]    result         = new uint[0];
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)type);

            if (dataByKey != null && masterRoleInfo != null)
            {
                for (int i = 0; i < dataByKey.UnlockArray.Length; i++)
                {
                    uint num = dataByKey.UnlockArray[i];
                    if (num > 0u)
                    {
                        ResUnlockCondition dataByKey2 = GameDataMgr.unlockConditionDatabin.GetDataByKey(num);
                        if (dataByKey2 != null && (RES_UNLOCKCONDITION_TYPE)dataByKey2.wUnlockType == conditionType)
                        {
                            return(dataByKey2.UnlockParam);
                        }
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public uint[] GetConditionParam(RES_SPECIALFUNCUNLOCK_TYPE type, RES_UNLOCKCONDITION_TYPE conditionType)
        {
            uint[]    numArray       = new uint[0];
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)type);

            if ((dataByKey != null) && (masterRoleInfo != null))
            {
                for (int i = 0; i < dataByKey.UnlockArray.Length; i++)
                {
                    uint key = dataByKey.UnlockArray[i];
                    if (key > 0)
                    {
                        ResUnlockCondition condition = GameDataMgr.unlockConditionDatabin.GetDataByKey(key);
                        if ((condition != null) && (((RES_UNLOCKCONDITION_TYPE)condition.wUnlockType) == conditionType))
                        {
                            return(condition.UnlockParam);
                        }
                    }
                }
            }
            return(numArray);
        }
        public bool CheckUnlock(uint id)
        {
            bool result = false;
            ResUnlockCondition dataByKey = GameDataMgr.unlockConditionDatabin.GetDataByKey(id);

            DebugHelper.Assert(dataByKey != null, "ResUnlockCondition[{0}] can not be find.", new object[]
            {
                id
            });
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "roleinfo can't be null in CheckUnlock");
            if (masterRoleInfo != null && dataByKey != null)
            {
                switch (dataByKey.wUnlockType)
                {
                case 1:
                    result = (masterRoleInfo.PvpLevel >= dataByKey.UnlockParam[0]);
                    break;

                case 2:
                {
                    int             num        = (int)dataByKey.UnlockParam[0];
                    int             num2       = (int)dataByKey.UnlockParam[1];
                    int             num3       = 0;
                    ResLevelCfgInfo dataByKey2 = GameDataMgr.levelDatabin.GetDataByKey((long)num);
                    DebugHelper.Assert(dataByKey2 != null, "can't find level = {0}", new object[]
                        {
                            num
                        });
                    if (dataByKey2 != null && dataByKey2 != null && masterRoleInfo.pveLevelDetail[num3] != null && masterRoleInfo.pveLevelDetail[num3].ChapterDetailList[dataByKey2.iChapterId - 1] != null)
                    {
                        PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[num3].ChapterDetailList[dataByKey2.iChapterId - 1];
                        for (int i = 0; i < pVE_CHAPTER_COMPLETE_INFO.LevelDetailList.Length; i++)
                        {
                            PVE_LEVEL_COMPLETE_INFO pVE_LEVEL_COMPLETE_INFO = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList[i];
                            if (pVE_LEVEL_COMPLETE_INFO != null && pVE_LEVEL_COMPLETE_INFO.iLevelID == num)
                            {
                                bool arg_178_0 = pVE_LEVEL_COMPLETE_INFO.levelStatus == 1 && num2 <= CAdventureSys.GetStarNum(pVE_LEVEL_COMPLETE_INFO.bStarBits);
                                break;
                            }
                        }
                    }
                    result = true;
                    break;
                }

                case 4:
                {
                    uint num4 = 0u;
                    if (masterRoleInfo.pvpDetail != null)
                    {
                        num4 = masterRoleInfo.pvpDetail.stOneVsOneInfo.dwTotalNum + masterRoleInfo.pvpDetail.stTwoVsTwoInfo.dwTotalNum + masterRoleInfo.pvpDetail.stThreeVsThreeInfo.dwTotalNum;
                    }
                    result = (dataByKey.UnlockParam[0] <= num4 && dataByKey.UnlockParam[1] <= masterRoleInfo.PvpLevel);
                    break;
                }
                }
            }
            return(result);
        }