SpinBox.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class SpinBox : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. SpinBoxButton component = base.transform.Find("Up").GetComponent<SpinBoxButton>();
  9. SpinBoxButton component2 = base.transform.Find("Down").GetComponent<SpinBoxButton>();
  10. UILabel component3 = base.transform.Find("Box").GetComponent<UILabel>();
  11. UILabel component4 = GameObject.Find("ProfilePanel/CharacterInfo/ProfileBase/StatusPoints/MaidPoint").GetComponent<UILabel>();
  12. this.amountPerPoint = 20;
  13. SpinBoxParam spinBoxParam = this.InitParam();
  14. component.Init(spinBoxParam, component3, component4);
  15. component2.Init(spinBoxParam, component3, component4);
  16. this.SetEnableButton();
  17. }
  18. private SpinBoxParam InitParam()
  19. {
  20. return new SpinBoxParam
  21. {
  22. m_maxNumber = this.maxNumber,
  23. m_minNumber = this.minNumber,
  24. amountPerPoint = this.amountPerPoint
  25. };
  26. }
  27. private void SetEnableButton()
  28. {
  29. bool enabledInput = BaseMgr<ProfileMgr>.Instance.m_enabledInput;
  30. IEnumerator enumerator = base.transform.GetEnumerator();
  31. try
  32. {
  33. while (enumerator.MoveNext())
  34. {
  35. object obj = enumerator.Current;
  36. Transform transform = (Transform)obj;
  37. if (transform.name == "Up" || transform.name == "Down")
  38. {
  39. transform.gameObject.SetActive(enabledInput);
  40. }
  41. }
  42. }
  43. finally
  44. {
  45. IDisposable disposable;
  46. if ((disposable = (enumerator as IDisposable)) != null)
  47. {
  48. disposable.Dispose();
  49. }
  50. }
  51. }
  52. [SerializeField]
  53. private int maxNumber = 9999;
  54. [SerializeField]
  55. private int minNumber;
  56. [SerializeField]
  57. private int amountPerPoint;
  58. private const string POINT_PATH = "ProfilePanel/CharacterInfo/ProfileBase/StatusPoints/MaidPoint";
  59. }