Пример #1
0
 public void Fill(int materialId, int NeedNum, bool isExtremityTrialDouble, bool isSceneDouble)
 {
     curId      = materialId;
     curNeednum = NeedNum;
     this.isExtremityTrialDouble = isExtremityTrialDouble;
     this.isSceneDouble          = isSceneDouble;
     Item.LTItemData             = new LTShowItemData(materialId.ToString(), 1, LTShowItemType.TYPE_GAMINVENTORY);
     if (ItemBtn.clickEvent != null)
     {
         ItemBtn.clickEvent.Clear();
     }
     ItemBtn.clickEvent.Add(new EventDelegate(OnClickItem));
     materialNum = GameItemUtil.GetInventoryItemNum(materialId);
     SetGoldMaterialSelect(materialId, materialNum, NeedNum);
     ToGetButton.GetComponent <UISprite>().spriteName = "Ty_Button_1";
     //进度条显示
     SetSliderState(materialNum, NeedNum);
     dropData = EconemyTemplateManager.Instance.GetItem(materialId).DropDatas[0];
     //下面处理右边按钮的显示状态
     if (materialNum >= NeedNum)
     {
         CenterShowLabel.gameObject.CustomSetActive(true);
         CenterShowLabel.text = CenterShowLabel.transform.GetChild(0).GetComponent <UILabel>().text = EB.Localizer.GetString("ID_PARTNER_UPGRADE_TIP_9");
         ToGetButton.GetComponent <UISprite>().color      = new Color(1, 0, 1);
         ToGetButton.GetComponent <BoxCollider>().enabled = false;
         QuicklyGet.CustomSetActive(false);
         LockObj.CustomSetActive(false);
     }
     else
     {
         ToGetButton.GetComponent <UISprite>().color      = new Color(1, 1, 1);
         ToGetButton.GetComponent <BoxCollider>().enabled = true;
         if (dropData == null)
         {
             return;
         }
         if (dropData.Type == DropType.ExtremityTrial)//途径为极限试炼
         {
             SetExtremityTrialGet(materialId, NeedNum, isExtremityTrialDouble);
         }
         else if (dropData.Type == DropType.Scene)//途径为主线副本
         {
             SetSceneGet(materialId, NeedNum, isSceneDouble);
         }
     }
 }
Пример #2
0
        //极限试炼获取途径处理
        private void SetExtremityTrialGet(int materialId, int NeedNum, bool isDouble)
        {
            Exrate = isDouble ? ActivityUtil.GetTimeLimitActivityMul(1003) : 1.0f;
            if (isDouble)
            {
                RateObj.CustomSetActive(true);
                RateLabel.text = "×" + Exrate.ToString();
            }
            else
            {
                RateObj.CustomSetActive(false);
            }
            //极限试炼分为可扫荡和不可扫荡
            //获取当最高通关卡
            int curlayer = GetExtremityTrialCurMaxLayer();

            dropList = Data.EconemyTemplateManager.Instance.GetItem(materialId).DropDatas;
            DataLookupsCache.Instance.SearchDataByID <int>("res.vigor.v", out curVigour);
            int approLayer = 1;

            if (GetApproLayer(curlayer, out approLayer))//可以扫荡,显示快速获取
            {
                CenterShowLabel.gameObject.CustomSetActive(false);
                QuicklyGet.CustomSetActive(true);
                LockObj.gameObject.CustomSetActive(false);
                sweepsNumber = Mathf.CeilToInt((NeedNum - materialNum) / (Exrate * 1));
                totalvigour  = GetTotalNeedVigour(sweepsNumber);
                if (ToGetButton.clickEvent != null)
                {
                    ToGetButton.clickEvent.Clear();
                }
                if (curVigour >= totalvigour)
                {
                    ToGetButton.clickEvent.Add(new EventDelegate());
                    showVigour = totalvigour;
                    ToGetButton.clickEvent.Add(new EventDelegate(() => OnQuicklyGetExtremityTrialDrop(approLayer, sweepsNumber, () => ShowReward())));
                    colorStr = LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal;
                }
                else if (curVigour < newVigor || (dayDisCountTimes <= 0 && curVigour < oldVigor))//一次都不能扫荡的
                {
                    showVigour = totalvigour;
                    colorStr   = LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;
                    ToGetButton.clickEvent.Add(new EventDelegate(() => BalanceResourceUtil.TurnToVigorGotView()));
                }
                else
                {
                    if (dayDisCountTimes > 0)
                    {
                        if (curVigour - dayDisCountTimes * newVigor >= 0)
                        {
                            sweepsNumber = dayDisCountTimes + Mathf.FloorToInt((curVigour - dayDisCountTimes * newVigor) / (float)oldVigor);
                            showVigour   = dayDisCountTimes * newVigor + (sweepsNumber - dayDisCountTimes) * oldVigor;
                        }
                        else
                        {
                            sweepsNumber = Mathf.FloorToInt(curVigour / (float)newVigor);
                            showVigour   = sweepsNumber * newVigor;
                        }
                    }
                    else
                    {
                        sweepsNumber = Mathf.FloorToInt(curVigour / (float)oldVigor);
                        showVigour   = sweepsNumber * oldVigor;
                    }
                    ToGetButton.clickEvent.Add(new EventDelegate(() => OnQuicklyGetExtremityTrialDrop(approLayer, sweepsNumber, () => ShowReward())));
                    colorStr = LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal;
                }
                VigourCost.text = VigourCost.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(LT.Hotfix.Utility.ColorUtility.ColorStringFormat, colorStr, showVigour);
            }
            else//无法扫荡显示前往获取
            {
                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(() => dropData.GotoDrop()));
                //ToGetButton.GetComponent<UISprite>().color = new Color(1, 1, 1);
                //ToGetButton.GetComponent<BoxCollider>().enabled = true;
                QuicklyGet.CustomSetActive(false);
                LockObj.gameObject.CustomSetActive(false);
            }
        }
Пример #3
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);
            }
        }