Ejemplo n.º 1
0
        public void Init(Hotfix_LT.Data.LostMainChapterTemplate data)
        {
            m_ChapterData         = data;
            mDMono.transform.name = m_ChapterData.Id;
            chapterId             = int.Parse(m_ChapterData.Id);
            newChapterFX.CustomSetActive(false);
            ContainerObj.CustomSetActive(true);

            BGSprite.spriteName = m_ChapterData.Icon;
            if (m_ChapterData.IsBoxRewardType())
            {
                InfoObj.CustomSetActive(false);
                BoxTipObj.CustomSetActive(true);
                PerfectObj.CustomSetActive(false);
                int mForwardChapterId = 0;
                int.TryParse(m_ChapterData.ForwardChapterId, out mForwardChapterId);
                BoxLabel.text = string.Format(EB.Localizer.GetString("ID_INSTANCE_MAP_BOX_REWRAD_TIP"), mForwardChapterId % 100);
                if (LTInstanceUtil.IsChapterComplete(m_ChapterData.ForwardChapterId))
                {
                    if (LTInstanceMapModel.Instance.GetMainChapterRewardState(m_ChapterData.Id))
                    {
                        ContainerObj.CustomSetActive(false);
                    }
                    else
                    {
                        RedPoint.CustomSetActive(true);
                    }
                }
                else
                {
                    RedPoint.CustomSetActive(false);
                }
                BGSprite.target.width  = 376;
                BGSprite.target.height = 360;
            }
            else
            {
                InfoObj.CustomSetActive(true);
                BoxTipObj.CustomSetActive(false);

                int allStarNum  = LTInstanceUtil.GetChapterCurStarNum(m_ChapterData.Id);
                int fullStarNum = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChapterMaxStarNumById(m_ChapterData.Id);
                PerfectObj.CustomSetActive(LTInstanceUtil.GetChapterIsPerfectComplete(m_ChapterData.Id) && allStarNum == fullStarNum);
                StarLabel.text = string.Format("{0}{1}/{2}", (allStarNum >= fullStarNum) ? "[42fe76]" : "", allStarNum, fullStarNum);
                NameLabel.text = m_ChapterData.Name;
                UpdateRedPoint();
                BGSprite.target.width  = 360;
                BGSprite.target.height = 420;
            }
            mDMono.transform.localPosition = data.ChapterPos;
            mDMono.gameObject.CustomSetActive(true);
        }
