protected override void UpdateData() { BasePlayerCharacterEntity owningCharacter = BasePlayerCharacterController.OwningCharacter; if (Data == null || Data.Count == 0) { if (uiTextAllLevels != null) { uiTextAllLevels.gameObject.SetActive(false); } foreach (KeyValuePair <Skill, TextWrapper> entry in CacheTextLevels) { entry.Value.text = string.Format( LanguageManager.GetText(formatKeyLevel), entry.Key.Title, "0", "0"); } } else { string tempAllText = string.Empty; Skill tempSkill; short tempCurrentLevel; short tempTargetLevel; string tempFormat; string tempLevelText; TextWrapper tempTextWrapper; foreach (KeyValuePair <Skill, short> dataEntry in Data) { if (dataEntry.Key == null || dataEntry.Value == 0) { continue; } // Set temp data tempSkill = dataEntry.Key; tempTargetLevel = dataEntry.Value; tempCurrentLevel = 0; // Add new line if text is not empty if (!string.IsNullOrEmpty(tempAllText)) { tempAllText += "\n"; } // Get skill level from character if (owningCharacter != null) { owningCharacter.CacheSkills.TryGetValue(tempSkill, out tempCurrentLevel); } // Use difference format by option if (showAsRequirement) { // This will show both current character skill level and target level tempFormat = tempCurrentLevel >= tempTargetLevel? LanguageManager.GetText(formatKeyLevel) : LanguageManager.GetText(formatKeyLevelNotEnough); tempLevelText = string.Format(tempFormat, tempSkill.Title, tempCurrentLevel.ToString("N0"), tempTargetLevel.ToString("N0")); } else { // This will show only target level, so current character skill level will not be shown tempLevelText = string.Format( LanguageManager.GetText(formatKeySimpleLevel), tempSkill.Title, tempTargetLevel.ToString("N0")); } // Append current skill level text tempAllText += tempLevelText; // Set current skill text to UI if (CacheTextLevels.TryGetValue(dataEntry.Key, out tempTextWrapper)) { tempTextWrapper.text = tempLevelText; } } if (uiTextAllLevels != null) { uiTextAllLevels.gameObject.SetActive(!string.IsNullOrEmpty(tempAllText)); uiTextAllLevels.text = tempAllText; } } }
protected override void UpdateData() { if (Data == null || Data.Count == 0) { if (uiTextAllInflictions != null) { uiTextAllInflictions.gameObject.SetActive(false); } foreach (KeyValuePair <DamageElement, TextWrapper> textAmount in CacheTextInflictions) { textAmount.Value.text = string.Format( textAmount.Key == GameInstance.Singleton.DefaultDamageElement ? LanguageManager.GetText(formatKeyInfliction) : LanguageManager.GetText(formatKeyInflictionAsElemental), textAmount.Key.Title, "0"); } } else { string tempAllText = string.Empty; DamageElement tempElement; float tempInfliction; string tempAmountText; foreach (KeyValuePair <DamageElement, float> dataEntry in Data) { if (dataEntry.Key == null || dataEntry.Value == 0) { continue; } // Set temp data tempElement = dataEntry.Key; tempInfliction = dataEntry.Value; // Add new line if text is not empty if (!string.IsNullOrEmpty(tempAllText)) { tempAllText += "\n"; } // Set current elemental damage infliction text tempAmountText = string.Format( tempElement == GameInstance.Singleton.DefaultDamageElement ? LanguageManager.GetText(formatKeyInfliction) : LanguageManager.GetText(formatKeyInflictionAsElemental), tempElement.Title, (tempInfliction * 100f).ToString("N0")); // Append current elemental damage infliction text tempAllText += tempAmountText; // Set current elemental damage infliction text to UI TextWrapper textDamages; if (CacheTextInflictions.TryGetValue(dataEntry.Key, out textDamages)) { textDamages.text = tempAmountText; } } if (uiTextAllInflictions != null) { uiTextAllInflictions.gameObject.SetActive(!string.IsNullOrEmpty(tempAllText)); uiTextAllInflictions.text = tempAllText; } } }