using System;
using UnityEngine;

public class StageOldUnitCircle : MonoBehaviour
{
	public void Awake()
	{
		this.btn_ = UTY.GetChildObject(base.gameObject, "Parent", false).GetComponent<UIButton>();
		this.over_image_ = UTY.GetChildObject(this.btn_.gameObject, "OverImage", false).GetComponent<UISprite>();
		this.name_label_ = UTY.GetChildObject(this.over_image_.gameObject, "Name", false).GetComponent<UILabel>();
		this.over_image_.alpha = 0f;
		EventDelegate.Add(base.GetComponentInChildren<UIButton>().onClick, new EventDelegate.Callback(this.OnClick));
		this.anime_ = base.gameObject.AddComponent<Animation>();
		this.anime_.playAutomatically = false;
		AnimationClip @in = this.In;
		bool legacy = true;
		this.Out.legacy = legacy;
		@in.legacy = legacy;
		this.anime_.AddClip(this.In, "In");
		this.anime_.AddClip(this.Out, "Out");
	}

	public void SetOnSelectEvent(Action<StageOldUnitCircle> call_back)
	{
		this.on_select_event_ = call_back;
	}

	public void SetOnFinishAnimeEvent(Action<StageOldUnitCircle> call_back)
	{
		this.on_finish_anime_event_ = call_back;
	}

	public void SetStageData(YotogiOld.StageData stage_data)
	{
		bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
		this.stage_data_ = stage_data;
		this.btn_.normalSprite = ((!isDaytime) ? this.stage_data_.thumbnail_name_night : this.stage_data_.thumbnail_name);
		this.name_label_.text = this.stage_data_.draw_name;
	}

	public void SetStageSpotData(YotogiOld.StageData stage_data, int spot_no)
	{
		this.stage_data_ = stage_data;
		this.spot_no_ = spot_no;
		YotogiOld.StageData.SpotData spotData = this.stage_data_.spot_data[this.spot_no_];
		bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
		this.btn_.normalSprite = ((!isDaytime) ? spotData.thumbnail_name_night : spotData.thumbnail_name_daytime);
		this.name_label_.text = spotData.name;
	}

	public void PlayAnimeFadeOut()
	{
		this.anime_.Play("Out");
	}

	public void PlayAnimeFadeIn()
	{
		this.anime_.Play("In");
	}

	public void OnHoverOver()
	{
		this.over_image_.alpha = 1f;
	}

	public void OnHoverOut()
	{
		this.over_image_.alpha = 0f;
	}

	public void OnClick()
	{
		if (this.anime_.isPlaying)
		{
			return;
		}
		if (this.on_select_event_ != null)
		{
			this.on_select_event_(this);
		}
	}

	public void OnAnimeEndOfChange()
	{
		if (this.on_finish_anime_event_ != null)
		{
			this.on_finish_anime_event_(this);
		}
	}

	public YotogiOld.StageData stage_data
	{
		get
		{
			return this.stage_data_;
		}
	}

	public int spot_no
	{
		get
		{
			return this.spot_no_;
		}
	}

	private YotogiOld.StageData stage_data_;

	private int spot_no_;

	private Action<StageOldUnitCircle> on_select_event_;

	private Action<StageOldUnitCircle> on_finish_anime_event_;

	private UIButton btn_;

	private UISprite over_image_;

	private UILabel name_label_;

	private Animation anime_;

	[SerializeField]
	private AnimationClip In;

	[SerializeField]
	private AnimationClip Out;
}
