using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using DarkTonic.MasterAudio;
using PixelCrushers.DialogueSystem;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x020000DA RID: 218
public class Spellcrafting : MonoBehaviour
{
	// Token: 0x06001467 RID: 5223 RVA: 0x0018B29C File Offset: 0x0018949C
	private void Awake()
	{
		this.contents1.SetActive(false);
		this.anim.enabled = false;
		if (this.knowledgePrefab != null)
		{
			for (int i = 0; i < 20; i++)
			{
				this.AddPrefab();
			}
		}
		this.allSpells.SetActive(false);
		this.deletePopup.SetActive(false);
	}

	// Token: 0x06001468 RID: 5224 RVA: 0x0018B2FA File Offset: 0x001894FA
	private void Start()
	{
	}

	// Token: 0x06001469 RID: 5225 RVA: 0x0018B2FC File Offset: 0x001894FC
	public void TurnOffMainCamera()
	{
		Links.x.worldCamera.cullingMask = 1;
	}

	// Token: 0x0600146A RID: 5226 RVA: 0x0018B30E File Offset: 0x0018950E
	public void TurnOnMainCamera()
	{
		Links.x.worldCamera.cullingMask = Links.x.mainCameraMask;
	}

	// Token: 0x0600146B RID: 5227 RVA: 0x0018B330 File Offset: 0x00189530
	public void UpdateSlider()
	{
		GameObject currentEventObject = Links.x.gameplay.currentEventObject;
		if (currentEventObject)
		{
			float x = Links.x.fellowship.direction.x;
			Slider slider = null;
			if (currentEventObject == this.slider1.gameObject)
			{
				slider = this.slider1;
			}
			if (currentEventObject == this.slider2.gameObject)
			{
				slider = this.slider2;
			}
			if (currentEventObject == this.slider3.gameObject)
			{
				slider = this.slider3;
			}
			if (currentEventObject == this.tetherSlider.gameObject)
			{
				slider = this.tetherSlider;
			}
			float num = 1f;
			if (slider)
			{
				float num2 = 0.3f;
				if (Time.realtimeSinceStartup > this.lastSliderTime + num2 || this.lastSliderTime == 0f)
				{
					if (x > 0f)
					{
						slider.value += num;
					}
					else if (x < 0f)
					{
						slider.value -= num;
					}
					this.lastSliderTime = Time.realtimeSinceStartup;
				}
			}
		}
	}

	// Token: 0x0600146C RID: 5228 RVA: 0x0018B444 File Offset: 0x00189644
	public void StartMenu(bool fromCC, Character startCharacter)
	{
		this.ccBlackOverlay.SetActive(false);
		this.cancelButton.SetActive(true);
		this.drawCursor.SetActive(false);
		Records.x.inMenus = true;
		if (this.spellLimitScreen.activeSelf)
		{
			this.spellLimitScreen.SetActive(false);
		}
		Records.x.SetTypingState(true);
		for (int i = 0; i < this.knowledgeTextUsed.Count; i++)
		{
			this.knowledgeTextOpen.Add(this.knowledgeTextUsed[i]);
			this.knowledgeOpen.Add(this.knowledgeUsed[i]);
			this.knowledgeUsed[i].SetActive(false);
		}
		this.drawing.ResetTexture();
		this.knowledgeUsed.Clear();
		this.knowledgeTextUsed.Clear();
		this.resetButton.SetActive(Links.x.mk);
		this.anim.enabled = true;
		this.canvas.enabled = true;
		this.anim.Play("SpellsOpen");
		Links.x.hudControl.ChangeHudVisibility(false, true);
		this.open = true;
		this.controllerMessage.enabled = false;
		this.runeFrame.enabled = Links.x.joy;
		this.contents1.SetActive(true);
		Records.x.AddMenu(base.gameObject);
		this.party = Links.x.portraitOrder;
		this.CloseAllSpells();
		int num = 0;
		if (fromCC)
		{
			this.character = startCharacter;
			num = this.party.IndexOf(startCharacter);
		}
		else
		{
			this.character = this.party[0];
			bool flag = false;
			for (int j = 0; j < this.party.Count; j++)
			{
				if (this.party[j] && !flag && !this.party[j].isBoro)
				{
					this.knowledge = this.party[j].stats.knowledge;
					if (this.knowledge.Count > 0)
					{
						flag = true;
						this.character = this.party[j];
						num = j;
					}
				}
			}
		}
		for (int k = 0; k < this.party.Count; k++)
		{
			this.portraits[k].texture = this.party[k].characterSheetPortrait.GetTextureIdle(this.currIndex);
			if (this.character == this.party[k])
			{
				this.portraitSelected[k].enabled = true;
				Color color = this.selectedPortraitColor;
				ColorBlock colors = this.portraitButtons[k].colors;
				colors.normalColor = color;
				this.portraitButtons[k].colors = colors;
			}
			else
			{
				this.portraitSelected[k].enabled = true;
				Color color2 = this.normalPortraitColor;
				ColorBlock colors2 = this.portraitButtons[k].colors;
				colors2.normalColor = color2;
				this.portraitButtons[k].colors = colors2;
			}
		}
		this.updateTime = 0f;
		this.ChangeCharacter(num);
		Links.x.fellowship.FreshBlinks();
		this.controllerSwitchL.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		this.controllerSwitchR.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
		this.controllerSwitchL.text = "<sprite=" + Links.x.gameplay.GetControllerSprite("Synergy", Links.x.gameplay.controllerName).ToString() + ">";
		this.controllerSwitchR.text = "<sprite=" + Links.x.gameplay.GetControllerSprite("Dodge", Links.x.gameplay.controllerName).ToString() + ">";
		this.controllerSwitchL.enabled = Links.x.joy;
		this.controllerSwitchR.enabled = Links.x.joy;
		Links.x.cameraEffects.ToggleObscurance();
	}

	// Token: 0x0600146D RID: 5229 RVA: 0x0018B8A8 File Offset: 0x00189AA8
	public void CheckIfAtSpellLimit()
	{
		if (this.character.stats.SpellCount() >= this.spellLimit)
		{
			this.spellLimitScreen.SetActive(true);
			this.book1.SetActive(false);
			this.book2.SetActive(true);
			this.SetInteractables(false);
			for (int i = 0; i < this.knowledgeUsed.Count; i++)
			{
				this.knowledgeTextUsed[i].color = this.textColorNormal;
				this.knowledgeUsed[i].gameObject.GetComponent<Image>().color = this.backColorNormal;
				this.knowledgeUsed[i].gameObject.transform.GetChild(1).gameObject.GetComponent<Image>().color = this.borderColorNormal;
			}
			return;
		}
		if (this.spellLimitScreen.activeSelf)
		{
			this.spellLimitScreen.SetActive(false);
			this.book1.SetActive(true);
			this.book2.SetActive(false);
			if (this.combinedKnowledge.Count > 0)
			{
				this.SetInteractables(true);
				this.SelectLearningButton(0);
			}
		}
	}

