using System; using System.Collections; using System.Collections.Generic; using com.workman.cm3d2.scene.dailyEtc; using I2.Loc; using UnityEngine; using wf; public class TitleCtrl : MonoBehaviour { public void Init(TitleMgr titleMgr, SceneMgr sceneMgr, GameObject goTitlePanel) { this.m_titleMgr = titleMgr; this.m_sceneMgr = sceneMgr; this.m_goTitlePanel = goTitlePanel; if (Product.isPublic) { Localize component = UTY.GetChildObject(goTitlePanel, "Title/TitleLogo", false).GetComponent(); Utility.SetLocalizeTerm(component, "SceneTitle/タイトルロゴ_全年齢", true); } this.m_listButton = new List(); this.m_dicTitleButton = new Dictionary(); int num = 0; IEnumerator enumerator = Enum.GetValues(typeof(TitleMgr.ButtonType)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; TitleMgr.ButtonType buttonType = (TitleMgr.ButtonType)obj; TitleCtrl.TitleButton titleButton = new TitleCtrl.TitleButton(); string text = buttonType.ToString(); GameObject childObject = UTY.GetChildObject(goTitlePanel, "ButtonGroup/" + text + "Group/" + text, false); if (buttonType == TitleMgr.ButtonType.Shop) { if (!GameMain.Instance.CMSystem.NetUse) { childObject.SetActive(false); continue; } childObject.SetActive(true); } if (Product.isPublic && buttonType == TitleMgr.ButtonType.Guest) { num += -61; childObject.SetActive(false); } else { Vector3 localPosition = childObject.transform.localPosition; childObject.transform.localPosition = new Vector3(localPosition.x, localPosition.y - (float)num, localPosition.z); childObject.AddComponent(); UIButton component2 = childObject.GetComponent(); EventDelegate.Add(component2.onClick, new EventDelegate.Callback(BaseMgr.Instance.ClickButton)); GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false); titleButton.selectCursor = childObject2; titleButton.name = buttonType; titleButton.active = false; this.m_dicTitleButton.Add(titleButton.name, titleButton); this.m_listButton.Add(UTY.GetChildObject(goTitlePanel, "ButtonGroup/" + text + "Group", false)); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.SetActiveButton(TitleMgr.ButtonType.Start); this.PrepareAnimation(goTitlePanel); } public void SetActiveButton(TitleMgr.ButtonType activeButton) { IEnumerator enumerator = Enum.GetValues(typeof(TitleMgr.ButtonType)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; TitleMgr.ButtonType buttonType = (TitleMgr.ButtonType)obj; if (buttonType != TitleMgr.ButtonType.Shop || GameMain.Instance.CMSystem.NetUse) { if (!Product.isPublic || buttonType != TitleMgr.ButtonType.Guest) { if (activeButton == buttonType) { this.m_dicTitleButton[buttonType].active = true; this.m_dicTitleButton[buttonType].selectCursor.SetActive(true); BaseMgr.Instance.m_currentActiveButton = activeButton; } else { this.m_dicTitleButton[buttonType].active = false; this.m_dicTitleButton[buttonType].selectCursor.SetActive(false); } } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } private void PrepareAnimation(GameObject goTitlePanel) { foreach (GameObject gameObject in this.m_listButton) { gameObject.transform.localPosition = new Vector2(-600f, 0f); } } public void StartComponentAnimation() { this.TitleButtonAnimation(); } private IEnumerator StartAnimator(Animator animator, float wait) { yield return new WaitForSeconds(wait); animator.SetBool("Active", true); yield break; } private void TitleLogoAnimation() { TweenAlpha tweenAlpha = this.m_goTitleLogo.AddComponent(); tweenAlpha.from = 0f; tweenAlpha.to = 1f; tweenAlpha.delay = 4f; tweenAlpha.duration = 1.5f; TweenScale tweenScale = this.m_goTitleLogo.AddComponent(); tweenScale.from = new Vector2(0f, 0f); tweenScale.to = new Vector2(1f, 1f); tweenScale.delay = 4f; tweenScale.duration = 1.5f; EventDelegate.Set(tweenScale.onFinished, new EventDelegate.Callback(this.TitleButtonAnimation)); tweenAlpha.PlayForward(); tweenScale.PlayForward(); } private void TitleButtonAnimation() { base.StartCoroutine(this.TweenAniamtion()); } private IEnumerator TweenAniamtion() { foreach (GameObject go in this.m_listButton) { iTween.MoveTo(go, iTween.Hash(new object[] { "x", 0, "y", 0, "time", 0.7f, "islocal", true })); yield return new WaitForSeconds(0.3f); } yield break; } public void OnStart() { GameMain.Instance.MainCamera.FadeOut(3f, false, delegate { this.m_sceneMgr.CloseScene(); }, true, default(Color)); TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f); } public void OnContinue(SaveAndLoadMgr saveAndLoadMgr) { saveAndLoadMgr.CallbackAfterFadeOut = new Action(this.m_titleMgr.OpenTitlePanel); this.m_titleMgr.CloseTitlePanel(new Action(saveAndLoadMgr.OpenLoadPanel)); } public void OnConfig() { BaseMgr.Instance.OpenConfigPanel(); } public void OnEnd() { GameMain.Instance.ToApplicationQuit(false); } public void OnShop() { Application.OpenURL(GameMain.Instance.CMSystem.ShopURL); } public void OnGuestMode(SaveAndLoadMgr saveAndLoadMgr) { saveAndLoadMgr.CallbackAfterFadeOut = new Action(this.m_titleMgr.OpenTitlePanel); this.m_titleMgr.CloseTitlePanel(new Action(saveAndLoadMgr.OpenLoadPanelKasiduki)); } public void OnBenchMark() { GameMain.Instance.MainCamera.FadeOut(3f, false, delegate { this.m_sceneMgr.GoToLabel("label_benchmarksetting"); }, true, default(Color)); TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f); } public void OnDance() { GameMain.Instance.MainCamera.FadeOut(3f, false, delegate { this.m_sceneMgr.GoToLabel("label_vsdance"); }, true, default(Color)); TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f); } public void OnCredit() { GameMain.Instance.MainCamera.FadeOut(3f, false, delegate { this.m_sceneMgr.GoToLabel("label_staffroll"); }, true, default(Color)); TweenAlpha.Begin(this.m_goTitlePanel, 3f, 0f); } private TitleMgr m_titleMgr; private SceneMgr m_sceneMgr; private GameObject m_goTitleLogo; private GameObject m_goTitleForScale; private GameObject m_goTitlePanel; private Dictionary m_dicTitleButton; private TitleMgr.ButtonType m_currentActiveButton; private List m_listButton; private const string SCENE_NAME_FROM_START = "SceneUserEdit"; private const string SCENE_NAME_FROM_CONTINUE = "SceneGeneral"; private const string SCENE_NAME_FROM_CONFIG = "SceneConfig"; private const float INIT_TITLE_LOGO_SCALE = 0f; private const float INIT_BUTTON_POS = -600f; private const float TITLELOGO_FADEIN_DELAY = 4f; private const float TITLELOGO_FADEIN_DURATION = 1.5f; private const float BUTTON_FADEIN_DURATION = 0.7f; private const float BUTTON_FADEIN_INTERVAL = 0.3f; private const float DURATION_TO_FADE = 3f; [SerializeField] private Animator m_animatorBenchMark; [SerializeField] private Animator m_animatorDance; private class TitleButton { public TitleMgr.ButtonType name; public GameObject selectCursor; public bool active; } }