UndressDance_Mgr.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using Dance;
  6. using MaidExtension;
  7. using UnityEngine;
  8. using wf;
  9. public class UndressDance_Mgr : PartsMgrBase
  10. {
  11. public static UndressDance_Mgr Instance { get; private set; }
  12. public Maid SelectMaid
  13. {
  14. get
  15. {
  16. return this.m_SelectedMaid;
  17. }
  18. }
  19. protected override void Start()
  20. {
  21. UndressDance_Mgr.Instance = this;
  22. this.m_ItemWindow.transform.localPosition = this.m_DeactiveOffset;
  23. this.m_ItemWindow.SetActive(false);
  24. base.Start();
  25. base.IsActive &= (DanceMain.SelectDanceData != null);
  26. if (!base.IsActive)
  27. {
  28. base.gameObject.SetActive(false);
  29. return;
  30. }
  31. base.transform.parent.gameObject.layer = base.gameObject.layer;
  32. foreach (UndressDance_Mgr.IconColor iconColor in this.m_IconColData)
  33. {
  34. this.m_LevelColPair.Add(iconColor.Level, iconColor.IconCol);
  35. }
  36. this.m_TakeEventColl = this.m_TakeEvent.GetComponent<BoxCollider>();
  37. UIEventTrigger component = this.m_TakeEvent.GetComponent<UIEventTrigger>();
  38. EventDelegate.Add(component.onHoverOver, new EventDelegate.Callback(this.ShowItemWindow));
  39. EventDelegate.Add(component.onHoverOut, new EventDelegate.Callback(this.CursorRecet));
  40. this.m_HoverCheckObj.Add(this.m_ItemWindow.transform.Find("BG").gameObject);
  41. this.m_HoverCheckObj.Add(this.m_CloseButton.gameObject);
  42. EventDelegate.Add(this.m_CloseButton.onClick, new EventDelegate.Callback(this.HideItemWindow));
  43. this.m_ItemGrid = this.m_ItemWindow.transform.Find("ItemGrid").GetComponent<UIGrid>();
  44. this.m_MaidGrid = this.m_ItemWindow.transform.Find("MaidIcon").GetComponent<UIGrid>();
  45. this.m_MaidTabPanel = this.m_MaidGrid.gameObject.GetComponent<UIWFTabPanel>();
  46. KasaiUtility.CsvRead("csv_rhythm_action/undress_parts_data.nei", new Action<CsvParser, int, int>(this.ReadPartsData), 0, 1, null);
  47. if (this.m_HannugiButton != null)
  48. {
  49. this.m_HannugiButton.SetActive(true);
  50. this.m_HannugiButton.transform.SetParent(this.m_ItemGrid.transform, false);
  51. }
  52. this.m_ItemGrid.repositionNow = true;
  53. KasaiUtility.CsvRead("csv_rhythm_action/undress_level2_data.nei", new Action<CsvParser, int, int>(this.ReadLevel2Key), 0, 1, null);
  54. KasaiUtility.CsvRead("csv_rhythm_action/undress_face_data.nei", new Action<CsvParser, int, int>(this.ReadFaceSetting), 0, 1, null);
  55. this.m_HoverCheckObj.Add(this.m_AlldressButton.gameObject);
  56. this.m_HoverCheckObj.Add(this.m_AllundressButton.gameObject);
  57. EventDelegate.Add(this.m_AlldressButton.onClick, new EventDelegate.Callback(this.AllDreass));
  58. EventDelegate.Add(this.m_AllundressButton.onClick, new EventDelegate.Callback(this.AllUndreass));
  59. if (GameMain.Instance.VRMode && GameMain.Instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  60. {
  61. AVRControllerButtons controller_buttons = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller_buttons;
  62. AVRControllerButtons controller_buttons2 = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller_buttons;
  63. this.m_ControllerInputFlag.Add(controller_buttons, false);
  64. this.m_ControllerInputFlag.Add(controller_buttons2, false);
  65. }
  66. if (GameMain.Instance.VRMode)
  67. {
  68. this.ShowItemWindow();
  69. }
  70. }
  71. private void ReadPartsData(CsvParser csv, int cx, int cy)
  72. {
  73. switch (cx)
  74. {
  75. case 0:
  76. {
  77. MPN key = (MPN)Enum.Parse(typeof(MPN), csv.GetCellAsString(cx, cy));
  78. this.m_MpnPartsData.Add(key, new UndressDance_Mgr.PartsData());
  79. break;
  80. }
  81. case 1:
  82. foreach (string value in csv.GetCellAsString(cx, cy).Split(new char[]
  83. {
  84. ','
  85. }))
  86. {
  87. this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.SlotIDlist.Add((TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), value));
  88. }
  89. break;
  90. case 2:
  91. {
  92. string text = csv.GetCellAsString(cx, cy);
  93. if (text.IndexOf(".tex") < 0)
  94. {
  95. text += ".tex";
  96. }
  97. if (!GameUty.FileSystem.IsExistentFile(text))
  98. {
  99. Debug.LogError("アイコンファイル[" + text + "]が見つかりませんでした");
  100. }
  101. Texture2D defaultIcon = ImportCM.CreateTexture(text);
  102. this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.DefaultIcon = defaultIcon;
  103. break;
  104. }
  105. case 3:
  106. this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.SexsualPoint = csv.GetCellAsInteger(cx, cy);
  107. break;
  108. case 4:
  109. {
  110. bool flag = csv.GetCellAsString(cx, cy) == "○";
  111. if (Product.isPublic && !flag)
  112. {
  113. return;
  114. }
  115. break;
  116. }
  117. case 5:
  118. foreach (string value2 in csv.GetCellAsString(cx, cy).Split(new char[]
  119. {
  120. ','
  121. }))
  122. {
  123. MPN mpn = (MPN)Enum.Parse(typeof(MPN), value2);
  124. if (mpn != MPN.null_mpn)
  125. {
  126. this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.Mpnlist.Add(mpn);
  127. }
  128. }
  129. break;
  130. }
  131. if (cx == csv.max_cell_x - 1)
  132. {
  133. this.CreatePartsIcon(this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Key);
  134. }
  135. }
  136. private void CreatePartsIcon(MPN mpn)
  137. {
  138. GameObject gameObject = Utility.CreatePrefab(this.m_ItemGrid.gameObject, "SceneDance/Rhythm_Action/Prefab/UndressDance/ItemIcon", true);
  139. this.m_HoverCheckObj.Add(gameObject);
  140. UndressItem component = gameObject.GetComponent<UndressItem>();
  141. component.Init(mpn);
  142. this.m_ItemUIList.Add(mpn, component);
  143. }
  144. private void ReadLevel2Key(CsvParser csv, int cx, int cy)
  145. {
  146. if (cx == 1)
  147. {
  148. this.m_Level2KeyList.Add(new List<MPN>());
  149. foreach (string value in csv.GetCellAsString(cx, cy).Split(new char[]
  150. {
  151. ','
  152. }))
  153. {
  154. this.m_Level2KeyList.Last<List<MPN>>().Add((MPN)Enum.Parse(typeof(MPN), value));
  155. }
  156. }
  157. }
  158. private void ReadFaceSetting(CsvParser csv, int cx, int cy)
  159. {
  160. switch (cx)
  161. {
  162. case 0:
  163. {
  164. UndressDance_Mgr.UndressLevel undressLevel = (UndressDance_Mgr.UndressLevel)Enum.Parse(typeof(UndressDance_Mgr.UndressLevel), csv.GetCellAsString(cx, cy));
  165. this.m_FaceSetting.Add(undressLevel, new UndressDance_Mgr.FaceDataBase());
  166. this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Level = undressLevel;
  167. break;
  168. }
  169. case 1:
  170. if (csv.IsCellToExistData(cx, cy))
  171. {
  172. this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.SexualPoint = csv.GetCellAsInteger(cx, cy);
  173. }
  174. break;
  175. case 2:
  176. if (csv.IsCellToExistData(cx, cy))
  177. {
  178. this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Face = csv.GetCellAsString(cx, cy).Split(new char[]
  179. {
  180. ','
  181. }).ToList<string>();
  182. }
  183. break;
  184. case 3:
  185. this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.FaceBlend = csv.GetCellAsString(cx, cy);
  186. break;
  187. case 4:
  188. if (csv.IsCellToExistData(cx, cy))
  189. {
  190. this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Probability = csv.GetCellAsInteger(cx, cy);
  191. }
  192. break;
  193. }
  194. }
  195. private void CursorRecet()
  196. {
  197. this.m_IsCursorOn = false;
  198. }
  199. private void WindowMove(float time)
  200. {
  201. this.m_MoveEnd = false;
  202. this.m_ItemWindow.transform.localPosition = Vector3.Lerp(Vector3.zero, this.m_DeactiveOffset, KasaiUtility.SinRate01(time, this.m_UIShowTime, this.m_IsWindowActive, false));
  203. }
  204. private void MoveEnd()
  205. {
  206. this.m_MoveEnd = true;
  207. if (!this.m_IsWindowActive)
  208. {
  209. this.m_ItemWindow.SetActive(false);
  210. }
  211. else
  212. {
  213. this.m_IsCursorOn = true;
  214. }
  215. this.m_TakeEventColl.enabled = !this.m_IsWindowActive;
  216. }
  217. private void ShowItemWindow()
  218. {
  219. if (!this.m_MoveEnd)
  220. {
  221. return;
  222. }
  223. if (this.m_IsCursorOn)
  224. {
  225. return;
  226. }
  227. if (!this.m_IsWindowActive)
  228. {
  229. this.m_IsWindowActive = true;
  230. this.m_ItemWindow.SetActive(true);
  231. base.StartCoroutine(KasaiUtility.TimeCroutine(this.m_UIShowTime, new Action<float>(this.WindowMove), new Action(this.MoveEnd)));
  232. }
  233. }
  234. private void HideItemWindow()
  235. {
  236. if (!this.m_MoveEnd)
  237. {
  238. return;
  239. }
  240. this.m_IsWindowActive = false;
  241. base.StartCoroutine(KasaiUtility.TimeCroutine(this.m_UIShowTime, new Action<float>(this.WindowMove), new Action(this.MoveEnd)));
  242. }
  243. private void MaidSelect()
  244. {
  245. Maid maid = this.m_MaidIconList[UIWFTabButton.current];
  246. if (this.m_SelectedMaid == maid)
  247. {
  248. return;
  249. }
  250. this.m_SelectedMaid = maid;
  251. foreach (UndressItem undressItem in this.m_ItemUIList.Values)
  252. {
  253. undressItem.UpdateState(maid);
  254. }
  255. this.UpdateHannugiButtonState();
  256. }
  257. private void AllDreass()
  258. {
  259. if (this.m_ForceLevel2)
  260. {
  261. this.SetMaidFace(UndressDance_Mgr.UndressLevel.None);
  262. this.m_ForceLevel2 = false;
  263. }
  264. if (this.m_ItemUIList.Values.All((UndressItem e) => !e.IsUndress))
  265. {
  266. return;
  267. }
  268. foreach (UndressItem undressItem in this.m_ItemUIList.Values)
  269. {
  270. undressItem.SetMaidMask(this.m_SelectedMaid, false);
  271. }
  272. }
  273. private void AllUndreass()
  274. {
  275. if (this.m_ItemUIList.Values.All((UndressItem e) => e.IsUndress))
  276. {
  277. return;
  278. }
  279. this.m_ForceLevel2 = false;
  280. foreach (UndressItem undressItem in this.m_ItemUIList.Values)
  281. {
  282. undressItem.SetMaidMask(this.m_SelectedMaid, true);
  283. }
  284. if (this.GetUndressLevel(false) != UndressDance_Mgr.UndressLevel.Level2)
  285. {
  286. this.m_ForceLevel2 = true;
  287. this.SetMaidFace(UndressDance_Mgr.UndressLevel.Level2);
  288. }
  289. }
  290. public void OnClickHannugiButton()
  291. {
  292. if (this.m_HannugiButton == null || this.m_SelectedMaid == null || !this.m_SelectedMaid.IsCrcBody)
  293. {
  294. return;
  295. }
  296. bool flag = this.m_SelectedMaid.mekureController.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.Hadake);
  297. this.m_SelectedMaid.mekureController.SetEnabledCostumeType(MaidCostumeChangeController.CostumeType.Hadake, !flag, null);
  298. this.UpdateHannugiButtonState();
  299. }
  300. private void UpdateHannugiButtonState()
  301. {
  302. if (this.m_HannugiButton == null || this.m_SelectedMaid == null)
  303. {
  304. return;
  305. }
  306. bool activeSelf = this.m_HannugiButton.activeSelf;
  307. this.m_HannugiButton.SetActive(this.m_SelectedMaid.IsCrcBody);
  308. if (!activeSelf && this.m_HannugiButton.activeSelf)
  309. {
  310. this.m_ItemGrid.repositionNow = true;
  311. }
  312. if (!this.m_HannugiButton.activeSelf)
  313. {
  314. return;
  315. }
  316. UIButton componentInChildren = this.m_HannugiButton.GetComponentInChildren<UIButton>();
  317. componentInChildren.isEnabled = this.m_SelectedMaid.mekureController.IsSupportedCostumeType(MaidCostumeChangeController.CostumeType.Hadake);
  318. if (!componentInChildren.isEnabled)
  319. {
  320. return;
  321. }
  322. bool flag = this.m_SelectedMaid.mekureController.IsEnabledCostumeType(MaidCostumeChangeController.CostumeType.Hadake);
  323. Color defaultColor = componentInChildren.defaultColor;
  324. defaultColor.a = ((!flag) ? 0.5f : 1f);
  325. componentInChildren.defaultColor = defaultColor;
  326. }
  327. private UndressDance_Mgr.UndressLevel GetUndressLevel(bool release_force2 = false)
  328. {
  329. UndressDance_Mgr.SexsualData sexsualData = this.m_MaidSexsualData[this.SelectMaid];
  330. UndressDance_Mgr.UndressLevel undressLevel = UndressDance_Mgr.UndressLevel.None;
  331. int sexsualPoint = sexsualData.SexsualPoint;
  332. foreach (UndressDance_Mgr.FaceDataBase faceDataBase in this.m_FaceSetting.Values)
  333. {
  334. if (faceDataBase.SexualPoint > 0 && sexsualPoint >= faceDataBase.SexualPoint)
  335. {
  336. undressLevel = faceDataBase.Level;
  337. }
  338. }
  339. if (undressLevel == UndressDance_Mgr.UndressLevel.Level1)
  340. {
  341. if (release_force2)
  342. {
  343. this.m_ForceLevel2 = false;
  344. }
  345. foreach (List<MPN> list in this.m_Level2KeyList)
  346. {
  347. bool flag = true;
  348. foreach (MPN key in list)
  349. {
  350. flag &= (this.m_ItemUIList.ContainsKey(key) && this.m_ItemUIList[key].IsUndress);
  351. if (!flag)
  352. {
  353. break;
  354. }
  355. }
  356. if (flag || this.m_ForceLevel2)
  357. {
  358. undressLevel = UndressDance_Mgr.UndressLevel.Level2;
  359. break;
  360. }
  361. }
  362. }
  363. return undressLevel;
  364. }
  365. private void SetFaceBlend(UndressDance_Mgr.UndressLevel level)
  366. {
  367. string faceBlend = this.m_FaceSetting[level].FaceBlend;
  368. TMorph.AddBlendType addBlendType = TMorph.AddBlendType.None;
  369. if (faceBlend.IndexOf("頬1") >= 0 || faceBlend.IndexOf("頬1") >= 0)
  370. {
  371. addBlendType |= TMorph.AddBlendType.Cheek1;
  372. }
  373. if (faceBlend.IndexOf("頬2") >= 0 || faceBlend.IndexOf("頬2") >= 0)
  374. {
  375. addBlendType |= TMorph.AddBlendType.Cheek2;
  376. }
  377. if (faceBlend.IndexOf("頬3") >= 0 || faceBlend.IndexOf("頬3") >= 0)
  378. {
  379. addBlendType |= TMorph.AddBlendType.Cheek3;
  380. }
  381. if (faceBlend.IndexOf("涙1") >= 0 || faceBlend.IndexOf("涙1") >= 0)
  382. {
  383. addBlendType |= TMorph.AddBlendType.Tear1;
  384. }
  385. if (faceBlend.IndexOf("涙2") >= 0 || faceBlend.IndexOf("涙2") >= 0)
  386. {
  387. addBlendType |= TMorph.AddBlendType.Tear2;
  388. }
  389. if (faceBlend.IndexOf("涙3") >= 0 || faceBlend.IndexOf("涙3") >= 0)
  390. {
  391. addBlendType |= TMorph.AddBlendType.Tear3;
  392. }
  393. if (faceBlend.IndexOf("赤面") >= 0)
  394. {
  395. addBlendType |= TMorph.AddBlendType.Blush;
  396. }
  397. if (faceBlend.IndexOf("ショック") >= 0)
  398. {
  399. addBlendType |= TMorph.AddBlendType.Shock;
  400. }
  401. if (faceBlend.IndexOf("玉涙") >= 0)
  402. {
  403. addBlendType |= TMorph.AddBlendType.TearBig;
  404. }
  405. this.SelectMaid.body0.Face.morph.SetValueOriginalBlendSet(addBlendType);
  406. this.SelectMaid.FaceBlend("オリジナル");
  407. }
  408. private IEnumerator FaceUpdate(UndressDance_Mgr.UndressLevel level)
  409. {
  410. UndressDance_Mgr.FaceDataBase face_data = this.m_FaceSetting[level];
  411. Maid maid = this.SelectMaid;
  412. RhythmAction_Mgr.Instance.SetMaidFaceBlendStop(maid, true);
  413. this.SetFaceBlend(level);
  414. if (face_data.Face.Count <= 0)
  415. {
  416. RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, false);
  417. yield break;
  418. }
  419. RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, true);
  420. float timer = 0f;
  421. int face_index = UnityEngine.Random.Range(0, face_data.Face.Count);
  422. maid.FaceAnime(face_data.Face[face_index], 1f, 0);
  423. for (;;)
  424. {
  425. timer += RhythmAction_Mgr.Instance.DanceDeltaTime;
  426. if (timer > this.m_FaceChangeTime)
  427. {
  428. timer = 0f;
  429. int num = UnityEngine.Random.Range(0, 100);
  430. if (num < face_data.Probability)
  431. {
  432. face_index = UnityEngine.Random.Range(0, face_data.Face.Count);
  433. RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, true);
  434. maid.FaceAnime(face_data.Face[face_index], 1f, 0);
  435. }
  436. else
  437. {
  438. RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, false);
  439. }
  440. }
  441. yield return null;
  442. }
  443. yield break;
  444. }
  445. private IEnumerator InputCheck()
  446. {
  447. for (;;)
  448. {
  449. if (RhythmAction_Mgr.Instance.DanceMaid.Count > 1)
  450. {
  451. bool flag = Input.GetKeyDown(KeyCode.RightArrow);
  452. bool flag2 = Input.GetKeyDown(KeyCode.LeftArrow);
  453. if (GameMain.Instance.VRMode && !flag2 && !flag && GameMain.Instance.VRDeviceTypeID != GameMain.VRDeviceType.NON)
  454. {
  455. AVRController left_controller = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller;
  456. AVRController right_controller = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller;
  457. AVRControllerButtons left_input = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller_buttons;
  458. AVRControllerButtons right_input = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller_buttons;
  459. GameMain.VRDeviceType vrdeviceTypeID = GameMain.Instance.VRDeviceTypeID;
  460. if (vrdeviceTypeID != GameMain.VRDeviceType.VIVE)
  461. {
  462. if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
  463. {
  464. Func<bool, bool> func = delegate(bool is_right)
  465. {
  466. bool flag5 = false;
  467. if (is_right)
  468. {
  469. flag5 |= (left_input.GetAxis().x > 0.5f && !this.m_ControllerInputFlag[left_input] && left_controller.HandDanceMode);
  470. flag5 |= (right_input.GetAxis().x > 0.5f && !this.m_ControllerInputFlag[right_input] && right_controller.HandDanceMode);
  471. }
  472. else
  473. {
  474. flag5 |= (left_input.GetAxis().x < -0.5f && !this.m_ControllerInputFlag[left_input] && left_controller.HandDanceMode);
  475. flag5 |= (right_input.GetAxis().x < -0.5f && !this.m_ControllerInputFlag[right_input] && right_controller.HandDanceMode);
  476. }
  477. return flag5;
  478. };
  479. flag2 = func(false);
  480. flag = func(true);
  481. this.m_ControllerInputFlag[left_input] = (Mathf.Abs(left_input.GetAxis().x) > 0.5f);
  482. this.m_ControllerInputFlag[right_input] = (Mathf.Abs(right_input.GetAxis().x) > 0.5f);
  483. }
  484. }
  485. else
  486. {
  487. Func<bool, bool> func2 = delegate(bool is_right)
  488. {
  489. bool flag5 = false;
  490. if (is_right)
  491. {
  492. flag5 |= (left_input.GetAxis().x > 0.5f && left_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && left_controller.HandDanceMode);
  493. flag5 |= (right_input.GetAxis().x > 0.5f && right_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && right_controller.HandDanceMode);
  494. }
  495. else
  496. {
  497. flag5 |= (left_input.GetAxis().x < -0.5f && left_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && left_controller.HandDanceMode);
  498. flag5 |= (right_input.GetAxis().x < -0.5f && right_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && right_controller.HandDanceMode);
  499. }
  500. return flag5;
  501. };
  502. flag2 = func2(false);
  503. flag = func2(true);
  504. }
  505. }
  506. if (flag || flag2)
  507. {
  508. UIWFTabButton[] array = this.m_MaidIconList.Keys.ToArray<UIWFTabButton>();
  509. for (int i = 0; i < this.m_MaidIconList.Count; i++)
  510. {
  511. if (!(array[i] != this.m_MaidTabPanel.GetSelectButtonObject()))
  512. {
  513. bool flag3 = false;
  514. if (flag)
  515. {
  516. flag3 = (i + 1 < this.m_MaidIconList.Count);
  517. }
  518. else if (flag2)
  519. {
  520. flag3 = (i - 1 >= 0);
  521. }
  522. if (flag3)
  523. {
  524. int num = (!flag) ? (i - 1) : (i + 1);
  525. this.m_MaidTabPanel.Select(array[num]);
  526. if (this.m_IsWindowActive)
  527. {
  528. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
  529. }
  530. }
  531. break;
  532. }
  533. }
  534. }
  535. }
  536. if (this.m_IsWindowActive && !GameMain.Instance.VRMode)
  537. {
  538. bool flag4 = UICamera.hoveredObject && this.m_HoverCheckObj.Contains(UICamera.hoveredObject);
  539. if (!flag4 && this.m_WaitCoroutine == null)
  540. {
  541. this.m_IsCursorOn = false;
  542. this.m_WaitCoroutine = KasaiUtility.TimeCroutine(this.m_HidewaitTime, null, new Action(this.HideItemWindow));
  543. base.StartCoroutine(this.m_WaitCoroutine);
  544. }
  545. else if (flag4 && this.m_WaitCoroutine != null)
  546. {
  547. this.m_IsCursorOn = true;
  548. base.StopCoroutine(this.m_WaitCoroutine);
  549. this.m_WaitCoroutine = null;
  550. }
  551. foreach (UndressDance_Mgr.MpnKeyData mpnKeyData in this.m_MpnInputPair)
  552. {
  553. if (this.m_ItemUIList.ContainsKey(mpnKeyData.Mpn) && this.m_ItemUIList[mpnKeyData.Mpn].IsEnable)
  554. {
  555. if (Input.GetKeyDown(mpnKeyData.InputKey))
  556. {
  557. this.m_ItemUIList[mpnKeyData.Mpn].SwitchMask();
  558. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
  559. }
  560. }
  561. }
  562. }
  563. yield return null;
  564. }
  565. yield break;
  566. }
  567. private IEnumerator TweeenNull()
  568. {
  569. yield return null;
  570. foreach (UIWFTabButton uiwftabButton in this.m_MaidIconList.Keys)
  571. {
  572. uiwftabButton.tweenTarget = null;
  573. }
  574. yield break;
  575. }
  576. private void SetMaidFace(UndressDance_Mgr.UndressLevel level)
  577. {
  578. if (!DanceSetting.Settings.UndressFaceOn)
  579. {
  580. return;
  581. }
  582. this.m_MaidSexsualData[this.SelectMaid].Level = level;
  583. if (this.m_FaceCroutine != null)
  584. {
  585. base.StopCoroutine(this.m_FaceCroutine);
  586. this.m_FaceCroutine = null;
  587. }
  588. this.m_MaidSexsualData[this.SelectMaid].Icon.color = this.m_LevelColPair[level];
  589. if (level != UndressDance_Mgr.UndressLevel.None)
  590. {
  591. this.m_FaceCroutine = this.FaceUpdate(level);
  592. base.StartCoroutine(this.m_FaceCroutine);
  593. }
  594. else
  595. {
  596. RhythmAction_Mgr.Instance.SetMaidFaceStop(this.SelectMaid, false);
  597. RhythmAction_Mgr.Instance.SetMaidFaceBlendStop(this.SelectMaid, false);
  598. }
  599. }
  600. public override void StartAction()
  601. {
  602. List<Maid> list = new List<Maid>(RhythmAction_Mgr.Instance.FactOrderList);
  603. list.Reverse();
  604. foreach (Maid maid in list)
  605. {
  606. if (maid)
  607. {
  608. foreach (UndressItem undressItem in this.m_ItemUIList.Values)
  609. {
  610. undressItem.AddMaidData(maid);
  611. }
  612. GameObject gameObject = Utility.CreatePrefab(this.m_MaidGrid.gameObject, "SceneDance/Rhythm_Action/Prefab/UndressDance/MaidIcon", true);
  613. Transform transform = gameObject.transform.Find("IconMask/Icon");
  614. this.m_HoverCheckObj.Add(transform.gameObject);
  615. transform.GetComponent<UITexture>().mainTexture = maid.GetThumIcon();
  616. UIWFTabButton component = transform.GetComponent<UIWFTabButton>();
  617. this.m_MaidIconList.Add(component, maid);
  618. EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.MaidSelect));
  619. this.m_MaidSexsualData.Add(maid, new UndressDance_Mgr.SexsualData());
  620. this.m_MaidSexsualData[maid].Icon = transform.GetComponent<UITexture>();
  621. }
  622. }
  623. this.m_MaidGrid.repositionNow = true;
  624. this.m_MaidTabPanel.UpdateChildren();
  625. this.m_MaidTabPanel.Select(this.m_MaidIconList.Last<KeyValuePair<UIWFTabButton, Maid>>().Key);
  626. base.StartCoroutine(this.InputCheck());
  627. base.StartCoroutine(this.TweeenNull());
  628. }
  629. public override void EndAction()
  630. {
  631. foreach (Maid maid in RhythmAction_Mgr.Instance.DanceMaid)
  632. {
  633. maid.body0.SetMaskMode(TBody.MaskMode.None);
  634. maid.FaceBlend("無し");
  635. }
  636. }
  637. public UndressDance_Mgr.PartsData GetPartsData(MPN mpn)
  638. {
  639. NDebug.Assert(this.m_MpnPartsData.ContainsKey(mpn), string.Format("UndressDance_Mgr.GetPartsData:リスト内に{0}は存在しません", mpn));
  640. return this.m_MpnPartsData[mpn];
  641. }
  642. public void ChangeSexsualPoint(MPN mpn)
  643. {
  644. if (!DanceSetting.Settings.UndressFaceOn)
  645. {
  646. return;
  647. }
  648. UndressDance_Mgr.UndressLevel level = this.m_MaidSexsualData[this.SelectMaid].Level;
  649. this.m_MaidSexsualData[this.SelectMaid].SexsualPoint += ((!this.m_ItemUIList[mpn].IsUndress) ? (-this.m_MpnPartsData[mpn].SexsualPoint) : this.m_MpnPartsData[mpn].SexsualPoint);
  650. if (this.m_MaidSexsualData[this.SelectMaid].SexsualPoint < 0)
  651. {
  652. this.m_MaidSexsualData[this.SelectMaid].SexsualPoint = 0;
  653. }
  654. UndressDance_Mgr.UndressLevel undressLevel = this.GetUndressLevel(true);
  655. if (level != undressLevel)
  656. {
  657. this.SetMaidFace(undressLevel);
  658. }
  659. }
  660. private const float m_InputBorder = 0.5f;
  661. [SerializeField]
  662. [Header("非アクティブ時のウィンドウのオフセット")]
  663. private Vector3 m_DeactiveOffset;
  664. [SerializeField]
  665. private UIButton m_CloseButton;
  666. [SerializeField]
  667. private GameObject m_TakeEvent;
  668. private BoxCollider m_TakeEventColl;
  669. [SerializeField]
  670. [Header("アイテムウィンドウ")]
  671. private GameObject m_ItemWindow;
  672. private UIGrid m_ItemGrid;
  673. private UIGrid m_MaidGrid;
  674. private UIWFTabPanel m_MaidTabPanel;
  675. [SerializeField]
  676. [Header("ウィンドウの移動時間")]
  677. private float m_UIShowTime = 0.5f;
  678. [SerializeField]
  679. private float m_HidewaitTime = 2f;
  680. [SerializeField]
  681. [Header("全脱衣ボタン")]
  682. private UIButton m_AllundressButton;
  683. [SerializeField]
  684. [Header("全着衣ボタン")]
  685. private UIButton m_AlldressButton;
  686. [SerializeField]
  687. [Header("半脱ぎボタン")]
  688. private GameObject m_HannugiButton;
  689. [SerializeField]
  690. private float m_FaceChangeTime = 5f;
  691. private IEnumerator m_WaitCoroutine;
  692. private bool m_IsWindowActive;
  693. private bool m_MoveEnd = true;
  694. private List<GameObject> m_HoverCheckObj = new List<GameObject>();
  695. private Dictionary<MPN, UndressDance_Mgr.PartsData> m_MpnPartsData = new Dictionary<MPN, UndressDance_Mgr.PartsData>();
  696. private Maid m_SelectedMaid;
  697. private Dictionary<MPN, UndressItem> m_ItemUIList = new Dictionary<MPN, UndressItem>();
  698. private Dictionary<UIWFTabButton, Maid> m_MaidIconList = new Dictionary<UIWFTabButton, Maid>();
  699. private bool m_IsCursorOn;
  700. [SerializeField]
  701. [Header("ショートカットキーと各Mpnの割り当て")]
  702. private List<UndressDance_Mgr.MpnKeyData> m_MpnInputPair = new List<UndressDance_Mgr.MpnKeyData>
  703. {
  704. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad1),
  705. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad2),
  706. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad3),
  707. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad4),
  708. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad5),
  709. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad6),
  710. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad7),
  711. new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad8)
  712. };
  713. private Dictionary<AVRControllerButtons, bool> m_ControllerInputFlag = new Dictionary<AVRControllerButtons, bool>();
  714. private List<List<MPN>> m_Level2KeyList = new List<List<MPN>>();
  715. private Dictionary<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase> m_FaceSetting = new Dictionary<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>();
  716. private Dictionary<Maid, UndressDance_Mgr.SexsualData> m_MaidSexsualData = new Dictionary<Maid, UndressDance_Mgr.SexsualData>();
  717. private IEnumerator m_FaceCroutine;
  718. [SerializeField]
  719. [Header("各レベルのアイコン色")]
  720. private List<UndressDance_Mgr.IconColor> m_IconColData = new List<UndressDance_Mgr.IconColor>
  721. {
  722. new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.None),
  723. new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level0),
  724. new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level1),
  725. new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level2)
  726. };
  727. private Dictionary<UndressDance_Mgr.UndressLevel, Color> m_LevelColPair = new Dictionary<UndressDance_Mgr.UndressLevel, Color>();
  728. private bool m_ForceLevel2;
  729. public class PartsData
  730. {
  731. public List<TBody.SlotID> SlotIDlist = new List<TBody.SlotID>();
  732. public List<MPN> Mpnlist = new List<MPN>();
  733. public Texture DefaultIcon;
  734. public int SexsualPoint;
  735. }
  736. [Serializable]
  737. private class MpnKeyData
  738. {
  739. public MpnKeyData(KeyCode key)
  740. {
  741. this.InputKey = key;
  742. }
  743. public MPN Mpn;
  744. public KeyCode InputKey;
  745. }
  746. private enum UndressLevel
  747. {
  748. None,
  749. Level0,
  750. Level1,
  751. Level2
  752. }
  753. private class FaceDataBase
  754. {
  755. public int SexualPoint;
  756. public UndressDance_Mgr.UndressLevel Level;
  757. public List<string> Face = new List<string>();
  758. public string FaceBlend = string.Empty;
  759. public int Probability;
  760. }
  761. private class SexsualData
  762. {
  763. public int SexsualPoint;
  764. public UndressDance_Mgr.UndressLevel Level;
  765. public UITexture Icon;
  766. }
  767. [Serializable]
  768. private class IconColor
  769. {
  770. public IconColor(UndressDance_Mgr.UndressLevel level)
  771. {
  772. this.Level = level;
  773. }
  774. public UndressDance_Mgr.UndressLevel Level;
  775. public Color IconCol = Color.white;
  776. }
  777. }