StatsLine.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class StatsLine : MonoBehaviour
  7. {
  8. public Text statName;
  9. public Text statValue;
  10. public void SetStatName(string value) {
  11. statName.text = value;
  12. }
  13. public void SetStatValue(string value) {
  14. statValue.text = value;
  15. }
  16. public void SetStatValue(int value) {
  17. statValue.text = value.ToString();
  18. }
  19. public string GetName() {
  20. return statName.text;
  21. }
  22. public string GetValue() {
  23. return statValue.text;
  24. }
  25. public int GetIntValue() {
  26. Int32.TryParse(statValue.text, out int returnValue);
  27. return returnValue;
  28. }
  29. public void MakeBold() {
  30. statName.fontStyle = FontStyle.Bold;
  31. statValue.fontStyle = FontStyle.Bold;
  32. }
  33. public void UnBold() {
  34. statName.fontStyle = FontStyle.Normal;
  35. statValue.fontStyle = FontStyle.Normal;
  36. }
  37. public void SetLocalizationKey(string key) {
  38. statName.GetComponent<TextLocalization>().key = key;
  39. }
  40. public void RemoveLocalization() {
  41. TextLocalization tl = statName.GetComponent<TextLocalization>();
  42. Destroy(tl);
  43. }
  44. }