123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- 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<UIButton>().onClick, new EventDelegate.Callback(this.OnClickCancel));
- this.ok_btn_ = UTY.GetChildObject(base.root_obj, "OK", false).GetComponent<UIButton>();
- 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<ScheduleTaskViewer>();
- 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<FreeModeItemList>();
- 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<ScheduleTaskViewer.ViewData> list = new List<ScheduleTaskViewer.ViewData>();
- 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<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>> dictionary = new Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>>();
- Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> dictionary2 = new Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase>();
- 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<Maid> list = new List<Maid>();
- using (Dictionary<int, string>.Enumerator enumerator = freeModeItemLifeMode.m_LifeModeData.dataMaidPersonalUniqueNameAndActiveSlotDic.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- KeyValuePair<int, string> 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<Maid> 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<FreeModeItemVip> vip_list_;
- public enum SelectMode
- {
- Everyday,
- Vip,
- Story,
- LifeMode
- }
- }
|