Decompiled source of AffinityEditor v0.1.0

AffinityEditor.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Ink.Runtime;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace AffinityEditor;

public class AffinityEditorPage : MonoBehaviour
{
	[Header("Affinity Editor Page")]
	public AffinityItemsData affinityItemsData;

	public List<AffinityItem> affinityItems = new List<AffinityItem>();

	public GameObject affinityItemPrefab;

	public Transform itemsContainer;

	public AffinityIndicatorTooltip tooltip;

	public AffinitySectionTooltip sectionTooltip;

	public EditLockButton editLockButton;

	public void Start()
	{
	}

	public void OnEnable()
	{
		((MonoBehaviour)this).StartCoroutine(ContentFitUpdate());
	}

	private IEnumerator ContentFitUpdate()
	{
		ContentSizeFitter contentSizeFitter = ((Component)this).GetComponent<ContentSizeFitter>();
		((Behaviour)contentSizeFitter).enabled = false;
		yield return (object)new WaitForEndOfFrame();
		((Behaviour)contentSizeFitter).enabled = true;
	}

	public void CreateAffinityItems()
	{
		foreach (AffinityItem affinityItem in affinityItems)
		{
			if (!((Object)(object)affinityItem == (Object)null))
			{
				if (Application.isEditor)
				{
					Object.DestroyImmediate((Object)(object)((Component)affinityItem).gameObject);
				}
				else
				{
					Object.Destroy((Object)(object)((Component)affinityItem).gameObject);
				}
			}
		}
		affinityItems.Clear();
		foreach (AffinityItemData item in affinityItemsData.items)
		{
			CreateAffinityItem(item);
		}
	}

	public void CreateAffinityItem(AffinityItemData itemData)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		GameObject obj = Object.Instantiate<GameObject>(affinityItemPrefab, itemsContainer);
		((Object)obj).name = "AffinityItem " + itemData.name;
		obj.transform.localScale = Vector3.one;
		AffinityItem component = obj.GetComponent<AffinityItem>();
		component.itemData = itemData;
		component.parentPage = this;
		affinityItems.Add(component);
		component.Initialize();
	}

	public void Toggle()
	{
		((Component)this).gameObject.SetActive(!((Component)this).gameObject.activeSelf);
		editLockButton.SetLock(locked: true);
	}
}
[Serializable]
public class AffinityItemsData
{
	public string infoText;

	public List<AffinityItemData> items = new List<AffinityItemData>();
}
public class AffinityIndicatorTooltip : MonoBehaviour
{
	public TextMeshProUGUI titleText;

	public GameObject divider;

	public TextMeshProUGUI tooltipText;

	public void Start()
	{
		HideTooltip();
	}

	public void ShowTooltip(AffinityItemIndicator tooltipIndicator)
	{
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrEmpty(tooltipIndicator.itemIndicatorData.name) && string.IsNullOrEmpty(tooltipIndicator.itemIndicatorData.description))
		{
			((Component)this).gameObject.SetActive(false);
			return;
		}
		((Component)this).gameObject.SetActive(true);
		if (string.IsNullOrEmpty(tooltipIndicator.itemIndicatorData.description))
		{
			divider.SetActive(false);
			((Component)tooltipText).gameObject.SetActive(false);
		}
		else
		{
			divider.SetActive(true);
			((Component)tooltipText).gameObject.SetActive(true);
		}
		((TMP_Text)titleText).text = tooltipIndicator.itemIndicatorData.name;
		((TMP_Text)tooltipText).text = tooltipIndicator.itemIndicatorData.description;
		Bounds val = RectTransformUtility.CalculateRelativeRectTransformBounds(((Component)this).transform.parent, ((Component)tooltipIndicator.iconImage).transform);
		RectTransform component = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>();
		RectTransform component2 = ((Component)this).GetComponent<RectTransform>();
		component2.anchorMin = Vector2.op_Implicit(((Bounds)(ref val)).min) / component.sizeDelta + component.pivot;
		component2.anchorMax = Vector2.op_Implicit(((Bounds)(ref val)).max) / component.sizeDelta + component.pivot;
		component2.offsetMin = Vector2.zero;
		component2.offsetMax = Vector2.zero;
	}

	public void HideTooltip()
	{
		((Component)this).gameObject.SetActive(false);
	}
}
public class AffinityItem : MonoBehaviour
{
	public Slider slider;

	public Image icon;

	public TMP_InputField valueTextInput;

	public Transform indicatorsContainer;

	public GameObject affinityItemIndicatorPrefab;

	public GameObject sectionPrefab;

	public Transform sectionContainer;