Ejemplo n.º 2
0
 public void ShowLand()
 {
     if (currentLand == null)
     {
         string max = Hotfix_LT.Data.SceneTemplateManager.Instance.GetMaxChapter(openChapterIds);
         Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(max);
         currentLandId = int.Parse(tpl.LandId);
         currentLand   = CreateLand(tpl.LandId);
         currentLand.transform.SetParent(LandContainerTrans);
         currentLand.transform.localPosition = CenterPos;
         currentLand.CustomSetActive(true);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 计算前置章节是否完成
        /// </summary>
        /// <param name="curChapterId"></param>
        /// <returns></returns>
        public static bool IsPreChapterComplete(string curChapterId)
        {
            Hotfix_LT.Data.LostMainChapterTemplate chapterData = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(curChapterId);
            if (chapterData == null)
            {
                return(false);
            }

            if (chapterData.ForwardChapterId == "0")
            {
                return(true);
            }

            return(IsChapterComplete(chapterData.ForwardChapterId));
        }
Ejemplo n.º 4
0
        //创建已开放章节列表
        private void InitChapter()
        {
            Hashtable chapterData;

            DataLookupsCache.Instance.SearchDataByID <Hashtable>("userCampaignStatus.normalChapters", out chapterData);
            openChapterIds.Clear();
            if (!openChapterIds.Contains("101"))
            {
                openChapterIds.Add("101");
            }
            if (chapterData != null)
            {
                foreach (DictionaryEntry data in chapterData)
                {
                    string chapterId = data.Key.ToString();
                    if (!openChapterIds.Contains(chapterId))
                    {
                        openChapterIds.Add(chapterId);
                    }
                }
            }
            List <Data.LostMainChapterTemplate> temps = Data.SceneTemplateManager.Instance.GetLostMainChapterBoxRewards();

            for (int i = 0; i < temps.Count; ++i)
            {
                if (!openChapterIds.Contains(temps[i].Id))
                {
                    openChapterIds.Add(temps[i].Id);
                }
            }

            string maxChapter = Hotfix_LT.Data.SceneTemplateManager.Instance.GetMaxChapter(openChapterIds);

            Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetNextChapter(maxChapter);
            if (tpl != null && LTInstanceUtil.IsChapterComplete(maxChapter))
            {
                openChapterIds.Add(tpl.Id);
                newChapterId = vaildMaxChapter = tpl.Id;
                maxLandId    = int.Parse(tpl.LandId);
            }
            else
            {
                newChapterId    = string.Empty;
                vaildMaxChapter = maxChapter;
                Hotfix_LT.Data.LostMainChapterTemplate cur = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(maxChapter);
                maxLandId = int.Parse(cur.LandId);
            }
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
0
        protected override void InitUI()
        {
            mChapterTpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(LTInstanceMapModel.Instance.MainChapterId);
            if (mChapterTpl == null) return;

            int fastNum = PlayerPrefs.GetInt("MainInstanceIsFastCombat");
            int openLevel = (int)Data.NewGameConfigTemplateManager.Instance.GetGameConfigValue("mainQuickBattle");
            int passLevel = LTInstanceMapModel.Instance.GetMaxCampaignLevel();
            bool isOpen = openLevel <= passLevel;
            IsMainQuick = (fastNum == 1 && isOpen);
            QuickSelectObj.CustomSetActive(IsMainQuick);

            InitStarBox();
            ChapterLabel.text = mChapterTpl.Name;
            MapCtrl.SetBGTexture(mChapterTpl.ChapterBg);
            MaskTex.spriteName = mChapterTpl.MaskBg;
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        //创建大陆
        private GameObject CreateLand(string landId)
        {
            if (LandQueue.Count == 0)
            {
                EB.Debug.LogWarning("LandQueue.Count not enough!");
                return(null);
            }
            Hotfix_LT.Data.LostMainLandTemplate temp = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainLandTemplateByLandId(landId);
            if (temp == null)
            {
                EB.Debug.LogWarning("LandId is error!landId = {0}", landId);
                return(null);
            }

            GameObject land = LandQueue.Dequeue();

            land.GetComponent <CampaignTextureCmp>().spriteName = temp.LineName;
            bool initSelect = false;

            for (int i = 0; i < temp.ChapterList.Count; ++i)
            {
                bool   show   = false;
                string dataId = temp.ChapterList[i];
                if (openChapterIds.Contains(dataId))
                {
                    show = true;
                }
                else
                {
                    var boxTemp = Hotfix_LT.Data.SceneTemplateManager.Instance.GetNextChapter(dataId);
                    if (boxTemp != null && boxTemp.IsBoxRewardType())
                    {
                        show = true;
                    }
                }
                if (show)
                {
                    Hotfix_LT.Data.LostMainChapterTemplate tpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(dataId);
                    if (tpl == null)
                    {
                        continue;
                    }
                    LTInstanceMapChapterCtrl item = GetItem(land.transform);
                    item.Init(tpl);
                    if (!string.IsNullOrEmpty(newChapterId) && tpl.Id.Equals(newChapterId))
                    {
                        newChapterId = string.Empty;
                        item.PlayNewChapterFX();
                    }
                    else
                    {
                        item.PlayNewChapterFX(false);
                    }

                    if (tpl.Id.Equals(vaildMaxChapter))
                    {
                        initSelect = true;
                        controller.Transforms["ArrowTran"].SetParent(item.mDMono.transform);
                    }
                }
            }
            if (!initSelect)
            {
                controller.Transforms["ArrowTran"].SetParent(PoolTrans);
            }
            land.name = landId;
            return(land);
        }
Ejemplo n.º 9
0
 public static bool GetIsChapterLimitConditionComplete(string chapterId, out int curnum)
 {
     Hotfix_LT.Data.LostMainChapterTemplate chapterData = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainChatpterTplById(chapterId);
     return(GetIsChapterLimitConditionComplete(chapterData, out curnum));
 }