SceneCasino.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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_NguiCam.enabled = 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_NguiCam.enabled = 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 WearMaidInit()
  151. {
  152. CasinoDataMgr.Instance.DealerMaid.FaceBlend("無し");
  153. CasinoDataMgr.Instance.DealerMaid.FaceAnime("通常", 1f, 0);
  154. CasinoDataMgr.Instance.DealerMaid.AudioMan.Stop();
  155. GameMain.Instance.ScriptMgr.is_motion_blend = false;
  156. GameMain.Instance.ScriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true);
  157. GameMain.Instance.CharacterMgr.CharaAllOfsetPos(this.m_MaidPos);
  158. GameMain.Instance.CharacterMgr.CharaAllOfsetRot(this.m_MaidAngle);
  159. base.LoadEnd();
  160. }
  161. protected override void LoadEnd()
  162. {
  163. Facility.CostumeType typeCostume = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
  164. if (!this.m_IsWearSet && typeCostume != Facility.CostumeType.Heroine)
  165. {
  166. if (typeCostume != Facility.CostumeType.Default)
  167. {
  168. if (typeCostume == Facility.CostumeType.Edit)
  169. {
  170. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
  171. }
  172. }
  173. else
  174. {
  175. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
  176. }
  177. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  178. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.WearMaidInit)));
  179. }
  180. else
  181. {
  182. this.WearMaidInit();
  183. }
  184. this.m_IsWearSet = true;
  185. }
  186. private void ToOtherLabel(string label)
  187. {
  188. if (string.IsNullOrEmpty(label))
  189. {
  190. return;
  191. }
  192. this.m_JumpLabel = label;
  193. this.m_GraphicRaycaster.enabled = false;
  194. this.FadeOut();
  195. }
  196. protected override void FadeOutEnd()
  197. {
  198. base.MainRecet();
  199. if (CasinoDataMgr.Instance.CurrentCasino.typeCostume != Facility.CostumeType.Heroine && this.m_JumpLabel == this.m_CancelLabel)
  200. {
  201. MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
  202. foreach (MPN idx in facilityCostumeEnableMPN)
  203. {
  204. CasinoDataMgr.Instance.DealerMaid.ResetProp(idx, false);
  205. }
  206. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  207. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(base.FadeOutEnd)));
  208. }
  209. else
  210. {
  211. base.FadeOutEnd();
  212. }
  213. }
  214. private IEnumerator ToEditCharaLoad()
  215. {
  216. GameMain.Instance.FacilityMgr.tempSelectFacility = CasinoDataMgr.Instance.CurrentCasino;
  217. CasinoDataMgr.Instance.CurrentCasino.typeCostume = Facility.CostumeType.Edit;
  218. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, true);
  219. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  220. while (GameMain.Instance.CharacterMgr.IsBusy())
  221. {
  222. yield return null;
  223. }
  224. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_NextLabel);
  225. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  226. yield break;
  227. }
  228. private void SelectMenu(SceneCasino.CasinoMenu menu)
  229. {
  230. switch (menu)
  231. {
  232. case SceneCasino.CasinoMenu.Blackjack:
  233. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 100L)
  234. {
  235. string f_strMsg = string.Format("ブラックジャックをするには最低でも\nコインが{0:#,##0}枚必用です", 100);
  236. GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null);
  237. }
  238. else
  239. {
  240. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  241. this.ToOtherLabel(this.m_NextLabel);
  242. }
  243. break;
  244. case SceneCasino.CasinoMenu.Slot:
  245. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 300L)
  246. {
  247. string f_strMsg2 = string.Format("スロットをするには最低でも\nコインが{0:#,##0}枚必用です", 300);
  248. GameMain.Instance.SysDlg.Show(f_strMsg2, SystemDialog.TYPE.OK, null, null);
  249. }
  250. else
  251. {
  252. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  253. this.ToOtherLabel(this.m_NextLabel);
  254. }
  255. break;
  256. case SceneCasino.CasinoMenu.SelectDealer:
  257. this.m_TempMaid = CasinoDataMgr.Instance.DealerMaid;
  258. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, true, 0.5f, null, true, true));
  259. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, false, 0.5f, null, true, true));
  260. break;
  261. case SceneCasino.CasinoMenu.SetCostume:
  262. CasinoDataMgr.Instance.IsChangeCostume = true;
  263. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  264. this.m_GraphicRaycaster.enabled = false;
  265. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  266. {
  267. base.StartCoroutine(this.ToEditCharaLoad());
  268. }, true, default(Color));
  269. break;
  270. default:
  271. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  272. this.ToOtherLabel(this.m_NextLabel);
  273. break;
  274. }
  275. }
  276. private IEnumerator DealerChange()
  277. {
  278. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  279. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  280. Facility.CostumeType costume_type = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
  281. bool costume_change = costume_type != Facility.CostumeType.Heroine;
  282. if (costume_change)
  283. {
  284. MPN[] mpn_array = FacilityDataTable.GetFacilityCostumeEnableMPN();
  285. foreach (MPN idx in mpn_array)
  286. {
  287. this.m_TempMaid.ResetProp(idx, false);
  288. }
  289. this.m_TempMaid.AllProcPropSeqStart();
  290. while (GameMain.Instance.CharacterMgr.IsBusy())
  291. {
  292. yield return null;
  293. }
  294. }
  295. GameMain.Instance.CharacterMgr.DeactivateMaid(this.m_TempMaid.ActiveSlotNo);
  296. GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
  297. CasinoDataMgr.Instance.DealerMaid.Visible = true;
  298. while (GameMain.Instance.CharacterMgr.IsBusy())
  299. {
  300. yield return null;
  301. }
  302. if (costume_type != Facility.CostumeType.Heroine)
  303. {
  304. if (costume_type != Facility.CostumeType.Default)
  305. {
  306. if (costume_type == Facility.CostumeType.Edit)
  307. {
  308. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
  309. }
  310. }
  311. else
  312. {
  313. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
  314. }
  315. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  316. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.LoadEnd)));
  317. }
  318. else
  319. {
  320. this.LoadEnd();
  321. }
  322. yield break;
  323. }
  324. public void Cancel()
  325. {
  326. this.ToOtherLabel(this.m_CancelLabel);
  327. }
  328. public void SelectOk()
  329. {
  330. if (this.m_SelectPanel.alpha <= 0.9f)
  331. {
  332. return;
  333. }
  334. if (this.m_TempMaid != CasinoDataMgr.Instance.DealerMaid)
  335. {
  336. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  337. {
  338. base.StartCoroutine(this.DealerChange());
  339. }, true, default(Color));
  340. }
  341. else
  342. {
  343. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  344. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  345. }
  346. }
  347. public const int MinBetBj = 100;
  348. public const int MinBetSlot = 300;
  349. [SerializeField]
  350. [Header("メニューとボタンのペア")]
  351. private List<SceneCasino.MenuButtonPair> m_MenuButtonPair = new List<SceneCasino.MenuButtonPair>();
  352. private Dictionary<SceneCasino.CasinoMenu, string> m_MenuLabelPair = new Dictionary<SceneCasino.CasinoMenu, string>();
  353. [SerializeField]
  354. [Header("各UIの設定")]
  355. private CanvasGroup m_CasinoMenu;
  356. [SerializeField]
  357. private CanvasGroup m_ExchangeFrame;
  358. [SerializeField]
  359. private UIPanel m_SelectPanel;
  360. [SerializeField]
  361. private CharacterSelectManager m_CharaSelect;
  362. [SerializeField]
  363. private GraphicRaycaster m_GraphicRaycaster;
  364. [SerializeField]
  365. [Header("メイドの位置・角度")]
  366. private Vector3 m_MaidPos = Vector3.zero;
  367. [SerializeField]
  368. private Vector3 m_MaidAngle = Vector3.zero;
  369. private Maid m_TempMaid;
  370. private bool m_IsWearSet;
  371. [SerializeField]
  372. private UICamera m_NguiCam;
  373. public enum CasinoMenu
  374. {
  375. Blackjack,
  376. Slot,
  377. SelectDealer,
  378. SetCostume,
  379. ItemExchange
  380. }
  381. [Serializable]
  382. private class MenuButtonPair
  383. {
  384. public SceneCasino.CasinoMenu Menu;
  385. public Button Button;
  386. }
  387. }