123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- 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<UIButton>();
- 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<UIPanel>();
- if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Challenge && !Result_Display.IsNextDisplay)
- {
- Result_Display.IsNextDisplay = true;
- this.m_ButtonUI.GetComponent<UISprite>().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<string, Result_Display.DisplayInfo> keyValuePair in Result_Display.DisplayData)
- {
- if (transform.name == keyValuePair.Key)
- {
- Transform transform2 = transform.Find("Value");
- UILabel component2 = transform2.GetComponent<UILabel>();
- 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.0174532924f);
- 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.0174532924f);
- }
- 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<GameObject>(path);
- gameObject = UnityEngine.Object.Instantiate<GameObject>(gameObject);
- gameObject.transform.SetParent(GameObject.Find("SystemUI Root").transform, false);
- gameObject.GetComponent<Result_Display>().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<Vector3> m_GroupStart = new List<Vector3>();
- protected List<Vector3> m_GroupEnd = new List<Vector3>();
- protected UIPanel m_MyPanel;
- protected string m_EndLabel;
- protected static Dictionary<string, Result_Display.DisplayInfo> DisplayData = new Dictionary<string, Result_Display.DisplayInfo>();
- 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;
- }
- }
|