YotogiSkillNameHoverPlate.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. using wf;
  6. public class YotogiSkillNameHoverPlate : MonoBehaviour
  7. {
  8. private void Awake()
  9. {
  10. this.label = base.GetComponent<UILabel>();
  11. this.bg = base.transform.parent.gameObject.GetComponent<UISprite>();
  12. }
  13. public void ClearName()
  14. {
  15. if (this.label == null)
  16. {
  17. return;
  18. }
  19. this.label.text = string.Empty;
  20. Utility.SetLocalizeTerm(this.label, string.Empty, false);
  21. }
  22. public void SetName(string skillName, string skillNameTerm, bool isExpLock)
  23. {
  24. if (this.label == null)
  25. {
  26. return;
  27. }
  28. if (isExpLock)
  29. {
  30. this.label.text = skillName + "(EXPロック)";
  31. }
  32. else
  33. {
  34. this.label.text = skillName;
  35. }
  36. if (Product.supportMultiLanguage)
  37. {
  38. Localize localize = this.label.GetComponent<Localize>();
  39. if (localize == null)
  40. {
  41. localize = this.label.gameObject.AddComponent<Localize>();
  42. localize.LocalizeEventExecEnd.AddListener(new UnityAction(this.OnLocalizeEvent));
  43. }
  44. localize.TermArgs = new Localize.ArgsPair[2];
  45. localize.TermArgs[0] = Localize.ArgsPair.Create(skillNameTerm, true);
  46. localize.TermArgs[1] = ((!isExpLock) ? Localize.ArgsPair.Create(string.Empty, false) : Localize.ArgsPair.Create("SceneYotogi/(EXPロック)", true));
  47. localize.SetTerm("SceneYotogi/スキル選択スキル名表記");
  48. }
  49. this.LabelPixelPerfect();
  50. }
  51. public void LabelPixelPerfect()
  52. {
  53. if (this.label == null)
  54. {
  55. return;
  56. }
  57. this.label.width = 0;
  58. this.label.MakePixelPerfect();
  59. this.bg.width = this.label.width + 20;
  60. }
  61. private void OnLocalizeEvent()
  62. {
  63. this.LabelPixelPerfect();
  64. }
  65. private UILabel label;
  66. private UISprite bg;
  67. }