123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using MaidStatus;
- using UnityEngine;
- using UnityEngine.UI;
- using wf;
- public class SceneCasino : KasaSceneMgr<SceneCasino>
- {
- protected override void Awake()
- {
- base.MainRecet();
- GameMain.Instance.BgMgr.ChangeBg(this.m_BgName);
- GameMain.Instance.SoundMgr.PlayBGM(this.m_BgmName, 0f, true);
- GameMain.Instance.MainCamera.SetControl(this.m_IsControll);
- base.SetCamera();
- bool is_upward2 = CasinoDataMgr.Instance.GetCasinoFacility(true);
- bool flag = CasinoDataMgr.Instance.GetCasinoFacility(true) && CasinoDataMgr.Instance.GetCasinoFacility(false);
- if (!GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("return_casinomenu") && flag)
- {
- this.m_CasinoMenu.alpha = 0f;
- this.m_ExchangeFrame.alpha = 0f;
- GameMain.Instance.MainCamera.FadeIn(0f, false, null, true, true, default(Color));
- GameObject gameObject = Utility.CreatePrefab(GameObject.Find("UI Root"), "OVR/DanceOVRDialog", true);
- gameObject.GetComponent<UIPanel>().depth = 250;
- FFNameDialog select_dialog = gameObject.GetComponent<FFNameDialog>();
- select_dialog.Init();
- Action<bool> select_casino = delegate(bool is_upward)
- {
- CasinoDataMgr.Instance.CasinoSelect(is_upward);
- select_dialog.Close();
- GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.Init), false, default(Color));
- };
- select_dialog.Show("どちらのカジノでプレイしますか?", CasinoDataMgr.Instance.GetCasinoFacility(true).facilityName, delegate
- {
- select_casino(true);
- }, CasinoDataMgr.Instance.GetCasinoFacility(false).facilityName, delegate
- {
- select_casino(false);
- });
- }
- else
- {
- if (!GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("return_casinomenu"))
- {
- CasinoDataMgr.Instance.CasinoSelect(is_upward2);
- }
- this.Init();
- }
- }
- private void Init()
- {
- this.m_CasinoMenu.alpha = 1f;
- this.m_ExchangeFrame.alpha = 1f;
- CasinoDataMgr.Instance.InitDealerMaid();
- CasinoDataMgr.Instance.InitShopData();
- GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
- if (CasinoDataMgr.Instance.IsChangeCostume)
- {
- CasinoDataMgr.Instance.IsChangeCostume = false;
- CasinoDataMgr.Instance.CurrentCasino.UpdateEditCostumeToMaidCostume(CasinoDataMgr.Instance.DealerMaid);
- }
- CasinoDataMgr.Instance.DealerMaid.Visible = true;
- CasinoDataMgr.Instance.DealerMaid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
- base.Awake();
- string text = "casinomenu_data.nei";
- if (!GameUty.FileSystem.IsExistentFile(text))
- {
- NDebug.Assert("表がありません。" + text, false);
- }
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool condition = csvParser.Open(afileBase);
- NDebug.Assert(condition, text + "\nopen failed.");
- for (int i = 1; i < csvParser.max_cell_y; i++)
- {
- if (csvParser.IsCellToExistData(0, i))
- {
- SceneCasino.CasinoMenu key = (SceneCasino.CasinoMenu)Enum.Parse(typeof(SceneCasino.CasinoMenu), csvParser.GetCellAsString(0, i));
- string cellAsString = csvParser.GetCellAsString(1, i);
- this.m_MenuLabelPair.Add(key, cellAsString);
- }
- }
- }
- }
- NDebug.Assert(GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("label"), "メニュー選択時のラベルが未指定です");
- this.m_NextLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["label"];
- NDebug.Assert(GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("cancel_label"), "キャンセル時のラベルが未指定です");
- this.m_CancelLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["cancel_label"];
- using (List<SceneCasino.MenuButtonPair>.Enumerator enumerator = this.m_MenuButtonPair.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- SceneCasino.MenuButtonPair pair = enumerator.Current;
- SceneCasino $this = this;
- pair.Button.onClick.AddListener(delegate()
- {
- $this.SelectMenu(pair.Menu);
- });
- }
- }
- this.m_CharaSelect.Create(CharacterSelectManager.Type.Select, 3, true);
- for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
- if (!stockMaid || stockMaid.status.heroineType == HeroineType.Sub)
- {
- this.m_CharaSelect.RemoveMaidPlate(stockMaid);
- }
- }
- CharacterSelectManager.CallBackOnSelect callBackCallBackOnSelect = delegate(Maid select_maid)
- {
- CasinoDataMgr.Instance.SetDealerMaid(select_maid);
- };
- this.m_CharaSelect.SetCallBackCallBackOnSelect(callBackCallBackOnSelect);
- this.m_CharaSelect.SelectMaid(CasinoDataMgr.Instance.DealerMaid);
- uGUITutorialPanel.OpenTutorial("SceneCasino", null, false);
- GameMain.Instance.SysShortcut.strSceneHelpName = "SceneCasino";
- }
- private void Start()
- {
- ExChangeUI instance = ExChangeUI.Instance;
- instance.FadeInStartAction = (Action)Delegate.Combine(instance.FadeInStartAction, new Action(delegate()
- {
- this.m_CasinoMenu.interactable = false;
- }));
- ExChangeUI instance2 = ExChangeUI.Instance;
- instance2.FadeInStartAction = (Action)Delegate.Combine(instance2.FadeInStartAction, new Action(delegate()
- {
- this.m_NguiEnable = false;
- }));
- ExChangeUI instance3 = ExChangeUI.Instance;
- instance3.FadeOutStartAction = (Action)Delegate.Combine(instance3.FadeOutStartAction, new Action(delegate()
- {
- this.m_CasinoMenu.interactable = true;
- }));
- ExChangeUI instance4 = ExChangeUI.Instance;
- instance4.FadeOutStartAction = (Action)Delegate.Combine(instance4.FadeOutStartAction, new Action(delegate()
- {
- this.m_NguiEnable = true;
- }));
- ExChangeUI instance5 = ExChangeUI.Instance;
- instance5.FadeOutStartAction = (Action)Delegate.Combine(instance5.FadeOutStartAction, new Action(delegate()
- {
- ExChangeUI.Instance.SetButtonState(true);
- }));
- }
- private void LateUpdate()
- {
- this.m_NguiCam.EnableProcess &= this.m_NguiEnable;
- }
- private void WearMaidInit()
- {
- CasinoDataMgr.Instance.DealerMaid.FaceBlend("無し");
- CasinoDataMgr.Instance.DealerMaid.FaceAnime("通常", 1f, 0);
- CasinoDataMgr.Instance.DealerMaid.AudioMan.Stop();
- GameMain.Instance.ScriptMgr.is_motion_blend = false;
- GameMain.Instance.ScriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true);
- GameMain.Instance.CharacterMgr.CharaAllOfsetPos(this.m_MaidPos);
- GameMain.Instance.CharacterMgr.CharaAllOfsetRot(this.m_MaidAngle);
- base.LoadEnd();
- }
- protected override void LoadEnd()
- {
- Facility.CostumeType typeCostume = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
- if (!this.m_IsWearSet && typeCostume != Facility.CostumeType.Heroine)
- {
- if (typeCostume != Facility.CostumeType.Default)
- {
- if (typeCostume == Facility.CostumeType.Edit)
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
- }
- }
- else
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
- }
- CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
- base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.WearMaidInit)));
- }
- else
- {
- this.WearMaidInit();
- }
- this.m_IsWearSet = true;
- }
- private void ToOtherLabel(string label)
- {
- if (string.IsNullOrEmpty(label))
- {
- return;
- }
- this.m_JumpLabel = label;
- this.m_GraphicRaycaster.enabled = false;
- this.FadeOut();
- }
- protected override void FadeOutEnd()
- {
- base.MainRecet();
- if (CasinoDataMgr.Instance.CurrentCasino.typeCostume != Facility.CostumeType.Heroine && this.m_JumpLabel == this.m_CancelLabel)
- {
- MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
- foreach (MPN idx in facilityCostumeEnableMPN)
- {
- CasinoDataMgr.Instance.DealerMaid.ResetProp(idx, false);
- }
- CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
- base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(base.FadeOutEnd)));
- }
- else
- {
- base.FadeOutEnd();
- }
- }
- private IEnumerator ToEditCharaLoad()
- {
- GameMain.Instance.FacilityMgr.tempSelectFacility = CasinoDataMgr.Instance.CurrentCasino;
- CasinoDataMgr.Instance.CurrentCasino.typeCostume = Facility.CostumeType.Edit;
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, true);
- CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
- while (GameMain.Instance.CharacterMgr.IsBusy())
- {
- yield return null;
- }
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_NextLabel);
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- yield break;
- }
- private void SelectMenu(SceneCasino.CasinoMenu menu)
- {
- switch (menu)
- {
- case SceneCasino.CasinoMenu.Blackjack:
- if (GameMain.Instance.CharacterMgr.status.casinoCoin < 100L)
- {
- string f_strMsg = string.Format("ブラックジャックをするには最低でも\nコインが{0:#,##0}枚必用です", 100);
- GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null);
- }
- else
- {
- GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
- this.ToOtherLabel(this.m_NextLabel);
- }
- break;
- case SceneCasino.CasinoMenu.Slot:
- if (GameMain.Instance.CharacterMgr.status.casinoCoin < 300L)
- {
- string f_strMsg2 = string.Format("スロットをするには最低でも\nコインが{0:#,##0}枚必用です", 300);
- GameMain.Instance.SysDlg.Show(f_strMsg2, SystemDialog.TYPE.OK, null, null);
- }
- else
- {
- GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
- this.ToOtherLabel(this.m_NextLabel);
- }
- break;
- case SceneCasino.CasinoMenu.SelectDealer:
- this.m_TempMaid = CasinoDataMgr.Instance.DealerMaid;
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, true, 0.5f, null, true, true));
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, false, 0.5f, null, true, true));
- break;
- case SceneCasino.CasinoMenu.SetCostume:
- CasinoDataMgr.Instance.IsChangeCostume = true;
- GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
- this.m_GraphicRaycaster.enabled = false;
- GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
- {
- base.StartCoroutine(this.ToEditCharaLoad());
- }, true, default(Color));
- break;
- default:
- GameMain.Instance.ScriptMgr.EvalScript("tf['menu_label_name'] = '" + this.m_MenuLabelPair[menu] + "';");
- this.ToOtherLabel(this.m_NextLabel);
- break;
- }
- }
- private IEnumerator DealerChange()
- {
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
- Facility.CostumeType costume_type = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
- bool costume_change = costume_type != Facility.CostumeType.Heroine;
- if (costume_change)
- {
- MPN[] mpn_array = FacilityDataTable.GetFacilityCostumeEnableMPN();
- foreach (MPN idx in mpn_array)
- {
- this.m_TempMaid.ResetProp(idx, false);
- }
- this.m_TempMaid.AllProcPropSeqStart();
- while (GameMain.Instance.CharacterMgr.IsBusy())
- {
- yield return null;
- }
- }
- GameMain.Instance.CharacterMgr.DeactivateMaid(this.m_TempMaid.ActiveSlotNo);
- GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
- CasinoDataMgr.Instance.DealerMaid.Visible = true;
- while (GameMain.Instance.CharacterMgr.IsBusy())
- {
- yield return null;
- }
- if (costume_type != Facility.CostumeType.Heroine)
- {
- if (costume_type != Facility.CostumeType.Default)
- {
- if (costume_type == Facility.CostumeType.Edit)
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(CasinoDataMgr.Instance.DealerMaid, false);
- }
- }
- else
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(CasinoDataMgr.Instance.DealerMaid);
- }
- CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
- base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.LoadEnd)));
- }
- else
- {
- this.LoadEnd();
- }
- yield break;
- }
- public void Cancel()
- {
- this.ToOtherLabel(this.m_CancelLabel);
- }
- public void SelectOk()
- {
- if (this.m_SelectPanel.alpha <= 0.9f)
- {
- return;
- }
- if (this.m_TempMaid != CasinoDataMgr.Instance.DealerMaid)
- {
- GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
- {
- base.StartCoroutine(this.DealerChange());
- }, true, default(Color));
- }
- else
- {
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_CasinoMenu, false, 0.5f, null, true, true));
- base.StartCoroutine(KasaiUtility.FadeCoroutine(this.m_SelectPanel, true, 0.5f, null, true, true));
- }
- }
- public const int MinBetBj = 100;
- public const int MinBetSlot = 300;
- [SerializeField]
- [Header("メニューとボタンのペア")]
- private List<SceneCasino.MenuButtonPair> m_MenuButtonPair = new List<SceneCasino.MenuButtonPair>();
- private Dictionary<SceneCasino.CasinoMenu, string> m_MenuLabelPair = new Dictionary<SceneCasino.CasinoMenu, string>();
- [SerializeField]
- [Header("各UIの設定")]
- private CanvasGroup m_CasinoMenu;
- [SerializeField]
- private CanvasGroup m_ExchangeFrame;
- [SerializeField]
- private UIPanel m_SelectPanel;
- [SerializeField]
- private CharacterSelectManager m_CharaSelect;
- [SerializeField]
- private GraphicRaycaster m_GraphicRaycaster;
- [SerializeField]
- [Header("メイドの位置・角度")]
- private Vector3 m_MaidPos = Vector3.zero;
- [SerializeField]
- private Vector3 m_MaidAngle = Vector3.zero;
- private Maid m_TempMaid;
- private bool m_IsWearSet;
- [SerializeField]
- private UICamera m_NguiCam;
- private bool m_NguiEnable = true;
- public enum CasinoMenu
- {
- Blackjack,
- Slot,
- SelectDealer,
- SetCostume,
- ItemExchange
- }
- [Serializable]
- private class MenuButtonPair
- {
- public SceneCasino.CasinoMenu Menu;
- public Button Button;
- }
- }
|