コード例 #1
0
ファイル: UIBuff.cs プロジェクト: ming81/TheExperiment
        protected override void UpdateData()
        {
            if (uiTextDuration != null)
            {
                var duration = Buff.GetDuration(Level);
                uiTextDuration.gameObject.SetActive(duration != 0);
                uiTextDuration.text = string.Format(durationFormat, duration.ToString("N0"));
            }

            if (uiTextRecoveryHp != null)
            {
                var recoveryHp = Buff.GetRecoveryHp(Level);
                uiTextRecoveryHp.gameObject.SetActive(recoveryHp != 0);
                uiTextRecoveryHp.text = string.Format(recoveryHpFormat, recoveryHp.ToString("N0"));
            }

            if (uiTextRecoveryMp != null)
            {
                var recoveryMp = Buff.GetRecoveryMp(Level);
                uiTextRecoveryMp.gameObject.SetActive(recoveryMp != 0);
                uiTextRecoveryMp.text = string.Format(recoveryMpFormat, recoveryMp.ToString("N0"));
            }

            if (uiTextRecoveryStamina != null)
            {
                var recoveryStamina = Buff.GetRecoveryStamina(Level);
                uiTextRecoveryStamina.gameObject.SetActive(recoveryStamina != 0);
                uiTextRecoveryStamina.text = string.Format(recoveryStaminaFormat, recoveryStamina.ToString("N0"));
            }

            if (uiTextRecoveryFood != null)
            {
                var recoveryFood = Buff.GetRecoveryFood(Level);
                uiTextRecoveryFood.gameObject.SetActive(recoveryFood != 0);
                uiTextRecoveryFood.text = string.Format(recoveryFoodFormat, recoveryFood.ToString("N0"));
            }

            if (uiTextRecoveryWater != null)
            {
                var recoveryWater = Buff.GetRecoveryWater(Level);
                uiTextRecoveryWater.gameObject.SetActive(recoveryWater != 0);
                uiTextRecoveryWater.text = string.Format(recoveryWaterFormat, recoveryWater.ToString("N0"));
            }

            if (uiBuffStats != null)
            {
                uiBuffStats.Data = Buff.GetIncreaseStats(Level);
            }

            if (uiBuffAttributes != null)
            {
                uiBuffAttributes.Data = GameDataHelpers.MakeAttributeAmountsDictionary(Buff.increaseAttributes, new Dictionary <Attribute, short>(), Level, 1f);
            }

            if (uiBuffResistances != null)
            {
                uiBuffResistances.Data = GameDataHelpers.MakeResistanceAmountsDictionary(Buff.increaseResistances, new Dictionary <DamageElement, float>(), Level, 1f);
            }

            if (uiBuffDamages != null)
            {
                uiBuffDamages.Data = GameDataHelpers.MakeDamageAmountsDictionary(Buff.increaseDamages, new Dictionary <DamageElement, MinMaxFloat>(), Level, 1f);
            }
        }
コード例 #2
0
ファイル: UIBuff.cs プロジェクト: davidrochin/rootmotionfix
        protected override void UpdateData()
        {
            if (uiTextDuration != null)
            {
                float duration = Buff.GetDuration(Level);
                uiTextDuration.gameObject.SetActive(duration != 0);
                uiTextDuration.text = string.Format(
                    LanguageManager.GetText(formatKeyDuration),
                    duration.ToString("N0"));
            }

            if (uiTextRecoveryHp != null)
            {
                int recoveryHp = Buff.GetRecoveryHp(Level);
                uiTextRecoveryHp.gameObject.SetActive(recoveryHp != 0);
                uiTextRecoveryHp.text = string.Format(
                    LanguageManager.GetText(formatKeyRecoveryHp),
                    recoveryHp.ToString("N0"));
            }

            if (uiTextRecoveryMp != null)
            {
                int recoveryMp = Buff.GetRecoveryMp(Level);
                uiTextRecoveryMp.gameObject.SetActive(recoveryMp != 0);
                uiTextRecoveryMp.text = string.Format(
                    LanguageManager.GetText(formatKeyRecoveryMp),
                    recoveryMp.ToString("N0"));
            }

            if (uiTextRecoveryStamina != null)
            {
                int recoveryStamina = Buff.GetRecoveryStamina(Level);
                uiTextRecoveryStamina.gameObject.SetActive(recoveryStamina != 0);
                uiTextRecoveryStamina.text = string.Format(
                    LanguageManager.GetText(formatKeyRecoveryStamina),
                    recoveryStamina.ToString("N0"));
            }

            if (uiTextRecoveryFood != null)
            {
                int recoveryFood = Buff.GetRecoveryFood(Level);
                uiTextRecoveryFood.gameObject.SetActive(recoveryFood != 0);
                uiTextRecoveryFood.text = string.Format(
                    LanguageManager.GetText(formatKeyRecoveryFood),
                    recoveryFood.ToString("N0"));
            }

            if (uiTextRecoveryWater != null)
            {
                int recoveryWater = Buff.GetRecoveryWater(Level);
                uiTextRecoveryWater.gameObject.SetActive(recoveryWater != 0);
                uiTextRecoveryWater.text = string.Format(
                    LanguageManager.GetText(formatKeyRecoveryWater),
                    recoveryWater.ToString("N0"));
            }

            if (uiBuffStats != null)
            {
                uiBuffStats.Data = Buff.GetIncreaseStats(Level);
            }

            if (uiBuffAttributes != null)
            {
                uiBuffAttributes.Data = GameDataHelpers.CombineAttributes(Buff.increaseAttributes, new Dictionary <Attribute, short>(), Level, 1f);
            }

            if (uiBuffResistances != null)
            {
                uiBuffResistances.Data = GameDataHelpers.CombineResistances(Buff.increaseResistances, new Dictionary <DamageElement, float>(), Level, 1f);
            }

            if (uiBuffDamages != null)
            {
                uiBuffDamages.Data = GameDataHelpers.CombineDamages(Buff.increaseDamages, new Dictionary <DamageElement, MinMaxFloat>(), Level, 1f);
            }
        }