using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Schedule; using UnityEngine; public class FreeModeSceneSelectBase : WfScreenChildren { public override void Awake() { base.Awake(); EventDelegate.Add(UTY.GetChildObject(base.root_obj, "Cancel", false).GetComponent().onClick, new EventDelegate.Callback(this.OnClickCancel)); this.ok_btn_ = UTY.GetChildObject(base.root_obj, "OK", false).GetComponent(); EventDelegate.Add(this.ok_btn_.onClick, new EventDelegate.Callback(this.OnClickOk)); if (this.mode == FreeModeSceneSelectBase.SelectMode.Vip) { this.night_task_viewer_ = UTY.GetChildObject(base.root_obj, "TaskViewer", false).GetComponent(); this.night_task_viewer_.gameObject.SetActive(true); this.night_task_viewer_.AlwaysDrawDescriptionViewer = true; } } protected override void OnCall() { SubtitleMovieManager.DestroyGlobalInstance(); this.is_scenario_load_ = false; if (this.maid_ != null) { this.maid_.Visible = true; return; } this.mgr_ = (base.parent_mgr as SceneFreeModeSelectManager); NDebug.AssertNull(this.mgr_ != null); this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0); this.freemode_item_list_ = UTY.GetChildObject(base.root_obj, "FreeModeItemList", false).GetComponent(); bool isEnabled; if (this.mode == FreeModeSceneSelectBase.SelectMode.Story) { isEnabled = this.freemode_item_list_.SetList(FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null).ToArray(), this.maid_); } else if (this.mode == FreeModeSceneSelectBase.SelectMode.Everyday) { isEnabled = this.freemode_item_list_.SetList(FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, this.maid_.status).ToArray(), this.maid_); } else if (this.mode == FreeModeSceneSelectBase.SelectMode.LifeMode) { isEnabled = this.freemode_item_list_.SetList(FreeModeItemLifeMode.CreateItemList(true).ToArray(), this.maid_); } else { this.freemode_item_list_.gameObject.SetActive(false); this.night_task_viewer_.gameObject.SetActive(true); ScheduleCSVData.Yotogi yotogi = null; int num = int.MaxValue; int num2 = int.MaxValue; this.vip_list_ = FreeModeItemVip.CreateItemVipList(this.maid_.status); List list = new List(); foreach (FreeModeItemVip freeModeItemVip in this.vip_list_) { ScheduleTaskViewer.ViewData item = default(ScheduleTaskViewer.ViewData); item.is_enabled = freeModeItemVip.isEnabled(this.maid_); item.schedule = freeModeItemVip.vip_data; if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay || !ScheduleCSVData.NetorareFlag.Contains(item.schedule.id)) { if (ScheduleAPI.VisibleNightWork(item.schedule.id, this.maid_, false)) { list.Add(item); if (item.is_enabled) { if (item.schedule.categoryID == num) { if (item.schedule.id <= num2) { yotogi = (ScheduleCSVData.Yotogi)item.schedule; num2 = item.schedule.id; } } else if (item.schedule.categoryID <= num) { yotogi = (ScheduleCSVData.Yotogi)item.schedule; num = item.schedule.categoryID; num2 = item.schedule.id; } } } } } this.night_task_viewer_.onClickWorkUnitEvent = delegate(ScheduleCSVData.ScheduleBase click_data) { if (click_data == null) { this.freemode_item_list_.select_item_data = null; return; } foreach (FreeModeItemVip freeModeItemVip2 in this.vip_list_) { if (freeModeItemVip2.vip_data == click_data) { this.freemode_item_list_.select_item_data = freeModeItemVip2; break; } } }; this.night_task_viewer_.onClickWorkUnitEvent(yotogi); Dictionary> dictionary = new Dictionary>(); Dictionary dictionary2 = new Dictionary(); dictionary.Add(ScheduleTaskCtrl.TaskType.Yotogi, list); dictionary2.Add(ScheduleMgr.ScheduleTime.Night, yotogi); this.night_task_viewer_.Call(this.maid_, ScheduleMgr.ScheduleTime.Night, dictionary, dictionary2); isEnabled = (this.freemode_item_list_.select_item_data != null); } this.ok_btn_.isEnabled = isEnabled; this.maid_.Visible = true; } private void OnClickOk() { if (this.freemode_item_list_ == null || this.freemode_item_list_.select_item_data == null) { return; } GameMain.Instance.SoundMgr.StopBGM(0.3f); this.is_scenario_load_ = true; AbstractFreeModeItem select_item_data = this.freemode_item_list_.select_item_data; string text = select_item_data.play_file_name; text = ScriptManager.ReplacePersonal(this.maid_, text); GameMain.Instance.ScriptMgr.EvalScript("tf['シーン再生_ファイル名'] = '" + text + "';"); if (select_item_data.type == AbstractFreeModeItem.ItemType.Vip) { this.mgr_.CallScenePlayVip(); } else if (select_item_data.type == AbstractFreeModeItem.ItemType.Normal) { this.mgr_.CallScenePlayEveryday(); } else if (select_item_data.type == AbstractFreeModeItem.ItemType.MainStory) { this.mgr_.CallScenePlayMainStory(); } else if (select_item_data.type == AbstractFreeModeItem.ItemType.LifeMode) { this.Finish(); } } protected override void OnFinish() { base.OnFinish(); if (this.is_scenario_load_) { if (this.IsLifeModeData()) { this.LifeModeScenarioMaidActivate(this.freemode_item_list_.select_item_data as FreeModeItemLifeMode, delegate { this.mgr_.CallScenePlayLifeMode(); }); } GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); GameMain.Instance.CharacterMgr.SetCharaAllPos(Vector3.zero); GameMain.Instance.CharacterMgr.SetCharaAllRot(Vector3.zero); GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false); GameMain.Instance.ScriptMgr.StopMotionScript(); } this.is_scenario_load_ = false; } private void OnClickCancel() { this.mgr_.CallScreen("Select"); } private bool IsLifeModeData() { return !(this.freemode_item_list_ == null) && this.freemode_item_list_.select_item_data != null && this.freemode_item_list_.select_item_data.type == AbstractFreeModeItem.ItemType.LifeMode; } private void LifeModeScenarioMaidActivate(FreeModeItemLifeMode freeModeItemLifeMode, Action onFinish) { List list = new List(); using (Dictionary.Enumerator enumerator = freeModeItemLifeMode.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair slotPersonalPair = enumerator.Current; Maid maid = GameMain.Instance.LifeModeMgr.lifeModeAllMaidList.First((Maid data) => data.status.personal.uniqueName == slotPersonalPair.Value); GameMain.Instance.CharacterMgr.SetActiveMaid(maid, slotPersonalPair.Key); list.Add(maid); } } base.StartCoroutine(this.CoWaitAllCharacterLoad(list, onFinish)); } private IEnumerator CoWaitAllCharacterLoad(IEnumerable maids, Action onFinish) { foreach (Maid maid in maids) { maid.Visible = true; maid.AllProcPropSeqStart(); while (maid.IsBusy) { yield return null; } } if (onFinish != null) { onFinish(); } yield break; } public FreeModeSceneSelectBase.SelectMode mode; private Maid maid_; private SceneFreeModeSelectManager mgr_; private UIButton ok_btn_; private FreeModeItemList freemode_item_list_; private ScheduleTaskViewer night_task_viewer_; private bool is_scenario_load_; private List vip_list_; public enum SelectMode { Everyday, Vip, Story, LifeMode } }