public void LoadSkillNew(Game.CharacterStats character, Game.CharacterStats.SkillType skillToLoad, int trainerMaxRank)
        {
            this.m_trainFailReason = string.Empty;
            this.m_skillType       = skillToLoad;
            this.LblName.text      = Game.GUIUtils.GetSkillTypeString(this.m_skillType);
            bool  flag = false;
            float skillPerRankMultiplier = StatsData.Instance.GetSkillPerRankMultiplier(this.m_skillType);
            int   skillRank = character.GetSkillRank(this.m_skillType);

            this.m_skillXP               = character.SkillXP[(int)this.m_skillType];
            this.m_nextRankXP            = Game.CharacterStats.ExperienceNeededForNextSkillRank(skillRank, skillPerRankMultiplier);
            this.LblRank.text            = string.Format(SDK.GUIUtils.GetText(291), skillRank, trainerMaxRank);
            this.LblRank.color           = UIGlobalColor.FetchColor(UIGlobalColor.ColorLookupID.TEXT_NORMAL_DEFAULT);
            this.ProgressRank.fillAmount = (float)this.m_skillXP / (float)this.m_nextRankXP;
            if (skillRank + 1 > trainerMaxRank)
            {
                this.m_trainFailReason = string.Format(SDK.GUIUtils.GetText(2129), trainerMaxRank);
                this.LblRank.color     = UIGlobalColor.FetchColor(UIGlobalColor.ColorLookupID.TEXT_UNAFFORDABLE);
                flag = true;
            }
            if (character.SkillsTrainedThisLevel >= character.Level * 5)
            {
                this.m_trainFailReason = SDK.GUIUtils.GetText(2132);
            }
            int num = Game.CharacterStats.CopperCostToTrainSkillToNextRank(skillRank + 1);

            Game.Player s_playerCharacter = Game.GameState.s_playerCharacter;
            if (s_playerCharacter == null)
            {
                return;
            }
            Game.PlayerInventory component = s_playerCharacter.GetComponent <Game.PlayerInventory>();
            if (component == null)
            {
                return;
            }
            bool flag2 = component.currencyTotalValue >= (float)num;

            this.CostView.ShowCost(num, flag2);
            if (!flag2)
            {
                this.m_trainFailReason = SDK.GUIUtils.GetText(2128);
            }
            this.ButtonMain.IsEnabled = (this.m_trainFailReason.Length == 0);
            if (!flag && !this.ButtonMain.IsEnabled)
            {
                this.LblRank.color = UIGlobalColor.FetchColor(UIGlobalColor.ColorLookupID.TEXT_NORMAL_DISABLED);
            }
            if (this.m_isHovered && this.m_trainFailReason.Length != 0)
            {
                this.OnTrainSkillHovered(this.ButtonTrain.gameObject, true);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Protected constructor
 /// </summary>
 /// <param name="mSceneMgr">A reference to the scene manager</param>
 /// <param name="characterStat">A reference to a character stat</param>
 protected HMD(SceneManager mSceneMgr, RenderWindow mWindow, CharacterStats characterStat)
 {
     this.mWindow        = mWindow;
     this.mSceneMgr      = mSceneMgr;
     this.characterStats = characterStat;
 }