using System;
using UnityEngine;

public class UIWFTabButton : UIWFSelectButton
{
	protected override void OnInit()
	{
		base.OnInit();
		this.backup_defaultColor = base.defaultColor;
		this.is_init_color_ = true;
	}

	protected override void OnClick()
	{
		if (UIWFTabButton.current == null && this.isEnabled)
		{
			UIWFTabButton uiwftabButton = UIWFTabButton.current;
			UIWFTabButton.current = this;
			base.OnClick();
			UIWFTabButton.current = uiwftabButton;
		}
	}

	public override void SetSelect(bool is_select)
	{
		if (!this.mInitDone)
		{
			this.OnInit();
		}
		if (!this.isEnabled)
		{
			return;
		}
		if (!this.is_init_color_)
		{
			this.backup_defaultColor = base.defaultColor;
			this.is_init_color_ = true;
		}
		if (is_select)
		{
			base.defaultColor = new Color(this.hover.r, this.hover.g, this.hover.b, this.hover.a);
			this.SetState(UIButtonColor.State.Normal, false);
			BoxCollider component = base.gameObject.GetComponent<BoxCollider>();
			if (component != null)
			{
				component.size = Vector3.zero;
			}
		}
		else
		{
			base.defaultColor = this.backup_defaultColor;
			BoxCollider component2 = base.gameObject.GetComponent<BoxCollider>();
			if (component2 != null && this.widget_ != null)
			{
				Vector2 localSize = this.widget_.localSize;
				component2.size = new Vector3(localSize.x, localSize.y, 0f);
			}
		}
		base.SetSelect(is_select);
	}

	[Obsolete("Use UIWFSelectButton.current")]
	public new static UIWFTabButton current;

	private bool is_init_color_;

	protected Color backup_defaultColor;
}