InspectList_Button.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using DG.Tweening;
  6. using CCS.App;
  7. public class InspectList_Button : MonoBehaviour
  8. {
  9. public TextMesh text_num, text_name, text_isOk;
  10. public Material material_Undetected, material_To_be_tested, material_qualified, material_Unqualified;
  11. public int status;//状态
  12. public int jiluStaatus;
  13. public bool isChange;//是否在修改状态下
  14. public string content;
  15. public string mainSubtasks;//标题
  16. public string endResultViewPos;//生成结算面板 的结束位置
  17. public int viewTag;//标签 1 2 用来判断 该条用语音还是 扫码 1扫码 二 语音
  18. public string code;//料号
  19. public StartInspect startInspect = StartInspect.Undetected;
  20. public void OnSelect(bool isSelect)
  21. {
  22. if (isSelect)
  23. {
  24. this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  25. text_isOk.text = "待结测";
  26. }
  27. else
  28. {
  29. SetBtnState();
  30. }
  31. }
  32. //void Update()
  33. //{
  34. // switch (status)
  35. // {
  36. // case 0://未检测
  37. // startInspect = StartInspect.Undetected;
  38. // break;
  39. // case 1://待检测
  40. // startInspect = StartInspect.To_be_tested;
  41. // break;
  42. // case 2://合格
  43. // startInspect = StartInspect.qualified;
  44. // break;
  45. // case 3://不合格
  46. // startInspect = StartInspect.Unqualified;
  47. // break;
  48. // }
  49. // if (startInspect == StartInspect.Undetected)
  50. // {
  51. // this.GetComponent<MeshRenderer>().material = material_Undetected;
  52. // text_isOk.text = "未检测";
  53. // }
  54. // else if (startInspect == StartInspect.To_be_tested)
  55. // {
  56. // this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  57. // text_isOk.text = "待结测";
  58. // }
  59. // else if (startInspect == StartInspect.qualified)
  60. // {
  61. // this.GetComponent<MeshRenderer>().material = material_qualified;
  62. // text_isOk.text = "合格";
  63. // }
  64. // else if (startInspect == StartInspect.Unqualified)
  65. // {
  66. // this.GetComponent<MeshRenderer>().material = material_Unqualified;
  67. // text_isOk.text = "不合格";
  68. // }
  69. //}
  70. void OnEnable()
  71. {
  72. SetBtnState();
  73. //switch (status)
  74. //{
  75. // case 0://未检测
  76. // startInspect = StartInspect.Undetected;
  77. // break;
  78. // case 1://待检测
  79. // startInspect = StartInspect.To_be_tested;
  80. // break;
  81. // case 2://合格
  82. // startInspect = StartInspect.qualified;
  83. // break;
  84. // case 3://不合格
  85. // startInspect = StartInspect.Unqualified;
  86. // break;
  87. //}
  88. //if (startInspect == StartInspect.Undetected)
  89. //{
  90. // this.GetComponent<MeshRenderer>().material = material_Undetected;
  91. // text_isOk.text = "未检测";
  92. //}
  93. //else if (startInspect == StartInspect.To_be_tested)
  94. //{
  95. // this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  96. // text_isOk.text = "待结测";
  97. //}
  98. //else if (startInspect == StartInspect.qualified)
  99. //{
  100. // this.GetComponent<MeshRenderer>().material = material_qualified;
  101. // text_isOk.text = "合格";
  102. //}
  103. //else if (startInspect == StartInspect.Unqualified)
  104. //{
  105. // this.GetComponent<MeshRenderer>().material = material_Unqualified;
  106. // text_isOk.text = "不合格";
  107. //}
  108. }
  109. public void SetBtnState()
  110. {
  111. switch (startInspect)
  112. {
  113. case StartInspect.Undetected:
  114. this.GetComponent<MeshRenderer>().material = material_Undetected;
  115. text_isOk.text = "未检测";
  116. break;
  117. case StartInspect.To_be_tested:
  118. break;
  119. case StartInspect.qualified:
  120. this.GetComponent<MeshRenderer>().material = material_qualified;
  121. text_isOk.text = "合格";
  122. break;
  123. case StartInspect.Unqualified:
  124. this.GetComponent<MeshRenderer>().material = material_Unqualified;
  125. text_isOk.text = "不合格";
  126. break;
  127. default:
  128. break;
  129. }
  130. }
  131. }