using System;
using System.Collections;
using DarkTonic.MasterAudio;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x02000093 RID: 147
public class AnimateButton : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler
{
	// Token: 0x06000E38 RID: 3640 RVA: 0x00110527 File Offset: 0x0010E727
	private void OnEnable()
	{
		this.clickedDown = false;
		if (this.controllerText && Links.x)
		{
			this.CheckController(Links.x.joy);
		}
	}

	// Token: 0x06000E39 RID: 3641 RVA: 0x00110559 File Offset: 0x0010E759
	public Button GetButton()
	{
		if (this.btn)
		{
			return this.btn;
		}
		return base.gameObject.GetComponent<Button>();
	}

	// Token: 0x06000E3A RID: 3642 RVA: 0x0011057C File Offset: 0x0010E77C
	public void CheckController(bool joy)
	{
		if (!this.image)
		{
			this.image = base.gameObject.GetComponent<Image>();
		}
		this.controllerText.enabled = joy;
		if (!joy)
		{
			this.image.enabled = true;
		}
		else
		{
			this.image.enabled = false;
		}
		if (this.controllerText.enabled)
		{
			if (this.type == "Close Rest" || (!Records.x.mainMenuOpen && this.type == "Close SaveLoad") || (this.type == "Close Formation" || (!Records.x.mainMenuOpen && this.type == "Close Options")) || this.type == "Close MapMenu" || this.type == "Close Map" || this.type == "Close CS" || this.type == "Close Journal" || this.type == "Close Tips")
			{
				this.controllerText.text = "";
			}
			else if (this.type.Contains("Feed"))
			{
				base.transform.GetChild(0).gameObject.SetActive(true);
				this.controllerText.text = Links.x.gameplay.gameFeedText;
			}
			else if (this.type.Contains("Tutorial"))
			{
				this.controllerText.text = Links.x.gameplay.continueText;
			}
			else if (this.type.Contains("Spellcrafting"))
			{
				this.controllerText.text = Links.x.gameplay.keyboardText2;
			}
			else
			{
				this.controllerText.text = Links.x.gameplay.exitMenuText;
			}
			this.controllerText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
			return;
		}
		if (this.type.Contains("Feed"))
		{
			base.transform.GetChild(0).gameObject.SetActive(false);
		}
	}