	[Header("Auto Assigned")]
	public AffinityEditorPage parentPage;

	public List<AffinityItemIndicator> itemIndicators = new List<AffinityItemIndicator>();

	public List<AffinitySection> sections = new List<AffinitySection>();

	public AffinityItemData itemData;

	public int value;

	public void Start()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		object variableValue = Mgr_InkVariables.GetVariableValue(itemData.inkVariableName);
		if (variableValue == null)
		{
			Plugin.Logger.LogWarning((object)("Could not find ink variable " + itemData.inkVariableName));
			return;
		}
		value = (int)variableValue;
		Refresh();
		InkMaster.ActiveInstance.InkStory.ObserveVariable(itemData.inkVariableName, new VariableObserver(OnInkVariableChanged));
		((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)OnSliderValueChanged);
		((UnityEvent<string>)(object)valueTextInput.onEndEdit).AddListener((UnityAction<string>)OnTextInputValueChanged);
	}

	public void OnEnable()
	{
		AccessTools.Method(typeof(RoundRectAuto), "reassignAllProps", (Type[])null, (Type[])null).Invoke(((Component)slider).GetComponent<RoundRectAuto>(), null);
	}

	public void Initialize()
	{
		icon.sprite = itemData.icon;
		slider.maxValue = itemData.sections.Last().value;
		CreateItemIndicators();
		CreateSections();
	}

	public void CreateItemIndicators()
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		float num = 0f;
		foreach (AffinityItemIndicatorData itemIndicator in itemData.itemIndicators)
		{
			GameObject val = Object.Instantiate<GameObject>(affinityItemIndicatorPrefab);
			((Object)val).name = "AffinityItemIndicator";
			val.transform.SetParent(indicatorsContainer);
			val.transform.localScale = Vector3.one;
			AffinityItemIndicator component = val.GetComponent<AffinityItemIndicator>();
			component.itemIndicatorData = itemIndicator;
			component.layoutElement.flexibleWidth = itemIndicator.value - num;
			component.parentItem = this;
			num = itemIndicator.value;
			itemIndicators.Add(val.GetComponent<AffinityItemIndicator>());
		}
		if (itemData.sections.Last().value - num != 0f)
		{
			GameObject obj = Object.Instantiate<GameObject>(affinityItemIndicatorPrefab);
			((Object)obj).name = "RightPadding";
			obj.transform.SetParent(indicatorsContainer);
			obj.transform.localScale = Vector3.one;
			obj.GetComponent<AffinityItemIndicator>().layoutElement.flexibleWidth = itemData.sections.Last().value - num;
			((Behaviour)obj.GetComponent<AffinityItemIndicator>()).enabled = false;
			((Component)obj.transform.GetChild(0)).gameObject.SetActive(false);
		}
	}

	private void CreateSections()
	{
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		foreach (AffinitySection section in sections)
		{
			if (Application.isEditor)
			{
				Object.DestroyImmediate((Object)(object)section);
			}
			else
			{
				Object.Destroy((Object)(object)section);
			}
		}
		sections.Clear();
		float previousWidth = 0f;
		foreach (AffinitySectionData section2 in itemData.sections)
		{
			GameObject obj = Object.Instantiate<GameObject>(sectionPrefab, sectionContainer);
			((Object)obj).name = "SliderBackground";
			obj.transform.localScale = Vector3.one;
			AffinitySection component = obj.GetComponent<AffinitySection>();
			component.sectionData = section2;
			component.parentItem = this;
			component.Initialize(previousWidth);
			sections.Add(component);
			previousWidth = section2.value;
		}
	}

	public void OnInkVariableChanged(string variableName, object value)
	{
		if (variableName == itemData.inkVariableName)
		{
			this.value = (int)value;
			Refresh();
		}
	}

	public void OnSliderValueChanged(float value)
	{
		if (parentPage.editLockButton.isLocked)
		{
			parentPage.editLockButton.Blink();
			slider.value = this.value;
		}
		else
		{
			this.value = (int)value;
			Refresh();
			SetInkVariable();
		}
	}

	public void OnTextInputValueChanged(string text)
	{
		int result;
		if (parentPage.editLockButton.isLocked)
		{
			parentPage.editLockButton.Blink();
			valueTextInput.text = value.ToString();
		}
		else if (int.TryParse(text, out result))
		{
			value = result;
			Refresh();
			SetInkVariable();
		}
		else
		{
			valueTextInput.text = value.ToString();
		}
	}

	public void Refresh()
	{
		slider.SetValueWithoutNotify((float)value);
		valueTextInput.text = value.ToString();
	}

	public void SetInkVariable()
	{
		Mgr_InkVariables.Instance.ChangeGlobalVar(itemData.inkVariableName, (object)value, true);
		AccessTools.Method(typeof(Affinity), "RefreshCharacterTiers", (Type[])null, (Type[])null).Invoke(Plugin.affinity, null);
	}
}
[Serializable]
public class AffinityItemData
{
	public string name;

