SceneCasino.cs 14 KB

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