Esempio n. 1
0
        /// <summary>
        /// 设置英雄头像
        /// </summary>
        /// <param name="UpGradeId"></param>
        /// <param name="icon"></param>
        /// <param name="char_type"></param>
        /// <param name="role_grade"></param>
        /// <param name="star"></param>
        /// <param name="heroLevel"></param>
        private void SetHeroIcon(string heroName, int UpGradeId, string icon, Hotfix_LT.Data.eRoleAttr char_type, int role_grade, int star, int heroLevel, string heroProfile, string profileSprite, int isawaken)
        {
            int quality  = 0;
            int addLevel = 0;

            LTPartnerDataManager.GetPartnerQuality(UpGradeId, out quality, out addLevel);
            if (addLevel == 0)
            {
                LTUIUtil.SetText(BreakLabel, "");
            }
            else
            {
                LTUIUtil.SetText(BreakLabel, "+" + addLevel.ToString());
            }
            BreakLabel.gameObject.SetActive(addLevel != 0);
            LTUIUtil.SetLevelText(HeroLevel.transform.parent.GetComponent <UISprite>(), HeroLevel, heroLevel);
            LTUIUtil.SetText(HeroName, heroName);
            LTUIUtil.SetText(HeroRoleProfile, string.Format("{0}", heroProfile == null ? EB.Localizer.GetString("ID_NATION_BATTLE_BUFF_FULL_CALL") : heroProfile));
            HeroRoleProfileSprite.spriteName = profileSprite;
            HeroIcon.spriteName       = icon;
            HeroType.spriteName       = LTPartnerConfig.LEVEL_SPRITE_NAME_DIC[char_type];
            HeroIconBorder.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[quality];
            GameItemUtil.SetColorfulPartnerCellFrame(quality, HeriIconBorderBG);
            HotfixCreateFX.ShowUpgradeQualityFX(upgradeFx, HeroIconBorder.transform, quality, upgradeefclip);
            GradeIcon.spriteName = LTPartnerConfig.PARTNER_GRADE_SPRITE_NAME_DIC[(PartnerGrade)role_grade];
            HotfixCreateFX.ShowCharTypeFX(charFx, efClip, HeroType.transform, (PartnerGrade)role_grade, char_type);
            StarList.SetSrarList(star, isawaken);
        }
Esempio n. 2
0
        public void SetExp(string heroid)
        {
            if (int.Parse(heroid) < 0)
            {
                var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(int.Parse(heroid));
                if (hireInfo != null)
                {
                    m_Level.text = hireInfo.level.ToString();
                    m_Exp_Progress.gameObject.CustomSetActive(false);
                    m_Exp_Add_Label.gameObject.CustomSetActive(false);
                }
                return;
            }
            IDictionary expData;
            int         addExp = 0;

            if (DataLookupsCache.Instance.SearchDataByID <IDictionary>(RewardsPath, out expData))
            {
                addExp = EB.Dot.Integer("quantity", expData, 0);
                m_Exp_Add_Label.text = string.Format(EB.Localizer.GetString("ID_codefont_in_CamapignVictoryExpDataSet_743"), addExp);
            }
            else
            {
                m_Exp_Add_Label.text = string.Format(EB.Localizer.GetString("ID_codefont_in_CamapignVictoryExpDataSet_743"), 0);
            }

            int endLevel  = 0;
            int endExpSum = 0;

            DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.level", heroid), out endLevel);
            DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.xp", heroid), out endExpSum);
            int   endLevelExp = endExpSum - Hotfix_LT.Data.CharacterTemplateManager.Instance.GerHeroPastExpSum(endLevel);
            float endPercent  = (float)endLevelExp / (float)Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(endLevel).buddy_exp;

            var partnerData = LTPartnerDataManager.Instance.GetPartnerByHeroId(int.Parse(heroid));

            if (partnerData != null)
            {
                Hotfix_LT.Data.UpGradeInfoTemplate curTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetUpGradeInfo(partnerData.UpGradeId, partnerData.HeroInfo.char_type);
                if (partnerData.Level >= curTpl.level_limit)
                {
                    LTUIUtil.SetLevelText(m_Level.transform.parent.GetComponent <UISprite>(), m_Level, partnerData);
                    m_Exp_Progress.value = endPercent;
                    return;
                }
            }

            int   startExpSum   = endExpSum - addExp;
            int   startLevel    = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelByExp(startExpSum);
            int   startLevelExp = startExpSum - Hotfix_LT.Data.CharacterTemplateManager.Instance.GerHeroPastExpSum(startLevel);
            float startPercent  = (float)startLevelExp / (float)Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(startLevel).buddy_exp;

            EB.Coroutines.Run(PlayExpProgressAni(startPercent, endPercent, endLevel - startLevel, startLevel));

            if (m_Exp_Label != null)
            {
                LTUIUtil.SetText(m_Exp_Label, endLevelExp + "/" + Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(endLevel).buddy_exp);
            }
        }