	public string iconAssetName;

	public string inkVariableName;

	public List<AffinityItemIndicatorData> itemIndicators = new List<AffinityItemIndicatorData>();

	public List<AffinitySectionData> sections = new List<AffinitySectionData>();

	[JsonIgnore]
	public Sprite icon => AssetBundleHelper.LoadAsset<Sprite>(iconAssetName);
}
public class AffinityItemIndicator : SelectableElement
{
	public LayoutElement layoutElement;

	public Image iconImage;

	[Header("Auto Assigned")]
	public AffinityItem parentItem;

	public AffinityItemIndicatorData itemIndicatorData;

	protected override void Awake()
	{
		((UIBehaviour)this).Awake();
	}

	protected override void Start()
	{
		((UIBehaviour)this).Start();
	}

	public override void OnSelected()
	{
		((SelectableElement)this).OnSelected();
		parentItem.parentPage.tooltip.ShowTooltip(this);
	}

	public override void OnBeginHover()
	{
		((SelectableElement)this).OnBeginHover();
		parentItem.parentPage.tooltip.ShowTooltip(this);
	}

	public override void OnEndHover()
	{
		((SelectableElement)this).OnEndHover();
		parentItem.parentPage.tooltip.HideTooltip();
	}
}
[Serializable]
public class AffinityItemIndicatorData
{
	public float value;

	public string name;

	public string description;
}
public class AffinitySection : Selectable
{
	public Image background;

	public LayoutElement layoutElement;

	[Header("Auto Assigned")]
	public AffinitySectionData sectionData;

	public AffinityItem parentItem;

	public void Initialize(float previousWidth)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		((Graphic)background).color = sectionData.color;
		layoutElement.flexibleWidth = sectionData.value - previousWidth;
	}

	public override void OnPointerEnter(PointerEventData eventData)
	{
		parentItem.parentPage.sectionTooltip.ShowTooltip(this);
	}

	public override void OnPointerExit(PointerEventData eventData)
	{
		parentItem.parentPage.sectionTooltip.HideTooltip();
	}
}
[Serializable]
public class AffinitySectionData
{
	public string name;

	public float value;

	public Color color;
}
public class AffinitySectionTooltip : MonoBehaviour
{
	public TextMeshProUGUI tooltipText;

	public List<Image> backgroundImages = new List<Image>();

	public float bgMultiplier = 1.5f;

	public void ShowTooltip(AffinitySection section)
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		if (string.IsNullOrEmpty(section.sectionData.name))
		{
			((Component)this).gameObject.SetActive(false);
			return;
		}
		((Component)this).gameObject.SetActive(true);
		((TMP_Text)tooltipText).text = section.sectionData.name;
		Bounds val = RectTransformUtility.CalculateRelativeRectTransformBounds(((Component)this).transform.parent, ((Component)section).transform);
		RectTransform component = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>();
		RectTransform component2 = ((Component)this).GetComponent<RectTransform>();
		component2.anchorMin = Vector2.op_Implicit(((Bounds)(ref val)).min) / component.sizeDelta + component.pivot;
		component2.anchorMax = Vector2.op_Implicit(((Bounds)(ref val)).max) / component.sizeDelta + component.pivot;
		component2.offsetMin = Vector2.zero;
		component2.offsetMax = Vector2.zero;
		Color color = section.sectionData.color;
		color *= bgMultiplier;
		color.a = 1f;
		foreach (Image backgroundImage in backgroundImages)
		{
			((Graphic)backgroundImage).color = color;
		}
	}

	public void HideTooltip()
	{
		((Component)this).gameObject.SetActive(false);
		((TMP_Text)tooltipText).text = "";
	}
}
public static class AssetBundleHelper
{
	public static AssetBundle assetBundle;

	public static void LoadBundle(string path)
	{
		if (!Application.isEditor)
		{
			assetBundle = AssetBundle.LoadFromFile(path);
		}
	}

	public static T LoadAsset<T>(string assetName) where T : Object
	{
		if (string.IsNullOrEmpty(assetName))
		{
			Plugin.Logger.LogError((object)"Requested asset name is null or empty");
			return default(T);
		}
		return assetBundle.LoadAsset<T>(assetName);
	}
}
public class CloseButton : SelectableButton
{
	public float hoverIntensity = 0.9f;

