示例#1
0
        public void To(Data.PromotionTemplate info, Data.PromotionAttributeLevelTemplate attrInfo)
        {
            Reset();

            string attrName     = attrInfo.name;
            int    attrId       = attrInfo.id;
            bool   isPercentNum = attrInfo.attrValue.ToString().Contains(".");
            int    nextId       = Data.CharacterTemplateManager.Instance.GetNextPromotionId(info.id);
            string formatStr;

            if (PageId == 1)
            {
                formatStr = isPercentNum ? "{0}/{1}%" : "{0}/{1}";
            }
            else
            {
                formatStr = isPercentNum ? "{0}/{1}%({2})" : "{0}/{1}({2})";
            }
            Data.PromotionTemplate nextInfo = Data.CharacterTemplateManager.Instance.GetPromotionInfo(nextId);
            int    currentAttrLevel         = LTPromotionManager.Instance.GetCurrentAttrLevel(attrId);
            float  attrValue   = isPercentNum ? attrInfo.attrValue * 100 : attrInfo.attrValue;
            string deltaFormat = nextInfo == null ? "Max" : isPercentNum ? "+{0}%" : "+{0}";
            string deltaStr    = string.Format(deltaFormat, nextInfo == null ? "" : ((nextInfo.attributeLevelUpperLimit - info.attributeLevelUpperLimit) * attrValue).ToString());

            _labName.text = EquipmentUtility.AttrTypeTrans(attrName, false);
            int trainingAfterAttrLevel;

            if (!LTPromotionManager.Instance.GetTrainingAfterAttrLevel(attrId, out trainingAfterAttrLevel))
            {
                trainingAfterAttrLevel = currentAttrLevel;
            }
            PlayProgressfx(trainingAfterAttrLevel * attrValue - currentAttrLevel * attrValue > 0, false);
            DOTween.To(val =>
            {
                float targetValue   = info.attributeLevelUpperLimit * attrValue;
                string sign         = isPercentNum ? "%" : string.Empty;
                string currentValue = LT.Hotfix.Utility.ColorUtility.FormatColorByGreen(val, targetValue, sign, isPercentNum ? 1 : 0);
                _labProgress.text   = EB.StringUtil.Format(formatStr, currentValue, targetValue.ToString(isPercentNum ? "0.0" : "0"), deltaStr);
            }, currentAttrLevel * attrValue, trainingAfterAttrLevel * attrValue, dynamicEffectDuration);
            DOTween.To(val =>
            {
                _uiProgressBar.value = val;
                SetProgressBarForeground(val > 0.99f);
            }, currentAttrLevel / (float)info.attributeLevelUpperLimit, trainingAfterAttrLevel / (float)info.attributeLevelUpperLimit, dynamicEffectDuration).OnComplete(() =>
            {
                ShowIncrement(currentAttrLevel * attrValue, trainingAfterAttrLevel * attrValue, isPercentNum);
            });
        }
示例#2
0
        public void Set(Data.PromotionTemplate info, int pageId)
        {
            var attrList = LTPromotionManager.Instance.GetAttrList();
            var len      = _items.Length;
            var count    = attrList.Count;

            for (var i = 0; i < len; i++)
            {
                var item = _items[i];

                if (i < count)
                {
                    item.Set(info, attrList[i], pageId);
                }
                else
                {
                    item.Set(info, CharacterTemplateManager.Instance.GetPromotionAttributeLevelInfo(i + 1), pageId);
                }
            }

            _uiGrid.Reposition();
        }
示例#3
0
        public void Set(Data.PromotionTemplate info, Data.PromotionAttributeLevelTemplate attrInfo, int PageId)
        {
            var attrList = LTPromotionManager.Instance.GetAttrList();

            if (attrList != null && attrList.Contains(attrInfo))
            {
                _labProgress.gameObject.CustomSetActive(true);
                _labUnlock.gameObject.CustomSetActive(false);
            }
            else
            {
                _labProgress.gameObject.CustomSetActive(false);
                _labUnlock.gameObject.CustomSetActive(true);
                var promotionInfo = Data.CharacterTemplateManager.Instance.GetPromotionInfo(attrInfo.unlockLevel, 0);

                if (promotionInfo != null)
                {
                    _labUnlock.text = string.Format(EB.Localizer.GetString("ID_PROMOTION_ATTRIBUTE_UNLOCK_TIPS"), promotionInfo.name);
                }
            }
            this.PageId = PageId;
            To(info, attrInfo);
        }