using System; using System.Collections; using PrivateMaidMode; using UnityEngine; public class PrivateEventManager : WfScreenChildren { protected bool isNoon { get { return GameMain.Instance.CharacterMgr.status.isDaytime; } } public override void Awake() { base.Awake(); if (this.eventHelpObject != null) { this.eventHelpObject.SetActive(false); } } protected override void OnCall() { this.okButton.gameObject.SetActive(false); if (ScenePrivateEventModeAwake.callEventId == -1) { if (this.eventHelpObject != null) { this.eventHelpObject.SetActive(true); } base.StartCoroutine(this.SetupPrivateMode()); } } protected IEnumerator SetupPrivateMode() { this.setupCompleted = false; PrivateModeMgr privateModeData = PrivateModeMgr.Instance; this.maid = privateModeData.PrivateMaid; if (privateModeData.SelectBG == null) { NDebug.Assert("プライベートモードの設定が未設定で始まりました", false); privateModeData.SetPrivateBG(DataBase.GetData(10).bgData); } if (this.maid == null) { this.maid = GameMain.Instance.CharacterMgr.GetMaid(0); } else { GameMain.Instance.CharacterMgr.SetActiveMaid(this.maid, 0); } this.maid.AllProcPropSeqStart(); this.maid.Visible = true; while (this.maid.IsBusy) { yield return null; } MaidColliderCollect.SuspendColliderAll(this.maid, false); privateModeData.SelectBG.Apply(this.isNoon); this.bgEvent = privateModeData.SelectBG.GetEvent(this.isNoon); if (this.bgEvent != null) { if (this.eventHelpObject != null && this.bgEvent.eventPointList.Length <= 0) { UILabel component = UTY.GetChildObject(this.eventHelpObject, "Text/Text", false).GetComponent(); if (component != null) { component.text = "イベントがありません"; } } if (this.eventHitObject != null) { UnityEngine.Object.DestroyImmediate(this.eventHitObject); } this.eventHitObject = this.bgEvent.InstantiateHitPrefab(this.bgHitPrefabParent.gameObject); this.eventHitObject.SetActive(true); } PrivateModeEventObject.onClickObject = new Action(this.OnClickEventObject); privateModeData.LoadLocation(); yield return null; this.okButton.gameObject.SetActive(true); this.setupCompleted = true; uGUITutorialPanel.OpenTutorial("ScenePrivateEventMode", null, false); yield break; } protected override bool IsCallFadeIn() { return this.setupCompleted; } public void OnClickOK() { if (!this.setupCompleted) { return; } this.Finish(); } protected override void OnFinish() { if (this.loadScriptAction != null) { this.loadScriptAction(); this.loadScriptAction = null; return; } if (this.eventHitObject != null) { this.eventHitObject.SetActive(false); } PartColliderData.SetDefaultCursor(); string returnFile = ScenePrivateEventModeAwake.returnFile; if (!string.IsNullOrEmpty(returnFile)) { GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(returnFile, string.Empty); } base.parent_mgr.CallScreen("Move"); } protected void OnClickEventObject(int eventNo) { if (this.bgEvent == null || this.maid == null || GameMain.Instance.MainCamera.IsFadeProc()) { return; } this.loadScriptAction = delegate() { bool flag = this.bgEvent.LoadScript(this.maid, eventNo); if (!flag) { Debug.LogError("イベントNo" + eventNo + "のイベントは設定されていません"); } return flag; }; GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click); this.Finish(); } [SerializeField] private Transform bgHitPrefabParent; [SerializeField] private UIButton okButton; [SerializeField] private GameObject eventHelpObject; protected bool setupCompleted; protected Maid maid; protected DataBase.BG.Event bgEvent; protected GameObject eventHitObject; protected Func loadScriptAction; }