InspectList_Button.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. Debug.Log("选择了"+ isSelect);
  23. if (isSelect)
  24. {
  25. this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  26. text_isOk.text = "待结测";
  27. }
  28. else
  29. {
  30. SetBtnState();
  31. }
  32. }
  33. //void Update()
  34. //{
  35. // switch (status)
  36. // {
  37. // case 0://未检测
  38. // startInspect = StartInspect.Undetected;
  39. // break;
  40. // case 1://待检测
  41. // startInspect = StartInspect.To_be_tested;
  42. // break;
  43. // case 2://合格
  44. // startInspect = StartInspect.qualified;
  45. // break;
  46. // case 3://不合格
  47. // startInspect = StartInspect.Unqualified;
  48. // break;
  49. // }
  50. // if (startInspect == StartInspect.Undetected)
  51. // {
  52. // this.GetComponent<MeshRenderer>().material = material_Undetected;
  53. // text_isOk.text = "未检测";
  54. // }
  55. // else if (startInspect == StartInspect.To_be_tested)
  56. // {
  57. // this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  58. // text_isOk.text = "待结测";
  59. // }
  60. // else if (startInspect == StartInspect.qualified)
  61. // {
  62. // this.GetComponent<MeshRenderer>().material = material_qualified;
  63. // text_isOk.text = "合格";
  64. // }
  65. // else if (startInspect == StartInspect.Unqualified)
  66. // {
  67. // this.GetComponent<MeshRenderer>().material = material_Unqualified;
  68. // text_isOk.text = "不合格";
  69. // }
  70. //}
  71. void OnEnable()
  72. {
  73. SetBtnState();
  74. //switch (status)
  75. //{
  76. // case 0://未检测
  77. // startInspect = StartInspect.Undetected;
  78. // break;
  79. // case 1://待检测
  80. // startInspect = StartInspect.To_be_tested;
  81. // break;
  82. // case 2://合格
  83. // startInspect = StartInspect.qualified;
  84. // break;
  85. // case 3://不合格
  86. // startInspect = StartInspect.Unqualified;
  87. // break;
  88. //}
  89. //if (startInspect == StartInspect.Undetected)
  90. //{
  91. // this.GetComponent<MeshRenderer>().material = material_Undetected;
  92. // text_isOk.text = "未检测";
  93. //}
  94. //else if (startInspect == StartInspect.To_be_tested)
  95. //{
  96. // this.GetComponent<MeshRenderer>().material = material_To_be_tested;
  97. // text_isOk.text = "待结测";
  98. //}
  99. //else if (startInspect == StartInspect.qualified)
  100. //{
  101. // this.GetComponent<MeshRenderer>().material = material_qualified;
  102. // text_isOk.text = "合格";
  103. //}
  104. //else if (startInspect == StartInspect.Unqualified)
  105. //{
  106. // this.GetComponent<MeshRenderer>().material = material_Unqualified;
  107. // text_isOk.text = "不合格";
  108. //}
  109. }
  110. public void SetBtnState()
  111. {
  112. switch (startInspect)
  113. {
  114. case StartInspect.Undetected:
  115. this.GetComponent<MeshRenderer>().material = material_Undetected;
  116. text_isOk.text = "未检测";
  117. break;
  118. case StartInspect.To_be_tested:
  119. break;
  120. case StartInspect.qualified:
  121. this.GetComponent<MeshRenderer>().material = material_qualified;
  122. text_isOk.text = "合格";
  123. break;
  124. case StartInspect.Unqualified:
  125. this.GetComponent<MeshRenderer>().material = material_Unqualified;
  126. text_isOk.text = "不合格";
  127. break;
  128. default:
  129. break;
  130. }
  131. }
  132. }