	// Token: 0x0600146E RID: 5230 RVA: 0x0018B9C8 File Offset: 0x00189BC8
	private void Update()
	{
		if (this.open)
		{
			if (Time.realtimeSinceStartup > this.updateTime + 0.15f)
			{
				this.updateTime = Time.realtimeSinceStartup;
				this.currIndex = 0;
				for (int i = 0; i < this.party.Count; i++)
				{
					this.portraits[i].texture = this.party[i].characterSheetPortrait.GetTextureIdle(this.currIndex);
				}
			}
			if (this.combinedKnowledge.Count > 0)
			{
				this.SetCost();
				this.SetDescription();
			}
			if (!Records.x.paused)
			{
				Links.x.gameplay.TogglePause(true);
			}
			if (Links.x.inventory.gems >= this.SetCost())
			{
				this.notEnoughMoney = false;
			}
			else
			{
				this.notEnoughMoney = true;
			}
			if (this.nameInput.text == "" || !this.hasDrawn || this.notEnoughMoney || this.uniqueNames.Contains(this.nameInput.text))
			{
				if (this.combinedKnowledge.Count == 0)
				{
					this.button.interactable = false;
					this.buttonText.text = "";
				}
				else
				{
					this.button.interactable = true;
					if (this.notEnoughMoney)
					{
						this.buttonText.text = "Not enough minerals";
					}
					else if (!this.hasDrawn)
					{
						this.buttonText.text = "Missing Rune";
					}
					else if (this.uniqueNames.Contains(this.nameInput.text))
					{
						this.buttonText.text = "Name used";
					}
					else
					{
						this.buttonText.text = "Missing Name";
					}
				}
			}
			else if (this.combinedKnowledge.Count == 0)
			{
				this.button.interactable = false;
			}
			else
			{
				this.button.interactable = true;
				if (!this.character.stats.HasSpellName(this.nameInput.text))
				{
					this.buttonText.text = "Create Spell";
				}
				else
				{
					this.buttonText.text = "Duplicate Name";
				}
			}
			if (Links.x.joy)
			{
				if (Links.x.gameplay.targetDodgeStart)
				{
					int num = this.party.IndexOf(this.character);
					int num2;
					if (num == 3)
					{
						num2 = 0;
					}
					else
					{
						num2 = num + 1;
					}
					if (num2 > -1 && num2 <= 3)
					{
						this.ChangeCharacter(num2);
					}
				}
				if (Links.x.gameplay.aimStart)
				{
					int num3 = this.party.IndexOf(this.character);
					int num4;
					if (num3 == 0)
					{
						num4 = 3;
					}
					else
					{
						num4 = num3 - 1;
					}
					if (num4 > -1 && num4 <= 3)
					{
						this.ChangeCharacter(num4);
					}
				}
				if (Links.x.gameplay.currentEventObject == this.runeRT.gameObject)
				{
					if (!this.drawingRune)
					{
						this.drawingRune = true;
						this.drawPosition = this.runeRT.anchoredPosition + new Vector2(200f, 200f);
						this.drawCursor.SetActive(true);
						this.str.Clear();
						this.controllerMessage.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
						int controllerSprite = Links.x.gameplay.GetControllerSprite("Show Items", Links.x.gameplay.controllerName);
						int controllerSprite2 = Links.x.gameplay.GetControllerSprite("Right Joystick", Links.x.gameplay.controllerName);
						int controllerSprite3 = Links.x.gameplay.GetControllerSprite("Attack", Links.x.gameplay.controllerName);
						int controllerSprite4 = Links.x.gameplay.GetControllerSprite("Interact", Links.x.gameplay.controllerName);
						this.str.Append("<voffset=.4em><size=50><sprite=");
						this.str.Append(controllerSprite);
						this.str.Append("></size></voffset><cspace=.6em></cspace>Draw         <voffset=.4em><size=50><sprite=");
						this.str.Append(controllerSprite2);
						this.str.Append("></size></voffset><cspace=.6em></cspace>Move         <voffset=.4em><size=50><sprite=");
						this.str.Append(controllerSprite3);
						this.str.Append("></size></voffset><cspace=.6em></cspace>Confirm         <voffset=.4em><size=50><sprite=");
						this.str.Append(controllerSprite4);
						this.str.Append("></size></voffset><cspace=.6em></cspace>Clear");
						this.controllerMessage.text = this.str.ToString();
						this.controllerMessage.enabled = true;
					}
				}
				else if (this.drawingRune)
				{
					this.drawingRune = false;
					this.drawCursor.SetActive(false);
					this.controllerMessage.enabled = false;
				}
				GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
				bool flag = false;
				if (currentSelectedGameObject == null)
				{
					flag = true;
				}
				if (!flag && !flag)
				{
					if (this.allSpells.activeSelf)
					{
						if (currentSelectedGameObject.transform.parent != this.contentPanel2.transform)
						{
							flag = true;
						}
						if (currentSelectedGameObject == this.lastSelected)
						{
							flag = true;
						}
						if (!flag)
						{
							this.selectedRectTransform = currentSelectedGameObject.GetComponent<RectTransform>();
							float num5 = Mathf.Abs(this.selectedRectTransform.anchoredPosition.y) + this.selectedRectTransform.rect.height;
							float y = this.contentPanel2.anchoredPosition.y;
							float num6 = this.contentPanel2.anchoredPosition.y + this.scrollRectTransform2.rect.height;
							if (num5 > num6)
							{
								float num7 = num5 - this.scrollRectTransform2.rect.height + 90f;
								this.contentPanel2.anchoredPosition = new Vector2(this.contentPanel2.anchoredPosition.x, num7);
							}
							else if (Mathf.Abs(this.selectedRectTransform.anchoredPosition.y) < y)
							{
								this.contentPanel2.anchoredPosition = new Vector2(this.contentPanel2.anchoredPosition.x, Mathf.Abs(this.selectedRectTransform.anchoredPosition.y));
							}
							this.lastSelected = currentSelectedGameObject;
						}
						if (currentSelectedGameObject.name.Contains("Spell Song"))
						{
							Links.x.hudControl.JoyBounds(currentSelectedGameObject.GetComponent<UITriggerButton>().rt, currentSelectedGameObject.GetComponent<UITriggerButton>().boxOffset, false);
						}
					}
					else
					{
						if (currentSelectedGameObject.transform.parent != this.contentPanel.transform)
						{
							flag = true;
						}
						if (currentSelectedGameObject == this.lastSelected)
						{
							flag = true;
						}
						if (!flag)
						{
							this.selectedRectTransform = currentSelectedGameObject.GetComponent<RectTransform>();
							float num8 = Mathf.Abs(this.selectedRectTransform.anchoredPosition.y) + this.selectedRectTransform.rect.height;
							float y2 = this.contentPanel.anchoredPosition.y;
							float height = this.scrollRectTransform.rect.height;
							float num9 = this.contentPanel.anchoredPosition.y + height;
							if (num8 > num9)
							{
								float num10 = num8 - height + 90f;
								this.contentPanel.anchoredPosition = new Vector2(this.contentPanel.anchoredPosition.x, num10);
							}
							else if (Mathf.Abs(this.selectedRectTransform.anchoredPosition.y) < y2)
							{
								float num11 = 60f;
								this.contentPanel.anchoredPosition = new Vector2(this.contentPanel.anchoredPosition.x, Mathf.Abs(this.selectedRectTransform.anchoredPosition.y) - num11);
							}
							this.lastSelected = currentSelectedGameObject;
						}
						if (currentSelectedGameObject.name.Contains("Knowledge"))
						{
							Links.x.hudControl.JoyBounds(currentSelectedGameObject.GetComponent<UITriggerButton>().rt, currentSelectedGameObject.GetComponent<UITriggerButton>().boxOffset, false);
						}
					}
				}
			}
			if (Links.x.gameplay.currentEventObject == this.nameInput.gameObject && !Links.x.keyboardScript.gameObject.activeSelf)
			{
				if (Links.x.gameplay.actionStart)
				{
					Links.x.keyboardScript.StartMenu(this.nameInput, null, base.gameObject, "Spellcrafting");
					this.canvasGroup.interactable = false;
					this.cancelButton.SetActive(false);
				}
				if ((Links.x.fellowship.move.y < -0.25f || Links.x.fellowship.move.y > 0.25f || Links.x.gameplay.party2Down || Links.x.gameplay.partyItems3Down || Links.x.gameplay.partyItems4Down) && this.controllerMoveOutOfInputField == null)
				{
					string text = "Down";
					if (Links.x.fellowship.move.y > 0.25f)
					{
						text = "Up";
					}
					this.controllerMoveOutOfInputField = this.FieldWait(text);
					base.StartCoroutine(this.controllerMoveOutOfInputField);
				}
			}
			if (this.drawingRune && Links.x.joy)
			{
				EventSystem.current.SetSelectedGameObject(this.runeRT.gameObject);
				if (Links.x.gameplay.itemsStart)
				{
					this.drawing.joystickPosition = this.drawPosition;
					this.drawing.OnBeginDrag(null);
					this.hasDrawn = true;
				}
				float num12 = Links.x.fellowship.direction.magnitude / 2f;
				Vector2 vector = new Vector3(Links.x.fellowship.direction.x, Links.x.fellowship.direction.y) * num12 * this.drawSpeed * Time.unscaledDeltaTime;
				bool flag2 = true;
				Vector2 vector2 = this.drawPosition + vector;
				Vector3 vector3 = this.WorldToUISpace(Links.x.menuCamera.WorldToScreenPoint(vector2));
				Vector2 anchoredPosition = this.drawCursorRT.anchoredPosition;
				if (vector2.x >= this.bottomRight.anchoredPosition.x)
				{
					flag2 = false;
				}
				if (vector2.x <= this.bottomLeft.anchoredPosition.x)
				{
					flag2 = false;
				}
				if (vector2.y >= this.topRight.anchoredPosition.y)
				{
					flag2 = false;
				}
				if (vector2.y <= this.bottomRight.anchoredPosition.y)
				{
					flag2 = false;
				}
				if (flag2)
				{
					this.drawPosition += vector;
					this.drawCursorRT.anchoredPosition = vector3;
				}
				if (Links.x.gameplay.itemsDown && flag2)
				{
					float num13 = this.rectParent.anchoredPosition.x * -1f + vector3.x;
					float num14 = this.rectParent.anchoredPosition.y * -1f + vector3.y;
					this.drawing.joystickPosition = new Vector2(num13, num14);
					this.drawing.OnDrag(null);
				}
				if (Links.x.gameplay.itemsUp && Links.x.joy)
				{
					this.drawing.OnEndDrag(null);
				}
				if (Links.x.gameplay.interactStart)
				{
					this.ResetTex();
				}
				if (Links.x.gameplay.actionStart)
				{
					if (Links.x.joy)
					{
						EventSystem.current.SetSelectedGameObject(this.nameInput.gameObject);
					}
					this.drawingRune = false;
					this.drawCursor.SetActive(false);
					this.controllerMessage.enabled = false;
				}
			}
		}
	}

	// Token: 0x0600146F RID: 5231 RVA: 0x0018C5B2 File Offset: 0x0018A7B2
	private IEnumerator FieldWait(string dir)
	{
		yield return new WaitForSecondsRealtime(0.15f);
		if (dir == "Down" || dir == "Left")
		{
			EventSystem.current.SetSelectedGameObject(this.button.gameObject);
		}
		else
		{
			EventSystem.current.SetSelectedGameObject(this.runeRT.gameObject);
		}
		this.controllerMoveOutOfInputField = null;
		yield break;
	}

	// Token: 0x06001470 RID: 5232 RVA: 0x0018C5C8 File Offset: 0x0018A7C8
	public Vector3 WorldToUISpace(Vector3 screenPos)
	{
		Vector2 vector;
		RectTransformUtility.ScreenPointToLocalPointInRectangle(this.canvas.transform as RectTransform, screenPos, this.canvas.worldCamera, out vector);
		return this.canvas.transform.TransformPoint(vector);
	}

	// Token: 0x06001471 RID: 5233 RVA: 0x0018C614 File Offset: 0x0018A814
	public void Drawn()
	{
		if (!Links.x.joy)
		{
			this.hasDrawn = true;
		}
	}

