using System;
using System.Collections;
using UnityEngine;

public class ChallengeResult : Result_Display
{
	private void Awake()
	{
		this.m_RankUIPanel = this.m_RankUI.GetComponent<UIPanel>();
		this.m_RankUIPanel.alpha = 0f;
		this.m_RankValueEnd = this.m_RankUI.localPosition;
		this.m_RankUI.localPosition += Vector3.down * this.m_RankUIPosDawn;
		this.m_RankValueStart = this.m_RankUI.localPosition;
		base.Initialize();
		base.StartCoroutine(this.UISlideIn());
	}

	protected override void Update()
	{
		base.Update();
	}

	protected override void UIInit(Transform child)
	{
		UISprite component = child.GetComponent<UISprite>();
		Vector3 localPosition = child.localPosition;
		localPosition.x = UI_ScreenFitBase.PointToScreenPos(Vector3.right * (float)UICamera.ScreenWidth).x;
		if (component)
		{
			localPosition.x += (float)(component.width / 2);
		}
		this.m_GroupEnd.Add(child.localPosition);
		this.m_GroupStart.Add(localPosition);
		child.localPosition = localPosition;
	}

	private IEnumerator UISlideIn()
	{
		float timer = 0f;
		int count = 0;
		GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
		for (;;)
		{
			timer += base.m_MydeltaTime;
			this.m_ResultGroup.GetChild(count).localPosition = Vector3.Lerp(this.m_GroupStart[count], this.m_GroupEnd[count], base.SinRate01(timer, this.m_UISlide));
			if (timer > this.m_UISlide)
			{
				count++;
				timer = 0f;
				if (count == this.m_ResultGroup.childCount)
				{
					break;
				}
				yield return new WaitForSeconds(this.m_UISlideRug / (float)this.m_TimeSpeed);
				GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
			}
			yield return null;
		}
		yield return new WaitForSeconds(this.m_RankWait / (float)this.m_TimeSpeed);
		base.StartCoroutine(this.RankFadeIn());
		yield break;
		yield break;
	}

	private IEnumerator RankFadeIn()
	{
		float timer = 0f;
		for (;;)
		{
			timer += base.m_MydeltaTime;
			this.m_RankUIPanel.alpha = base.SinRate01(timer, this.m_RankFade);
			this.m_RankUI.localPosition = Vector3.Lerp(this.m_RankValueStart, this.m_RankValueEnd, base.SinRate01(timer, this.m_RankFade));
			if (timer > this.m_RankFade)
			{
				break;
			}
			yield return null;
		}
		this.m_ButtonUI.SetActive(true);
		yield break;
		yield break;
	}

	[SerializeField]
	[Header("UIのスライド時間")]
	private float m_UISlide = 0.15f;

	[SerializeField]
	[Header("UI表示終了後の待機時間")]
	private float m_UISlideRug = 0.0625f;

	[SerializeField]
	[Header("評定表示UIのフェードイン時間")]
	private float m_RankFade = 0.5f;

	[SerializeField]
	[Header("評定表示UIの表示開始までの待機時間")]
	private float m_RankWait = 0.25f;

	[SerializeField]
	private float m_RankUIPosDawn = 1f;

	[SerializeField]
	[Header("評定表示UI")]
	private Transform m_RankUI;

	private UIPanel m_RankUIPanel;

	private Vector3 m_RankValueStart;

	private Vector3 m_RankValueEnd;
}
