Beispiel #1
0
        public void OnChapterClick()
        {
            if (m_ChapterData.IsBoxRewardType())
            {
                if (!LTInstanceUtil.IsChapterComplete(m_ChapterData.ForwardChapterId))
                {
                    int FC = 0;
                    int.TryParse(m_ChapterData.ForwardChapterId, out FC);
                    MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_INSTANCE_MAP_BOX_REWRAD_TIP2"), FC % 100));
                    return;
                }
                if (LTInstanceMapModel.Instance.GetMainChapterRewardState(m_ChapterData.Id))
                {
                    return;
                }
                LTInstanceMapModel.Instance.RequestMainChapterReward(m_ChapterData.Id, delegate
                {
                    ContainerObj.CustomSetActive(false);
                    GlobalMenuManager.Instance.Open("LTShowRewardView", m_ChapterData.RewardDataDic[0]);
                });
                return;
            }

            FusionAudio.PostEvent("UI/General/ButtonClick", true);
            if (AllianceUtil.GetIsInTransferDart("ID_CAMPAGIN"))
            {
                return;
            }

            //此处判断进阶条件是否满足
            if (!LTInstanceUtil.GetIsChapterLimitConditionComplete(m_ChapterData, out int currNum))
            {
                //打开跳转界面
                GlobalMenuManager.Instance.Open("PlayerUpgradeTipView", new int[3] {
                    m_ChapterData.Limitparam2, m_ChapterData.Limitparam1, currNum
                });
                return;
            }
            if (BalanceResourceUtil.GetUserLevel() < m_ChapterData.LevelLimit)
            {
                MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_codefont_in_LTInstanceMapChapterCtrl_2697"), m_ChapterData.LevelLimit));
                //GlobalMenuManager.Instance.Open("LTPlayerLevelUpTipView", "Levelup");
                return;
            }

            //主线章节入口
            if (LTInstanceMapHudController.curChapterID != null && LTInstanceMapHudController.curChapterID != m_ChapterData.Id)
            {
                return;
            }
            LTInstanceMapHudController.curChapterID = m_ChapterData.Id;

            if (!string.IsNullOrEmpty(m_ChapterData.BeforeChapter))
            {
                string flagStr = PlayerPrefs.GetString(LoginManager.Instance.LocalUserId.Value + m_ChapterData.BeforeChapter);

                if (string.IsNullOrEmpty(flagStr))
                {
                    LTStoryController.OpenStory(OnChapterClick, m_ChapterData.BeforeChapter);
                    PlayerPrefs.SetString(LoginManager.Instance.LocalUserId.Value + m_ChapterData.BeforeChapter, "True");//本地临时保存,等服务器做好了会保存到服务器
                    PlayerPrefs.Save();
                    return;
                }
            }
            Action act = new Action(delegate
            {
                LTMainInstanceHudController.EnterInstance(m_ChapterData.Id);
                LTInstanceMapHudController.curChapterID = null;
            });

            Hotfix_LT.Messenger.Raise(Hotfix_LT.EventName.PlayCloudFxEvent, act);
        }
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);
            }
        }
Beispiel #3
0
        public static bool GetChapterIsOpen(int chapterId)
        {
            Hashtable chapterData = Johny.HashtablePool.Claim();

            DataLookupsCache.Instance.SearchHashtableByID("userCampaignStatus.normalChapters", out chapterData);
            int maxChapterId = 101;

            foreach (DictionaryEntry data in chapterData)
            {
                int chapterIntId = int.Parse(data.Key.ToString());
                if (chapterIntId > maxChapterId)
                {
                    maxChapterId = chapterIntId;
                }
            }
            Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetNextChapter(maxChapterId.ToString());
            if (tpl != null && LTInstanceUtil.IsChapterComplete(maxChapterId.ToString()) && BalanceResourceUtil.GetUserLevel() >= tpl.LevelLimit && LTInstanceUtil.GetIsChapterLimitConditionComplete(tpl, out int num))
            {
                maxChapterId = int.Parse(tpl.Id);
            }

            return(chapterId <= maxChapterId);
        }