using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FreeResult : Result_Display
{
	private void Awake()
	{
		base.Initialize();
		base.StartCoroutine(this.ScoreFadeIn());
	}

	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);
		}
		if (this.m_ScoreResultUI != child)
		{
			this.m_RateResultGroup.Add(child);
			this.m_GroupEnd.Add(child.localPosition);
			this.m_GroupStart.Add(localPosition);
		}
		else
		{
			this.m_ScoreUIStart = localPosition;
			this.m_ScoreUIEnd = child.localPosition;
		}
		child.localPosition = localPosition;
	}

	private IEnumerator ScoreFadeIn()
	{
		while (GameMain.Instance.MainCamera.IsFadeOut())
		{
			yield return null;
		}
		float timer = 0f;
		GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
		for (;;)
		{
			timer += base.m_MydeltaTime;
			this.m_ScoreResultUI.localPosition = Vector3.Lerp(this.m_ScoreUIStart, this.m_ScoreUIEnd, base.SinRate01(timer, this.m_ScoreUISlide));
			if (timer > this.m_ScoreUISlide)
			{
				break;
			}
			yield return null;
		}
		yield return new WaitForSeconds(this.m_ScoreUIRug / (float)this.m_TimeSpeed);
		base.StartCoroutine(this.OtherResultFadeIn());
		yield break;
		yield break;
	}

	private IEnumerator OtherResultFadeIn()
	{
		float timer = 0f;
		int count = 0;
		GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
		for (;;)
		{
			timer += base.m_MydeltaTime;
			this.m_RateResultGroup[count].localPosition = Vector3.Lerp(this.m_GroupStart[count], this.m_GroupEnd[count], base.SinRate01(timer, this.m_OtherUISlide));
			if (timer > this.m_OtherUISlide)
			{
				count++;
				timer = 0f;
				yield return new WaitForSeconds(this.m_OtherUIRug / (float)this.m_TimeSpeed);
				if (count == this.m_RateResultGroup.Count)
				{
					break;
				}
				GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
			}
			yield return null;
		}
		this.m_ButtonUI.SetActive(true);
		yield break;
		yield break;
	}

	[SerializeField]
	[Header("スコア表示UI表示後の待機時間")]
	private float m_ScoreUIRug = 0.25f;

	[SerializeField]
	[Header("スコア表示UIのスライド時間")]
	private float m_ScoreUISlide = 0.5f;

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

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

	[SerializeField]
	[Header("スコア表示UI")]
	private Transform m_ScoreResultUI;

	private Vector3 m_ScoreUIStart;

	private Vector3 m_ScoreUIEnd;

	private List<Transform> m_RateResultGroup = new List<Transform>();
}
