Ejemplo n.º 1
0
        public void ShowLevelUp()
        {
            if (OldData != data)
            {
                OldData = data;
                Show(data.Eid);
            }
            string colorStr               = (LTPartnerEquipDataManager.Instance.UpLevelSelectList.Count > 0)?"[42fe79]": "[ffffff]";
            int    totalAddEXP            = 0;
            Dictionary <string, int> Dics = LTPartnerEquipDataManager.Instance.getEquipUpItemNumDic();

            foreach (var item in Dics)
            {
                totalAddEXP += LTPartnerEquipDataManager.Instance.getEquipUpItemExp(item.Key) * item.Value;
            }
            for (int i = 0; i < LTPartnerEquipDataManager.Instance.UpLevelSelectList.Count; i++)
            {
                totalAddEXP += LTPartnerEquipDataManager.Instance.GetTotleExpByEid(LTPartnerEquipDataManager.Instance.UpLevelSelectList[i]);
            }
            Hotfix_LT.Data.EquipmentLevelUp LevelUpInfo = new Hotfix_LT.Data.EquipmentLevelUp();
            bool GetExpInfo = false;

            for (int i = data.EquipLevel; i < MaxLevel; i++)
            {
                if (data.Exp + totalAddEXP < LevelUpList[i].TotalNeedExp)
                {
                    GetExpInfo  = true;
                    LevelUpInfo = LevelUpList[i]; break;
                }
            }
            int OverPlueExp = GetExpInfo? (LevelUpInfo.TotalNeedExp - LevelUpInfo.needExp) : LevelUpList[MaxLevel - 1].TotalNeedExp;
            int costCount   = totalAddEXP;

            if (totalAddEXP > 0 && !GetExpInfo)
            {
                costCount = OverPlueExp - data.Exp;
            }

            int   temp1     = data.Exp - OverPlueExp + totalAddEXP;
            int   temp2     = LevelUpInfo.needExp;
            float tempValue = (float )temp1 / (float)temp2;

            nextExpSlider.value = (LevelUpInfo.level == 0 || (LevelUpInfo.level - 1) > data.EquipLevel)?1: tempValue;


            nextLevelLabel.text = nextLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}{1}", colorStr, (LevelUpInfo.level - 1) >= 0? (LevelUpInfo.level - 1) : LevelUpList.Count);
            nextLevelLabel.gameObject.CustomSetActive(((LevelUpInfo.level - 1) >= 0 ? (LevelUpInfo.level - 1) : MaxLevel) != data.EquipLevel);

            NextLevel        = (LevelUpInfo.level - 1) >= 0 ? (LevelUpInfo.level - 1) : MaxLevel;
            SliderLabel.text = string.Format("{0}{1}/{2}", colorStr, temp1, LevelUpInfo.needExp);

            int    resGold   = BalanceResourceUtil.GetUserGold();
            string colorStr2 = (costCount > resGold) ? "[ff6699]" : "[ffffff]";

            CostLabel.text = CostLabel.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}{1}", colorStr2, costCount);
            //CostLabel.updateAnchors = UIRect.AnchorUpdate.OnUpdate;
            CostIcon.UpdateAnchors();

            SetUplevelBtn(totalAddEXP > 0);
        }
