123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- 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<PrivateModeEventObject>())
- {
- 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<UILabel>();
- if (component != null)
- {
- component.text = "イベントはありません";
- }
- }
- }
- PrivateModeEventObject.onClickObject = new Action<int>(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<bool> loadScriptAction;
- }
|