using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public abstract class Result_Display : MonoBehaviour { protected float m_MydeltaTime { get { return Time.deltaTime * (float)this.m_TimeSpeed; } } protected void Initialize() { UIButton component = this.m_ButtonUI.GetComponent(); EventDelegate.Remove(component.onClick, new EventDelegate.Callback(this.ClickButton)); EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.ClickButton)); this.m_ButtonUI.SetActive(false); this.m_MyPanel = base.GetComponent(); if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Challenge && !Result_Display.IsNextDisplay) { Result_Display.IsNextDisplay = true; this.m_ButtonUI.GetComponent().spriteName = this.m_NextSpriteName; } else { Result_Display.IsNextDisplay = false; } IEnumerator enumerator = this.m_ResultGroup.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; this.UIInit(transform); foreach (KeyValuePair keyValuePair in Result_Display.DisplayData) { if (transform.name == keyValuePair.Key) { Transform transform2 = transform.Find("Value"); UILabel component2 = transform2.GetComponent(); if (keyValuePair.Value.Type == Result_Display.ResultType.String) { component2.text = keyValuePair.Value.Value; } else { if (component2) { component2.enabled = false; } IEnumerator enumerator3 = transform2.GetEnumerator(); try { while (enumerator3.MoveNext()) { object obj2 = enumerator3.Current; Transform transform3 = (Transform)obj2; if (transform3.name == keyValuePair.Value.Value) { transform3.gameObject.SetActive(true); } else { transform3.gameObject.SetActive(false); } } } finally { IDisposable disposable; if ((disposable = (enumerator3 as IDisposable)) != null) { disposable.Dispose(); } } } break; } } } } finally { IDisposable disposable2; if ((disposable2 = (enumerator as IDisposable)) != null) { disposable2.Dispose(); } } this.m_NowSceneName = SceneManager.GetActiveScene().name; } protected virtual void Update() { if (this.m_NowSceneName != SceneManager.GetActiveScene().name) { UnityEngine.Object.Destroy(base.gameObject); Result_Display.IsNextDisplay = false; } this.m_TimeSpeed = ((!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl)) ? 1 : 2); } protected abstract void UIInit(Transform child); protected IEnumerator FadeOut() { float timer = 0f; for (;;) { timer += this.m_MydeltaTime; float rate = 1f - Mathf.Sin(timer / this.m_FadeTime * 90f * 0.017453292f); this.m_MyPanel.alpha = rate; if (timer >= this.m_FadeTime) { break; } yield return null; } if (Result_Display.IsNextDisplay) { Result_Display.StartDisplay(this.m_EndLabel); } else { this.ResultEnd(); } UnityEngine.Object.Destroy(base.gameObject); yield break; yield break; } protected virtual void ResultEnd() { GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_EndLabel); GameMain.Instance.ScriptMgr.adv_kag.Exec(); } protected float SinRate01(float time, float total) { return Mathf.Sin(Mathf.Clamp01(time / total) * 90f * 0.017453292f); } public virtual void ClickButton() { base.StartCoroutine(this.FadeOut()); } public static void StartDisplay(string label) { string path = string.Empty; switch (RhythmAction_Mgr.NowDance) { case RhythmAction_Mgr.DanceType.Free: case RhythmAction_Mgr.DanceType.Challenge: if (!Result_Display.IsNextDisplay) { path = "SceneDance/Rhythm_Action/Prefab/Result/FreeResult"; } else { path = "SceneDance/Rhythm_Action/Prefab/Result/ChallengeResult"; } break; case RhythmAction_Mgr.DanceType.VS: path = "SceneDance/Rhythm_Action/Prefab/Result/VSResult"; break; case RhythmAction_Mgr.DanceType.BenchMark: path = "SceneDance/Rhythm_Action/Prefab/Result/BenchResult"; break; } GameObject gameObject = Resources.Load(path); gameObject = UnityEngine.Object.Instantiate(gameObject); gameObject.transform.SetParent(GameObject.Find("SystemUI Root").transform, false); gameObject.GetComponent().m_EndLabel = label; } public static void SetResultData(string key, string value, Result_Display.ResultType type = Result_Display.ResultType.String) { if (!Result_Display.DisplayData.ContainsKey(key)) { Result_Display.DisplayData.Add(key, new Result_Display.DisplayInfo()); } Result_Display.DisplayData[key].Type = type; Result_Display.DisplayData[key].Value = value; } public static string GetData(string key) { if (Result_Display.DisplayData.ContainsKey(key)) { return Result_Display.DisplayData[key].Value; } return string.Empty; } private const string m_FreeResult_Path = "SceneDance/Rhythm_Action/Prefab/Result/FreeResult"; private const string m_ChallengeResult_Path = "SceneDance/Rhythm_Action/Prefab/Result/ChallengeResult"; private const string m_VSResult_Path = "SceneDance/Rhythm_Action/Prefab/Result/VSResult"; private const string m_BenchResult_Path = "SceneDance/Rhythm_Action/Prefab/Result/BenchResult"; private const string m_VrDanceResult_Path = "SceneDance/Rhythm_Action/Prefab/Result/VrDanceResult"; protected const int m_Magnification = 2; [SerializeField] [Header("フェードアウト時間")] protected float m_FadeTime; [SerializeField] [Header("ボタン")] protected GameObject m_ButtonUI; [SerializeField] protected string m_NextSpriteName = "cm3d2_common_nextbuttom"; [SerializeField] [Header("リザルト表示UIグループ")] protected Transform m_ResultGroup; [SerializeField] [Header("UIがスライドするときのSE")] protected string m_SlideSEName = "3_result.ogg"; protected List m_GroupStart = new List(); protected List m_GroupEnd = new List(); protected UIPanel m_MyPanel; protected string m_EndLabel; protected static Dictionary DisplayData = new Dictionary(); protected static bool IsNextDisplay = false; protected string m_NowSceneName = string.Empty; protected int m_TimeSpeed = 1; public enum ResultType { String, Image } protected class DisplayInfo { public Result_Display.ResultType Type; public string Value = string.Empty; } }