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(); this.eventIconVisibleCheckBox.onClick.Add(delegate(WFCheckBox checkBox) { this.SetEventListVisible(!checkBox.check); }); this.eventHelpObject.SetActive(false); } protected override void OnCall() { this.okButton.gameObject.SetActive(false); if (ScenePrivateEventModeAwake.callEventId == -1) { this.eventHelpObject.SetActive(true); base.StartCoroutine(this.SetupPrivateMode()); } else { this.eventIconVisibleCheckBox.gameObject.SetActive(false); this.eventSelectPanel.gameObject.SetActive(false); } } 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) { UnityEngine.Object.DestroyImmediate(this.eventHitObject); this.eventHitObject = this.bgEvent.InstantiateHitPrefab(this.bgHitPrefabParent.gameObject); this.eventHitObject.SetActive(true); bool flag = false; foreach (PrivateModeEventObject privateModeEventObject in this.eventHitObject.GetComponentsInChildren()) { DataBase.BG.Event.PointData eventData = this.bgEvent.GetEventData(privateModeEventObject.GetEventNo()); bool flag2 = this.bgEvent.IsExec(this.maid, privateModeEventObject.GetEventNo()); if (flag2 && !this.bgEvent.IsFinishedReadingFile(this.maid, eventData, this.bgEvent.GetNextScenarioIndex(this.maid, eventData))) { privateModeEventObject.CreateNewStar(); } privateModeEventObject.gameObject.SetActive(flag2); flag = (flag || flag2); } if (this.eventHelpObject != null && (this.bgEvent.eventPointList.Length <= 0 || !flag)) { UILabel component = UTY.GetChildObject(this.eventHelpObject, "Text/Text", false).GetComponent(); if (component != null) { component.text = "イベントがありません"; } } } PrivateModeEventObject.onClickObject = new Action(this.OnClickEventObject); privateModeData.LoadLocation(); yield return null; this.eventSelectPanel.Setup(null, null); this.SetEventListVisible(GameMain.Instance.CMSystem.SConfig.PrivateModeEventListVisible); this.okButton.gameObject.SetActive(true); this.setupCompleted = true; uGUITutorialPanel.OpenTutorial("ScenePrivateEventMode", null, false); yield break; } private void SetEventListVisible(bool visible) { this.eventIconVisibleCheckBox.check = !visible; this.eventSelectPanel.gameObject.SetActive(visible); UTY.GetChildObject(this.eventHelpObject, "Text", false).SetActive(!visible); if (this.eventHitObject != null) { this.eventHitObject.SetActive(!visible); } GameMain.Instance.CMSystem.SConfig.PrivateModeEventListVisible = visible; } 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; [SerializeField] private PrivateEventSelectPanel eventSelectPanel; [SerializeField] private WFCheckBox eventIconVisibleCheckBox; protected bool setupCompleted; protected Maid maid; protected DataBase.BG.Event bgEvent; protected GameObject eventHitObject; protected Func loadScriptAction; }