	public float baseIntensity = 0.8f;

	public AffinityEditorPage affinityEditorPage;

	protected override void Awake()
	{
		((SelectableElement)this)._hoverIntensity = hoverIntensity;
		((SelectableElement)this)._baseIntensity = baseIntensity;
		((UIBehaviour)this).Awake();
	}

	public override void OnSubmit()
	{
		((SelectableButton)this).OnSubmit();
		affinityEditorPage.Toggle();
	}
}
public class EditLockButton : SelectableButton
{
	public Sprite unlockedSprite;

	public Sprite lockedSprite;

	public Image image;

	[SerializeField]
	private bool _isLocked;

	[SerializeField]
	private float blinkInterval = 0.5f;

	[SerializeField]
	private int blinkCount = 3;

	[SerializeField]
	private float stroke = 4f;

	public AffinityEditorPage affinityEditorPage;

	public RoundRectAuto bg;

	public float hoverIntensity = 0.9f;

	public float baseIntensity = 0.8f;

	private bool isRunning;

	public bool isLocked
	{
		get
		{
			return _isLocked;
		}
		private set
		{
			_isLocked = value;
			if (_isLocked)
			{
				image.sprite = lockedSprite;
			}
			else
			{
				image.sprite = unlockedSprite;
			}
		}
	}

	protected override void Awake()
	{
		((SelectableElement)this)._hoverIntensity = hoverIntensity;
		((SelectableElement)this)._baseIntensity = baseIntensity;
		((UIBehaviour)this).Awake();
	}

	protected override void Start()
	{
		((UIBehaviour)this).Start();
		isLocked = true;
		image.sprite = lockedSprite;
	}

	public override void OnSubmit()
	{
		((SelectableButton)this).OnSubmit();
		SetLock(!isLocked);
	}

	public void SetLock(bool locked)
	{
		isLocked = locked;
	}

	public void Blink()
	{
		((MonoBehaviour)this).StartCoroutine(BlinkCoroutine());
	}

	private IEnumerator BlinkCoroutine()
	{
		if (!isRunning)
		{
			isRunning = true;
			for (int i = 0; i < blinkCount; i++)
			{
				bg.stroke = stroke;
				yield return (object)new WaitForSeconds(blinkInterval);
				bg.stroke = 0f;
				yield return (object)new WaitForSeconds(blinkInterval);
			}
			isRunning = false;
		}
	}
}
public class EditorToggleButton : SelectableElement
{
	public AffinityEditorPage affinityEditorPage;

	public bool isOpen { get; private set; }

	public void Toggle()
	{
		affinityEditorPage.Toggle();
	}

	public override void OnSelected()
	{
		((SelectableElement)this).OnSelected();
		Toggle();
	}
}
public class InfoButton : SelectableButton
{
	public bool isActive;

	public Transform infoPanel;

	public float hoverIntensity = 0.9f;

	public float baseIntensity = 0.8f;

	protected override void Awake()
	{
		((SelectableElement)this)._hoverIntensity = hoverIntensity;
		((SelectableElement)this)._baseIntensity = baseIntensity;
		((UIBehaviour)this).Awake();
	}

	protected override void Start()
	{
		((UIBehaviour)this).Start();
		isActive = false;
		((Component)infoPanel).gameObject.SetActive(false);
	}

	public override void OnSubmit()
	{
		((SelectableButton)this).OnSubmit();
		((Component)infoPanel).gameObject.SetActive(!((Component)infoPanel).gameObject.activeSelf);
	}
}
public class InfoText : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
{
	public AffinityEditorPage parentPage;

	public Dictionary<string, string> infoData;

	public void Start()
	{
		((TMP_Text)((Component)this).GetComponent<TextMeshProUGUI>()).text = parentPage.affinityItemsData.infoText;
	}

	public void OnPointerClick(PointerEventData eventData)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		TMP_Text component = ((Component)this).GetComponent<TMP_Text>();
		int num = TMP_TextUtilities.FindIntersectingLink(component, Vector2.op_Implicit(eventData.position), (Camera)null);
		if (num != -1)
		{
			TMP_LinkInfo val = component.textInfo.linkInfo[num];
			Application.OpenURL(((TMP_LinkInfo)(ref val)).GetLinkID());
		}
	}
}
[BepInPlugin("AffinityEditor", "Affinity Editor", "0.0.1")]
[BepInDependency("MeteorCore", "0.0.2")]
[BepInProcess("Goodbye Volcano High.exe")]
public class Plugin : BaseUnityPlugin
{
	public const string PLUGIN_GUID = "AffinityEditor";

