OnaholeNodeMenuChildSecondRow.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. string uniqueName = base.selectedNodeButton.button.uniqueName;
  206. if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoMode)
  207. {
  208. this.nodeMenuManager.autoPistonEnabled = bool.Parse(uniqueName);
  209. }
  210. else if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoFinish)
  211. {
  212. this.nodeMenuManager.autoFinishEnabled = bool.Parse(uniqueName);
  213. }
  214. else if (this.mode == OnaholeNodeMenuChildSecondRow.Mode.AutoReaction)
  215. {
  216. this.nodeMenuManager.autoReaction = bool.Parse(uniqueName);
  217. }
  218. this.isInputEnabled = false;
  219. this.ClearButtonObject();
  220. this.nodeMenuManager.ReturnMenu();
  221. }
  222. private void ClearButtonObject()
  223. {
  224. Transform transform = this.menuButtonGrid.transform;
  225. GameObject[] array = new GameObject[transform.childCount];
  226. for (int i = 0; i < transform.childCount; i++)
  227. {
  228. array[i] = transform.GetChild(i).gameObject;
  229. }
  230. for (int j = 0; j < array.Length; j++)
  231. {
  232. UnityEngine.Object.DestroyImmediate(array[j]);
  233. }
  234. transform.DetachChildren();
  235. this.menuButtons.Clear();
  236. this.operationMap.Clear();
  237. }
  238. protected override void Update()
  239. {
  240. if (this.sliderInputMode)
  241. {
  242. NodeButtonData selectedNodeButton = base.selectedNodeButton;
  243. OnaholeNodeSlider onaholeNodeSlider = selectedNodeButton.button as OnaholeNodeSlider;
  244. if (onaholeNodeSlider != null)
  245. {
  246. if (base.inputRightKye)
  247. {
  248. onaholeNodeSlider.sliderValue += 0.1f;
  249. }
  250. else if (base.inputLeftKey)
  251. {
  252. onaholeNodeSlider.sliderValue -= 0.1f;
  253. }
  254. else if (base.inputCancelKey)
  255. {
  256. base.SetFocusButton(selectedNodeButton);
  257. this.sliderInputMode = false;
  258. base.OnCancelMenu();
  259. }
  260. else if (base.inputEnterKey)
  261. {
  262. base.SetFocusButton(selectedNodeButton);
  263. this.sliderInputMode = false;
  264. base.OnEnterMenu();
  265. }
  266. }
  267. }
  268. else if (this.mode != OnaholeNodeMenuChildSecondRow.Mode.Costume)
  269. {
  270. if (base.inputDownKey)
  271. {
  272. base.NextItem();
  273. }
  274. else if (base.inputUpKey)
  275. {
  276. base.PrevItem();
  277. }
  278. else if (base.inputEnterKey || base.inputRightKye)
  279. {
  280. this.OnEnterMenu();
  281. }
  282. else if (base.inputCancelKey || base.inputLeftKey)
  283. {
  284. this.OnCancelMenu();
  285. }
  286. }
  287. else if (base.inputDownKey)
  288. {
  289. base.NextItem();
  290. }
  291. else if (base.inputUpKey)
  292. {
  293. base.PrevItem();
  294. }
  295. else if (base.inputRightKye)
  296. {
  297. base.RightItem();
  298. }
  299. else if (base.inputLeftKey)
  300. {
  301. bool flag = false;
  302. int num = 0;
  303. while (num < this.operationMap[0].Count && !flag)
  304. {
  305. NodeButtonData nodeButtonData = this.operationMap[0][num];
  306. if (nodeButtonData.button.selectType == OnaholeNodeButton.SelectType.Focus || nodeButtonData.button.selectType == OnaholeNodeButton.SelectType.Select)
  307. {
  308. flag = true;
  309. }
  310. num++;
  311. }
  312. if (flag)
  313. {
  314. this.OnCancelMenu();
  315. }
  316. else
  317. {
  318. base.LeftItem();
  319. }
  320. }
  321. else if (base.inputEnterKey)
  322. {
  323. this.OnEnterMenu();
  324. }
  325. else if (base.inputCancelKey)
  326. {
  327. this.OnCancelMenu();
  328. }
  329. if (this.changeInput != -1)
  330. {
  331. this.isInputEnabled = (this.changeInput == 1);
  332. }
  333. this.changeInput = -1;
  334. }
  335. private readonly int kGridCellHeightButtonItem = 45;
  336. private readonly int kGridCellHeightSliderItem = 100;
  337. [SerializeField]
  338. public OnaholeNodeMenuManager nodeMenuManager;
  339. [SerializeField]
  340. private OnaholeNodeMenuChildThirdRow thirdRow;
  341. private OnaholeNodeMenuChildSecondRow.Mode mode;
  342. private int changeInput;
  343. private bool sliderInputMode;
  344. public enum Mode
  345. {
  346. StageSelect,
  347. SkillCategorySelect,
  348. Costume,
  349. DeviceSetting,
  350. MaidSensitivity,
  351. PistonSetting,
  352. ManAlpha,
  353. AutoMode,
  354. AutoFinish,
  355. AutoReaction,
  356. YotogiEnd
  357. }
  358. }