using System; using com.workman.cm3d2.scene.dailyEtc; using Kasizuki; using UnityEngine; public class TitleMgr : BaseMgr { public void Awake() { Debug.Log("Title::Awake"); } private void Start() { } private void Init() { GameObject gameObject = GameObject.Find("/UI Root"); NDebug.Assert(gameObject != null, string.Format("{0}が見つかりませんでした。", "UI Root")); gameObject.transform.Find("TitlePanel").gameObject.SetActive(false); gameObject.transform.Find("TitlePanel_Trial").gameObject.SetActive(false); gameObject.transform.Find("TitlePanel_PlayReview").gameObject.SetActive(false); this.m_goTitlePanel = gameObject.transform.Find("TitlePanel").gameObject; this.m_goTitlePanel.SetActive(true); NDebug.Assert(this.m_goTitlePanel != null, string.Format("{0}が見つかりませんでした。", "TitlePanel")); this.m_goTitlePanel.SetActive(true); this.m_titleCtrl = this.m_goTitlePanel.GetComponent(); NDebug.Assert(this.m_titleCtrl != null, string.Format("{0}が見つかりませんでした。", "TitleCtrlコンポーネント")); this.m_sceneMgr = this.getSceneManager(); this.m_titleCtrl.Init(this, this.m_sceneMgr, this.m_goTitlePanel); GameObject childObject = UTY.GetChildObject(gameObject, "Manager/SaveAndLoadMgr", false); NDebug.Assert(childObject != null, string.Format("{0}が見つかりませんでした。", "Manager/SaveAndLoadMgr")); this.m_saveAndLoadMgr = childObject.GetComponent(); this.m_saveAndLoadMgr.BaseInit(); this.InitKasizukiSaveLoadCtrl(); this.InitCommand(); GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel(); GameMain.Instance.Serialize(-1, "タイトルへ戻る"); GameMain.Instance.BgMgr.DeleteBg(); GameMain.Instance.SoundMgr.StopAll(); GameMain.Instance.SoundMgr.PlayBGM("BGM004.ogg", 0f, true); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, false); GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color)); GameMain.Instance.MainCamera.FadeIn(3f, false, null, true, true, default(Color)); GameMain.Instance.MainCamera.SetTargetPos(new Vector3(-9.30211f, 1.579518f, 17.12966f), true); GameMain.Instance.MainCamera.SetDistance(0.5999951f, true); GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(-221.6162f, -9.254665f), true); GameMain.Instance.MainCamera.SetControl(true); GameMain.Instance.MainLight.Reset(); if (GameMain.Instance.VRMode) { GameMain.Instance.MainCamera.SetPos(new Vector3(0f, 1.855f, 20f)); GameMain.Instance.MainCamera.SetRotation(new Vector3(0f, -180f, 0f)); GameMain.Instance.OvrMgr.OvrCamera.ReCallcOffset(); } GameMain.Instance.SysShortcut.gameObject.SetActive(true); this.m_titleCtrl.StartComponentAnimation(); GameMain.Instance.LoadIcon.force_draw_new = false; } private SceneMgr getSceneManager() { SceneMgr result = null; GameObject f_goParent = GameObject.Find("/UI Root"); GameObject childObject = UTY.GetChildObject(f_goParent, "Manager", false); if (childObject != null) { result = childObject.GetComponent(); } return result; } private void InitCommand() { if (this.m_goTitleCommand == null) { this.m_goTitleCommand = UnityEngine.Object.Instantiate(new GameObject()); this.m_goTitleCommand.name = "TitleCommand"; } this.m_goTitleCommand.AddComponent().Init(); this.m_goTitleCommand.AddComponent().Init(); this.m_goTitleCommand.AddComponent().Init(); } private void InitKasizukiSaveLoadCtrl() { if (this.m_KasizukiSaveAndLoadCtrl == null) { return; } SaveAndLoadMgr saveAndLoadMgr = this.m_saveAndLoadMgr; saveAndLoadMgr.OnOpenLoadPanelKasizukiLocal = (Action)Delegate.Combine(saveAndLoadMgr.OnOpenLoadPanelKasizukiLocal, new Action(delegate() { this.m_saveAndLoadMgr.CloseSaveAndLoadPanel(); this.m_KasizukiSaveAndLoadCtrl.Open(0.25f, null); this.m_KasizukiSaveAndLoadCtrl.Open(SaveAndLoadMgr.ViewType.Load, true); this.m_KasizukiSaveAndLoadCtrl.GetChildObject("DisplayButtonGroup/DisplaySave").SetActive(false); })); KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl = this.m_KasizukiSaveAndLoadCtrl; kasizukiSaveAndLoadCtrl.onClickCancel = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl.onClickCancel, new Action(delegate() { this.m_KasizukiSaveAndLoadCtrl.Close(0.25f, delegate { GameMain.Instance.Deserialize(-1, false); this.m_saveAndLoadMgr.CallbackAfterFadeOut = new Action(this.OpenTitlePanel); this.m_saveAndLoadMgr.OpenLoadPanelKasiduki(); }); })); KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl2 = this.m_KasizukiSaveAndLoadCtrl; kasizukiSaveAndLoadCtrl2.onLoad = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl2.onLoad, new Action(delegate() { this.m_KasizukiSaveAndLoadCtrl.Close(0.5f, delegate { GameMain.Instance.CharacterMgr.status.SetFlag("傅きモード", 1); GameMain.Instance.ScriptMgr.adv_kag.Exec(); }); })); KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl3 = this.m_KasizukiSaveAndLoadCtrl; kasizukiSaveAndLoadCtrl3.onClickNewGame = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl3.onClickNewGame, new Action(delegate() { this.m_KasizukiSaveAndLoadCtrl.Close(0.5f, delegate { GameMain.Instance.CharacterMgr.status.SetFlag("傅きモード", 1); GameMain.Instance.ScriptMgr.adv_kag.Exec(); }); })); KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl4 = this.m_KasizukiSaveAndLoadCtrl; kasizukiSaveAndLoadCtrl4.onDelete = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl4.onDelete, new Action(delegate() { int nowOriginSaveDataNumber = GameMain.Instance.KasizukiMgr.NowOriginSaveDataNumber; if (GameMain.Instance.GetSaveDataHeader(nowOriginSaveDataNumber) == null) { NDebug.Assert("本編セーブデータ" + nowOriginSaveDataNumber + "番の取得に失敗しました", false); return; } GameMain.Instance.SerializeKasizukiOnly(nowOriginSaveDataNumber); this.m_KasizukiSaveAndLoadCtrl.GetChildObject("DisplayButtonGroup/DisplaySave").SetActive(false); })); } public void ClickButton() { string name = UIButton.current.name; this.EnterButton(name); } public void EnterButton(string buttonName) { if (!base.IsValidateButton(buttonName)) { return; } TitleMgr.ButtonType activeButton = (TitleMgr.ButtonType)Enum.Parse(typeof(TitleMgr.ButtonType), buttonName); switch (activeButton) { case TitleMgr.ButtonType.Start: this.m_titleCtrl.OnStart(); break; case TitleMgr.ButtonType.Continue: this.m_titleCtrl.OnContinue(this.m_saveAndLoadMgr); break; case TitleMgr.ButtonType.Guest: this.m_titleCtrl.OnGuestMode(this.m_saveAndLoadMgr); break; case TitleMgr.ButtonType.Config: this.m_titleCtrl.OnConfig(); break; case TitleMgr.ButtonType.End: this.m_titleCtrl.OnEnd(); break; case TitleMgr.ButtonType.Shop: this.m_titleCtrl.OnShop(); break; } this.m_titleCtrl.SetActiveButton(activeButton); } public void MoveNextButton() { int num = (int)this.m_currentActiveButton; num++; if (num > Enum.GetValues(typeof(TitleMgr.ButtonType)).Length - 1) { num = 0; } this.m_titleCtrl.SetActiveButton((TitleMgr.ButtonType)num); this.m_currentActiveButton = (TitleMgr.ButtonType)num; } public void MovePreviousButton() { int num = (int)this.m_currentActiveButton; num--; if (num < 0) { num = Enum.GetValues(typeof(TitleMgr.ButtonType)).Length - 1; } this.m_titleCtrl.SetActiveButton((TitleMgr.ButtonType)num); this.m_currentActiveButton = (TitleMgr.ButtonType)num; } public void OpenTitlePanel() { if (!this.m_bInit) { this.Init(); this.m_bInit = true; } this.FadeInPanel(); } protected void FadeInPanel() { this.m_goTitlePanel.SetActive(true); TweenAlpha tweenAlpha = this.m_goTitlePanel.AddComponent(); tweenAlpha.from = 0f; tweenAlpha.to = 1f; tweenAlpha.duration = 0.5f; tweenAlpha.PlayForward(); } public void CloseTitlePanel(Action OnFinished = null) { this.FadeOutPanel(OnFinished); } protected void FadeOutPanel(Action OnFinished = null) { TweenAlpha tweenAlpha = TweenAlpha.Begin(this.m_goTitlePanel, 0.5f, 0f); EventDelegate.Set(tweenAlpha.onFinished, delegate() { this.m_goTitlePanel.SetActive(false); if (OnFinished != null) { OnFinished(); } }); } public void NextScene(string labelName) { string label_name = GameMain.Instance.ScriptMgr.adv_kag.tag_backup[labelName]; GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(label_name); GameMain.Instance.ScriptMgr.adv_kag.Exec(); } public TitleMgr.ButtonType m_currentActiveButton; public TitleCtrl m_titleCtrl; private SceneMgr m_sceneMgr; private SaveAndLoadMgr m_saveAndLoadMgr; [SerializeField] private GameObject m_goTitlePanel; private GameObject m_goTitleCommand; private TitleCommand m_command; [SerializeField] private KasizukiSaveAndLoadCtrl m_KasizukiSaveAndLoadCtrl; private bool m_bInit; private const string uiRootPath = "/UI Root"; private const string TITLE_COMMAND_NAME = "TitleCommand"; private const float DURATION_TO_FADE = 0.5f; public enum ButtonType { Start, Continue, Guest, Config, End, Shop } }