using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x02000099 RID: 153
public class ButtonMultiTargets : Button
{
	// Token: 0x06000E7C RID: 3708 RVA: 0x00115D14 File Offset: 0x00113F14
	protected override void Start()
	{
		this.GetTargetGraphics();
		base.Start();
		Color color = base.colors.normalColor;
		if (this.hasTargetGraphics)
		{
			Image[] array = this.targetImages;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].CrossFadeColor(color, 0f, true, true);
				TextMeshProUGUI[] array2 = this.targetText;
				for (int j = 0; j < array2.Length; j++)
				{
					array2[j].CrossFadeColor(color, 0f, true, true);
				}
			}
			if (base.currentSelectionState == Selectable.SelectionState.Disabled)
			{
				color = base.colors.disabledColor;
				array = this.targetImages;
				for (int i = 0; i < array.Length; i++)
				{
					array[i].CrossFadeColor(color, 0f, true, true);
					TextMeshProUGUI[] array2 = this.targetText;
					for (int j = 0; j < array2.Length; j++)
					{
						array2[j].CrossFadeColor(color, 0f, true, true);
					}
				}
			}
		}
	}

	// Token: 0x06000E7D RID: 3709 RVA: 0x00115E04 File Offset: 0x00114004
	private void GetTargetGraphics()
	{
		if (!this.targetGraphics)
		{
			this.targetGraphics = base.GetComponent<MultiTargetGraphics>();
			this.hasTargetGraphics = true;
		}
		if (this.hasTargetGraphics)
		{
			this.targetImages = this.targetGraphics.targetImages;
			this.targetText = this.targetGraphics.targetText;
		}
	}

	// Token: 0x06000E7E RID: 3710 RVA: 0x00115E5C File Offset: 0x0011405C
	protected override void DoStateTransition(Selectable.SelectionState state, bool instant)
	{
		if (!this.hasTargetGraphics)
		{
			this.GetTargetGraphics();
		}
		if (state == Selectable.SelectionState.Highlighted && Input.GetMouseButton(0))
		{
			return;
		}
		Color color = ((state == Selectable.SelectionState.Disabled) ? base.colors.disabledColor : ((state == Selectable.SelectionState.Highlighted) ? base.colors.highlightedColor : ((state == Selectable.SelectionState.Normal) ? base.colors.normalColor : ((state == Selectable.SelectionState.Pressed) ? base.colors.pressedColor : ((state == Selectable.SelectionState.Selected) ? base.colors.selectedColor : Color.white)))));
		Image[] array = this.targetImages;
		for (int i = 0; i < array.Length; i++)
		{
			array[i].CrossFadeColor(color, instant ? 0f : base.colors.fadeDuration, true, true);
		}
		TextMeshProUGUI[] array2 = this.targetText;
		for (int i = 0; i < array2.Length; i++)
		{
			array2[i].CrossFadeColor(color, instant ? 0f : base.colors.fadeDuration, true, true);
		}
	}

	// Token: 0x06000E7F RID: 3711 RVA: 0x00115F60 File Offset: 0x00114160
	private bool CanReachSelectable(Selectable select)
	{
		return !select || (select.interactable && select.gameObject.activeInHierarchy);
	}

	// Token: 0x06000E80 RID: 3712 RVA: 0x00115F84 File Offset: 0x00114184
	public override Selectable FindSelectableOnLeft()
	{
		Selectable selectable = base.FindSelectableOnLeft();
		while (!this.CanReachSelectable(selectable))
		{
			selectable = selectable.FindSelectableOnLeft();
		}
		return selectable;
	}

	// Token: 0x06000E81 RID: 3713 RVA: 0x00115FAC File Offset: 0x001141AC
	public override Selectable FindSelectableOnRight()
	{
		Selectable selectable = base.FindSelectableOnRight();
		while (!this.CanReachSelectable(selectable))
		{
			selectable = selectable.FindSelectableOnRight();
		}
		return selectable;
	}

	// Token: 0x06000E82 RID: 3714 RVA: 0x00115FD4 File Offset: 0x001141D4
	public override Selectable FindSelectableOnUp()
	{
		Selectable selectable = base.FindSelectableOnUp();
		while (!this.CanReachSelectable(selectable))
		{
			selectable = selectable.FindSelectableOnUp();
		}
		return selectable;
	}

	// Token: 0x06000E83 RID: 3715 RVA: 0x00115FFC File Offset: 0x001141FC
	public override Selectable FindSelectableOnDown()
	{
		Selectable selectable = base.FindSelectableOnDown();
		while (!this.CanReachSelectable(selectable))
		{
			selectable = selectable.FindSelectableOnDown();
		}
		return selectable;
	}

	// Token: 0x0400170C RID: 5900
	private Image[] targetImages;

	// Token: 0x0400170D RID: 5901
	private TextMeshProUGUI[] targetText;

	// Token: 0x0400170E RID: 5902
	private MultiTargetGraphics targetGraphics;

	// Token: 0x0400170F RID: 5903
	private bool hasTargetGraphics;
}
