SceneCasino.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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("SceneCasino/ダイアログ/どちらのカジノでプレイしますか?", CasinoDataMgr.Instance.GetCasinoFacility(true).facilityName, delegate
  35. {
  36. select_casino(true);
  37. }, CasinoDataMgr.Instance.GetCasinoFacility(false).facilityName, delegate
  38. {
  39. select_casino(false);
  40. }, string.Empty, null);
  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, false);
  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. GameMain.Instance.SysDlg.ShowFromLanguageTerm("SceneCasino/ダイアログ/ブラックジャックをするには最低でもコインが{0}枚必用で", new string[]
  240. {
  241. string.Format("{0:#,##0}", 100)
  242. }, SystemDialog.TYPE.OK, null, null);
  243. }
  244. else
  245. {
  246. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  247. this.ToOtherLabel(this.m_NextLabel);
  248. }
  249. break;
  250. case SceneCasino.CasinoMenu.Slot:
  251. if (GameMain.Instance.CharacterMgr.status.casinoCoin < 300L)
  252. {
  253. GameMain.Instance.SysDlg.ShowFromLanguageTerm("SceneCasino/ダイアログ/スロットをするには最低でもコインが{0}枚必用です", new string[]
  254. {
  255. string.Format("{0:#,##0}", 300)
  256. }, SystemDialog.TYPE.OK, null, null);
  257. }
  258. else
  259. {
  260. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  261. this.ToOtherLabel(this.m_NextLabel);
  262. }
  263. break;
  264. case SceneCasino.CasinoMenu.SelectDealer:
  265. this.m_TempMaid = CasinoDataMgr.Instance.DealerMaid;
  266. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, true, 0.5f, null, true, true));
  267. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, false, 0.5f, null, true, true));
  268. break;
  269. case SceneCasino.CasinoMenu.SetCostume:
  270. CasinoDataMgr.Instance.IsChangeCostume = true;
  271. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  272. this.m_GraphicRaycaster.enabled = false;
  273. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  274. {
  275. base.StartCoroutine(this.ToEditCharaLoad());
  276. }, true, default(Color));
  277. break;
  278. default:
  279. GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
  280. this.ToOtherLabel(this.m_NextLabel);
  281. break;
  282. }
  283. }
  284. private IEnumerator DealerChange()
  285. {
  286. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  287. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  288. Facility.CostumeType costume_type = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
  289. bool costume_change = costume_type != Facility.CostumeType.Heroine;
  290. if (costume_change)
  291. {
  292. MPN[] mpn_array = FacilityDataTable.GetFacilityCostumeEnableMPN();
  293. foreach (MPN idx in mpn_array)
  294. {
  295. this.m_TempMaid.ResetProp(idx, false);
  296. }
  297. this.m_TempMaid.AllProcPropSeqStart();
  298. while (GameMain.Instance.CharacterMgr.IsBusy())
  299. {
  300. yield return null;
  301. }
  302. }
  303. GameMain.Instance.CharacterMgr.DeactivateMaid(this.m_TempMaid.ActiveSlotNo);
  304. GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
  305. CasinoDataMgr.Instance.DealerMaid.Visible = true;
  306. while (GameMain.Instance.CharacterMgr.IsBusy())
  307. {
  308. yield return null;
  309. }
  310. if (costume_type != Facility.CostumeType.Heroine)
  311. {
  312. if (costume_type != Facility.CostumeType.Default)
  313. {
  314. if (costume_type == Facility.CostumeType.Edit)
  315. {
  316. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
  317. }
  318. }
  319. else
  320. {
  321. CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
  322. }
  323. CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
  324. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.LoadEnd)));
  325. }
  326. else
  327. {
  328. this.LoadEnd();
  329. }
  330. yield break;
  331. }
  332. public void Cancel()
  333. {
  334. this.ToOtherLabel(this.m_CancelLabel);
  335. }
  336. public void SelectOk()
  337. {
  338. if (this.m_SelectPanel.alpha <= 0.9f)
  339. {
  340. return;
  341. }
  342. if (this.m_TempMaid != CasinoDataMgr.Instance.DealerMaid)
  343. {
  344. GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
  345. {
  346. base.StartCoroutine(this.DealerChange());
  347. }, true, default(Color));
  348. }
  349. else
  350. {
  351. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
  352. base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
  353. }
  354. }
  355. public const int MinBetBj = 100;
  356. public const int MinBetSlot = 300;
  357. [SerializeField]
  358. [Header("メニューとボタンのペア")]
  359. private List<SceneCasino.MenuButtonPair> m_MenuButtonPair = new List<SceneCasino.MenuButtonPair>();
  360. private Dictionary<SceneCasino.CasinoMenu, string> m_MenuLabelPair = new Dictionary<SceneCasino.CasinoMenu, string>();
  361. [SerializeField]
  362. [Header("各UIの設定")]
  363. private CanvasGroup m_CasinoMenu;
  364. [SerializeField]
  365. private CanvasGroup m_ExchangeFrame;
  366. [SerializeField]
  367. private UIPanel m_SelectPanel;
  368. [SerializeField]
  369. private CharacterSelectManager m_CharaSelect;
  370. [SerializeField]
  371. private GraphicRaycaster m_GraphicRaycaster;
  372. [SerializeField]
  373. [Header("メイドの位置・角度")]
  374. private Vector3 m_MaidPos = Vector3.zero;
  375. [SerializeField]
  376. private Vector3 m_MaidAngle = Vector3.zero;
  377. private Maid m_TempMaid;
  378. private bool m_IsWearSet;
  379. [SerializeField]
  380. private UICamera m_NguiCam;
  381. private bool m_NguiEnable = true;
  382. public enum CasinoMenu
  383. {
  384. Blackjack,
  385. Slot,
  386. SelectDealer,
  387. SetCostume,
  388. ItemExchange
  389. }
  390. [Serializable]
  391. private class MenuButtonPair
  392. {
  393. public SceneCasino.CasinoMenu Menu;
  394. public Button Button;
  395. }
  396. }