	// Token: 0x06001472 RID: 5234 RVA: 0x0018C62C File Offset: 0x0018A82C
	public void Setup()
	{
		for (int i = 0; i < this.knowledgeTextUsed.Count; i++)
		{
			this.knowledgeTextOpen.Add(this.knowledgeTextUsed[i]);
			this.knowledgeOpen.Add(this.knowledgeUsed[i]);
			this.knowledgeUsed[i].SetActive(false);
		}
		this.knowledgeUsed.Clear();
		this.knowledgeTextUsed.Clear();
		if (!this.allSpells.activeSelf)
		{
			this.learningHeader.text = "Select Effect";
		}
		this.allSpellsHeader.text = this.character.stats.GetName() + "'s Spells";
		this.treeList = new string[0];
		if (Links.x.diorama.sceneName == "C5_AbandonedFarm")
		{
			this.treeList = new string[] { "HealingSpores", "VinePrison", "VineCocoon", "SlipSlime", "SporeFloat", "PukeSpores", "VineWall", "LizardTrap", "FrogTrap" };
		}
		if (Links.x.diorama.sceneName == "C6_FortenLazure")
		{
			this.treeList = new string[]
			{
				"CorpseNest", "SporeFloat", "SlipSlime", "AttractionSpores", "Entangle", "SilentMoss", "AcornMen", "VineWall", "RolyTrap", "FrogTrap",
				"VinePrison", "PukeSpores"
			};
		}
		if (Links.x.diorama.sceneName == "C6_Cave" && QuestLog.GetQuestState("C6_DryadVolTree") == QuestState.Success)
		{
			this.treeList = new string[] { "JumpFrog" };
		}
		if (Links.x.diorama.sceneName == "D6_Rozafir")
		{
			this.treeList = new string[] { "FindShroomer", "FindFish", "FindForest" };
		}
		this.knowledge = this.character.stats.knowledge;
		this.combinedKnowledge.Clear();
		int num = 0;
		foreach (string text in this.treeList)
		{
			if (!this.knowledge.Contains(text))
			{
				this.combinedKnowledge.Add(text);
				num++;
			}
		}
		foreach (string text2 in this.knowledge)
		{
			this.combinedKnowledge.Add(text2);
		}
		int num2 = Links.x.inventory.PartyMineralCount();
		this.partyMinerals.text = "Collected minerals: " + num2.ToString();
		this.knowledgeHeader1.text = "Effects " + this.character.stats.GetName() + " can learn from tree";
		this.knowledgeHeader2.text = this.character.stats.GetName() + "'s known effects";
		int count = this.combinedKnowledge.Count;
		for (int k = count - 1; k >= 0; k--)
		{
			if (this.knowledgeOpen.Count == 0)
			{
				this.AddPrefab();
			}
			GameObject gameObject = this.knowledgeOpen[0];
			TextMeshProUGUI textMeshProUGUI = this.knowledgeTextOpen[0];
			this.knowledgeOpen.RemoveAt(0);
			this.knowledgeTextOpen.RemoveAt(0);
			this.knowledgeUsed.Add(gameObject);
			this.knowledgeTextUsed.Add(textMeshProUGUI);
			gameObject.SetActive(true);
			Library.Pagan paganRow = Links.x.library.GetPaganRow(this.combinedKnowledge[k]);
			this.str.Clear();
			this.str.Append("<font=Bold>");
			this.str.Append(paganRow._DisplayName);
			this.str.Append("</font>\n<size=.8em>");
			this.str.Append(paganRow._School);
			this.str.Append(" Effect: ");
			this.str.Append(paganRow._Description);
			this.str.Append("</size>");
			textMeshProUGUI.text = this.str.ToString();
			float preferredHeight = textMeshProUGUI.preferredHeight;
			textMeshProUGUI.rectTransform.sizeDelta = new Vector2(565f, preferredHeight + 30f);
			gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(565f, preferredHeight + 30f);
			gameObject.GetComponent<AnimateButton>().id = k;
			if (k == count - 1)
			{
			}
			if (k < num)
			{
				gameObject.transform.GetChild(2).gameObject.SetActive(true);
				gameObject.transform.GetChild(2).GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = "+" + paganRow._LearningCost.ToString();
			}
			else
			{
				gameObject.transform.GetChild(2).gameObject.SetActive(false);
			}
			gameObject.transform.SetAsFirstSibling();
		}
		this.forSaleHeader.SetAsFirstSibling();
		this.learnedHeader.SetSiblingIndex(num + 1);
		if (this.combinedKnowledge.Count == 0)
		{
			this.SetInteractables(false);
		}
		else
		{
			this.SetInteractables(true);
			this.SelectLearningButton(0);
		}
		this.contentTr.gameObject.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f);
	}

	// Token: 0x06001473 RID: 5235 RVA: 0x0018CC28 File Offset: 0x0018AE28
	public void UpdateKnowledgeOrder()
	{
	}

	// Token: 0x06001474 RID: 5236 RVA: 0x0018CC2C File Offset: 0x0018AE2C
	public Button GetFirstKnowledge()
	{
		Transform parent = this.forSaleHeader.parent;
		Button button = null;
		foreach (object obj in parent)
		{
			Transform transform = (Transform)obj;
			if (!button)
			{
				button = transform.gameObject.GetComponent<Button>();
				if (button)
				{
					break;
				}
			}
		}
		return button;
	}

	// Token: 0x06001475 RID: 5237 RVA: 0x0018CCA4 File Offset: 0x0018AEA4
	public void SelectLearningButton(int num)
	{
		int num2 = num;
		if (num > -1)
		{
			num = this.combinedKnowledge.Count - 1 - num;
		}
		if (this.spellLimitScreen.activeSelf && num > -1)
		{
			return;
		}
		if (this.fromEnchantMenu)
		{
			this.SetInteractables(false);
		}
		if (num > -1)
		{
			this.SetInteractables(true);
			for (int i = 0; i < this.knowledgeUsed.Count; i++)
			{
				if (i == num)
				{
					this.knowledgeTextUsed[i].color = this.textColorSelected;
					this.knowledgeUsed[i].gameObject.GetComponent<Image>().color = this.backColorSelected;
					this.knowledgeUsed[i].gameObject.transform.GetChild(1).gameObject.GetComponent<Image>().color = this.borderColorSelected;
				}
				else
				{
					this.knowledgeTextUsed[i].color = this.textColorNormal;
					this.knowledgeUsed[i].gameObject.GetComponent<Image>().color = this.backColorNormal;
					this.knowledgeUsed[i].gameObject.transform.GetChild(1).gameObject.GetComponent<Image>().color = this.borderColorNormal;
				}
			}
			this.currentLearning = num2;
			this.selectedPagan = Links.x.library.GetPaganRow(this.combinedKnowledge[num2]);
		}
		if (this.selectedPagan == null)
		{
			Debug.Log("Selected pagan row is null " + num2.ToString());
			return;
		}
		this.slider1.wholeNumbers = true;
		this.slider2.wholeNumbers = true;
		this.slider3.wholeNumbers = Records.x.SpellWholeNumber(this.selectedPagan._Slider3);
		if (this.fromEnchantMenu)
		{
			this.enchant.slider1.wholeNumbers = true;
			this.enchant.slider2.wholeNumbers = true;
			this.enchant.slider3.wholeNumbers = true;
		}
		if (this.selectedPagan._Slider1 != "")
		{
			this.slider1.interactable = true;
			this.slider1.enabled = true;
			this.slider1Image.enabled = true;
			this.slider1label.enabled = true;
			this.slider1Min.enabled = true;
			this.slider1Max.enabled = true;
			float num3 = this.selectedPagan._Slider1Min;
			float num4 = this.selectedPagan._Slider1Max;
			this.slider1label.text = this.selectedPagan._Slider1;
			if (this.selectedPagan._Slider1 == "PartyTarget")
			{
				this.slider1Max.text = "Party";
				this.slider1Min.text = "Single";
			}
			else
			{
				this.slider1Min.text = num3.ToString();
				this.slider1Max.text = num4.ToString();
			}
			this.slider1.maxValue = num4;
			this.slider1.minValue = num3;
			this.slider1.value = num3;
			this.sliderBg1.enabled = true;
		}
		else
		{
			this.slider1.interactable = false;
			this.slider1.enabled = false;
			this.slider1Image.enabled = false;
			this.slider1label.enabled = false;
			this.slider1Min.enabled = false;
			this.slider1Max.enabled = false;
			this.sliderBg1.enabled = false;
		}
		if (this.selectedPagan._Slider2 != "")
		{
			float num5 = this.selectedPagan._Slider2Min;
			float num6 = this.selectedPagan._Slider2Max;
			this.slider2.interactable = true;
			this.slider2.enabled = true;
			this.slider2Image.enabled = true;
			this.slider2label.enabled = true;
			this.slider2Min.enabled = true;
			this.slider2Max.enabled = true;
			this.slider2label.text = this.selectedPagan._Slider2;
			if (this.selectedPagan._Slider2 == "PartyTarget")
			{
				this.slider2Max.text = "Party";
				this.slider2Min.text = "Single";
			}
			else
			{
				this.slider2Min.text = num5.ToString();
				this.slider2Max.text = num6.ToString();
			}
			this.slider2.maxValue = num6;
			this.slider2.minValue = num5;
			this.slider2.value = num5;
			this.sliderBg2.enabled = true;
			Navigation navigation = this.slider1.navigation;
			navigation.selectOnDown = this.slider2;
			this.slider1.navigation = navigation;
		}
		else
		{
			this.slider2.enabled = false;
			this.slider2.interactable = false;
			this.slider2Image.enabled = false;
			this.slider2label.enabled = false;
			this.slider2Min.enabled = false;
			this.slider2Max.enabled = false;
			this.sliderBg2.enabled = false;
			Navigation navigation2 = this.slider1.navigation;
			if (this.selectedPagan._NeedsTether)
			{
				navigation2.selectOnDown = this.tetherSlider;
			}
			else
			{
				navigation2.selectOnDown = this.button;
			}
			this.slider1.navigation = navigation2;
		}
		if (this.selectedPagan._Slider3 != "")
		{
			this.slider3.interactable = true;
			this.slider3.enabled = true;
			this.slider3Image.enabled = true;
			this.slider3label.enabled = true;
			this.slider3Min.enabled = true;
			this.slider3Max.enabled = true;
			float num7 = this.selectedPagan._Slider3Min;
			float num8 = this.selectedPagan._Slider3Max;
			this.slider3label.text = this.selectedPagan._Slider3;
			if (this.selectedPagan._Slider3 == "PartyTarget")
			{
				this.slider3Max.text = "Party";
				this.slider3Min.text = "Single";
			}
			else if (this.selectedPagan._Slider3 == "Movement")
			{
				this.slider3Max.text = "Targeted";
				this.slider3Min.text = "Random";
			}
			else
			{
				this.slider3Min.text = num7.ToString();
				this.slider3Max.text = num8.ToString();
			}
			if (this.selectedPagan._Slider3 == "Summons")
			{
				this.slider3label.text = "Summon Clumps";
			}
			this.slider3.maxValue = num8;
			this.slider3.minValue = num7;
			this.slider3.value = num7;
			this.sliderBg3.enabled = true;
			Navigation navigation3 = this.slider2.navigation;
			navigation3.selectOnDown = this.slider3;
			this.slider2.navigation = navigation3;
		}
		else
		{
			this.slider3.enabled = false;
			this.slider3.interactable = false;
			this.slider3Image.enabled = false;
			this.slider3label.enabled = false;
			this.slider3Min.enabled = false;
			this.slider3Max.enabled = false;
			this.sliderBg3.enabled = false;
			Navigation navigation4 = this.slider2.navigation;
			if (this.selectedPagan._NeedsTether)
			{
				navigation4.selectOnDown = this.tetherSlider;
			}
			else
			{
				navigation4.selectOnDown = this.button;
			}
			this.slider2.navigation = navigation4;
		}
		if (this.selectedPagan._NeedsTether)
		{
			this.tetherSlider.gameObject.transform.parent.gameObject.SetActive(true);
			this.tetherSlider.value = this.tetherSlider.minValue;
			this.tetherSlider.interactable = true;
			this.tetherSlider.maxValue = (float)this.GetMax("Tether");
			this.tetherMax.text = this.tetherSlider.maxValue.ToString();
			this.tetherSlider.minValue = 0f;
			this.tetherLabel.enabled = true;
			this.tetherMin.text = this.tetherSlider.minValue.ToString();
			this.tetherMin.enabled = true;
			this.tetherMax.enabled = true;
			this.tetherImage.enabled = true;
			Navigation navigation5 = this.slider3.navigation;
			navigation5.selectOnDown = this.tetherSlider;
			this.slider3.navigation = navigation5;
			navigation5 = this.tetherSlider.navigation;
			if (this.slider3.interactable)
			{
				navigation5.selectOnUp = this.slider3;
			}
			else if (this.slider2.interactable)
			{
				navigation5.selectOnUp = this.slider2;
			}
			else
			{
				navigation5.selectOnUp = this.slider1;
			}
			this.tetherSlider.navigation = navigation5;
			navigation5 = this.button.navigation;
			navigation5.selectOnUp = this.tetherSlider;
			this.button.navigation = navigation5;
		}
		else
		{
			this.tetherSlider.gameObject.transform.parent.gameObject.SetActive(false);
			this.tetherSlider.value = 0f;
			this.tetherSlider.interactable = false;
			this.tetherSlider.maxValue = (float)this.GetMax("Tether");
			this.tetherLabel.enabled = false;
			this.tetherMin.enabled = false;
			this.tetherMax.enabled = false;
			this.tetherImage.enabled = false;
			Navigation navigation6 = this.button.navigation;
			if (this.slider3.interactable)
			{
				navigation6.selectOnUp = this.slider3;
			}
			else if (this.slider2.interactable)
			{
				navigation6.selectOnUp = this.slider2;
			}
			else
			{
				navigation6.selectOnUp = this.slider1;
			}
			navigation6.selectOnDown = this.tetherSlider;
			this.button.navigation = navigation6;
			navigation6 = this.slider3.navigation;
			navigation6.selectOnDown = this.button;
			this.slider3.navigation = navigation6;
		}
		if (this.fromEnchantMenu)
		{
			this.enchant.slider1.interactable = this.slider1.interactable;
			this.enchant.slider1Image.enabled = this.slider1Image.enabled;
			this.enchant.slider1label.enabled = this.slider1label.enabled;
			this.enchant.slider1Min.enabled = this.slider1Min.enabled;
			this.enchant.slider1Max.enabled = this.slider1Max.enabled;
			this.enchant.slider1label.text = this.slider1label.text;
			if (this.selectedPagan._Slider1 == "Radius")
			{
				this.slider1.minValue = 1f;
				this.slider1.value = 1f;
			}
			this.enchant.slider1.minValue = this.slider1.minValue;
			float num9 = Mathf.Round(this.slider1.minValue * this.characterSkill) + 1f;
			if (num9 > this.slider1.maxValue)
			{
				num9 = this.slider1.maxValue;
			}
			if (num9 < this.slider1.minValue)
			{
				num9 = this.slider1.minValue;
			}
			this.enchant.slider1.maxValue = this.slider1.maxValue;
			this.enchant.slider1Max.text = this.enchant.slider1.maxValue.ToString();
			this.enchant.slider1.value = this.enchant.slider1.minValue;
			this.enchant.slider1Min.text = this.enchant.slider1.minValue.ToString();
			this.enchant.slider2.interactable = this.slider2.interactable;
			this.enchant.slider2Image.enabled = this.slider2Image.enabled;
			this.enchant.slider2label.enabled = this.slider2label.enabled;
			this.enchant.slider2Min.enabled = this.slider2Min.enabled;
			this.enchant.slider2Max.enabled = this.slider2Max.enabled;
			this.enchant.slider2label.text = this.slider2label.text;
			if (this.selectedPagan._Slider2 == "Radius")
			{
				this.slider2.minValue = 1f;
				this.slider2.value = 1f;
			}
			this.enchant.slider2.minValue = this.slider2.minValue;
			num9 = Mathf.Round(this.slider2.minValue * this.characterSkill) + 1f;
			if (num9 > this.slider2.maxValue)
			{
				num9 = this.slider2.maxValue;
			}
			if (num9 < this.slider2.minValue)
			{
				num9 = this.slider2.minValue;
			}
			this.enchant.slider2.maxValue = this.slider2.maxValue;
			this.enchant.slider2Max.text = this.enchant.slider2.maxValue.ToString();
			this.enchant.slider2.value = this.enchant.slider2.minValue;
			this.enchant.slider2Min.text = this.enchant.slider2.minValue.ToString();
			if (this.selectedPagan._Slider2 != "")
			{
				this.enchant.slider2.gameObject.SetActive(true);
			}
			else
			{
				this.enchant.slider2.gameObject.SetActive(false);
			}
			if (this.enchant.slider2.interactable)
			{
				this.enchant.slider1.gameObject.GetComponent<UITriggerButton>().selectNext = this.enchant.slider2.gameObject;
			}
			else
			{
				this.enchant.slider1.gameObject.GetComponent<UITriggerButton>().selectNext = this.enchant.confirmButton.gameObject;
			}
			if (this.enchant.slider3.interactable)
			{
				this.enchant.slider2.gameObject.GetComponent<UITriggerButton>().selectNext = this.enchant.slider3.gameObject;
			}
			else
			{
				this.enchant.slider2.gameObject.GetComponent<UITriggerButton>().selectNext = this.enchant.confirmButton.gameObject;
			}
			this.enchant.slider3.interactable = this.slider3.interactable;
			this.enchant.slider3Image.enabled = this.slider3Image.enabled;
			this.enchant.slider3label.enabled = this.slider3label.enabled;
			this.enchant.slider3Min.enabled = this.slider3Min.enabled;
			this.enchant.slider3Max.enabled = this.slider3Max.enabled;
			this.enchant.slider3label.text = this.slider3label.text;
			if (this.selectedPagan._Slider3 == "Radius")
			{
				this.slider3.minValue = 1f;
				this.slider3.value = 1f;
			}
			this.enchant.slider3.minValue = this.slider3.minValue;
			num9 = Mathf.Round(this.slider3.minValue * this.characterSkill) + 1f;
			if (num9 > this.slider3.maxValue)
			{
				num9 = this.slider3.maxValue;
			}
			if (num9 < this.slider3.minValue)
			{
				num9 = this.slider3.minValue;
			}
			this.enchant.slider3.maxValue = this.slider3.maxValue;
			this.enchant.slider3Max.text = this.enchant.slider3.maxValue.ToString();
			this.enchant.slider3.value = this.enchant.slider3.minValue;
			this.enchant.slider3Min.text = this.enchant.slider3.minValue.ToString();
			if (this.selectedPagan._Slider3 != "")
			{
				this.enchant.slider3.gameObject.SetActive(true);
			}
			else
			{
				this.enchant.slider3.gameObject.SetActive(false);
			}
		}
		this.resourceSlider.value = this.resourceSlider.maxValue;
		if (num > -1)
		{
			this.SetCost();
			this.SetDescription();
			this.nameInput.text = "";
			this.nameInput.placeholder.gameObject.SetActive(true);
		}
	}

	// Token: 0x06001476 RID: 5238 RVA: 0x0018DE2C File Offset: 0x0018C02C
	public void ChangeCharacter(int num)
	{
		if (Links.x.mk)
		{
			EventSystem.current.SetSelectedGameObject(null);
		}
		this.character = this.party[num];
		this.SetSpellbookGrid("Spells", this.character, "", true);
		for (int i = 0; i < this.party.Count; i++)
		{
			if (i == num)
			{
				this.portraitSelected[i].enabled = true;
				Color color = this.selectedPortraitColor;
				ColorBlock colors = this.portraitButtons[i].colors;
				colors.normalColor = color;
				this.portraitButtons[i].colors = colors;
			}
			else
			{
				this.portraitSelected[i].enabled = true;
				Color color2 = this.normalPortraitColor;
				ColorBlock colors2 = this.portraitButtons[i].colors;
				colors2.normalColor = color2;
				this.portraitButtons[i].colors = colors2;
			}
		}
		this.Setup();
		this.CheckIfAtSpellLimit();
		if (this.allSpells.activeSelf)
		{
			this.learningHeader.text = this.character.stats.GetName() + "'s Spells";
		}
		if (Links.x.joy)
		{
			Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.button.gameObject);
		}
	}

	// Token: 0x06001477 RID: 5239 RVA: 0x0018DF90 File Offset: 0x0018C190
	public void StopEditingText()
	{
	}

	// Token: 0x06001478 RID: 5240 RVA: 0x0018DF92 File Offset: 0x0018C192
	public void StartEditingText()
	{
	}

	// Token: 0x06001479 RID: 5241 RVA: 0x0018DF94 File Offset: 0x0018C194
	private IEnumerator Keyboard()
	{
		yield return new WaitForSecondsRealtime(0.0001f);
		if (Links.x.joy)
		{
			Links.x.keyboardScript.StartMenu(this.nameInput, null, base.gameObject, "Spellcrafting");
			this.canvasGroup.interactable = false;
			this.cancelButton.SetActive(false);
		}
		yield break;
	}

	// Token: 0x0600147A RID: 5242 RVA: 0x0018DFA4 File Offset: 0x0018C1A4
	public void EndTypingName()
	{
		if (Links.x.joy)
		{
			this.canvasGroup.interactable = true;
			if (Links.x.joy)
			{
				EventSystem.current.SetSelectedGameObject(this.button.gameObject);
			}
			this.cancelButton.SetActive(true);
		}
	}

	// Token: 0x0600147B RID: 5243 RVA: 0x0018DFF6 File Offset: 0x0018C1F6
	public void ResetTex()
	{
		this.hasDrawn = false;
		this.drawing.ResetTexture();
	}

	// Token: 0x0600147C RID: 5244 RVA: 0x0018E00C File Offset: 0x0018C20C
	public void Confirm()
	{
		if (!(this.nameInput.text == "") && this.hasDrawn && !this.notEnoughMoney)
		{
			this.confirming = true;
			this.anim1Image.enabled = true;
			this.anim2Image.enabled = true;
			this.anim3Image.enabled = true;
			this.anim4Image.enabled = true;
			this.anim5Image.enabled = true;
			this.anim6Image.enabled = true;
			this.anim1VignImage.enabled = true;
			this.anim2VignImage.enabled = true;
			this.anim3VignImage.enabled = true;
			this.anim4VignImage.enabled = true;
			this.anim5VignImage.enabled = true;
			this.anim6VignImage.enabled = true;
			Links.x.inventory.RemoveMinerals(this.SetCost());
			base.StartCoroutine(this.Confirming(this.nameInput.text, Mathf.RoundToInt(this.slider1.value), Mathf.RoundToInt(this.slider2.value), Mathf.RoundToInt(this.slider3.value), Mathf.RoundToInt(this.tetherSlider.value), new Vector2((float)this.GetSpiritCost(), 0f)));
		}
	}

	// Token: 0x0600147D RID: 5245 RVA: 0x0018E15E File Offset: 0x0018C35E
	private IEnumerator Confirming(string spellname, int s1, int s2, int s3, int teth, Vector2 res)
	{
		string i = this.nameInput.text;
		yield return new WaitForEndOfFrame();
		string fileName = string.Concat(new string[]
		{
			Application.persistentDataPath,
			"/AutoSave/",
			i,
			"_",
			this.character.stats.partyID.ToString(),
			".png"
		});
		Vector3[] array = new Vector3[4];
		this.drawing.gameObject.GetComponent<RectTransform>().GetWorldCorners(array);
		Vector2 vector = RectTransformUtility.WorldToScreenPoint(Links.x.menuCamera, array[0]);
		Vector2 vector2 = RectTransformUtility.WorldToScreenPoint(Links.x.menuCamera, array[1]);
		ref Vector2 ptr = RectTransformUtility.WorldToScreenPoint(Links.x.menuCamera, array[2]);
		int num = Mathf.RoundToInt(vector2.y - vector.y);
		int num2 = Mathf.RoundToInt(ptr.x - vector.x);
		Texture2D texture2D = new Texture2D(num2, num, TextureFormat.RGB24, false);
		Rect rect = new Rect(Mathf.Round(vector.x), Mathf.Round(vector.y), (float)num2, (float)num);
		texture2D.ReadPixels(rect, 0, 0);
		texture2D.Apply();
		if (num2 > 256)
		{
			Texture2D texture2D2 = this.ScaleTexture(texture2D, 256, 256);
			byte[] array2 = texture2D2.EncodeToPNG();
			Object.Destroy(texture2D);
			Object.Destroy(texture2D2);
			File.WriteAllBytes(fileName, array2);
		}
		else
		{
			byte[] array3 = texture2D.EncodeToPNG();
			Object.Destroy(texture2D);
			File.WriteAllBytes(fileName, array3);
		}
		this.anim1.Play("1");
		this.anim2.Play("1");
		this.anim3.Play("1");
		this.anim4.Play("1");
		this.anim5.Play("1");
		this.anim6.Play("1");
		while (this.anim1.enabled)
		{
			yield return null;
		}
		this.character.stats.AddPaganKnowledge(this.selectedPagan._ID);
		this.character.stats.SaveSpell(this.selectedPagan._ID, spellname, s1, s2, s3, teth, res);
		int num3 = Random.Range(0, 3);
		if (num3 == 0)
		{
			MasterAudio.PlaySoundAndForget("Feedback", Random.Range(0.5f, 0.6f), new float?(1f), 0f, "IntercessionA", null);
		}
		if (num3 == 1)
		{
			MasterAudio.PlaySoundAndForget("Feedback", Random.Range(0.5f, 0.6f), new float?(1f), 0f, "IntercessionB", null);
		}
		if (num3 == 2)
		{
			MasterAudio.PlaySoundAndForget("Feedback", Random.Range(0.5f, 0.6f), new float?(1f), 0f, "IntercessionC", null);
		}
		for (int j = 0; j < this.knowledgeUsed.Count; j++)
		{
			this.knowledgeTextUsed[j].color = this.textColorNormal;
			this.knowledgeUsed[j].gameObject.GetComponent<Image>().color = this.backColorNormal;
			this.knowledgeUsed[j].gameObject.transform.GetChild(1).gameObject.GetComponent<Image>().color = this.borderColorNormal;
		}
		this.fx1.Play("Idle");
		this.str.Clear();
		this.str.Append(this.character.stats.GetName());
		string text = "Bold";
		this.str.Append(" crafted a new spell\n<size=1.6em><font=");
		this.str.Append(text);
		this.str.Append(">");
		this.str.Append(i);
		this.str.Append("</font></size>");
		this.confirmImage.SetActive(true);
		Sprite sprite = Links.x.archives.AddRune(spellname, fileName, this.character.stats.partyID.ToString(), this.selectedPagan._ID);
		this.confirmSpellImage.sprite = sprite;
		this.confirmText.enabled = true;
		this.confirmText.text = this.str.ToString();
		this.fx1.Play("Idle");
		yield return new WaitForSecondsRealtime(2f);
		this.SetSpellbookGrid("Spells", this.character, "", true);
		MasterAudio.PlaySoundAndForget("Feedback", 0.3f, new float?(1f), 0f, "Highlight Window", null);
		this.fx2.Play("Idle");
		yield return new WaitForSecondsRealtime(1f);
		this.confirmImage.SetActive(false);
		this.confirmText.enabled = false;
		this.SetInteractables(false);
		this.ResetTex();
		this.anim1.Play("2");
		this.anim2.Play("2");
		this.anim3.Play("2");
		this.anim4.Play("2");
		this.anim5.Play("2");
		this.anim6.Play("2");
		yield return new WaitForSecondsRealtime(0.1f);
		while (this.anim1.enabled)
		{
			yield return null;
		}
		this.confirming = false;
		this.anim1Image.enabled = false;
		this.anim2Image.enabled = false;
		this.anim3Image.enabled = false;
		this.anim4Image.enabled = false;
		this.anim5Image.enabled = false;
		this.anim6Image.enabled = false;
		this.anim1VignImage.enabled = false;
		this.anim2VignImage.enabled = false;
		this.anim3VignImage.enabled = false;
		this.anim4VignImage.enabled = false;
		this.anim5VignImage.enabled = false;
		this.anim6VignImage.enabled = false;
		this.Setup();
		this.CheckIfAtSpellLimit();
		if (Links.x.joy)
		{
			Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.button.gameObject);
		}
		this.hasDrawn = false;
		yield break;
	}

	// Token: 0x0600147E RID: 5246 RVA: 0x0018E19C File Offset: 0x0018C39C
	private int SetCost()
	{
		if (this.selectedPagan != null)
		{
			int num = this.selectedPagan._Difficulty;
			if (this.open && !this.character.stats.HasPaganKnowledge(this.selectedPagan._ID))
			{
				num += this.selectedPagan._LearningCost;
			}
			if (this.slider1.interactable)
			{
				num += Mathf.RoundToInt(this.slider1.value) * (int)Records.x.SpellCostWeight(this.selectedPagan._Slider1);
			}
			if (this.slider2.interactable)
			{
				num += Mathf.RoundToInt(this.slider2.value) * (int)Records.x.SpellCostWeight(this.selectedPagan._Slider2);
			}
			if (this.slider3.interactable)
			{
				num += Mathf.RoundToInt(this.slider3.value) * (int)Records.x.SpellCostWeight(this.selectedPagan._Slider3);
			}
			num += Mathf.RoundToInt(this.tetherSlider.value) * (int)Records.x.SpellCostWeight("Tether");
			this.cost.text = "Minerals: ";
			if (num <= Links.x.inventory.gems)
			{
				TextMeshProUGUI textMeshProUGUI = this.cost;
				textMeshProUGUI.text += "<color=#D497C2>";
			}
			else
			{
				TextMeshProUGUI textMeshProUGUI2 = this.cost;
				textMeshProUGUI2.text += "<color=#C3582F>";
			}
			TextMeshProUGUI textMeshProUGUI3 = this.cost;
			textMeshProUGUI3.text += num.ToString();
			TextMeshProUGUI textMeshProUGUI4 = this.cost;
			textMeshProUGUI4.text += "</color><size=.7em>/";
			TextMeshProUGUI textMeshProUGUI5 = this.cost;
			textMeshProUGUI5.text += Links.x.inventory.gems.ToString();
			TextMeshProUGUI textMeshProUGUI6 = this.cost;
			textMeshProUGUI6.text += "</size>";
			return num;
		}
		return 0;
	}

	// Token: 0x0600147F RID: 5247 RVA: 0x0018E398 File Offset: 0x0018C598
	public void UpdateVariablesFromEnchantMenu()
	{
		this.slider1.value = this.enchant.slider1.value;
		this.slider2.value = this.enchant.slider2.value;
		this.slider3.value = this.enchant.slider3.value;
		this.tetherSlider.value = this.enchant.tetherSlider.value;
	}

	// Token: 0x06001480 RID: 5248 RVA: 0x0018E418 File Offset: 0x0018C618
	public string SetDescription()
	{
		this.str.Clear();
		if (!this.fromEnchantMenu)
		{
			this.str.Append("<font=Bold><size=1.5em>");
			this.str.Append(this.selectedPagan._DisplayName);
			this.str.Append("</size></font>\n");
		}
		this.str.Append(this.selectedPagan._DynamicDescriptionStart);
		string text;
		if (this.fromEnchantMenu)
		{
			text = Records.x.PaganDescription(this.selectedPagan, this.slider1.value, this.slider2.value, this.slider3.value);
		}
		else
		{
			text = Records.x.PaganDescription(this.selectedPagan, (float)Mathf.RoundToInt(this.slider1.value), (float)Mathf.RoundToInt(this.slider2.value), (float)Mathf.RoundToInt(this.slider3.value));
		}
		this.str.Append(text);
		if (this.fromEnchantMenu)
		{
			this.str.Append(".");
		}
		else
		{
			this.str.Append(".");
			this.str.Append("\n");
			if (this.tetherSlider.gameObject.activeInHierarchy)
			{
				this.str.Append(".\n<font=Bold>Overpower Strength: </font>");
				this.str.Append(this.R2(this.tetherSlider.value));
			}
			this.str.Append("\n<font=Bold>Spirit Cost: </font>");
			this.str.Append(this.GetSpiritCost());
			this.str.Append(" spirit");
			this.str.Append("\n<font=Bold>Spell Challenge: </font>");
			float num = Records.x.SpellDifficulty(this.selectedPagan, this.slider1.value, this.slider2.value, this.slider3.value);
			this.str.Append(num);
			float num2 = this.character.stats.PaganHitChance(true, this.selectedPagan._School);
			if (num2 >= num)
			{
				this.str.Append(" (vs. <color=#CA8C1E>");
			}
			else
			{
				this.str.Append(" (vs. <color=#F3482F>");
			}
			this.str.Append(this.character.stats.GetName());
			this.str.Append("'s ");
			this.str.Append(num2);
			this.str.Append("</color>)");
		}
		this.description.text = this.str.ToString();
		return this.description.text;
	}

	// Token: 0x06001481 RID: 5249 RVA: 0x0018E6D1 File Offset: 0x0018C8D1
	public void UpdateSlider(int num)
	{
		this.SetCost();
	}

	// Token: 0x06001482 RID: 5250 RVA: 0x0018E6DC File Offset: 0x0018C8DC
	public int GetSpiritCost()
	{
		int num = 0;
		if (this.slider1.interactable)
		{
			num += Mathf.RoundToInt(this.slider1.value) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider1));
		}
		if (this.slider2.interactable)
		{
			num += Mathf.RoundToInt(this.slider2.value) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider2));
		}
		if (this.slider3.interactable)
		{
			num += Mathf.RoundToInt(this.slider3.value) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider3));
		}
		int num2 = 0;
		if (this.slider1.interactable)
		{
			num2 += Mathf.RoundToInt(this.slider1.minValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider1));
		}
		if (this.slider2.interactable)
		{
			num2 += Mathf.RoundToInt(this.slider2.minValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider2));
		}
		if (this.slider3.interactable)
		{
			num2 += Mathf.RoundToInt(this.slider3.minValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider3));
		}
		int num3 = 0;
		if (this.slider1.interactable)
		{
			num3 += Mathf.RoundToInt(this.slider1.maxValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider1));
		}
		if (this.slider2.interactable)
		{
			num3 += Mathf.RoundToInt(this.slider2.maxValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider2));
		}
		if (this.slider3.interactable)
		{
			num3 += Mathf.RoundToInt(this.slider3.maxValue) * Mathf.RoundToInt(Records.x.SpellCostWeight(this.selectedPagan._Slider3));
		}
		float num4 = (float)num3 - (float)num2;
		float num5 = ((float)num - (float)num2) / num4;
		if (num5 <= 0.33f)
		{
			return 1;
		}
		if (num5 > 0.33f && num5 <= 0.66f)
		{
			return 2;
		}
		return 3;
	}

	// Token: 0x06001483 RID: 5251 RVA: 0x0018E934 File Offset: 0x0018CB34
	public void StartEndMenu(bool fromCloseButton)
	{
		Links.x.gameplay.TogglePause(false);
		this.anim.Play("SpellsClose");
		this.drawingRune = false;
		Links.x.hudControl.JoyBox(false);
		this.open = false;
		this.TurnOnMainCamera();
		Links.x.cameraEffects.ToggleObscurance();
	}

	// Token: 0x06001484 RID: 5252 RVA: 0x0018E994 File Offset: 0x0018CB94
	public void EndMenu()
	{
		this.open = false;
		this.contents1.SetActive(false);
		Records.x.SetTypingState(false);
		Records.x.inMenus = false;
		Records.x.RemoveMenu(base.gameObject);
		this.anim.enabled = false;
		this.canvas.enabled = false;
		Links.x.hudControl.ChangeHudVisibility(true, true);
		this.drawingRune = false;
		this.hasDrawn = false;
	}

	// Token: 0x06001485 RID: 5253 RVA: 0x0018EA14 File Offset: 0x0018CC14
	public void OpenAllSpells()
	{
		if (this.allSpells.activeSelf)
		{
			this.CloseAllSpells();
			return;
		}
		this.learningHeader.text = this.character.stats.GetName() + "'s Spells";
		this.anim.Play("SpellsOpenGrid");
		this.contentTr.gameObject.SetActive(false);
		bool flag = false;
		if (this.spells.Count > 0)
		{
			flag = true;
			if (Links.x.joy)
			{
				EventSystem.current.SetSelectedGameObject(this.spells[0].gameObject);
			}
		}
		if (!flag && Links.x.joy)
		{
			EventSystem.current.SetSelectedGameObject(this.allSpellsButton);
		}
	}

	// Token: 0x06001486 RID: 5254 RVA: 0x0018EAD4 File Offset: 0x0018CCD4
	public void CloseAllSpells()
	{
		Debug.Log("Close all spells");
		if (this.contents1.activeSelf)
		{
			this.anim.Play("SpellsCloseOnlyGrid");
		}
		else
		{
			this.CloseSpellsFromCS();
		}
		this.contentTr.gameObject.SetActive(true);
		if (Links.x.spellcrafting.open && Links.x.joy)
		{
			this.learningHeader.text = "Select Effect";
			bool flag = false;
			if (this.knowledgeUsed.Count > 0)
			{
				flag = true;
				Navigation navigation = this.portraitButtons[0].navigation;
				navigation.selectOnLeft = this.knowledgeUsed[0].gameObject.transform.parent.gameObject.transform.GetChild(0).gameObject.GetComponent<Button>();
				navigation.selectOnDown = this.knowledgeUsed[0].gameObject.transform.parent.gameObject.transform.GetChild(0).gameObject.GetComponent<Button>();
				this.portraitButtons[0].navigation = navigation;
			}
			if (!flag)
			{
				Navigation navigation2 = this.portraitButtons[0].navigation;
				navigation2.selectOnLeft = this.allSpellsButton.GetComponent<Button>();
				navigation2.selectOnDown = this.allSpellsButton.GetComponent<Button>();
				this.portraitButtons[0].navigation = navigation2;
			}
		}
	}

	// Token: 0x06001487 RID: 5255 RVA: 0x0018EC50 File Offset: 0x0018CE50
	public void CloseSpellDelete()
	{
		this.deletePopup.SetActive(false);
		if (Links.x.spellcrafting.open && Links.x.joy && Links.x.joy)
		{
			bool flag = false;
			if (this.spells.Count > 0)
			{
				flag = true;
				Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.spells[0].gameObject);
			}
			if (!flag)
			{
				Links.x.gameplay.SetInteractableSelected(EventSystem.current, this.allSpellsButton);
			}
		}
		this.cancelButton.SetActive(true);
	}

	// Token: 0x06001488 RID: 5256 RVA: 0x0018ECF2 File Offset: 0x0018CEF2
	public void OpenSpellDelete(string spellname)
	{
		this.toDelete = spellname;
		this.deletePopup.SetActive(true);
		this.deletePopupText.text = "Are you sure you want to delete " + spellname + "?";
		this.cancelButton.SetActive(false);
	}

	// Token: 0x06001489 RID: 5257 RVA: 0x0018ED30 File Offset: 0x0018CF30
	public void Delete()
	{
		this.character.stats.RemoveSpell(this.toDelete);
		Links.x.spellcrafting.SetSpellbookGrid("Spells", this.character, "", true);
		this.CloseSpellDelete();
		this.CheckIfAtSpellLimit();
	}

	// Token: 0x0600148A RID: 5258 RVA: 0x0018ED7F File Offset: 0x0018CF7F
	public void CloseSpellsFromCS()
	{
		this.anim.Play("SpellsCloseGrid");
	}

	// Token: 0x0600148B RID: 5259 RVA: 0x0018ED91 File Offset: 0x0018CF91
	public void CloseSpellsFromCSFlag()
	{
		this.canvas.enabled = false;
		this.allSpells.SetActive(false);
		this.anim.enabled = false;
	}

	// Token: 0x0600148C RID: 5260 RVA: 0x0018EDB8 File Offset: 0x0018CFB8
	public void SetSpellbookGrid(string type, Character c, string skill, bool fromAllSpells)
	{
		this.anim.enabled = true;
		this.canvas.enabled = true;
		if (!fromAllSpells)
		{
			this.anim.Play("SpellsOpenGrid");
		}
		if (!fromAllSpells)
		{
			this.contents1.SetActive(false);
		}
		if (true)
		{
			this.abilityNames = c.stats.abilityNames;
			this.uniqueNames = c.stats.uniqueNames;
			this.spellLevels = c.stats.abilityLevels;
			this.abilityCosts = c.stats.abilityCost;
			this.abilityRows = c.stats.abilityRows;
			int count = this.abilityNames.Count;
			if (this.spells.Count > 0)
			{
				for (int i = 0; i < this.spells.Count; i++)
				{
					Links.x.cellar.ReturnPooledUIObject(49, this.spells[i].gameObject);
				}
				this.spells.Clear();
			}
			this.allSpellsPortrait.texture = c.characterSheetPortrait.GetTextureIdle(0);
			this.allSpellsHeader.text = c.stats.GetName() + "'s ";
			if (fromAllSpells)
			{
				TextMeshProUGUI textMeshProUGUI = this.allSpellsHeader;
				textMeshProUGUI.text += " Spell Variants";
			}
			else
			{
				if (type == "Spells")
				{
					if (skill == "Vines")
					{
						TextMeshProUGUI textMeshProUGUI2 = this.allSpellsHeader;
						textMeshProUGUI2.text += "Vines Spell Variants";
					}
					if (skill == "Spores")
					{
						TextMeshProUGUI textMeshProUGUI3 = this.allSpellsHeader;
						textMeshProUGUI3.text += "Spores Spell Variants";
					}
					if (skill == "Fauna")
					{
						TextMeshProUGUI textMeshProUGUI4 = this.allSpellsHeader;
						textMeshProUGUI4.text += "Fauna Spell Variants";
					}
				}
				if (type == "Songs")
				{
					if (skill == "Flute")
					{
						TextMeshProUGUI textMeshProUGUI5 = this.allSpellsHeader;
						textMeshProUGUI5.text += "Flute Songs";
					}
					if (skill == "Drum")
					{
						TextMeshProUGUI textMeshProUGUI6 = this.allSpellsHeader;
						textMeshProUGUI6.text += "Drum Beats";
					}
					if (skill == "Horn")
					{
						TextMeshProUGUI textMeshProUGUI7 = this.allSpellsHeader;
						textMeshProUGUI7.text += "Horn Songs";
					}
				}
				if (type == "Words")
				{
					if (skill == "Melee")
					{
						TextMeshProUGUI textMeshProUGUI8 = this.allSpellsHeader;
						textMeshProUGUI8.text += "Melee";
					}
					if (skill == "Range")
					{
						TextMeshProUGUI textMeshProUGUI9 = this.allSpellsHeader;
						textMeshProUGUI9.text += "Range";
					}
					if (skill == "Defense")
					{
						TextMeshProUGUI textMeshProUGUI10 = this.allSpellsHeader;
						textMeshProUGUI10.text += "Defense";
					}
					TextMeshProUGUI textMeshProUGUI11 = this.allSpellsHeader;
					textMeshProUGUI11.text += " Words of Power";
				}
			}
			for (int j = 0; j < count; j++)
			{
				bool flag = false;
				if (this.abilityRows[j]._IsSpell && fromAllSpells)
				{
					flag = true;
				}
				if (this.abilityRows[j]._IsSpell && type == "Spells" && !fromAllSpells && this.abilityRows[j]._MainSkill == skill)
				{
					flag = true;
				}
				if (!this.abilityRows[j]._IsSpell && type == "Songs" && this.abilityRows[j]._MainSkill == skill)
				{
					flag = true;
				}
				if (!this.abilityRows[j]._IsSpell && type == "Words" && this.abilityRows[j]._MainSkill == skill)
				{
					flag = true;
				}
				if (flag)
				{
					GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(49);
					pooledGameObject.SetActive(true);
					pooledGameObject.transform.SetParent(this.spellTransform, false);
					SkillButton component = pooledGameObject.GetComponent<SkillButton>();
					if (fromAllSpells || type == "Spells")
					{
						component.abilityName = this.abilityNames[j];
						component.uniqueName = this.uniqueNames[j];
						component.index = j;
						component.abilityCost = (float)((int)this.abilityCosts[j].x);
						component.character = c;
						component.spellStats = this.spellLevels[j];
					}
					if (type == "Songs")
					{
						component.abilityName = this.abilityNames[j];
						component.index = j;
						component.character = c;
						component.componentID = -1;
					}
					if (type == "Words")
					{
						component.abilityName = this.abilityNames[j];
						component.index = j;
						component.character = c;
						component.componentID = -1;
					}
					component.inWindow = false;
					component.inSpellMenu = true;
					component.Setup(true, true);
					this.spells.Add(component);
					pooledGameObject.transform.localPosition = new Vector3(pooledGameObject.transform.localPosition.x, pooledGameObject.transform.localPosition.y, 0f);
				}
			}
			if (this.spells.Count > 0)
			{
				this.noAbilitiesText.text = "";
				return;
			}
			this.str.Clear();
			this.str.Append(c.stats.GetName());
			this.str.Append(" has no ");
			if (type == "Spells")
			{
				if (skill == "Vines")
				{
					this.str.Append("Vines spells");
				}
				if (skill == "Spores")
				{
					this.str.Append("Spores spells");
				}
				if (skill == "Fauna")
				{
					this.str.Append("Fauna spells");
				}
				if (skill == "")
				{
					this.str.Append(" spells");
				}
			}
			if (type == "Songs")
			{
				if (skill == "Flute")
				{
					this.str.Append("Flute songs");
				}
				if (skill == "Drum")
				{
					this.str.Append("Drum beats");
				}
				if (skill == "Horn")
				{
					this.str.Append("Horn songs");
				}
			}
			if (type == "Words")
			{
				if (skill == "Melee")
				{
					this.str.Append("Melee");
				}
				if (skill == "Range")
				{
					this.str.Append("Range");
				}
				if (skill == "Defense")
				{
					this.str.Append("Defense");
				}
				this.str.Append(" Words of Power");
			}
			this.str.Append(".");
			this.noAbilitiesText.text = this.str.ToString();
		}
	}

	// Token: 0x0600148D RID: 5261 RVA: 0x0018F500 File Offset: 0x0018D700
	private void AddPrefab()
	{
		GameObject gameObject = Object.Instantiate<GameObject>(this.knowledgePrefab, Vector3.zero, Quaternion.identity);
		gameObject.transform.SetParent(this.contentTr, true);
		gameObject.transform.localPosition = Vector3.zero;
		gameObject.transform.localRotation = Quaternion.identity;
		gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
		this.knowledgeOpen.Add(gameObject);
		this.knowledgeTextOpen.Add(gameObject.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>());
		gameObject.SetActive(false);
	}

	// Token: 0x0600148E RID: 5262 RVA: 0x0018F5A8 File Offset: 0x0018D7A8
	private void SetInteractables(bool state)
	{
		this.button.interactable = state;
		this.slider1.interactable = state;
		this.slider2.interactable = state;
		this.slider3.interactable = state;
		this.resourceSlider.interactable = state;
		this.tetherSlider.interactable = state;
		this.nameInput.interactable = state;
		this.slider1Image.enabled = state;
		this.slider2Image.enabled = state;
		this.slider3Image.enabled = state;
		this.resourceImage.enabled = state;
		this.tetherImage.enabled = state;
		this.slider1label.enabled = state;
		this.slider2label.enabled = state;
		this.slider3label.enabled = state;
		this.slider1Min.enabled = state;
		this.slider1Max.enabled = state;
		this.slider2Min.enabled = state;
		this.slider2Max.enabled = state;
		this.slider3Min.enabled = state;
		this.slider3Max.enabled = state;
		this.tetherMin.enabled = state;
		this.tetherMax.enabled = state;
		this.resourceLabel.enabled = state;
		this.resourceLabelMin.enabled = state;
		this.resourceLabelMax.enabled = state;
		this.tetherLabel.enabled = state;
		this.cost.enabled = state;
		this.description.enabled = state;
		if (!state)
		{
			this.description.text = "";
		}
		this.sliderBg1.enabled = true;
		this.sliderBg2.enabled = true;
		this.sliderBg3.enabled = true;
		this.resourceSliderBg.enabled = true;
		this.nameInput.text = "";
		this.nameInput.placeholder.gameObject.SetActive(state);
		this.drawBackground.enabled = state;
		this.rune.enabled = state;
	}

	// Token: 0x0600148F RID: 5263 RVA: 0x0018F792 File Offset: 0x0018D992
	private int GetMax(string type)
	{
		type == "Tether";
		return 10;
	}

	// Token: 0x06001490 RID: 5264 RVA: 0x0018F7A4 File Offset: 0x0018D9A4
	private Texture2D ScaleTexture(Texture2D source, int targetWidth, int targetHeight)
	{
		Texture2D texture2D = new Texture2D(targetWidth, targetHeight, source.format, true);
		Color[] pixels = texture2D.GetPixels(0);
		float num = 1f / (float)source.width * ((float)source.width / (float)targetWidth);
		float num2 = 1f / (float)source.height * ((float)source.height / (float)targetHeight);
		for (int i = 0; i < pixels.Length; i++)
		{
			pixels[i] = source.GetPixelBilinear(num * ((float)i % (float)targetWidth), num2 * Mathf.Floor((float)(i / targetWidth)));
		}
		texture2D.SetPixels(pixels, 0);
		texture2D.Apply();
		return texture2D;
	}

	// Token: 0x06001491 RID: 5265 RVA: 0x0018F83E File Offset: 0x0018DA3E
	public float R2(float x)
	{
		return Mathf.Round(x * 10f) / 10f;
	}

	// Token: 0x04002314 RID: 8980
	public GameObject contents1;

	// Token: 0x04002315 RID: 8981
	public Canvas canvas;

	// Token: 0x04002316 RID: 8982
	public CanvasGroup canvasGroup;

	// Token: 0x04002317 RID: 8983
	public Animator anim;

	// Token: 0x04002318 RID: 8984
	public bool open;

	// Token: 0x04002319 RID: 8985
	[Header("Enchant Links")]
	public bool fromEnchantMenu;

	// Token: 0x0400231A RID: 8986
	public float characterSkill;

	// Token: 0x0400231B RID: 8987
	public EnchantItem enchant;

	// Token: 0x0400231C RID: 8988
	[Header("Objects")]
	public GameObject knowledgePrefab;

	// Token: 0x0400231D RID: 8989
	public List<GameObject> knowledgeOpen = new List<GameObject>();

	// Token: 0x0400231E RID: 8990
	public List<TextMeshProUGUI> knowledgeTextOpen = new List<TextMeshProUGUI>();

	// Token: 0x0400231F RID: 8991
	public List<GameObject> knowledgeUsed = new List<GameObject>();

	// Token: 0x04002320 RID: 8992
	public List<TextMeshProUGUI> knowledgeTextUsed = new List<TextMeshProUGUI>();

	// Token: 0x04002321 RID: 8993
	private List<Character> party;

	// Token: 0x04002322 RID: 8994
	private List<string> knowledge;

	// Token: 0x04002323 RID: 8995
	public Character character;

	// Token: 0x04002324 RID: 8996
	private StringFast str = new StringFast(64);

	// Token: 0x04002325 RID: 8997
	public string toDelete;

	// Token: 0x04002326 RID: 8998
	public Library.Pagan selectedPagan;

	// Token: 0x04002327 RID: 8999
	public GameObject spellLimitScreen;

	// Token: 0x04002328 RID: 9000
	public GameObject book1;

	// Token: 0x04002329 RID: 9001
	public GameObject book2;

	// Token: 0x0400232A RID: 9002
	public GameObject ccBlackOverlay;

	// Token: 0x0400232B RID: 9003
	public GameObject cancelButton;

	// Token: 0x0400232C RID: 9004
	public GameObject resetButton;

	// Token: 0x0400232D RID: 9005
	[Header("References")]
	public Transform contentTr;

	// Token: 0x0400232E RID: 9006
	public List<RawImage> portraits = new List<RawImage>();

	// Token: 0x0400232F RID: 9007
	public List<Image> portraitSelected = new List<Image>();

	// Token: 0x04002330 RID: 9008
	public List<Button> portraitButtons = new List<Button>();

	// Token: 0x04002331 RID: 9009
	public Color borderColorSelected;

	// Token: 0x04002332 RID: 9010
	public Color borderColorNormal;

	// Token: 0x04002333 RID: 9011
	public Color textColorSelected;

	// Token: 0x04002334 RID: 9012
	public Color textColorNormal;

	// Token: 0x04002335 RID: 9013
	public Color backColorSelected;

	// Token: 0x04002336 RID: 9014
	public Color backColorNormal;

	// Token: 0x04002337 RID: 9015
	public HannahAnimator anim1;

	// Token: 0x04002338 RID: 9016
	public HannahAnimator anim2;

	// Token: 0x04002339 RID: 9017
	public HannahAnimator anim3;

	// Token: 0x0400233A RID: 9018
	public HannahAnimator anim4;

	// Token: 0x0400233B RID: 9019
	public HannahAnimator anim5;

	// Token: 0x0400233C RID: 9020
	public HannahAnimator anim6;

	// Token: 0x0400233D RID: 9021
	public HannahAnimator fx1;

	// Token: 0x0400233E RID: 9022
	public HannahAnimator fx2;

	// Token: 0x0400233F RID: 9023
	public TextMeshProUGUI learningHeader;

	// Token: 0x04002340 RID: 9024
	public TextMeshProUGUI allSpellsHeader;

	// Token: 0x04002341 RID: 9025
	public TextMeshProUGUI knowledgeHeader1;

	// Token: 0x04002342 RID: 9026
	public TextMeshProUGUI knowledgeHeader2;

	// Token: 0x04002343 RID: 9027
	public TMP_InputField nameInput;

	// Token: 0x04002344 RID: 9028
	public Slider slider1;

	// Token: 0x04002345 RID: 9029
	public Slider slider2;

	// Token: 0x04002346 RID: 9030
	public Slider slider3;

	// Token: 0x04002347 RID: 9031
	public Slider tetherSlider;

	// Token: 0x04002348 RID: 9032
	public Slider resourceSlider;

	// Token: 0x04002349 RID: 9033
	public TextMeshProUGUI slider1label;

	// Token: 0x0400234A RID: 9034
	public TextMeshProUGUI slider2label;

	// Token: 0x0400234B RID: 9035
	public TextMeshProUGUI slider3label;

	// Token: 0x0400234C RID: 9036
	public TextMeshProUGUI tetherLabel;

	// Token: 0x0400234D RID: 9037
	public TextMeshProUGUI tetherMin;

	// Token: 0x0400234E RID: 9038
	public TextMeshProUGUI tetherMax;

	// Token: 0x0400234F RID: 9039
	public TextMeshProUGUI slider1Min;

	// Token: 0x04002350 RID: 9040
	public TextMeshProUGUI slider1Max;

	// Token: 0x04002351 RID: 9041
	public TextMeshProUGUI slider2Min;

	// Token: 0x04002352 RID: 9042
	public TextMeshProUGUI slider2Max;

	// Token: 0x04002353 RID: 9043
	public TextMeshProUGUI slider3Min;

	// Token: 0x04002354 RID: 9044
	public TextMeshProUGUI slider3Max;

	// Token: 0x04002355 RID: 9045
	public TextMeshProUGUI resourceLabel;

	// Token: 0x04002356 RID: 9046
	public TextMeshProUGUI resourceLabelMin;

	// Token: 0x04002357 RID: 9047
	public TextMeshProUGUI resourceLabelMax;

	// Token: 0x04002358 RID: 9048
	public TextMeshProUGUI cost;

	// Token: 0x04002359 RID: 9049
	public TextMeshProUGUI partyMinerals;

	// Token: 0x0400235A RID: 9050
	public TextMeshProUGUI description;

	// Token: 0x0400235B RID: 9051
	public TextMeshProUGUI buttonText;

	// Token: 0x0400235C RID: 9052
	public TextMeshProUGUI confirmText;

	// Token: 0x0400235D RID: 9053
	public TextMeshProUGUI controllerMessage;

	// Token: 0x0400235E RID: 9054
	public Button button;

	// Token: 0x0400235F RID: 9055
	public Image confirmSpellImage;

	// Token: 0x04002360 RID: 9056
	public Image runeFrame;

	// Token: 0x04002361 RID: 9057
	public GameObject confirmImage;

	// Token: 0x04002362 RID: 9058
	public Image slider1Image;

	// Token: 0x04002363 RID: 9059
	public Image slider2Image;

	// Token: 0x04002364 RID: 9060
	public Image slider3Image;

	// Token: 0x04002365 RID: 9061
	public Image resourceImage;

	// Token: 0x04002366 RID: 9062
	public Image tetherImage;

	// Token: 0x04002367 RID: 9063
	public Image sliderBg1;

	// Token: 0x04002368 RID: 9064
	public Image sliderBg2;

	// Token: 0x04002369 RID: 9065
	public Image sliderBg3;

	// Token: 0x0400236A RID: 9066
	public Image resourceSliderBg;

	// Token: 0x0400236B RID: 9067
	public Image drawBackground;

	// Token: 0x0400236C RID: 9068
	public Image rune;

	// Token: 0x0400236D RID: 9069
	public Image anim1Image;

	// Token: 0x0400236E RID: 9070
	public Image anim2Image;

	// Token: 0x0400236F RID: 9071
	public Image anim3Image;

	// Token: 0x04002370 RID: 9072
	public Image anim4Image;

	// Token: 0x04002371 RID: 9073
	public Image anim5Image;

	// Token: 0x04002372 RID: 9074
	public Image anim6Image;

	// Token: 0x04002373 RID: 9075
	public Image anim1VignImage;

	// Token: 0x04002374 RID: 9076
	public Image anim2VignImage;

	// Token: 0x04002375 RID: 9077
	public Image anim3VignImage;

	// Token: 0x04002376 RID: 9078
	public Image anim4VignImage;

	// Token: 0x04002377 RID: 9079
	public Image anim5VignImage;

	// Token: 0x04002378 RID: 9080
	public Image anim6VignImage;

	// Token: 0x04002379 RID: 9081
	public Texture2D drawingTexture;

	// Token: 0x0400237A RID: 9082
	public DrawViewController drawing;

	// Token: 0x0400237B RID: 9083
	public GameObject allSpells;

	// Token: 0x0400237C RID: 9084
	public GameObject allSpellsButton;

	// Token: 0x0400237D RID: 9085
	public Transform spellTransform;

	// Token: 0x0400237E RID: 9086
	public RawImage allSpellsPortrait;

	// Token: 0x0400237F RID: 9087
	public GameObject deletePopup;

	// Token: 0x04002380 RID: 9088
	public TextMeshProUGUI deletePopupText;

	// Token: 0x04002381 RID: 9089
	public TextMeshProUGUI noAbilitiesText;

	// Token: 0x04002382 RID: 9090
	public bool hasDrawn;

	// Token: 0x04002383 RID: 9091
	public bool notEnoughMoney;

	// Token: 0x04002384 RID: 9092
	public int spellLimit = 3;

	// Token: 0x04002385 RID: 9093
	private int currIndex;

	// Token: 0x04002386 RID: 9094
	private float updateTime;

	// Token: 0x04002387 RID: 9095
	private int currentLearning;

	// Token: 0x04002388 RID: 9096
	public bool confirming;

	// Token: 0x04002389 RID: 9097
	public Color selectedPortraitColor;

	// Token: 0x0400238A RID: 9098
	public Color normalPortraitColor;

	// Token: 0x0400238B RID: 9099
	public List<Library.Abilities> abilityRows;

	// Token: 0x0400238C RID: 9100
	private List<string> uniqueNames;

	// Token: 0x0400238D RID: 9101
	private List<string> abilityNames;

	// Token: 0x0400238E RID: 9102
	private List<Vector2> abilityCosts;

	// Token: 0x0400238F RID: 9103
	private List<Vector4> spellLevels;

	// Token: 0x04002390 RID: 9104
	public List<SkillButton> spells = new List<SkillButton>();

	// Token: 0x04002391 RID: 9105
	public string[] treeList = new string[0];

	// Token: 0x04002392 RID: 9106
	public List<string> combinedKnowledge = new List<string>();

	// Token: 0x04002393 RID: 9107
	public Transform forSaleHeader;

	// Token: 0x04002394 RID: 9108
	public Transform learnedHeader;

	// Token: 0x04002395 RID: 9109
	private float lastSliderTime;

	// Token: 0x04002396 RID: 9110
	public RectTransform scrollRectTransform;

	// Token: 0x04002397 RID: 9111
	public RectTransform scrollRectTransform2;

	// Token: 0x04002398 RID: 9112
	public RectTransform contentPanel;

	// Token: 0x04002399 RID: 9113
	public RectTransform contentPanel2;

	// Token: 0x0400239A RID: 9114
	public RectTransform selectedRectTransform;

	// Token: 0x0400239B RID: 9115
	private GameObject lastSelected;

	// Token: 0x0400239C RID: 9116
	public TextMeshProUGUI controllerSwitchL;

	// Token: 0x0400239D RID: 9117
	public TextMeshProUGUI controllerSwitchR;

	// Token: 0x0400239E RID: 9118
	[Header("Drawing Rune")]
	public bool drawingRune;

	// Token: 0x0400239F RID: 9119
	public RectTransform runeRT;

	// Token: 0x040023A0 RID: 9120
	public RectTransform bottomLeft;

	// Token: 0x040023A1 RID: 9121
	public RectTransform topRight;

	// Token: 0x040023A2 RID: 9122
	public RectTransform bottomRight;

	// Token: 0x040023A3 RID: 9123
	public RectTransform topLeft;

	// Token: 0x040023A4 RID: 9124
	public Vector2 drawPosition;

	// Token: 0x040023A5 RID: 9125
	public RectTransform drawCursorRT;

	// Token: 0x040023A6 RID: 9126
	public RectTransform rectParent;

	// Token: 0x040023A7 RID: 9127
	public GameObject drawCursor;

	// Token: 0x040023A8 RID: 9128
	public float drawSpeed = 4f;

	// Token: 0x040023A9 RID: 9129
	private IEnumerator controllerMoveOutOfInputField;
}
