UIButtonElement.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class UIButtonElement : MonoBehaviour
  5. {
  6. public Button[] buttonFaces
  7. {
  8. get
  9. {
  10. return this.m_ButtonFaces;
  11. }
  12. }
  13. public int faceIndex
  14. {
  15. get
  16. {
  17. return this.m_FaceIndex;
  18. }
  19. set
  20. {
  21. if (this.m_FaceIndex != value)
  22. {
  23. value = ((value >= 0) ? value : 0);
  24. value = ((this.m_ButtonFaces.Length > value) ? value : (this.m_ButtonFaces.Length - 1));
  25. this.m_FaceIndex = value;
  26. }
  27. }
  28. }
  29. public Text textContentNumber
  30. {
  31. get
  32. {
  33. return this.m_TextContentNumber;
  34. }
  35. }
  36. public Text textContentName
  37. {
  38. get
  39. {
  40. return this.m_TextContentName;
  41. }
  42. }
  43. public Text textContentTime
  44. {
  45. get
  46. {
  47. return this.m_TextContentTime;
  48. }
  49. }
  50. public Image imageThumbnail
  51. {
  52. get
  53. {
  54. return this.m_ImageThumbnail;
  55. }
  56. }
  57. public Button buttonStart
  58. {
  59. get
  60. {
  61. return this.m_ButtonStart;
  62. }
  63. }
  64. public void ButtonEvent_ChangeFaceType(int index)
  65. {
  66. this.faceIndex = index;
  67. ColorBlock colors = this.m_ButtonFaces[this.faceIndex].colors;
  68. colors.normalColor = Color.white;
  69. this.m_ButtonFaces[this.faceIndex].colors = colors;
  70. for (int i = 0; i < this.m_ButtonFaces.Length; i++)
  71. {
  72. if (i != this.faceIndex)
  73. {
  74. colors = this.m_ButtonFaces[i].colors;
  75. colors.normalColor = new Color(0.66f, 0.66f, 0.66f, 1f);
  76. this.m_ButtonFaces[i].colors = colors;
  77. }
  78. }
  79. }
  80. [SerializeField]
  81. private Button[] m_ButtonFaces;
  82. [SerializeField]
  83. private int m_FaceIndex;
  84. [SerializeField]
  85. private Text m_TextContentNumber;
  86. [SerializeField]
  87. private Text m_TextContentName;
  88. [SerializeField]
  89. private Text m_TextContentTime;
  90. [SerializeField]
  91. private Image m_ImageThumbnail;
  92. [SerializeField]
  93. private Button m_ButtonStart;
  94. }