SceneCasino.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using MaidStatus;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. using wf;
  8. public class SceneCasino : KasaSceneMgr<SceneCasino>
  9. {
  10. protected override void Awake()
  11. {
  12. base.MainRecet();
  13. GameMain.Instance.BgMgr.ChangeBg(this.m_BgName);
  14. GameMain.Instance.SoundMgr.PlayBGM(this.m_BgmName, 0f, true);
  15. GameMain.Instance.MainCamera.SetControl(this.m_IsControll);
  16. base.SetCamera();
  17. bool is_upward2 = CasinoDataMgr.Instance.GetCasinoFacility(true);
  18. bool flag = CasinoDataMgr.Instance.GetCasinoFacility(true) && CasinoDataMgr.Instance.GetCasinoFacility(false);
  19. if (!GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("return_casinomenu") && flag)
  20. {
  21. this.m_CasinoMenu.alpha = 0f;
  22. this.m_ExchangeFrame.alpha = 0f;
  23. GameMain.Instance.MainCamera.FadeIn(0f, false, null, true, true, default(Color));
  24. GameObject gameObject = Utility.CreatePrefab(GameObject.Find("UI Root"), "OVR/DanceOVRDialog", true);
  25. gameObject.GetComponent<UIPanel>().depth = 250;
  26. FFNameDialog select_dialog = gameObject.GetComponent<FFNameDialog>();
  27. select_dialog.Init();
  28. Action<bool> select_casino = delegate(bool is_upward)
  29. {
  30. CasinoDataMgr.Instance.CasinoSelect(is_upward);
  31. select_dialog.Close();
  32. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.Init), false, default(Color));
  33. };
  34. select_dialog.Show("どちらのカジノでプレイしますか?", CasinoDataMgr.Instance.GetCasinoFacility(true).facilityName, delegate
  35. {
  36. select_casino(true);
  37. }, CasinoDataMgr.Instance.GetCasinoFacility(false).facilityName, delegate
  38. {
  39. select_casino(false);
  40. });
  41. }
  42. else
  43. {
  44. if (!GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("return_casinomenu"))
  45. {
  46. CasinoDataMgr.Instance.CasinoSelect(is_upward2);
  47. }
  48. this.Init();
  49. }
  50. }
  51. private void Init()
  52. {
  53. this.m_CasinoMenu.alpha = 1f;
  54. this.m_ExchangeFrame.alpha = 1f;
  55. CasinoDataMgr.Instance.InitDealerMaid();
  56. CasinoDataMgr.Instance.InitShopData();
  57. GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
  58. if (CasinoDataMgr.Instance.IsChangeCostume)
  59. {
  60. CasinoDataMgr.Instance.IsChangeCostume = false;
  61. CasinoDataMgr.Instance.CurrentCasino.UpdateEditCostumeToMaidCostume(CasinoDataMgr.Instance.DealerMaid);
  62. }
  63. CasinoDataMgr.Instance.DealerMaid.Visible = true;
  64. CasinoDataMgr.Instance.DealerMaid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  65. base.Awake();
  66. string text = "casinomenu_data.nei";
  67. if (!GameUty.FileSystem.IsExistentFile(text))
  68. {
  69. NDebug.Assert("表がありません。" + text, false);
  70. }
  71. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
  72. {
  73. using (CsvParser csvParser = new CsvParser())
  74. {
  75. bool condition = csvParser.Open(afileBase);
  76. NDebug.Assert(condition, text + "\nopen failed.");
  77. for (int i = 1; i < csvParser.max_cell_y; i++)
  78. {
  79. if (csvParser.IsCellToExistData(0, i))
  80. {
  81. SceneCasino.CasinoMenu key = (SceneCasino.CasinoMenu)Enum.Parse(typeof(SceneCasino.CasinoMenu), csvParser.GetCellAsString(0, i));
  82. string cellAsString = csvParser.GetCellAsString(1, i);
  83. this.m_MenuLabelPair.Add(key, cellAsString);
  84. }
  85. }
  86. }
  87. }
  88. NDebug.Assert(GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("label"), "メニュー選択時のラベルが未指定です");
  89. this.m_NextLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["label"];
  90. NDebug.Assert(GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("cancel_label"), "キャンセル時のラベルが未指定です");
  91. this.m_CancelLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["cancel_label"];
  92. using (List<SceneCasino.MenuButtonPair>.Enumerator enumerator = this.m_MenuButtonPair.GetEnumerator())
  93. {
  94. while (enumerator.MoveNext())
  95. {
  96. SceneCasino.MenuButtonPair pair = enumerator.Current;
  97. SceneCasino $this = this;
  98. pair.Button.onClick.AddListener(delegate()
  99. {
  100. $this.SelectMenu(pair.Menu);
  101. });
  102. }
  103. }
  104. this.m_CharaSelect.Create(CharacterSelectManager.Type.Select, 3, true);
  105. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  106. {
  107. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  108. if (!stockMaid || stockMaid.status.heroineType == HeroineType.Sub)
  109. {
  110. this.m_CharaSelect.RemoveMaidPlate(stockMaid);
  111. }
  112. }
  113. CharacterSelectManager.CallBackOnSelect callBackCallBackOnSelect = delegate(Maid select_maid)
  114. {
  115. CasinoDataMgr.Instance.SetDealerMaid(select_maid);
  116. };
  117. this.m_CharaSelect.SetCallBackCallBackOnSelect(callBackCallBackOnSelect);
  118. this.m_CharaSelect.SelectMaid(CasinoDataMgr.Instance.DealerMaid);
  119. uGUITutorialPanel.OpenTutorial("SceneCasino", null, false);
  120. GameMain.Instance.SysShortcut.strSceneHelpName = "SceneCasino";
  121. }
  122. private void Start()
  123. {
  124. ExChangeUI instance = ExChangeUI.Instance;
  125. instance.FadeInStartAction = (Action)Delegate.Combine(instance.FadeInStartAction, new Action(delegate()
  126. {
  127. this.m_CasinoMenu.interactable = false;
  128. }));
  129. ExChangeUI instance2 = ExChangeUI.Instance;
  130. instance2.FadeInStartAction = (Action)Delegate.Combine(instance2.FadeInStartAction, new Action(delegate()
  131. {
  132. this.m_NguiEnable = false;
  133. }));
  134. ExChangeUI instance3 = ExChangeUI.Instance;
  135. instance3.FadeOutStartAction = (Action)Delegate.Combine(instance3.FadeOutStartAction, new Action(delegate()
  136. {
  137. this.m_CasinoMenu.interactable = true;
  138. }));
  139. ExChangeUI instance4 = ExChangeUI.Instance;
  140. instance4.FadeOutStartAction = (Action)Delegate.Combine(instance4.FadeOutStartAction, new Action(delegate()
  141. {
  142. this.m_NguiEnable = true;
  143. }));
  144. ExChangeUI instance5 = ExChangeUI.Instance;
  145. instance5.FadeOutStartAction = (Action)Delegate.Combine(instance5.FadeOutStartAction, new Action(delegate()
  146. {
  147. ExChangeUI.Instance.SetButtonState(true);
  148. }));
  149. }
  150. private void LateUpdate()
  151. {
  152. this.m_NguiCam.EnableProcess &= this.m_NguiEnable;
  153. }
  154. private void WearMaidInit()
  155. {
  156. CasinoDataMgr.Instance.DealerMaid.FaceBlend("無し");
  157. CasinoDataMgr.Instance.DealerMaid.FaceAnime("通常", 1f, 0);
  158. CasinoDataMgr.Instance.DealerMaid.AudioMan.Stop();
  159. GameMain.Instance.ScriptMgr.is_motion_blend = false;
  160. GameMain.Instance.ScriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true);
  161. GameMain.Instance.CharacterMgr.CharaAllOfsetPos(this.m_MaidPos);
  162. GameMain.Instance.CharacterMgr.CharaAllOfsetRot(this.m_MaidAngle);
  163. base.LoadEnd();
  164. }
  165. protected override void LoadEnd()
  166. {
  167. Facility.CostumeType typeCostume = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
  168. if (!this.m_IsWearSet && typeCostume != Facility.CostumeType.Heroine)
  169. {
  170. if (typeCostume != Facility.CostumeType.Default)
  171. {
  172. if (typeCostume == Facility.CostumeType.Edit)
  173. {
  174. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
  175. }
  176. }
  177. else
  178. {
  179. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
  180. }
  181. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  182. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.WearMaidInit)));
  183. }
  184. else
  185. {
  186. this.WearMaidInit();
  187. }
  188. this.m_IsWearSet = true;
  189. }
  190. private void ToOtherLabel(string label)
  191. {
  192. if (string.IsNullOrEmpty(label))
  193. {
  194. return;
  195. }
  196. this.m_JumpLabel = label;
  197. this.m_GraphicRaycaster.enabled = false;
  198. this.FadeOut();
  199. }
  200. protected override void FadeOutEnd()
  201. {
  202. base.MainRecet();
  203. if (CasinoDataMgr.Instance.CurrentCasino.typeCostume != Facility.CostumeType.Heroine && this.m_JumpLabel == this.m_CancelLabel)
  204. {
  205. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  206. foreach (MPN idx in facilityCostumeEnableMPN)
  207. {
  208. CasinoDataMgr.Instance.DealerMaid.ResetProp(idx, false);
  209. }
  210. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  211. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(base.FadeOutEnd)));
  212. }
  213. else
  214. {
  215. base.FadeOutEnd();
  216. }
  217. }
  218. private IEnumerator ToEditCharaLoad()
  219. {
  220. GameMain.Instance.FacilityMgr.tempSelectFacility = CasinoDataMgr.Instance.CurrentCasino;
  221. CasinoDataMgr.Instance.CurrentCasino.typeCostume = Facility.CostumeType.Edit;
  222. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, true);
  223. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  224. while (GameMain.Instance.CharacterMgr.IsBusy())
  225. {
  226. yield return null;
  227. }
  228. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_NextLabel);
  229. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  230. yield break;
  231. }
  232. private void SelectMenu(SceneCasino.CasinoMenu menu)
  233. {
  234. switch (menu)
  235. {
  236. case SceneCasino.CasinoMenu.Blackjack:
  237. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 100L)
  238. {
  239. string f_strMsg = string.Format("ブラックジャックをするには最低でも\nコインが{0:#,##0}枚必用です", 100);
  240. GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null);
  241. }
  242. else
  243. {
  244. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  245. this.ToOtherLabel(this.m_NextLabel);
  246. }
  247. break;
  248. case SceneCasino.CasinoMenu.Slot:
  249. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 300L)
  250. {
  251. string f_strMsg2 = string.Format("スロットをするには最低でも\nコインが{0:#,##0}枚必用です", 300);
  252. GameMain.Instance.SysDlg.Show(f_strMsg2, SystemDialog.TYPE.OK, null, null);
  253. }
  254. else
  255. {
  256. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  257. this.ToOtherLabel(this.m_NextLabel);
  258. }
  259. break;
  260. case SceneCasino.CasinoMenu.SelectDealer:
  261. this.m_TempMaid = CasinoDataMgr.Instance.DealerMaid;
  262. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, true, 0.5f, null, true, true));
  263. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, false, 0.5f, null, true, true));
  264. break;
  265. case SceneCasino.CasinoMenu.SetCostume:
  266. CasinoDataMgr.Instance.IsChangeCostume = true;
  267. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  268. this.m_GraphicRaycaster.enabled = false;
  269. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  270. {
  271. base.StartCoroutine(this.ToEditCharaLoad());
  272. }, true, default(Color));
  273. break;
  274. default:
  275. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  276. this.ToOtherLabel(this.m_NextLabel);
  277. break;
  278. }
  279. }
  280. private IEnumerator DealerChange()
  281. {
  282. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  283. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  284. Facility.CostumeType costume_type = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
  285. bool costume_change = costume_type != Facility.CostumeType.Heroine;
  286. if (costume_change)
  287. {
  288. MPN[] mpn_array = FacilityDataTable.GetFacilityCostumeEnableMPN();
  289. foreach (MPN idx in mpn_array)
  290. {
  291. this.m_TempMaid.ResetProp(idx, false);
  292. }
  293. this.m_TempMaid.AllProcPropSeqStart();
  294. while (GameMain.Instance.CharacterMgr.IsBusy())
  295. {
  296. yield return null;
  297. }
  298. }
  299. GameMain.Instance.CharacterMgr.DeactivateMaid(this.m_TempMaid.ActiveSlotNo);
  300. GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
  301. CasinoDataMgr.Instance.DealerMaid.Visible = true;
  302. while (GameMain.Instance.CharacterMgr.IsBusy())
  303. {
  304. yield return null;
  305. }
  306. if (costume_type != Facility.CostumeType.Heroine)
  307. {
  308. if (costume_type != Facility.CostumeType.Default)
  309. {
  310. if (costume_type == Facility.CostumeType.Edit)
  311. {
  312. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
  313. }
  314. }
  315. else
  316. {
  317. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
  318. }
  319. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  320. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.LoadEnd)));
  321. }
  322. else
  323. {
  324. this.LoadEnd();
  325. }
  326. yield break;
  327. }
  328. public void Cancel()
  329. {
  330. this.ToOtherLabel(this.m_CancelLabel);
  331. }
  332. public void SelectOk()
  333. {
  334. if (this.m_SelectPanel.alpha <= 0.9f)
  335. {
  336. return;
  337. }
  338. if (this.m_TempMaid != CasinoDataMgr.Instance.DealerMaid)
  339. {
  340. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  341. {
  342. base.StartCoroutine(this.DealerChange());
  343. }, true, default(Color));
  344. }
  345. else
  346. {
  347. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  348. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  349. }
  350. }
  351. public const int MinBetBj = 100;
  352. public const int MinBetSlot = 300;
  353. [SerializeField]
  354. [Header("メニューとボタンのペア")]
  355. private List<SceneCasino.MenuButtonPair> m_MenuButtonPair = new List<SceneCasino.MenuButtonPair>();
  356. private Dictionary<SceneCasino.CasinoMenu, string> m_MenuLabelPair = new Dictionary<SceneCasino.CasinoMenu, string>();
  357. [SerializeField]
  358. [Header("各UIの設定")]
  359. private CanvasGroup m_CasinoMenu;
  360. [SerializeField]
  361. private CanvasGroup m_ExchangeFrame;
  362. [SerializeField]
  363. private UIPanel m_SelectPanel;
  364. [SerializeField]
  365. private CharacterSelectManager m_CharaSelect;
  366. [SerializeField]
  367. private GraphicRaycaster m_GraphicRaycaster;
  368. [SerializeField]
  369. [Header("メイドの位置・角度")]
  370. private Vector3 m_MaidPos = Vector3.zero;
  371. [SerializeField]
  372. private Vector3 m_MaidAngle = Vector3.zero;
  373. private Maid m_TempMaid;
  374. private bool m_IsWearSet;
  375. [SerializeField]
  376. private UICamera m_NguiCam;
  377. private bool m_NguiEnable = true;
  378. public enum CasinoMenu
  379. {
  380. Blackjack,
  381. Slot,
  382. SelectDealer,
  383. SetCostume,
  384. ItemExchange
  385. }
  386. [Serializable]
  387. private class MenuButtonPair
  388. {
  389. public SceneCasino.CasinoMenu Menu;
  390. public Button Button;
  391. }
  392. }