using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x020000B1 RID: 177
public class HuddleButton : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
	// Token: 0x06001078 RID: 4216 RVA: 0x0013B658 File Offset: 0x00139858
	public void Setup(Character newCharacter)
	{
		this.character = newCharacter;
		if (this.character.stats.SpiritMax() <= 0)
		{
			if (this.variableName.Contains("Magic") || this.variableName.Contains("Mages"))
			{
				base.gameObject.SetActive(false);
			}
			else
			{
				base.gameObject.SetActive(true);
			}
		}
		this.SetSelection();
	}

	// Token: 0x06001079 RID: 4217 RVA: 0x0013B6C3 File Offset: 0x001398C3
	public void OnPointerEnter(PointerEventData eventData)
	{
		this.icon.sprite = this.overButton;
	}

	// Token: 0x0600107A RID: 4218 RVA: 0x0013B6D6 File Offset: 0x001398D6
	public void OnPointerExit(PointerEventData eventData)
	{
		this.SetSelection();
	}

	// Token: 0x0600107B RID: 4219 RVA: 0x0013B6DE File Offset: 0x001398DE
	public void SetSelection()
	{
		if (this.selected)
		{
			this.icon.sprite = this.downButton;
			return;
		}
		this.icon.sprite = this.upButton;
	}

	// Token: 0x0600107C RID: 4220 RVA: 0x0013B70C File Offset: 0x0013990C
	public void OnPointerDown(PointerEventData eventData)
	{
		this.selected = true;
		for (int i = 0; i < this.toggles.Count; i++)
		{
			if (this.toggles[i] != this)
			{
				this.toggles[i].selected = false;
				this.toggles[i].SetSelection();
			}
		}
		this.SetSelection();
		this.character.stats.SetCompanionControl(this.variableName, this.variableState, this.variableNum);
	}

	// Token: 0x0600107D RID: 4221 RVA: 0x0013B795 File Offset: 0x00139995
	public void OnPointerUp(PointerEventData eventData)
	{
	}

	// Token: 0x04001B63 RID: 7011
	public Sprite upButton;

	// Token: 0x04001B64 RID: 7012
	public Sprite overButton;

	// Token: 0x04001B65 RID: 7013
	public Sprite downButton;

	// Token: 0x04001B66 RID: 7014
	public Image icon;

	// Token: 0x04001B67 RID: 7015
	public List<HuddleButton> toggles = new List<HuddleButton>();

	// Token: 0x04001B68 RID: 7016
	public string variableName;

	// Token: 0x04001B69 RID: 7017
	public bool variableState;

	// Token: 0x04001B6A RID: 7018
	public int variableNum;

	// Token: 0x04001B6B RID: 7019
	public string hoverName;

	// Token: 0x04001B6C RID: 7020
	public Character character;

	// Token: 0x04001B6D RID: 7021
	public bool selected;
}