Ejemplo n.º 2
0
        IEnumerator LevelUpScrollAniPlay()//装备经验条动效
        {
            nextLevelLabel.gameObject.CustomSetActive(false);
            InputBlockerManager.Instance.Block(InputBlockReason.UI_SERVER_REQUEST, 1f);
            nextExpSlider.value = 0;
            CostLabel.text      = CostLabel.transform.GetChild(0).GetComponent <UILabel>().text = "0";
            //CostLabel.updateAnchors = UIRect.AnchorUpdate.OnUpdate;
            CostIcon.UpdateAnchors();
            SetUplevelBtn();
            int   upLvTimes = data.EquipLevel - OldData.EquipLevel; //进行次数
            float maxTimer  = 0.8f;                                 //最大花费时间
            float minTimer  = 0.1f;                                 //最小花费时间
            int   maxNum    = 0;                                    //最大值

            Hotfix_LT.Data.EquipmentLevelUp LevelUpInfo = LevelUpList[OldData.EquipLevel];
            int   OverPlueExp = LevelUpInfo.TotalNeedExp - LevelUpInfo.needExp;
            int   NowExp      = OldData.Exp - OverPlueExp;
            int   NeedExp     = LevelUpInfo.needExp;
            float startValue  = (float)NowExp / (float)NeedExp; //开始经验条
            int   startNum    = NowExp;                         //开始数字
            float endValue;                                     //结束经验条
            int   endNum;                                       //结束数字

            if (data.EquipLevel != MaxLevel)
            {
                LevelUpInfo = LevelUpList[data.EquipLevel];
                OverPlueExp = LevelUpInfo.TotalNeedExp - LevelUpInfo.needExp;
                NowExp      = data.Exp - OverPlueExp;
                NeedExp     = LevelUpInfo.needExp;
                endValue    = (float)NowExp / (float)NeedExp;
                endNum      = NowExp;
            }
            else  //达到最大强化等级
            {
                endValue = -1;
                endNum   = -1;
            }
            if (upLvTimes != 0)
            {
                FusionAudio.PostEvent("UI/Partner/ExpSlider", true);
            }
            for (int i = 0; i <= upLvTimes; i++)
            {
                if (i != upLvTimes)
                {
                    float timer = Mathf.Clamp(maxTimer * (1f - startValue) / (upLvTimes - i), minTimer, maxTimer);
                    SliderFx.TimesList.Enqueue(new SliderAniData(startValue, 1, timer));
                    maxNum = LevelUpList[OldData.EquipLevel + i].needExp;
                    LabelFx.TimesList.Enqueue(new LabelAniData(startNum, maxNum, maxNum, timer));
                    startNum   = 0;
                    startValue = 0;
                    yield return(new WaitForSeconds(timer - 0.02f));

                    nowLevelLabel.text = nowLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = (OldData.EquipLevel + 1 + i).ToString();
                    UpLeveItem.LevelLabel.gameObject.CustomSetActive(OldData.EquipLevel + 1 + i > 0);
                    UpLeveItem.LevelLabel.text = string.Format("+{0}", (OldData.EquipLevel + 1 + i));
                    ItemFx.CustomSetActive(false);
                    ItemFx.CustomSetActive(true);
                }
                else//最后一次时
                {
                    SliderFx.TimesList.Enqueue(new SliderAniData(startValue, endValue, maxTimer * endValue));
                    maxNum = data.EquipLevel != MaxLevel? LevelUpList[data.EquipLevel].needExp:0;
                    LabelFx.TimesList.Enqueue(new LabelAniData(startNum, endNum, maxNum, maxTimer * endValue));
                    nowLevelLabel.text = nowLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = data.EquipLevel.ToString();
                    UpLeveItem.LevelLabel.gameObject.CustomSetActive(data.EquipLevel > 0);
                    UpLeveItem.LevelLabel.text = string.Format("+{0}", data.EquipLevel);
                }
            }

            if (data.EquipLevel != OldData.EquipLevel)
            {
                FusionAudio.PostEvent("UI/Equipment/LvlUp", mDMono.gameObject, true);
            }
            ShowSynthesis(data);
            yield break;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 刷新强化所有属性
        /// </summary>
        /// <param name="eid"></param>
        public void Show(int eid)
        {
            StopAllCoroutines();
            SliderFx.ResetList();
            LabelFx.ResetList();
            data = LTPartnerEquipDataManager.Instance.GetEquipmentInfoByEID(eid);
            if (data == null)
            {
                EB.Debug.LogError("LTPartnerEquipUplevelController.Show data is null,Eid = {0}", eid);
                return;
            }
            if (data.Eid == 0)
            {
                return;
            }
            UpLeveItem.Fill(data);
            ItemNameLabel.applyGradient  = true;
            ItemNameLabel.gradientTop    = LT.Hotfix.Utility.ColorUtility.QualityToGradientTopColor(data.QualityLevel);
            ItemNameLabel.gradientBottom = LT.Hotfix.Utility.ColorUtility.QualityToGradientBottomColor(data.QualityLevel);
            ItemNameLabel.text           = data.Name;
            LevelUpList        = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetLevelUpListByQuality(data.QualityLevel);
            nowLevelLabel.text = nowLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = nextLevelLabel.text = nextLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = data.EquipLevel.ToString();
            nextLevelLabel.gameObject.CustomSetActive(false);
            NextLevel          = data.EquipLevel;
            MaxLevel           = LevelUpList.Count;
            maxLevelLabel.text = maxLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = MaxLevel.ToString();
            if (data.MainAttributes.Name != null)
            {
                MainAttrObj.AttrName.text = AttrTypeTrans(data.MainAttributes.Name);
                MainAttrObj.CurValue.text = AttrTrans(data.MainAttributes);
                // MainAttrObj.FxObj.CustomSetActive(false);
                if (MainAttrObj.NextValue.gameObject.activeSelf)
                {
                    MainAttrObj.CurValue.GetComponent <TweenScale>().ResetToBeginning();
                    MainAttrObj.CurValue.GetComponent <TweenScale>().PlayForward();
                    MainAttrObj.NextValue.gameObject.CustomSetActive(false);
                }
            }
            else
            {
                EB.Debug.LogError(string.Format("Equipment(id={0}) Main Attribbute is Missing", data.Eid));
                MainAttrObj.AttrName.gameObject.CustomSetActive(false);
                MainAttrObj.CurValue.gameObject.CustomSetActive(false);
                MainAttrObj.NextValue.gameObject.CustomSetActive(false);
                MainAttrObj.LockObj.CustomSetActive(false);
                // MainAttrObj.FxObj.CustomSetActive(false);
            }
            int UpLv = data.EquipLevel / 3;
            int high = 0;
            EquipAttributeRate rate = EconemyTemplateManager.Instance.GetEquipAttributeRate(data.QualityLevel);

            for (int i = rate.rating.Count - 1; i >= 0; i--)
            {
                if (rate.rating[i] > 0)
                {
                    high = i;
                    break;
                }
            }
            for (int i = 0; i < 4; i++)
            {
                if (i < data.ExAttributes.Count)
                {
                    ExAttrObj[i].AttrName.text = AttrTypeTrans(data.ExAttributes[i].Name);
                    ExAttrObj[i].CurValue.text = AttrTrans(data.ExAttributes[i]);
                    ExAttrObj[i].AttrName.gameObject.CustomSetActive(true);
                    ExAttrObj[i].CurValue.gameObject.CustomSetActive(true);
                    ExAttrObj[i].LockObj.CustomSetActive(false);
                    if (ExAttrObj[i].NextValue.gameObject.activeSelf)
                    {
                        ExAttrObj[i].CurValue.GetComponent <TweenScale>().ResetToBeginning();
                        ExAttrObj[i].CurValue.GetComponent <TweenScale>().PlayForward();
                        ExAttrObj[i].NextValue.gameObject.CustomSetActive(false);
                    }
                }
                else
                {
                    UpLv++;
                    if (i < high)
                    {
                        ExAttrObj[i].LockObj.GetComponent <UILabel>().text = ExAttrObj[i].LockObj.transform.GetChild(0).GetComponent <UILabel>().text = string.Format(EB.Localizer.GetString("ID_codefont_in_LTPartnerEquipUplevelController_4355"), UpLv * 3);
                    }
                    else
                    {
                        ExAttrObj[i].LockObj.GetComponent <UILabel>().text = ExAttrObj[i].LockObj.transform.GetChild(0).GetComponent <UILabel>().text = string.Empty;
                    }
                    ExAttrObj[i].AttrName.gameObject.CustomSetActive(false);
                    ExAttrObj[i].CurValue.gameObject.CustomSetActive(false);
                    ExAttrObj[i].NextValue.gameObject.CustomSetActive(false);
                    ExAttrObj[i].LockObj.CustomSetActive(true);
                    // ExAttrObj[i].FxObj.CustomSetActive(false);
                }
            }
            int NowExp      = 0;
            int NeedExp     = 0;
            int OverPlueExp = 0;

            if (data.EquipLevel < MaxLevel)
            {
                Hotfix_LT.Data.EquipmentLevelUp LevelUpInfo = LevelUpList[data.EquipLevel];
                OverPlueExp = LevelUpInfo.TotalNeedExp - LevelUpInfo.needExp;

                NowExp           = data.Exp - OverPlueExp;
                NeedExp          = LevelUpInfo.needExp;
                SliderLabel.text = string.Format("{0}/{1}", NowExp, NeedExp);
            }
            else
            {
                SliderLabel.text = string.Format(EB.Localizer.GetString("ID_codefont_in_LTEquipLabelAni_1251"));
            }

            nowExpSlider.value = nextExpSlider.value = (data.EquipLevel >= MaxLevel) ? 1.0f : ((float)NowExp / (float)NeedExp);
            CostLabel.text     = CostLabel.transform.GetChild(0).GetComponent <UILabel>().text = "0";
            //CostLabel.updateAnchors = UIRect.AnchorUpdate.OnUpdate;
            CostIcon.UpdateAnchors();
            SetUplevelBtn();
        }