OnaholeNodeMenuChildSecondRow.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class OnaholeNodeMenuChildSecondRow : OnaholeBaseNodeMenuManager
  5. {
  6. private void Awake()
  7. {
  8. this.Clear();
  9. }
  10. public void Clear()
  11. {
  12. this.isInputEnabled = (this.sliderInputMode = false);
  13. this.changeInput = -1;
  14. this.ClearButtonObject();
  15. this.mode = OnaholeNodeMenuChildSecondRow.Mode.SkillCategorySelect;
  16. }
  17. public void CallMenu(OnaholeNodeMenuChildSecondRow.Mode mode)
  18. {
  19. this.mode = mode;
  20. this.ClearButtonObject();
  21. if (mode == OnaholeNodeMenuChildSecondRow.Mode.StageSelect)
  22. {
  23. this.CallStageSlect();
  24. }
  25. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.SkillCategorySelect)
  26. {
  27. this.CallSkillCategorySelect();
  28. }
  29. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.Costume)
  30. {
  31. this.CallCostumeSetting();
  32. }
  33. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.DeviceSetting)
  34. {
  35. this.CallChuBLipSetting();
  36. }
  37. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.MaidSensitivity)
  38. {
  39. this.CallMaidSensitivitySetting();
  40. }
  41. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.PistonSetting)
  42. {
  43. this.CallPistonSetting();
  44. }
  45. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.ManAlpha)
  46. {
  47. this.CallManAlphaSetting();
  48. }
  49. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.AutoMode)
  50. {
  51. this.CallGeneralBoolControl(this.nodeMenuManager.autoPistonEnabled);
  52. }
  53. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.AutoFinish)
  54. {
  55. this.CallGeneralBoolControl(this.nodeMenuManager.autoFinishEnabled);
  56. }
  57. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.AutoReaction)
  58. {
  59. this.CallGeneralBoolControl(this.nodeMenuManager.autoReaction);
  60. }
  61. else if (mode == OnaholeNodeMenuChildSecondRow.Mode.YotogiEnd)
  62. {
  63. this.CallYotogiEnd();
  64. }
  65. if (mode != OnaholeNodeMenuChildSecondRow.Mode.Costume)
  66. {
  67. this.menuButtonGrid.Reposition();
  68. }
  69. this.changeInput = 1;
  70. }
  71. private void CallStageSlect()
  72. {
  73. }
  74. public void CallSkillCategorySelect()
  75. {
  76. }
  77. private void CallCostumeSetting()
  78. {
  79. Action enterEvent = delegate()
  80. {
  81. UndressingManager.UndressingData undressingData = this.nodeMenuManager.undressingManager.GetUndressingData((UndressingManager.UnitType)Enum.Parse(typeof(UndressingManager.UnitType), base.selectedNodeButton.button.uniqueName));
  82. this.nodeMenuManager.undressingManager.OnClickButton(undressingData);
  83. };
  84. GameObject gameObject = this.menuButtonGrid.gameObject;
  85. foreach (UndressingManager.UnitData unitData in this.nodeMenuManager.undressingManager.UnitDataList)
  86. {
  87. OnaholeNodeIconButton onaholeNodeIconButton = base.CreateNodeIconMenu(gameObject, unitData.UnitType.ToString());
  88. onaholeNodeIconButton.SetCopyTargetSprite(unitData.ButtonObject.GetComponent<UISprite>());
  89. onaholeNodeIconButton.selectType = ((!unitData.ButtonObject.isEnabled) ? OnaholeNodeButton.SelectType.Disable : OnaholeNodeButton.SelectType.Focus);
  90. this.menuButtons.Add(new NodeButtonData(onaholeNodeIconButton, enterEvent));
  91. }
  92. base.SetFocusButton(this.menuButtons[0]);
  93. this.menuButtonGrid.arrangement = UIGrid.Arrangement.Horizontal;
  94. this.menuButtonGrid.cellWidth = (this.menuButtonGrid.cellHeight = 115f);
  95. this.menuButtonGrid.maxPerLine = 3;
  96. this.menuButtonGrid.Reposition();
  97. this.operationMap = new List<List<NodeButtonData>>();
  98. for (int i = 0; i < this.menuButtonGrid.maxPerLine; i++)
  99. {
  100. this.operationMap.Add(new List<NodeButtonData>());
  101. }
  102. int num = 0;
  103. foreach (NodeButtonData item in this.menuButtons)
  104. {
  105. List<NodeButtonData> list = this.operationMap[num];
  106. list.Add(item);
  107. num++;
  108. if (this.operationMap.Count <= num)
  109. {
  110. num = 0;
  111. }
  112. }
  113. this.menuButtonGrid.cellWidth = 0f;
  114. this.menuButtonGrid.arrangement = UIGrid.Arrangement.Vertical;
  115. this.menuButtonGrid.maxPerLine = 0;
  116. }
  117. private void CallChuBLipSetting()
  118. {
  119. GameObject gameObject = this.menuButtonGrid.gameObject;
  120. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.Sensitivity, "Sensitivity"), new Action(this.StartSliderInputMode)));
  121. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.HoleSync, "HoleSync"), new Action(this.StartSliderInputMode)));
  122. base.SetFocusButton(this.menuButtons[0]);
  123. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightSliderItem;
  124. }
  125. private void CallMaidSensitivitySetting()
  126. {
  127. GameObject gameObject = this.menuButtonGrid.gameObject;
  128. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.MaidSensitivity, "MaidSensitivity"), new Action(this.StartSliderInputMode)));
  129. base.SetFocusButton(this.menuButtons[0]);
  130. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightSliderItem;
  131. }
  132. private void CallPistonSetting()
  133. {
  134. GameObject gameObject = this.menuButtonGrid.gameObject;
  135. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.HoleAutoSpeed, "HoleAutoSpeed"), new Action(this.StartSliderInputMode)));
  136. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.HoleAutoInsertStartPos, "HoleAutoInsertStartPos"), new Action(this.StartSliderInputMode)));
  137. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.HoleAutoInsertEndPos, "HoleAutoInsertEndPos"), new Action(this.StartSliderInputMode)));
  138. base.SetFocusButton(this.menuButtons[0]);
  139. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightSliderItem;
  140. }
  141. private void CallManAlphaSetting()
  142. {
  143. GameObject gameObject = this.menuButtonGrid.gameObject;
  144. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateNodeSlider(gameObject, OnaholeNodeSlider.SliderType.ManAlpha, "ManAlpha"), new Action(this.StartSliderInputMode)));
  145. base.SetFocusButton(this.menuButtons[0]);
  146. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightSliderItem;
  147. }
  148. private void CallGeneralBoolControl(bool currentValue)
  149. {
  150. Action enterEvent = delegate()
  151. {
  152. this.OnCancelMenu();
  153. };
  154. GameObject gameObject = this.menuButtonGrid.gameObject;
  155. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateBasicNodeButton(gameObject, "ON", "true", true, false), enterEvent));
  156. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateBasicNodeButton(gameObject, "OFF", "false", true, false), enterEvent));
  157. base.SetFocusButton((!currentValue) ? this.menuButtons[1] : this.menuButtons[0]);
  158. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightButtonItem;
  159. }
  160. private void CallYotogiEnd()
  161. {
  162. Action enterEvent = delegate()
  163. {
  164. if (bool.Parse(base.selectedNodeButton.button.uniqueName))
  165. {
  166. this.nodeMenuManager.EndYotogi();
  167. }
  168. else
  169. {
  170. this.OnCancelMenu();
  171. }
  172. this.isInputEnabled = false;
  173. };
  174. GameObject gameObject = this.menuButtonGrid.gameObject;
  175. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateBasicNodeButton(gameObject, "OK", "true", true, false), enterEvent));
  176. this.menuButtons.Add(new NodeButtonData(OnaholeBaseNodeMenuManager.CreateBasicNodeButton(gameObject, "CANCEL", "false", true, false), enterEvent));
  177. base.SetFocusButton(this.menuButtons[1]);
  178. this.menuButtonGrid.cellHeight = (float)this.kGridCellHeightButtonItem;
  179. }
  180. private void StartSliderInputMode()
  181. {
  182. NodeButtonData selectedNodeButton = base.selectedNodeButton;
  183. base.SetSelectedButton(selectedNodeButton);
  184. this.sliderInputMode = true;
  185. }
  186. public void ReturnMenu()
  187. {
  188. if (base.selectedNodeButton != null)
  189. {
  190. base.selectedNodeButton.button.selectType = OnaholeNodeButton.SelectType.Focus;
  191. }
  192. this.changeInput = 1;
  193. }
  194. protected override void OnEnterMenu()
  195. {
  196. base.OnEnterMenu();
  197. if (base.selectedNodeButton != null)
  198. {
  199. base.selectedNodeButton.enterEvent();
  200. }
  201. }
  202. protected override void OnCancelMenu()
  203. {
  204. base.OnCancelMenu();
  205. if (base.selectedNodeButton != null)
  206. {
  207. string uniqueName = base.selectedNodeButton.button.uniqueName;
  208. if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoMode)
  209. {
  210. this.nodeMenuManager.autoPistonEnabled = bool.Parse(uniqueName);
  211. }
  212. else if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoFinish)
  213. {
  214. this.nodeMenuManager.autoFinishEnabled = bool.Parse(uniqueName);
  215. }
  216. else if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoReaction)
  217. {
  218. this.nodeMenuManager.autoReaction = bool.Parse(uniqueName);
  219. }
  220. }
  221. this.isInputEnabled = false;
  222. this.ClearButtonObject();
  223. this.nodeMenuManager.ReturnMenu();
  224. }
  225. private void ClearButtonObject()
  226. {
  227. Transform transform = this.menuButtonGrid.transform;
  228. GameObject[] array = new GameObject[transform.childCount];
  229. for (int i = 0; i < transform.childCount; i++)
  230. {
  231. array[i] = transform.GetChild(i).gameObject;
  232. }
  233. for (int j = 0; j < array.Length; j++)
  234. {
  235. UnityEngine.Object.DestroyImmediate(array[j]);
  236. }
  237. transform.DetachChildren();
  238. this.menuButtons.Clear();
  239. this.operationMap.Clear();
  240. }
  241. protected override void Update()
  242. {
  243. if (this.sliderInputMode)
  244. {
  245. NodeButtonData selectedNodeButton = base.selectedNodeButton;
  246. OnaholeNodeSlider onaholeNodeSlider = selectedNodeButton.button as OnaholeNodeSlider;
  247. if (onaholeNodeSlider != null)
  248. {
  249. if (base.inputRightKye)
  250. {
  251. onaholeNodeSlider.sliderValue += 0.1f;
  252. }
  253. else if (base.inputLeftKey)
  254. {
  255. onaholeNodeSlider.sliderValue -= 0.1f;
  256. }
  257. else if (base.inputCancelKey)
  258. {
  259. base.SetFocusButton(selectedNodeButton);
  260. this.sliderInputMode = false;
  261. base.OnCancelMenu();
  262. }
  263. else if (base.inputEnterKey)
  264. {
  265. base.SetFocusButton(selectedNodeButton);
  266. this.sliderInputMode = false;
  267. base.OnEnterMenu();
  268. }
  269. }
  270. }
  271. else if (this.mode != OnaholeNodeMenuChildSecondRow.Mode.Costume)
  272. {
  273. if (base.inputDownKey)
  274. {
  275. base.NextItem();
  276. }
  277. else if (base.inputUpKey)
  278. {
  279. base.PrevItem();
  280. }
  281. else if (base.inputEnterKey || base.inputRightKye)
  282. {
  283. this.OnEnterMenu();
  284. }
  285. else if (base.inputCancelKey || base.inputLeftKey)
  286. {
  287. this.OnCancelMenu();
  288. }
  289. }
  290. else if (base.inputDownKey)
  291. {
  292. base.NextItem();
  293. }
  294. else if (base.inputUpKey)
  295. {
  296. base.PrevItem();
  297. }
  298. else if (base.inputRightKye)
  299. {
  300. base.RightItem();
  301. }
  302. else if (base.inputLeftKey)
  303. {
  304. bool flag = false;
  305. int num = 0;
  306. while (num < this.operationMap[0].Count && !flag)
  307. {
  308. NodeButtonData nodeButtonData = this.operationMap[0][num];
  309. if (nodeButtonData.button.selectType == OnaholeNodeButton.SelectType.Focus || nodeButtonData.button.selectType == OnaholeNodeButton.SelectType.Select)
  310. {
  311. flag = true;
  312. }
  313. num++;
  314. }
  315. if (flag)
  316. {
  317. this.OnCancelMenu();
  318. }
  319. else
  320. {
  321. base.LeftItem();
  322. }
  323. }
  324. else if (base.inputEnterKey)
  325. {
  326. this.OnEnterMenu();
  327. }
  328. else if (base.inputCancelKey)
  329. {
  330. this.OnCancelMenu();
  331. }
  332. if (this.changeInput != -1)
  333. {
  334. this.isInputEnabled = (this.changeInput == 1);
  335. }
  336. this.changeInput = -1;
  337. }
  338. private readonly int kGridCellHeightButtonItem = 45;
  339. private readonly int kGridCellHeightSliderItem = 100;
  340. [SerializeField]
  341. public OnaholeNodeMenuManager nodeMenuManager;
  342. [SerializeField]
  343. private OnaholeNodeMenuChildThirdRow thirdRow;
  344. private OnaholeNodeMenuChildSecondRow.Mode mode;
  345. private int changeInput;
  346. private bool sliderInputMode;
  347. public enum Mode
  348. {
  349. StageSelect,
  350. SkillCategorySelect,
  351. Costume,
  352. DeviceSetting,
  353. MaidSensitivity,
  354. PistonSetting,
  355. ManAlpha,
  356. AutoMode,
  357. AutoFinish,
  358. AutoReaction,
  359. YotogiEnd
  360. }
  361. }