Ejemplo n.º 1
0
        public static int GetStrengthenAddShowValue(int strengthenLv)
        {
            int strengthenAddShowValue = 0;
            int correspondingHeroStrengthenNeedDataID     = strengthenLv - 1;
            HeroStrengthenNeedData heroStrengthenNeedData = HeroStrengthenNeedData.GetHeroStrengthenNeedDataByID(correspondingHeroStrengthenNeedDataID);

            if (heroStrengthenNeedData != null)
            {
                strengthenAddShowValue = heroStrengthenNeedData.strengthenAddShowValue;
            }
            return(strengthenAddShowValue);
        }
Ejemplo n.º 2
0
        public static string GetStrengthenLevelColorName(int strengthenLv)
        {
            int correspondingHeroStrengthenNeedDataID     = strengthenLv - 1;
            HeroStrengthenNeedData heroStrengthenNeedData = HeroStrengthenNeedData.GetHeroStrengthenNeedDataByID(correspondingHeroStrengthenNeedDataID);
            RoleStrengthenStage    color = RoleStrengthenStage.White;

            if (heroStrengthenNeedData != null)
            {
                color = heroStrengthenNeedData.roleStrengthenStage;
            }
            string roleNameColorString = string.Empty;

            switch (color)
            {
            case RoleStrengthenStage.White:
                roleNameColorString = Localization.Get("common.color_White");
                break;

            case RoleStrengthenStage.Green:
                roleNameColorString = Localization.Get("common.color_Green");
                break;

            case RoleStrengthenStage.Blue:
                roleNameColorString = Localization.Get("common.color_Blue");
                break;

            case RoleStrengthenStage.Purple:
                roleNameColorString = Localization.Get("common.color_Purple");
                break;

            case RoleStrengthenStage.Orange:
                roleNameColorString = Localization.Get("common.color_Orange");
                break;

            default:
                break;
            }
            return(roleNameColorString);
        }
Ejemplo n.º 3
0
        private void RefreshAttribute()
        {
            HeroInfo info;
            int      expTotal = 0;
            float    crit     = 0;

            HeroInfo[] materials           = HeroStrengthenProxy.instance.SelectedMaterialHeroInfos;
            int        count               = materials.Length;
            int        selectMaterialCount = 0;

            for (int i = 0; i < count; i++)
            {
                info = materials[i];
                if (info != null)
                {
                    HeroStrengthenProvideData data = HeroStrengthenProvideData.GetHeroStrengthenProvideDataByID(info.advanceLevel);
                    if (data != null)
                    {
                        expTotal += data.exp_provide;
                        crit     += (data.exp_provide * data.crit);
                    }
                    selectMaterialCount++;
                }
            }
            //crit
            if (expTotal != 0)
            {
                crit = crit / expTotal;
            }
            string s;

            if (crit >= 0 && crit < 10)
            {
                s = Localization.Get("ui.hero_strengthen_view.small");
            }
            else if (crit >= 10 && crit < 30)
            {
                s = Localization.Get("ui.hero_strengthen_view.mid");;
            }
            else
            {
                s = Localization.Get("ui.hero_strengthen_view.big");;
            }

            currentCriticalChangeText.text = s;

            //level
            RoleInfo heroInfo = HeroStrengthenProxy.instance.StrengthenHeroInfo;


            HeroStrengthenNeedData curData  = HeroStrengthenNeedData.GetHeroStrengthenNeedDataByLevel(heroInfo.strengthenLevel);
            HeroStrengthenNeedData nextData = HeroStrengthenNeedData.GetHeroStrengthenNeedDataByExp(HeroStrengthenNeedData.GetStrengthenTotalExp(heroInfo.strengthenLevel) + heroInfo.strengthenExp + expTotal);
            bool isMax = curData == null ? true : false;

            _isReachMaxLevel = isMax ? true : (nextData == null ? true : false);
            int addLevel = isMax ? 0 : (nextData == null) ? HeroStrengthenNeedData.LastNeedData().aggr_lv - heroInfo.strengthenLevel + 1 : nextData.aggr_lv - heroInfo.strengthenLevel;

            strengthenAddLevel = addLevel;

            int totalLv = heroInfo.strengthenLevel + addLevel;
            int stLv    = RoleUtil.GetStrengthenAddShowValue(totalLv);

            if (stLv == 0)
            {
                strengthenLevelText.text = "";
            }
            else
            {
                strengthenLevelText.text = string.Format("+{0}", stLv);
            }
            strengthenLevelDesText.text = string.Format(Localization.Get("ui.hero_strengthen_view.strengthen_level"), RoleUtil.GetStrengthenLevelColorName(totalLv));
            HeroStrengthenNeedData heroStrengthenNeedData = HeroStrengthenNeedData.GetHeroStrengthenNeedDataByID(totalLv - 1);
            RoleStrengthenStage    color = RoleStrengthenStage.White;

            if (heroStrengthenNeedData != null)
            {
                color = heroStrengthenNeedData.roleStrengthenStage;
                strengthenLevelText.color    = UIUtil.GetRoleNameColor(color);
                strengthenLevelDesText.color = UIUtil.GetRoleNameColor(color);
            }
            else
            {
                strengthenLevelText.color    = UIUtil.GetRoleNameColor(RoleStrengthenStage.White);
                strengthenLevelDesText.color = UIUtil.GetRoleNameColor(RoleStrengthenStage.White);
            }

            //属性
            RefreshMainAttribute(addLevel);

            //money
            float moneyTotal = GetStrengthenMoney(heroInfo.strengthenLevel, heroInfo.strengthenLevel + addLevel, expTotal);

            moneyTotal = moneyTotal * selectMaterialCount;
            if (moneyTotal > GameProxy.instance.BaseResourceDictionary.GetValue(BaseResType.Gold))
            {
                coinText.text = UIUtil.FormatToRedText(((int)moneyTotal).ToString());
            }
            else
            {
                coinText.text = ((int)moneyTotal).ToString();
            }

            RefreshExp(expTotal);
        }