SettingMachineRoomData.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using SC.XR.Unity;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class SettingMachineRoomData : MonoSingleton<SettingMachineRoomData>
  7. {
  8. public GameObject editorBtnCanvas;
  9. public GameObject EditorCanvas;
  10. public SCInputField line;
  11. public SCInputField list;
  12. public SCInputField lineI;
  13. public SCInputField listI;
  14. public SCInputField bNumber;
  15. public SCInputField cabinetW;
  16. public SCInputField cabinetH;
  17. public SCInputField bIntervalH;
  18. public SCInputField firstBladeSeverH;
  19. public SCInputField tagOffestPosY;
  20. public SCInputField cameraFar;
  21. public Slider lineSlider;
  22. public Slider listSlider;
  23. public Slider lineISlider;
  24. public Slider listISlider;
  25. public Slider bNumberSlider;
  26. public Slider cabinetWSlider;
  27. public Slider cabinetHSlider;
  28. public Slider bIntervalHSlider;
  29. public Slider firstBHSlider;
  30. public Slider tagOPosYSlider;
  31. public Slider cameraFarSlider;
  32. public Text lineText;
  33. public Text listText;
  34. public Text lineIText;
  35. public Text listIText;
  36. public Text bNumberText;
  37. public Text cabinetWText;
  38. public Text cabinetHText;
  39. public Text bIntervalHText;
  40. public Text firstBHText;
  41. public Text tagOPosYText;
  42. public Text cameraFarText;
  43. private void Start()
  44. {
  45. }
  46. public void Init(MachineRoomData data)
  47. {
  48. //this.line.textComponent.text = data.line.ToString();
  49. //this.list.textComponent.text = data.list.ToString();
  50. //this.lineI.textComponent.text = data.intervalW.ToString();
  51. //this.listI.textComponent.text = data.intervalL.ToString();
  52. //this.bNumber.textComponent.text = data.bladeSeverNumber.ToString();
  53. //this.cabinetW.textComponent.text = data.cabinetW.ToString();
  54. //this.cabinetH.textComponent.text = data.cabinetH.ToString();
  55. //this.bIntervalH.textComponent.text = data.bIntervalH.ToString();
  56. //this.firstBladeSeverH.textComponent.text = data.firstBladeSeverH.ToString();
  57. this.line.text = data.line.ToString();
  58. this.list.text = data.list.ToString();
  59. this.lineI.text = data.intervalW.ToString();
  60. this.listI.text = data.intervalL.ToString();
  61. this.bNumber.text = data.bladeSeverNumber.ToString();
  62. this.cabinetW.text = data.cabinetW.ToString();
  63. this.cabinetH.text = data.cabinetH.ToString();
  64. this.bIntervalH.text = data.bIntervalH.ToString();
  65. this.firstBladeSeverH.text = data.firstBladeSeverH.ToString();
  66. this.tagOffestPosY.text = data.tagOffestPosY.ToString();
  67. this.cameraFar.text = data.cameraFar.ToString();
  68. //this.line.text = "10";
  69. //this.list.text = "10";
  70. //this.lineI.text = "10";
  71. //this.listI.text = "10";
  72. //this.bNumber.text = "10";
  73. //this.cabinetW.text = "10";
  74. //this.cabinetH.text = "2";
  75. //this.bIntervalH.text = "1";
  76. //this.firstBladeSeverH.text = "2";
  77. //this.tagOffestPosY.text = "2";
  78. //this.cameraFar.text = "2";
  79. lineSlider.maxValue = 10;
  80. lineSlider.value = data.line;
  81. lineText.text = data.line.ToString();
  82. listSlider.maxValue = 10;
  83. listSlider.value = data.list;
  84. listText.text = data.list.ToString();
  85. lineISlider.maxValue = 10;
  86. lineISlider.value = data.intervalW;
  87. lineIText.text = data.intervalW.ToString();
  88. listISlider.maxValue = 10;
  89. listISlider.value = data.intervalL;
  90. listIText.text = data.intervalL.ToString();
  91. bNumberSlider.maxValue = 10;
  92. bNumberSlider.value = data.bladeSeverNumber;
  93. bNumberText.text = data.bladeSeverNumber.ToString();
  94. cabinetWSlider.maxValue = 10;
  95. cabinetWSlider.value = data.cabinetW;
  96. cabinetWText.text = data.cabinetW.ToString();
  97. cabinetHSlider.maxValue = 10f;
  98. cabinetHSlider.value = data.cabinetH;
  99. cabinetHText.text = data.cabinetH.ToString();
  100. bIntervalHSlider.maxValue = 10;
  101. bIntervalHSlider.value = data.bIntervalH;
  102. bIntervalHText.text = data.bIntervalH.ToString();
  103. firstBHSlider.maxValue = 2;
  104. firstBHSlider.value = data.firstBladeSeverH;
  105. firstBHText.text = data.firstBladeSeverH.ToString();
  106. tagOPosYSlider.maxValue = 2;
  107. tagOPosYSlider.value = data.tagOffestPosY;
  108. tagOPosYText.text = data.tagOffestPosY.ToString();
  109. cameraFarSlider.maxValue = 100;
  110. cameraFarSlider.minValue = 2;
  111. cameraFarSlider.value = data.cameraFar;
  112. cameraFarText.text = data.cameraFar.ToString();
  113. line.onValueChanged.AddListener((msg) => { if (msg == "") return; lineSlider.maxValue = int.Parse(msg); });
  114. lineSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.line = (int)value; MachineRoomManager.Instance.SettingMachine(); lineText.text = value.ToString(); });
  115. list.onValueChanged.AddListener((msg) => { if (msg == "") return; listSlider.maxValue = int.Parse(msg); });
  116. listSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.list = (int)value; MachineRoomManager.Instance.SettingMachine(); listText.text = value.ToString(); });
  117. lineI.onValueChanged.AddListener((msg) => { if (msg == "") return; lineISlider.maxValue = float.Parse(msg); });
  118. lineISlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.intervalW = value; MachineRoomManager.Instance.SettingMachine(); lineIText.text = value.ToString(); });
  119. listI.onValueChanged.AddListener((msg) => { if (msg == "") return; listISlider.maxValue = float.Parse(msg); });
  120. listISlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.intervalL = value; MachineRoomManager.Instance.SettingMachine(); listIText.text = value.ToString(); });
  121. bNumber.onValueChanged.AddListener((msg) => { if (msg == "") return; bNumberSlider.maxValue = int.Parse(msg); });
  122. bNumberSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.bladeSeverNumber = (int)value; MachineRoomManager.Instance.SettingMachine(); bNumberText.text = value.ToString(); });
  123. cabinetW.onValueChanged.AddListener((msg) => { if (msg == "") return; cabinetWSlider.maxValue = float.Parse(msg); });
  124. cabinetWSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.cabinetW = value; MachineRoomManager.Instance.SettingMachine(); cabinetWText.text = value.ToString(); });
  125. cabinetH.onValueChanged.AddListener((msg) => { if (msg == "") return; cabinetHSlider.maxValue = float.Parse(msg); });
  126. cabinetHSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.cabinetH = value; MachineRoomManager.Instance.SettingMachine(); cabinetHText.text = value.ToString(); });
  127. bIntervalH.onValueChanged.AddListener((msg) => { if (msg == "") return; bIntervalHSlider.maxValue = float.Parse(msg); });
  128. bIntervalHSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.bIntervalH = value; MachineRoomManager.Instance.SettingMachine(); bIntervalHText.text = value.ToString(); });
  129. firstBladeSeverH.onValueChanged.AddListener((msg) => { if (msg == "") return; firstBHSlider.maxValue = float.Parse(msg); });
  130. firstBHSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.firstBladeSeverH = value; MachineRoomManager.Instance.SettingMachine(); firstBHText.text = value.ToString(); });
  131. tagOffestPosY.onValueChanged.AddListener((msg) => { if (msg == "") return; tagOPosYSlider.maxValue = float.Parse(msg); });
  132. tagOPosYSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.tagOffestPosY = value; MachineRoomManager.Instance.SettingMachine(); tagOPosYText.text = value.ToString(); });
  133. cameraFar.onValueChanged.AddListener((msg) => { if (msg == "") return; cameraFarSlider.maxValue = float.Parse(msg); });
  134. cameraFarSlider.onValueChanged.AddListener((value) => { MachineRoomManager.Instance.data.cameraFar = value; MachineRoomManager.Instance.SettingCameraFar(); cameraFarText.text = value.ToString(); });
  135. // MachineRoomManager.Instance.MachineInit();
  136. }
  137. public void Onclick()
  138. {
  139. int lineNumber = int.Parse(line.textComponent.text);
  140. int listNumber = int.Parse(list.textComponent.text);
  141. float lineINumber = float.Parse(lineI.textComponent.text);
  142. float listINumber = float.Parse(listI.textComponent.text);
  143. int bNumbers = int.Parse(bNumber.textComponent.text);
  144. float cabinetWN = float.Parse(cabinetW.textComponent.text);
  145. float cabinetHN = float.Parse(cabinetH.textComponent.text);
  146. float bIntervalHN = float.Parse(bIntervalH.textComponent.text);
  147. float firstBHN = float.Parse(firstBladeSeverH.textComponent.text);
  148. MachineRoomManager.Instance.data.line = (int)lineSlider.value;
  149. MachineRoomManager.Instance.data.list = (int)listSlider.value;
  150. MachineRoomManager.Instance.data.intervalW = lineISlider.value;
  151. MachineRoomManager.Instance.data.intervalL = listISlider.value;
  152. MachineRoomManager.Instance.data.bladeSeverNumber = (int)bNumberSlider.value;
  153. MachineRoomManager.Instance.data.cabinetW = cabinetWSlider.value;
  154. MachineRoomManager.Instance.data.cabinetH = cabinetHSlider.value;
  155. MachineRoomManager.Instance.data.bIntervalH = bIntervalHSlider.value;
  156. MachineRoomManager.Instance.data.firstBladeSeverH = firstBHSlider.value;
  157. MachineRoomManager.Instance.SettingMachine();
  158. }
  159. private bool isEditor = false;
  160. public void EdiotrOnClick()
  161. {
  162. isEditor = !isEditor;
  163. EditorCanvas.SetActive(isEditor);
  164. }
  165. public void LineSlider( float maxValue)
  166. {
  167. lineSlider.maxValue = maxValue;
  168. }
  169. public void ListSlider( float maxValue)
  170. {
  171. listSlider.maxValue = maxValue;
  172. }
  173. private float openEditor = 0;
  174. public void EditorOpen()
  175. {
  176. openEditor++;
  177. if(openEditor>15&& openEditor<20)
  178. {
  179. editorBtnCanvas.SetActive(true);
  180. }
  181. else
  182. {
  183. editorBtnCanvas.SetActive(false);
  184. }
  185. }
  186. }