Beispiel #1
0
        /// <summary>
        /// 根据关卡ID判定关卡所在章节能否进入
        /// </summary>
        /// <param name="campaignId"></param>
        /// <returns></returns>
        public static bool GetChapterIsPassByCampaignId(string campaignId)
        {
            Hotfix_LT.Data.LostMainCampaignsTemplate campaignData = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainCampaignTplById(campaignId);
            if (campaignData == null)
            {
                return(false);
            }

            Hotfix_LT.Data.LostMainChapterTemplate chapterData = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(campaignData.ChapterId);
            if (chapterData == null)
            {
                return(false);
            }

            return(BalanceResourceUtil.GetUserLevel() >= chapterData.LevelLimit && LTInstanceUtil.IsPreChapterComplete(campaignData.ChapterId) && GetIsChapterLimitConditionComplete(chapterData, out int num));
        }
Beispiel #2
0
        /// <summary>
        /// 主线副本途径处理
        /// </summary>
        /// <param name="materialId"></param>
        /// <param name="NeedNum"></param>
        private void SetSceneGet(int materialId, int NeedNum, bool isDouble)
        {
            //双倍材料显示
            rate = isDouble ? ActivityUtil.GetTimeLimitActivityMulWithoutReLog(1002) : 1.0f;
            if (isDouble)
            {
                RateObj.CustomSetActive(true);
                RateLabel.text = "×" + rate.ToString();
            }
            else
            {
                RateObj.CustomSetActive(false);
            }
            SceneDropData tempDrop = dropData as SceneDropData;

            dropPath1 = EconemyTemplateManager.Instance.GetItem(materialId).DropChickId1;
            string[] chapterId = dropPath1.Split(':')[1].Split('_');
            LostMainChapterTemplate chapterData = SceneTemplateManager.Instance.GetLostMainChatpterTplById(chapterId[0]);

            DataLookupsCache.Instance.SearchDataByID <int>(string.Format("userCampaignStatus.normalChapters.{0}.campaigns.{1}.star", chapterId[0], chapterId[1]), out m_StarNum);
            DataLookupsCache.Instance.SearchDataByID <bool>(string.Format("userCampaignStatus.normalChapters.{0}.campaigns.{1}.complete", chapterId[0], chapterId[1]), out m_IsComplete);
            if (BalanceResourceUtil.GetUserLevel() < chapterData.LevelLimit || !LTInstanceUtil.GetIsChapterLimitConditionComplete(chapterData, out int num) || !LTInstanceUtil.IsPreChapterComplete(chapterId[0]) || !m_IsComplete)//等级未达到解锁条件,或者前置关卡未解锁
            {
                CenterShowLabel.gameObject.CustomSetActive(false);
                ToGetButton.GetComponent <UISprite>().spriteName = "Ty_Button_4";
                if (ToGetButton.clickEvent != null)
                {
                    ToGetButton.clickEvent.Clear();
                    ToGetButton.clickEvent.Add(new EventDelegate(ToCurMaxChapterTip));
                }
                QuicklyGet.CustomSetActive(false);
                LockObj.gameObject.CustomSetActive(true);
                UnLockChapter.text     = UnLockChapter.transform.GetChild(0).GetComponent <UILabel>().text = EB.Localizer.GetString("ID_PARTNER_UPGRADE_TIP_2");
                UnlockChapterName.text = UnlockChapterName.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(EB.Localizer.GetString("ID_PARTNER_UPGRADE_TIP_10"), chapterData.Name);
            }
            else if (m_IsComplete && m_StarNum < 3)
            {
                CenterShowLabel.gameObject.CustomSetActive(true);
                CenterShowLabel.text = CenterShowLabel.transform.GetChild(0).GetComponent <UILabel>().text = EB.Localizer.GetString("ID_PARTNER_UPGRADE_TIP_1");
                if (ToGetButton.clickEvent != null)
                {
                    ToGetButton.clickEvent.Clear();
                }
                ToGetButton.clickEvent.Add(new EventDelegate(() => GotoSceneChapter(int.Parse(chapterId[1]), materialId.ToString())));
                //ToGetButton.GetComponent<UISprite>().color = new Color(1, 1, 1);
                //ToGetButton.GetComponent<BoxCollider>().enabled = true;
                QuicklyGet.CustomSetActive(false);
                LockObj.gameObject.CustomSetActive(false);
            }
            else if (m_IsComplete && m_StarNum == 3)//可以扫荡
            {
                CenterShowLabel.gameObject.CustomSetActive(false);
                //ToGetButton.GetComponent<UISprite>().color = new Color(1, 1, 1);
                //ToGetButton.GetComponent<BoxCollider>().enabled = true;
                costPerCam  = SceneTemplateManager.Instance.GetLostMainCampaignTplById(chapterId[1]).CostVigor;
                totalvigour = Mathf.CeilToInt((NeedNum - materialNum) / rate) * costPerCam;
                DataLookupsCache.Instance.SearchDataByID <int>("res.vigor.v", out curVigour);
                QuicklyGet.CustomSetActive(true);
                if (ToGetButton.clickEvent != null)
                {
                    ToGetButton.clickEvent.Clear();
                }
                if (curVigour >= totalvigour)
                {
                    sweepsNumber = Mathf.CeilToInt((NeedNum - materialNum) / (rate * 1));
                    ToGetButton.clickEvent.Add(new EventDelegate(() => OnQuicklyGetButtonClick(int.Parse(chapterId[1]))));
                    showVigour = totalvigour;
                    colorStr   = LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal;
                }
                else if (curVigour < totalvigour && curVigour >= costPerCam)
                {
                    sweepsNumber = curVigour / costPerCam;
                    showVigour   = sweepsNumber * costPerCam;
                    ToGetButton.clickEvent.Add(new EventDelegate(() => OnQuicklyGetButtonClick(int.Parse(chapterId[1]))));
                    colorStr = LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal;
                }
                else
                {
                    showVigour = totalvigour;
                    colorStr   = LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;
                    ToGetButton.clickEvent.Add(new EventDelegate(() => BalanceResourceUtil.TurnToVigorGotView()));
                }

                VigourCost.text = VigourCost.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(LT.Hotfix.Utility.ColorUtility.ColorStringFormat, colorStr, showVigour);
                LockObj.gameObject.CustomSetActive(false);
            }
        }