Esempio n. 3
0
        public void SetHp(string heroId, bool isShowTempHp)
        {
            //float fullHp = 0;
            int   level   = 0;
            int   peak    = 0;
            float percent = 0;

            if (int.Parse(heroId) < 0)//是否雇佣
            {
                var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(int.Parse(heroId));
                if (hireInfo != null)
                {
                    float fullHp = hireInfo.base_MaxHP;
                    float curHp  = 0;
                    if (isShowTempHp)
                    {
                        curHp = LTHotfixManager.GetManager <SceneManager>().GetChallengeTempHp(heroId);
                    }
                    else
                    {
                        curHp = LTChallengeInstanceHpCtrl.GetCombatHp(heroId);
                    }
                    percent = curHp / fullHp;
                    level   = hireInfo.level;
                }
            }
            else
            {
                if (isShowTempHp)
                {
                    float curHp  = LTHotfixManager.GetManager <SceneManager>().GetChallengeTempHp(heroId);
                    float fullHp = 0;
                    DataLookupsCache.Instance.SearchDataByID <float>(string.Format("userCampaignStatus.challengeChapters.team.{0}.MHP", heroId), out fullHp);
                    percent = curHp / fullHp;
                }
                else
                {
                    percent = LTChallengeInstanceHpCtrl.GetCombatHPPercent(heroId);
                }
                DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.level", heroId), out level);

                DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.proficiency.1.1", heroId), out peak);
            }

            percent = Mathf.Min(percent, 1);

            PercentLabel.text = percent.ToString("0%");
            HpProgress.value  = percent;

            DeathLabel.gameObject.SetActive(percent <= 0);
            PercentLabel.gameObject.SetActive(percent > 0);

            LTUIUtil.SetLevelText(LevelLabel.transform.parent.GetComponent <UISprite>(), LevelLabel, level + peak);
        }
Esempio n. 4
0
        public virtual void Fill(OtherPlayerPartnerData data, bool canOpen = true)
        {
            if (data == null || data.Level == 0)
            {
                mDMono.gameObject.SetActive(false);
                return;
            }

            this.canOpen = canOpen;
            PartnerData  = data;
            LevelLabel.gameObject.CustomSetActive(data.Level > 0);
            LevelLabel.text = data.Level.ToString();
            LTUIUtil.SetLevelText(LevelBgSprite, LevelLabel, data.Level + data.AllRoundLevel);
            AttrBGSprite.spriteName = LTPartnerConfig.LEVEL_SPRITE_NAME_DIC[data.Attr];
            LTPartnerConfig.SetLevelSprite(AttrBGSprite, data.Attr, data.ArtifactLevel >= 0);
            HotfixCreateFX.ShowCharTypeFX(charFx, efClip, AttrBGSprite.transform, (PartnerGrade)data.QualityLevel, data.Attr);
            IconSprite.spriteName = data.Icon;

            // 新增
            if (BreakLabel != null && QualityBorderSpriteBg != null)
            {
                SetStarNum(data.Star, data.awakenLevel);
                int quality  = 0;
                int addLevel = 0;
                LTPartnerDataManager.GetPartnerQuality(data.UpGradeId, out quality, out addLevel);
                GameItemUtil.SetColorfulPartnerCellFrame(quality, QualityBorderSpriteBg);
                HotfixCreateFX.ShowUpgradeQualityFX(upgradeFx, QualityBorderSprite.transform, quality, upgradeefclip);
                QualityBorderSprite.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[quality];

                if (addLevel > 0)
                {
                    BreakLabel.gameObject.SetActive(true);
                    BreakLabel.text = "+" + addLevel.ToString();
                }
                else
                {
                    BreakLabel.gameObject.SetActive(false);
                }
            }
            else
            {
                //    LevelAttrBGSprite.spriteName = UIBuddyShowItem.AttrToLevelBG(data.Attr);
                QualityBorderSprite.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[data.QualityLevel];
                GameItemUtil.SetColorfulPartnerCellFrame(data.QualityLevel, QualityBorderSpriteBg);
                HotfixCreateFX.ShowUpgradeQualityFX(upgradeFx, QualityBorderSprite.transform, data.QualityLevel, upgradeefclip);
                SetStarNum(data.Star, data.awakenLevel);
            }
            if (data != null)
            {
                mDMono.gameObject.CustomSetActive(true);
            }
        }