	public const string PLUGIN_NAME = "Affinity Editor";

	public const string PLUGIN_VERSION = "0.0.1";

	internal static ManualLogSource Logger;

	internal static Harmony harmony;

	internal static BepInPlugin metadata;

	private AffinityItemsData affinityItemsData;

	public static Affinity affinity;

	public static TMP_FontAsset font { get; private set; }

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		metadata = MetadataHelper.GetMetadata((object)this);
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.LogInfo((object)"Plugin AffinityEditor is loaded!");
		harmony = new Harmony("AffinityEditor");
		harmony.PatchAll();
		try
		{
			AssetBundleHelper.LoadBundle(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "affinityeditor.assetbundle"));
		}
		catch (Exception arg)
		{
			Logger.LogError((object)$"AssetBundle load failed: {arg}");
			return;
		}
		Logger.LogInfo((object)"AssetBundle loaded");
		string text = File.ReadAllText(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "affinityEditorData.json"));
		if (string.IsNullOrEmpty(text))
		{
			Logger.LogError((object)"affinityEditorData.json is empty");
		}
		try
		{
			affinityItemsData = JsonConvert.DeserializeObject<AffinityItemsData>(text);
		}
		catch (Exception arg2)
		{
			Logger.LogError((object)$"Cloud not parse affinityEditorData.json\nContent:\n{text}\nError: {arg2}");
			return;
		}
		Logger.LogInfo((object)$"affinityEditorData.json imported, items count: {affinityItemsData.items.Count}");
		if (affinityItemsData.items.Count == 0)
		{
			Logger.LogError((object)("No items in affinityEditorData.json\nContent:\n" + text));
		}
		else
		{
			SceneManager.sceneLoaded += OnScneLoaded;
		}
	}

	private void OnScneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (!(((Scene)(ref scene)).name == "title") && !(((Scene)(ref scene)).name == "splash"))
		{
			TextMeshProUGUI component = GameObject.Find("UI_MASTER/UICanvas/SafeArea/PausePanel/PauseMenu/TabIconsRow/RowParent/Row2/text label").GetComponent<TextMeshProUGUI>();
			if ((Object)(object)component != (Object)null)
			{
				font = ((TMP_Text)component).font;
			}
			CreateEditor();
		}
	}

	private void SetChildrenFont(Transform transform)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		if ((Object)(object)font == (Object)null)
		{
			Logger.LogWarning((object)"font is null, skipping font setting");
			return;
		}
		foreach (Transform item in transform)
		{
			Transform val = item;
			if ((Object)(object)((Component)val).GetComponent<TextMeshProUGUI>() != (Object)null)
			{
				((TMP_Text)((Component)val).GetComponent<TextMeshProUGUI>()).font = font;
			}
			SetChildrenFont(val);
		}
	}

	private void CreateEditor()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		Logger.LogInfo((object)"Creating Affinty Editor");
		Transform transform = GameObject.Find("UI_MASTER/UICanvas/SafeArea/PausePanel/PausePage_Affinity/PageContent").transform;
		affinity = GameObject.Find("UI_MASTER/UICanvas/SafeArea/PausePanel/PausePage_Affinity").GetComponent<Affinity>();
		GameObject obj = Object.Instantiate<GameObject>(AssetBundleHelper.LoadAsset<GameObject>("AffinityEditorPage"), transform);
		RectTransform component = obj.GetComponent<RectTransform>();
		component.offsetMin = new Vector2(155f, -960f);
		component.offsetMax = new Vector2(1420f, 1000f);
		AffinityEditorPage component2 = obj.GetComponent<AffinityEditorPage>();
		component2.affinityItemsData = affinityItemsData;
		component2.CreateAffinityItems();
		SetChildrenFont(((Component)component2).transform);
		((Component)component2).gameObject.SetActive(false);
		GameObject obj2 = Object.Instantiate<GameObject>(AssetBundleHelper.LoadAsset<GameObject>("AffinityEditorButton"), transform.Find("AffinityVisualization/rings"));
		RectTransform component3 = obj2.GetComponent<RectTransform>();
		component3.anchorMin = new Vector2(0.5f, 0.5f);
		component3.anchorMax = new Vector2(0.5f, 0.5f);
		component3.anchoredPosition = new Vector2(665f - component3.sizeDelta.x / 2f, 0f - (665f - component3.sizeDelta.y / 2f));
		obj2.GetComponent<EditorToggleButton>().affinityEditorPage = component2;
	}
}