	// Token: 0x06000E3B RID: 3643 RVA: 0x001107C0 File Offset: 0x0010E9C0
	public void OnPointerEnter(PointerEventData eventData)
	{
		this.hovering = true;
		if (Input.GetMouseButton(0))
		{
			return;
		}
		if (Links.x.joy && !this.canInteract)
		{
			return;
		}
		if (this.animator && this.enterAnimation != "")
		{
			if (this.ignoreEnterAnimation == "")
			{
				this.animator.Play(this.enterAnimation);
			}
			else if (!this.animator.currentAnimation.Contains(this.ignoreEnterAnimation))
			{
				this.animator.Play(this.enterAnimation);
			}
		}
		if (this.showTooltip)
		{
			if (this.type.Contains("Proficiency"))
			{
				if (!this.rt)
				{
					this.GetRT();
				}
				Links.x.characterSheet.ShowProficiencyInfo(this.type, this.rt);
			}
			else if (this.type.Contains("ItemUse"))
			{
				Character character = base.gameObject.transform.parent.gameObject.GetComponent<SkillBag>().portrait.character;
				Links.x.hudControl.currentHotkeyButton = this;
				int num = character.GetInvNum(26);
				if (this.type.Contains("2"))
				{
					num = character.GetInvNum(28);
				}
				if (this.type.Contains("3"))
				{
					num = character.GetInvNum(30);
				}
				string displayName = Links.x.library.GetInvRowByIndex(num)._DisplayName;
				if (displayName == "")
				{
					Links.x.tooltip.AddHoverText("For belt item", base.gameObject, "Up");
				}
				else
				{
					Links.x.tooltip.AddHoverText("Use " + displayName, base.gameObject, "Up");
				}
			}
			else if (this.type == "Head")
			{
				if (this.state)
				{
					this.state = false;
				}
			}
			else if (this.type == "Clock")
			{
				this.str.Clear();
				this.str.Append("Rest   <voffset=.4em><size=30><sprite=");
				int keyIconIndex = Links.x.keyControl.GetKeyIconIndex("LMB");
				this.str.Append(keyIconIndex);
				this.str.Append("></size></voffset>\n\nCurrently: ");
				float num2 = Mathf.Floor(Links.x.gameplay.gameHours);
				string text = Links.x.gameplay.ShowHour(num2);
				this.str.Append(text);
				Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
			}
			else if (this.type == "Party Wait")
			{
				if (true)
				{
					if (Records.x.circle)
					{
						Links.x.tooltip.AddHoverText("Break", base.gameObject, "UpMenuButtons");
					}
					else
					{
						this.str.Clear();
						if (Records.x.partySailing)
						{
							this.str.Append("Unavailable");
						}
						else
						{
							string hotkeyString = Links.x.keyControl.GetHotkeyString("Commands");
							this.str.Append("Form Up  <voffset=.4em><size=50> <sprite=");
							int keyIconIndex2 = Links.x.keyControl.GetKeyIconIndex(hotkeyString);
							this.str.Append(keyIconIndex2);
							this.str.Append("></size></voffset>");
						}
						Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
					}
				}
				else
				{
					Links.x.tooltip.AddHoverText("Companions\n\nstay back", base.gameObject, "Up");
				}
			}
			else if (this.type.Contains("Journal"))
			{
				if (Links.x.joy)
				{
					Links.x.tooltip.AddHoverText("Notes", base.gameObject, "Up");
				}
				else
				{
					this.str.Clear();
					string hotkeyString2 = Links.x.keyControl.GetHotkeyString("Notes");
					if (hotkeyString2 == "Space" || hotkeyString2 == "Tab" || hotkeyString2 == "Caps Lock" || hotkeyString2 == "Return")
					{
						this.str.Append("Notes   <voffset=.4em><size=50> <sprite=");
					}
					else
					{
						this.str.Append("Notes  <voffset=.4em><size=50> <sprite=");
					}
					int keyIconIndex3 = Links.x.keyControl.GetKeyIconIndex(hotkeyString2);
					this.str.Append(keyIconIndex3);
					this.str.Append("></size></voffset>");
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
				}
			}
			else if (this.type.Contains("Map"))
			{
				if (Links.x.joy)
				{
					Links.x.tooltip.AddHoverText("Map", base.gameObject, "Up");
				}
				else
				{
					this.str.Clear();
					string hotkeyString3 = Links.x.keyControl.GetHotkeyString("Map");
					if (hotkeyString3 == "Space" || hotkeyString3 == "Tab" || hotkeyString3 == "Caps Lock" || hotkeyString3 == "Return")
					{
						this.str.Append("Map   <voffset=.4em><size=50> <sprite=");
					}
					else
					{
						this.str.Append("Map  <voffset=.4em><size=50> <sprite=");
					}
					int keyIconIndex4 = Links.x.keyControl.GetKeyIconIndex(hotkeyString3);
					this.str.Append(keyIconIndex4);
					this.str.Append("></size></voffset>");
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
				}
			}
			else if (this.type.Contains("Sheep"))
			{
				if (Links.x.gaia.boroControls.BoroNearby())
				{
					Links.x.hudControl.BoroTooltipOn("Dismiss");
				}
				else
				{
					Links.x.hudControl.BoroTooltipOn("Call");
				}
			}
			else if (this.type.Contains("Boro Stats"))
			{
				Links.x.hudControl.BoroTooltipOn("Boro stats");
			}
			else if (this.type.Contains("Character Sheet"))
			{
				if (Links.x.joy)
				{
					Links.x.tooltip.AddHoverText("Character Sheet", base.gameObject, "Up");
				}
				else
				{
					this.str.Clear();
					string hotkeyString4 = Links.x.keyControl.GetHotkeyString("Character Sheet");
					if (hotkeyString4 == "Space" || hotkeyString4 == "Tab" || hotkeyString4 == "Caps Lock" || hotkeyString4 == "Return")
					{
						this.str.Append("Character Sheet   <voffset=.4em><size=50> <sprite=");
					}
					else
					{
						this.str.Append("Character Sheet  <voffset=.4em><size=50> <sprite=");
					}
					int keyIconIndex5 = Links.x.keyControl.GetKeyIconIndex(hotkeyString4);
					this.str.Append(keyIconIndex5);
					this.str.Append("></size></voffset>");
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
				}
			}
			else if (this.type.Contains("Settings"))
			{
				if (Links.x.joy)
				{
					Links.x.tooltip.AddHoverText("Settings", base.gameObject, "UpMenuButtonsRight");
				}
				else
				{
					this.str.Clear();
					this.str.Append("Settings  <voffset=.4em><size=50> <sprite=");
					int keyIconIndex6 = Links.x.keyControl.GetKeyIconIndex("Escape");
					this.str.Append(keyIconIndex6);
					this.str.Append("></size></voffset>");
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtonsRight");
				}
			}
			else if (this.type.Contains("Tactics"))
			{
				Links.x.tooltip.AddHoverText("Tactics", base.gameObject, "UpMenuButtons");
			}
			else if (!this.type.Contains("Toggle Windows"))
			{
				if (this.type.Contains("Stun Badge"))
				{
					this.str.Clear();
					Library.Characters pcrowFromName = Links.x.library.GetPCRowFromName(this.info);
					this.str.Append(pcrowFromName._DisplayName);
					this.str.Append(" (");
					this.str.Append(pcrowFromName._GenericName);
					this.str.Append(") ");
					this.str.Append(" ~ Stunned for ");
					int num3 = this.id + 24 - (int)Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours());
					if (num3 < 1)
					{
						this.str.Append("< 1 hour");
					}
					else
					{
						this.str.Append(num3);
						if (num3 == 1)
						{
							this.str.Append(" hour");
						}
						else
						{
							this.str.Append(" hours");
						}
					}
					if (!this.state)
					{
						this.str.Append("\n\n<color=#F8553C>[Cannot claim reward until area is clear!]</color>");
					}
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "Down");
				}
				else if (this.type.Contains("Bribe Badge"))
				{
					this.str.Clear();
					Library.Characters pcrowFromName2 = Links.x.library.GetPCRowFromName(this.info);
					this.str.Append("Victim: ");
					this.str.Append(pcrowFromName2._DisplayName);
					string text2 = Records.x.CanBribe(this.info);
					if (text2 == "Yes")
					{
						this.str.Append("\n\nShout 'Bribe' for reparations");
					}
					else if (text2 == "Too far")
					{
						this.str.Append("\n\nNo guards or victims nearby to bribe");
					}
					else if (text2 == "Out of town")
					{
						this.str.Append("\n\nToo far to bribe");
					}
					else if (text2 == "Stunned")
					{
						this.str.Append("\n\nWitnesses are stunned, but word will spread in ");
						int num4 = this.id + 24 - (int)Mathf.Floor((float)Links.x.gameplay.GetCurrentGameTimeHours());
						if (num4 < 1)
						{
							this.str.Append("< 1 hour");
						}
						else
						{
							this.str.Append(num4);
							if (num4 == 1)
							{
								this.str.Append(" hour");
							}
							else
							{
								this.str.Append(" hours");
							}
						}
					}
					else
					{
						this.str.Append("\n\nCannot bribe now");
					}
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "Down");
				}
				else if (this.type.Contains("Toggle Lethality"))
				{
					this.str.Clear();
					if (Links.x.mk)
					{
						if (Records.x.kill)
						{
							this.str.Append("Party will kill");
						}
						else
						{
							this.str.Append("Party will stun");
						}
						Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "Up");
					}
				}
				else if (this.type.Contains("Pause"))
				{
					if (Links.x.mk)
					{
						this.str.Clear();
						if (Records.x.paused)
						{
							this.str.Append("Free Time");
						}
						else
						{
							this.str.Append("Pause Time");
						}
						string hotkeyString5 = Links.x.keyControl.GetHotkeyString("Pause");
						if (hotkeyString5 == "Space" || hotkeyString5 == "Tab" || hotkeyString5 == "Caps Lock" || hotkeyString5 == "Return")
						{
							this.str.Append("   <voffset=.4em><size=50> <sprite=");
						}
						else
						{
							this.str.Append("  <voffset=.4em><size=50> <sprite=");
						}
						int keyIconIndex7 = Links.x.keyControl.GetKeyIconIndex(hotkeyString5);
						this.str.Append(keyIconIndex7);
						this.str.Append("></size></voffset>");
						Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "Up");
					}
					else
					{
						Links.x.tooltip.AddHoverText("Pause (" + Links.x.keyControl.GetHotkeyString("Pause") + ")", base.gameObject, "Up");
					}
				}
				else if (this.type.Contains("Rest"))
				{
					Links.x.tooltip.AddHoverText("Rest", base.gameObject, "Up");
				}
				else if (this.type.Contains("Tactics Label"))
				{
					Links.x.formation.SetDescriptionFromLabel(base.gameObject.name);
				}
				else if (this.type.Contains("Select All"))
				{
					Links.x.tooltip.AddHoverText("Select All (" + Links.x.keyControl.GetHotkeyString("Select All") + ")", base.gameObject, "Up");
				}
				else if (this.type.Contains("Select Party"))
				{
					SkillBag component = base.gameObject.transform.parent.gameObject.GetComponent<SkillBag>();
					Character character2 = component.portrait.character;
					component.portrait.PortraitHover(true);
				}
				else if (this.type.Contains("Show Items"))
				{
					this.str.Clear();
					string hotkeyString6 = Links.x.keyControl.GetHotkeyString("Show Items");
					if (Links.x.mk)
					{
						if (hotkeyString6 == "Space" || hotkeyString6 == "Tab" || hotkeyString6 == "Caps Lock" || hotkeyString6 == "Return")
						{
							this.str.Append("Show Items   <voffset=.4em><size=50> <sprite=");
						}
						else
						{
							this.str.Append("Show Items  <voffset=.4em><size=50> <sprite=");
						}
						int keyIconIndex8 = Links.x.keyControl.GetKeyIconIndex(hotkeyString6);
						this.str.Append(keyIconIndex8);
						this.str.Append("></size></voffset>");
					}
					else
					{
						this.str.Append("Show Items  <voffset=.4em><size=50> <sprite=");
						int controllerSprite = Links.x.gameplay.GetControllerSprite("Show Items", Links.x.gameplay.controllerName);
						this.str.Append(controllerSprite);
						this.str.Append("></size></voffset>");
					}
					Links.x.tooltip.AddHoverText(this.str.ToString(), base.gameObject, "UpMenuButtons");
				}
				else if (this.type.Contains("AI"))
				{
					if (Records.x.ai == 1)
					{
						Links.x.tooltip.AddHoverText("Always\n\nattack", base.gameObject, "Up");
					}
					else
					{
						Links.x.tooltip.AddHoverText("Wait for\n\norders", base.gameObject, "Up");
					}
				}
				else if (this.type == "Effect")
				{
					Portrait component2 = base.gameObject.transform.parent.transform.parent.gameObject.GetComponent<Portrait>();
					if (!this.image)
					{
						this.image = base.gameObject.GetComponent<Image>();
					}
					component2.skillBag.TooltipOn(null, base.gameObject, component2.GetEffectName(this.image), true);
				}
				else
				{
					Links.x.tooltip.AddHoverText(this.type, base.gameObject, "Up");
				}
			}
		}
		else if (this.type.Contains("Crafting"))
		{
			Links.x.arrowKit.SetHover(this.type, base.gameObject.name);
		}
		Links.x.gameplay.uiCanClick = true;
		this.canInteract = false;
	}

	// Token: 0x06000E3C RID: 3644 RVA: 0x0011192C File Offset: 0x0010FB2C
	public void OnPointerExit(PointerEventData eventData)
	{
		this.hovering = false;
		Links.x.hudControl.currentHotkeyButton = null;
		if (Links.x.joy && !this.canInteract)
		{
			return;
		}
		if (Input.GetMouseButton(0))
		{
			return;
		}
		if (this.animator && this.exitAnimation != "")
		{
			if (this.image)
			{
				if (this.image.enabled)
				{
					this.animator.Play(this.exitAnimation);
				}
			}
			else
			{
				this.animator.Play(this.exitAnimation);
			}
		}
		if (this.showTooltip)
		{
			if (this.type.Contains("Proficiency"))
			{
				Links.x.characterSheet.EndHover(this.rt);
			}
			else if (this.type == "Effect")
			{
				base.gameObject.transform.parent.transform.parent.gameObject.GetComponent<Portrait>().skillBag.TooltipOff();
			}
			else
			{
				Links.x.tooltip.EndHoverText(base.gameObject, false);
				Links.x.characterTooltip.EndHoverText(base.gameObject, false);
			}
		}
		if (this.type == "Sheep" || this.type == "Boro Stats")
		{
			Links.x.hudControl.BoroTooltipOff();
		}
		if (this.type == "Select Party")
		{
			base.gameObject.transform.parent.gameObject.GetComponent<SkillBag>().portrait.PortraitHover(false);
		}
		else if (this.type.Contains("Tactics Label"))
		{
			Links.x.formation.SetDescriptionFromLabel("");
		}
		else if (this.type.Contains("Crafting"))
		{
			Links.x.arrowKit.EndHover();
		}
		else if (this.type == "Head" && !this.state)
		{
			base.gameObject.GetComponent<Button>().interactable = true;
		}
		Links.x.gameplay.uiCanClick = false;
		this.canInteract = false;
	}

	// Token: 0x06000E3D RID: 3645 RVA: 0x00111B68 File Offset: 0x0010FD68
	public void OnPointerDown(PointerEventData eventData)
	{
		this.clickedDown = true;
		this.timeSinceMouseDown = Time.timeSinceLevelLoad;
		if (Links.x.mk && Records.x.movingWindows)
		{
			Records.x.movingWindows = false;
			Links.x.hudControl.ToggleWindowVisual(false);
			Links.x.hudControl.ToggleWindowInteractables(true);
		}
		if (this.animator && this.downAnimation != "")
		{
			this.animator.Play(this.downAnimation);
		}
		this.type == "Head";
		if (this.type.Contains("Close"))
		{
			Links.x.gameplay.StoneSoundQuieter();
		}
		else if (Links.x.mk)
		{
			if (Input.GetMouseButton(1))
			{
				MasterAudio.PlaySoundAndForget("Click up", Random.Range(0.55f, 0.65f), new float?(1f), 0f, "", null);
			}
			else
			{
				MasterAudio.PlaySoundAndForget(this.soundName, Random.Range(0.75f, 0.8f), new float?(1f), 0f, "", null);
			}
		}
		else
		{
			MasterAudio.PlaySoundAndForget(this.soundName, Random.Range(0.75f, 0.8f), new float?(1f), 0f, "", null);
		}
		if (this.type == "Spin")
		{
			Links.x.creation.spinning = true;
			Links.x.creation.mouseStart = Input.mousePosition;
		}
	}

	// Token: 0x06000E3E RID: 3646 RVA: 0x00111D28 File Offset: 0x0010FF28
	public void SetImageFromSave()
	{
		if (this.type == "AI")
		{
			if (Records.x.ai == 0)
			{
				this.image.sprite = this.sprite1;
			}
			else
			{
				this.image.sprite = this.sprite2;
			}
		}
		this.type == "Party Wait";
		if (this.type == "Show Items")
		{
			if (!Links.x.inventory.groundBag.toggle)
			{
				this.image.sprite = this.sprite1;
				if (Links.x.joy)
				{
					base.gameObject.GetComponent<Button>().spriteState = new SpriteState
					{
						highlightedSprite = this.sprite1,
						selectedSprite = this.sprite1,
						disabledSprite = this.sprite1
					};
				}
			}
			else
			{
				this.image.sprite = this.sprite2;
				if (Links.x.joy)
				{
					base.gameObject.GetComponent<Button>().spriteState = new SpriteState
					{
						highlightedSprite = this.sprite2,
						selectedSprite = this.sprite2,
						disabledSprite = this.sprite2
					};
				}
			}
		}
		if (this.type.Contains("Toggle Lethality"))
		{
			if (Records.x.kill)
			{
				this.animator.Play("Open");
			}
			else
			{
				this.animator.Play("Close");
			}
		}
		this.type == "Pause";
	}

	// Token: 0x06000E3F RID: 3647 RVA: 0x00111EC3 File Offset: 0x001100C3
	public void DoButtonFromHotkey()
	{
		this.clickedDown = true;
		this.fromHotKey = true;
		this.OnPointerUp(null);
	}

	// Token: 0x06000E40 RID: 3648 RVA: 0x00111EDC File Offset: 0x001100DC
	public void CircleOn()
	{
		if (!this.anim)
		{
			this.anim = base.gameObject.GetComponent<Animator>();
		}
		this.anim.Play("FormUp_On");
		this.anim.SetBool("Breaking", false);
	}

	// Token: 0x06000E41 RID: 3649 RVA: 0x00111F28 File Offset: 0x00110128
	public void CircleOff()
	{
		if (!this.anim)
		{
			this.anim = base.gameObject.GetComponent<Animator>();
		}
		if (!this.anim.GetBool("Breaking"))
		{
			this.anim.Play("FormUp_Off");
		}
	}

	// Token: 0x06000E42 RID: 3650 RVA: 0x00111F75 File Offset: 0x00110175
	public void CircleBreak()
	{
		this.anim.SetBool("Breaking", true);
		this.anim.Play("FormUp_Break");
	}

	// Token: 0x06000E43 RID: 3651 RVA: 0x00111F98 File Offset: 0x00110198
	public void CircleMorale(float amt)
	{
	}

	// Token: 0x06000E44 RID: 3652 RVA: 0x00111F9C File Offset: 0x0011019C
	public void OnPointerUp(PointerEventData eventData)
	{
		if (!this.clickedDown && Links.x.mk)
		{
			return;
		}
		if (Links.x.joy && !this.canInteract)
		{
			return;
		}
		if (this.mouseUp != null && (!this.onlyForController || (this.onlyForController && Links.x.joy)))
		{
			this.mouseUp.Invoke();
		}
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		if (!this.fromHotKey && Links.x.mk && Input.GetMouseButtonUp(0))
		{
			MasterAudio.PlaySoundAndForget("Click up", Random.Range(0.6f, 0.7f), new float?(1f), 0f, "", null);
		}
		this.fromHotKey = false;
		this.clickedDown = false;
		if (this.animator && this.upAnimation != "")
		{
			this.animator.Play(this.upAnimation);
		}
		if (this.type == null)
		{
			this.canInteract = false;
			return;
		}
		if (this.type == "Knowledge")
		{
			Links.x.spellcrafting.SelectLearningButton(this.id);
		}
		if (this.type == "Party Wait")
		{
			if (true)
			{
				if (!Records.x.circle && !Links.x.gameplay.makeCircleMode && !Records.x.partySailing)
				{
					Links.x.gameplay.makeCircleMode = true;
					if (Links.x.joy)
					{
						Links.x.gameplay.StartControllerTargeting();
					}
				}
				else if (!Records.x.partySailing)
				{
					if (Links.x.gameplay.makeCircleMode)
					{
						Links.x.gameplay.EndCircleMode();
					}
					else
					{
						Links.x.fellowship.BreakCircle(false);
					}
				}
				if (Records.x.circle || Links.x.gameplay.makeCircleMode)
				{
					this.CircleOn();
				}
				else
				{
					this.CircleOff();
				}
			}
			else
			{
				Links.x.gameplay.TogglePartyWait();
				if (Records.x.partyWait)
				{
					base.gameObject.GetComponent<HannahAnimator>().enabled = false;
				}
				else
				{
					base.gameObject.GetComponent<HannahAnimator>().enabled = true;
				}
			}
		}
		if ((Links.x.joy || (Links.x.mk && Time.timeSinceLevelLoad < this.timeSinceMouseDown + 0.35f && !Input.GetMouseButton(0))) && this.type == "Select Party")
		{
			SkillBag component = base.gameObject.transform.parent.gameObject.GetComponent<SkillBag>();
			bool flag = false;
			if (Links.x.main && Links.x.main.timelineIcon && Links.x.main.timelineIcon.overridePause)
			{
				flag = true;
			}
			if (!flag)
			{
				component.portrait.SelectCharacter();
			}
		}
		if (this.type.Contains("Toggle Lethality"))
		{
			Links.x.hudControl.ToggleLethality(false);
			if (Links.x.joy)
			{
				this.OnPointerEnter(null);
			}
			if (Records.x.kill)
			{
				this.animator.Play("Open");
			}
			else
			{
				this.animator.Play("Close");
			}
		}
		if (this.type == "Show Items")
		{
			if (!Links.x.inventory.groundBag.toggle)
			{
				Links.x.inventory.groundBag.toggle = true;
				this.image.sprite = this.sprite2;
			}
			else
			{
				Links.x.inventory.groundBag.toggle = false;
				this.image.sprite = this.sprite1;
			}
			this.OnPointerEnter(null);
		}
		if (this.type == "AI")
		{
			if (Records.x.ai == 0)
			{
				Records.x.ai = 1;
				Links.x.gameFeed.AddFeed("Guards will automatically attack");
				this.image.sprite = this.sprite2;
				if (Links.x.hasMain && Records.x.combat && Links.x.main.hasActions)
				{
					Links.x.combat.AddPartyToTurnList();
				}
			}
			else
			{
				Records.x.ai = 0;
				Links.x.gameFeed.AddFeed("Guards will wait for actions");
				this.image.sprite = this.sprite1;
			}
			this.OnPointerEnter(null);
		}
		if (this.type == "Pause")
		{
			if (!Records.x.paused)
			{
				Links.x.gameplay.TogglePause(true);
			}
			else
			{
				Links.x.gameplay.TogglePause(false);
			}
		}
		if (this.type.Contains("Sheep"))
		{
			if (Records.x.removeControls)
			{
				this.canInteract = false;
				return;
			}
			if (Links.x.gaia.boroControls.BoroNearby())
			{
				Links.x.gaia.boroControls.Leave();
			}
			else
			{
				Links.x.gameplay.CallBoro();
			}
		}
		if (this.type.Contains("Boro Stats"))
		{
			Links.x.hudControl.OpenBoroCard();
		}
		if (this.type == "CharacterCreationName")
		{
			Links.x.creation.InputChanged();
			Links.x.creation.input.gameObject.GetComponent<UITriggerButton>().FirstSelect();
		}
		if (this.type == "JournalScroll" && Links.x.joy)
		{
			if (!this.scroll)
			{
				this.scroll = base.gameObject.GetComponent<JournalScroll>();
			}
			if (this.scroll)
			{
				this.scroll.PointerUpFromTrigger();
			}
		}
		if (this.type == "Spin")
		{
			Links.x.creation.spinning = false;
		}
		if (this.type.Contains("Close"))
		{
			this.CloseButton();
		}
		this.canInteract = false;
	}

	// Token: 0x06000E45 RID: 3653 RVA: 0x001125EC File Offset: 0x001107EC
	public void CloseButton()
	{
		if (this.closeCoroutine == null && base.gameObject.activeSelf && !Links.x.keyboardScript.gameObject.activeSelf)
		{
			this.closeCoroutine = this.CloseButtonUp();
			base.StartCoroutine(this.closeCoroutine);
		}
	}

	// Token: 0x06000E46 RID: 3654 RVA: 0x0011263D File Offset: 0x0011083D
	private IEnumerator CloseButtonUp()
	{
		yield return new WaitForSecondsRealtime(0.1f);
		Links.x.gameplay.openingAnotherMenu = false;
		if (this.type == "Close SaveLoad" && (!Records.x.mainCharacterDead || Records.x.mainMenuOpen))
		{
			Links.x.saveLoad.StartEndMenu(true);
		}
		if (this.type == "Close ResolutionConfirm")
		{
			Links.x.options.CloseResolutionBox();
		}
		if (this.type == "Close SaveLoad MainMenu")
		{
			Links.x.saveLoad.confirmMainMenu.SetActive(false);
			Links.x.saveLoad.GetNewFirstObject();
		}
		if (this.type == "Close SaveLoad Quit")
		{
			Links.x.saveLoad.confirmQuit.SetActive(false);
			Links.x.saveLoad.GetNewFirstObject();
		}
		if (this.type == "Close SaveLoadConfirm")
		{
			Links.x.saveLoad.CloseConfirm();
			Links.x.saveLoad.GetNewFirstObject();
		}
		if (this.type == "Close CS")
		{
			Links.x.characterSheet.StartEndMenu(false, true);
		}
		if (this.type == "Close Map")
		{
			Links.x.sceneMap.StartEndMenu(true);
		}
		if (this.type == "Close LevelUp")
		{
			Links.x.characterSheet.levelUpMenu.CloseMenu();
		}
		if (this.type == "Close Rest")
		{
			Links.x.rest.CloseMenu(true);
		}
		if (this.type == "Close Forfeits")
		{
			Links.x.forfeits.CloseMenu(true);
		}
		if (this.type == "Close Note")
		{
			Links.x.characterSheet.CloseNote();
		}
		if (this.type == "Close EnchantMenu")
		{
			Links.x.inventory.enchantMenu.CloseMenu();
		}
		if (this.type == "Close Formations")
		{
			Links.x.formation.StartEndMenu(true);
		}
		if (this.type == "Close Status Effects")
		{
			Links.x.characterSheet.CloseStatusEffects();
		}
		if (this.type == "Close Options")
		{
			Links.x.options.StartEndMenu(true);
		}
		if (this.type == "Close Splitter")
		{
			Links.x.inventory.splitter.CloseFromButton();
		}
		if (this.type == "Close Remove Character")
		{
			Links.x.characterSheet.CloseRemoveFromParty();
		}
		if (this.type == "Close Character Creation")
		{
			Links.x.creation.Finish();
		}
		if (this.type == "Close Journal")
		{
			Links.x.journal.StartEndMenu(true);
		}
		if (this.type == "Close Journal Remove Scroll")
		{
			Links.x.journal.CloseRemoveScrollMenu();
		}
		if (this.type == "Close Books")
		{
			Links.x.characterSheet.booksMenu.CloseMenu();
		}
		if (this.type == "Close Tips")
		{
			Links.x.hudControl.CloseTips();
		}
		if (this.type == "Close Ruleset")
		{
			Links.x.characterSheet.CloseOutput();
		}
		if (this.type == "Close MapConfirm")
		{
			Links.x.mapConfirm.StartEndMenu();
		}
		if (this.type == "Close ArrowKit")
		{
			Links.x.arrowKit.StartClose();
		}
		if (this.type == "Close Spellcrafting")
		{
			Links.x.spellcrafting.StartEndMenu(true);
		}
		if (this.type == "Close Spellgrid")
		{
			Links.x.spellcrafting.CloseAllSpells();
		}
		if (this.type == "Close SpellDeleteConfirm")
		{
			Links.x.spellcrafting.CloseSpellDelete();
		}
		if (this.type == "Close SpellDeleteConfirmCS")
		{
			Links.x.characterSheet.booksMenu.CloseSpellDelete();
		}
		if (this.type == "Close Tutorial")
		{
			Links.x.hudControl.CloseTutorialTooltip();
		}
		if (this.type == "Close Credits")
		{
			GameObject.Find("Main Menu").GetComponent<MainMenu>().CloseCredits();
		}
		this.closeCoroutine = null;
		yield break;
	}

	// Token: 0x06000E47 RID: 3655 RVA: 0x0011264C File Offset: 0x0011084C
	public void GetRT()
	{
		this.rt = base.gameObject.GetComponent<RectTransform>();
	}

	// Token: 0x06000E48 RID: 3656 RVA: 0x0011265F File Offset: 0x0011085F
	public void GetParentRT()
	{
		this.rt = base.gameObject.transform.parent.gameObject.GetComponent<RectTransform>();
	}

	// Token: 0x06000E49 RID: 3657 RVA: 0x00112684 File Offset: 0x00110884
	public void SetPositionAtWorldPoint(Vector3 worldPoint)
	{
		Vector3 vector = Links.x.worldCamera.WorldToScreenPoint(worldPoint);
		vector.z = 0f;
		vector.x = vector.x * (1920f / (float)Screen.width) - 960f;
		vector.y = vector.y * (Links.x.canvasRT.sizeDelta.y / (float)Screen.height) - Links.x.canvasRT.sizeDelta.y / 2f;
		this.rt.localPosition = vector;
	}

	// Token: 0x04001690 RID: 5776
	public string soundName = "Clicks Stone A";

	// Token: 0x04001691 RID: 5777
	public HannahAnimator animator;

	// Token: 0x04001692 RID: 5778
	public string downAnimation;

	// Token: 0x04001693 RID: 5779
	public string upAnimation;

	// Token: 0x04001694 RID: 5780
	public string enterAnimation;

	// Token: 0x04001695 RID: 5781
	public string exitAnimation;

	// Token: 0x04001696 RID: 5782
	public string ignoreEnterAnimation;

	// Token: 0x04001697 RID: 5783
	public string type;

	// Token: 0x04001698 RID: 5784
	public Image image;

	// Token: 0x04001699 RID: 5785
	public Sprite sprite1;

	// Token: 0x0400169A RID: 5786
	public Sprite sprite2;

	// Token: 0x0400169B RID: 5787
	public bool showTooltip;

	// Token: 0x0400169C RID: 5788
	private RectTransform rt;

	// Token: 0x0400169D RID: 5789
	private Image image2;

	// Token: 0x0400169E RID: 5790
	private IEnumerator closeCoroutine;

	// Token: 0x0400169F RID: 5791
	public UnityEvent mouseUp = new UnityEvent();

	// Token: 0x040016A0 RID: 5792
	private SkillButton skillButton;

	// Token: 0x040016A1 RID: 5793
	public bool canInteract;

	// Token: 0x040016A2 RID: 5794
	public bool clickedDown;

	// Token: 0x040016A3 RID: 5795
	public TextMeshProUGUI controllerText;

	// Token: 0x040016A4 RID: 5796
	private JournalScroll scroll;

	// Token: 0x040016A5 RID: 5797
	private StringFast str = new StringFast(64);

	// Token: 0x040016A6 RID: 5798
	public bool hovering;

	// Token: 0x040016A7 RID: 5799
	public bool onlyForController;

	// Token: 0x040016A8 RID: 5800
	private bool fromHotKey;

	// Token: 0x040016A9 RID: 5801
	public int id;

	// Token: 0x040016AA RID: 5802
	public string info;

	// Token: 0x040016AB RID: 5803
	public bool state;

	// Token: 0x040016AC RID: 5804
	private float timeSinceMouseDown;

	// Token: 0x040016AD RID: 5805
	private Button btn;

	// Token: 0x040016AE RID: 5806
	private Animator anim;
}