Esempio n. 5
0
        private void UpdateItem(bool isRefreshRedPoint = true)
        {
            if (partnerData == null)
            {
                if (mDMono != null && mDMono.gameObject != null)
                {
                    mDMono.gameObject.CustomSetActive(false);
                }
                return;
            }
            mDMono.gameObject.CustomSetActive(true);

            int quality  = 0;
            int addLevel = 0;

            LTPartnerDataManager.GetPartnerQuality(partnerData.UpGradeId, out quality, out addLevel);

            FrameSprite.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[quality];
            GameItemUtil.SetColorfulPartnerCellFrame(quality, FrameBGSprite);
            curSelectId = LTPartnerDataManager.Instance.DropSelectPartnerId;

            if (partnerData.HeroId <= 0)
            {
                SetGrey(IconSprite);
                SetGrey(FrameSprite);
                SetDark(FrameBGSprite);
            }
            else
            {
                SetNormal(IconSprite);
                SetNormal(FrameSprite);
            }

            if (addLevel > 0)
            {
                breakLebel.transform.parent.gameObject.CustomSetActive(true);
                breakLebel.text = "+" + addLevel.ToString();
            }
            else
            {
                breakLebel.transform.parent.gameObject.SetActive(false);
            }
            //BottomSprite.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[quality];

            IconSprite.spriteName = partnerData.HeroInfo.icon;
            LTPartnerConfig.SetLevelSprite(LevelSprite, partnerData.HeroInfo.char_type, partnerData.ArtifactLevel >= 0);
            LTUIUtil.SetLevelText(LevelLabel.transform.parent.GetComponent <UISprite>(), LevelLabel, partnerData);
            if (partnerData.HeroId > 0)
            {
                PartnerGrade grade = (PartnerGrade)partnerData.HeroInfo.role_grade;
                HotfixCreateFX.ShowCharTypeFX(charFx, efClip, LevelSprite.transform, grade, partnerData.HeroInfo.char_type);
                HotfixCreateFX.ShowUpgradeQualityFX(upgradeFx, FrameSprite.transform, quality, upgradeefclip);
            }
            else
            {
                ShardSlider.value      = (float)partnerData.ShardNum / (float)partnerData.HeroInfo.summon_shard;
                ShardSprite.spriteName = partnerData.ShardNum >= partnerData.HeroInfo.summon_shard ? "Ty_Strip_Green" : "Ty_Strip_Blue";
                ShardLabel.text        = string.Format("{0}/{1}", partnerData.ShardNum, partnerData.HeroInfo.summon_shard);
            }
            isCanSummon = partnerData.HeroId <= 0 && partnerData.ShardNum >= partnerData.HeroInfo.summon_shard;

            isGoIntoBattle = partnerData.IsGoIntoBattle;
            FormationFlagObj.CustomSetActive(isGoIntoBattle);
            SetItemState();
            StarController.SetSrarList(partnerData.Star, partnerData.IsAwaken);
            SetSelectState(partnerData.StatId == curSelectId ? SELECT_STATE.SELECT : SELECT_STATE.UN_SELECT);

            if (isRefreshRedPoint)
            {
                if (isGoIntoBattle)
                {
                    InitRedPoint();
                }
                else
                {
                    RedPoint.CustomSetActive(false);
                    if (partnerData.StatId == curSelectId)
                    {
                        InitRedPoint(false);
                    }
                    ShowSummonRedPoint();
                }
            }
        }
Esempio n. 6
0
        public void SetItem(LTPartnerData itemData)
        {
            //itemData为空的时候也把ItemData置空,其他地方使用ItemData需要判空
            ItemData = itemData;

            if (itemData == null || (itemData.StatId == 0 && itemData.InfoId == 0))
            {
                mDMono.gameObject.CustomSetActive(false);
                return;
            }

            RecommendSprite.CustomSetActive(false);
            SleepPS.CustomSetActive(false);


            if (BattleReadyHudController.sBattleType == eBattleType.SleepTower && LTClimingTowerHudController.Instance != null)
            {
                SleepPS.CustomSetActive(!LTClimingTowerHudController.Instance.CanUpTeam(ItemData.HeroId));
            }

            IconSprite.spriteName = ItemData.HeroInfo.icon;
            if (ItemData.HeroId <= 0 && !ItemData.IsHeroBattle || ItemData.IsHeroBattle && LTNewHeroBattleManager.GetInstance().CurrentType == HeroBattleType.High && LTNewHeroBattleManager.GetInstance().HasChallengeHeroInfoID.Contains(ItemData.StatId))
            {
                SetGrey(IconSprite);
                SetGrey(FrameSprite);
                SetDark(FrameBGSprite);
                HideObj.CustomSetActive(false);
                return;
            }
            else
            {
                SetNormal(IconSprite);
                SetNormal(FrameSprite);
                HideObj.CustomSetActive(true);
            }
            int quality  = 0;
            int addLevel = 0;

            LTPartnerDataManager.GetPartnerQuality(ItemData.UpGradeId, out quality, out addLevel);

            FrameSprite.spriteName = LTPartnerConfig.OUT_LINE_SPRITE_NAME_DIC[quality];
            GameItemUtil.SetColorfulPartnerCellFrame(quality, FrameBGSprite);
            HotfixCreateFX.ShowUpgradeQualityFX(upgradeFx, FrameSprite.transform, quality, upgradeefclip);
            //FrameBGSprite.color = LTPartnerConfig.QUANTITY_BG_COLOR_DIC[quality];
            LTPartnerConfig.SetLevelSprite(LevelSprite, ItemData.HeroInfo.char_type, ItemData.ArtifactLevel >= 0);
            int index = QualitySettings.GetQualityLevel();

            if (index < 1)
            {
                HotfixCreateFX.ShowCharTypeFX(charFx, efClip, LevelSprite.transform, (PartnerGrade)ItemData.HeroInfo.role_grade, ItemData.HeroInfo.char_type);
            }
            LTUIUtil.SetLevelText(LevelBGSprite, LevelLabel, ItemData);
            if (itemData.IsHeroBattle)
            {
                LevelBGSprite.spriteName = "Ty_Brand_Di1";
            }
            //英雄交锋特殊处理 其他布阵需要考虑觉醒后星星颜色变化
            if (BattleReadyHudController.sBattleType == eBattleType.HeroBattle)
            {
                StarController.SetSrarList(ItemData.Star, ItemData.HeroBattleAwakenLevel);
            }
            else
            {
                //天梯选人界面特殊处理
                if (ItemData.IsHire)
                {
                    StarController.SetSrarList(ItemData.Star, ItemData.HireAwakeLevel);
                }
                else
                {
                    StarController.SetSrarList(ItemData.Star, ItemData.IsAwaken);
                }
            }
            if (addLevel > 0)
            {
                breakLebel.transform.parent.gameObject.CustomSetActive(true);
                breakLebel.text = "+" + addLevel.ToString();
            }
            else
            {
                breakLebel.transform.parent.gameObject.CustomSetActive(false);
            }

            if (itemData.Level > 0 && LTResourceInstanceHudController.mChooseLevel != null)
            {
                for (int i = 0; i < LTResourceInstanceHudController.mChooseLevel.recommend_partners_id.Length; i++)
                {
                    if (LTResourceInstanceHudController.mChooseLevel.recommend_partners_id[i] != 0 && ItemData.HeroInfo.id == LTResourceInstanceHudController.mChooseLevel.recommend_partners_id[i])
                    {
                        RecommendSprite.CustomSetActive(true);
                        break;
                    }
                }
            }

            DeathSprite.gameObject.CustomSetActive(false);
            if ((BattleReadyHudController.sBattleType == eBattleType.ChallengeCampaign || BattleReadyHudController.sBattleType == eBattleType.AlienMazeBattle) && !FormationUtil.IsAlive(itemData.HeroId, itemData.IsHire) && itemData.uid <= 0)
            {
                DeathSprite.gameObject.CustomSetActive(true);
            }

            if (HireSprite)
            {
                HireSprite.CustomSetActive(itemData.IsHire && ItemData.uid <= 0);
            }

            MercenaryUseFlag.CustomSetActive(false);
            MercenaryUseFlag.CustomSetActive(ShowUseFlag());

            mDMono.gameObject.CustomSetActive(true);
        }