Decompiled source of Nebula v2.0.1

plugins/Nebula.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Nebula.Missions;
using Nebula.ModConfig;
using Nebula.UI;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Nebula")]
[assembly: AssemblyConfiguration("Export")]
[assembly: AssemblyDescription("Nebula is a collection of utilities for adding various assets related to House of the Dying Sun.")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1")]
[assembly: AssemblyProduct("Nebula")]
[assembly: AssemblyTitle("Nebula")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Nebula
{
	[BepInPlugin("Nebula", "Nebula", "2.0.1")]
	[BepInProcess("dyingsun.exe")]
	public class NebulaPlugin : BaseUnityPlugin
	{
		public delegate void SceneReadyDelegate(Scene scene);

		public static event SceneReadyDelegate SceneReady;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello world!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Welcome to a nebula of possible log spam. Hang tight!");
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			SceneManager.sceneLoaded -= OnSceneLoaded;
			((MonoBehaviour)this).StartCoroutine(InitAfterFrame(scene));
		}

		private IEnumerator InitAfterFrame(Scene scene)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return null;
			try
			{
				ModConfigMenuCreator.CreateConfigMenu();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Caught " + ex.GetType().FullName + " while creating config menu: " + ex.Message + " (source: " + ex.Source + ")\n\nStack trace:\n" + ex.StackTrace));
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Scene fully loaded. Calling for mods to add to the queues.");
			NebulaPlugin.SceneReady?.Invoke(scene);
			NodeSpawner.InitQueue();
			ButtonSpawner.InitQueue();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Initialization complete.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Nebula";

		public const string PLUGIN_NAME = "Nebula";

		public const string PLUGIN_VERSION = "2.0.1";
	}
}

plugins/Nebula.Missions.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Nebula.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Nebula.Missions")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Nebula.Missions")]
[assembly: AssemblyTitle("Nebula.Missions")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Nebula.Missions;

public class NamedNodeDatum
{
	public string sortieName;

	public List<string> connections;

	public string posName;

	public NamedNodeDatum(string sortieName, List<string> connections, string posName = "")
	{
		this.sortieName = sortieName;
		this.connections = connections;
		if (posName == "")
		{
			this.posName = sortieName.Replace("MISSION_", "POS_");
		}
		else
		{
			this.posName = posName;
		}
	}
}
public class NamedOverworldNode : OverworldNode
{
	public List<string> connectionNames = new List<string>();

	public void ConnectNamed()
	{
		foreach (string connectionName in connectionNames)
		{
			Transform val = ((Component)this).transform.parent.FindChild(connectionName);
			if (!((Object)(object)val == (Object)null))
			{
				OverworldNode component = ((Component)val).GetComponent<OverworldNode>();
				((OverworldNode)this).ConnectTo(component);
			}
		}
	}
}
public static class NodeFactory
{
	public static NamedOverworldNode Create(NodeFactoryDatum nodeDatum)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		string name = ((Object)nodeDatum.sortieTemplate).name;
		NamedOverworldNode namedOverworldNode = new NamedOverworldNode();
		((Object)namedOverworldNode).name = name.Replace("MISSION_", "NODE_");
		namedOverworldNode.connectionNames = nodeDatum.connectionNames;
		((OverworldNode)namedOverworldNode).sortieTemplate = nodeDatum.sortieTemplate;
		NamedOverworldNode namedOverworldNode2 = namedOverworldNode;
		((Component)namedOverworldNode2).transform.position = nodeDatum.position;
		HUDIconOverworldNode val = ((Component)namedOverworldNode2).gameObject.AddComponent<HUDIconOverworldNode>();
		((HUDIcon)val).mesh = Resources.Load<Mesh>("ui/hudicons_landmarks_model_31");
		return namedOverworldNode2;
	}

	public static List<NamedOverworldNode> CreateMultiple(List<NodeFactoryDatum> nodeDatums)
	{
		return new List<NamedOverworldNode>(LinqSubstitute.Remap<NodeFactoryDatum, NamedOverworldNode>((IEnumerable<NodeFactoryDatum>)nodeDatums, (Func<NodeFactoryDatum, NamedOverworldNode>)Create));
	}
}
public class NodeFactoryDatum
{
	public SortieTemplate sortieTemplate;

	public List<string> connectionNames;

	public Vector3 position;

	public NodeFactoryDatum(SortieTemplate sortieTemplate, List<string> connectionNames, Vector3 position)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		this.sortieTemplate = sortieTemplate;
		this.connectionNames = connectionNames;
		this.position = position;
	}
}
public class NodeSpawner : MonoBehaviour
{
	private const string type = "NodeSpawner";

	public static Queue<NamedOverworldNode> nodeQueue = new Queue<NamedOverworldNode>();

	public static void InitQueue()
	{
		GameObject rootObject = GameObjectUtils.GetRootObject("#GALAXY_ROOT");
		Transform parent = rootObject.transform.FindChild("GALAXY_ROTATOR/ROOT_Overworld");
		Debug.Log((object)string.Format("{0}: Parenting {1} nodes in queue to map root...", "NodeSpawner", nodeQueue.Count));
		foreach (NamedOverworldNode item in nodeQueue)
		{
			((Component)item).transform.parent = parent;
		}
		Debug.Log((object)"NodeSpawner: Connecting parented nodes...");
		foreach (NamedOverworldNode item2 in nodeQueue)
		{
			Debug.Log((object)(((Object)item2).name + ": Connecting..."));
			item2.ConnectNamed();
		}
		Debug.Log((object)"NodeSpawner: Node connections complete.");
		nodeQueue.Clear();
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "Nebula.Missions";

	public const string PLUGIN_NAME = "Nebula.Missions";

	public const string PLUGIN_VERSION = "1.0.0";
}

plugins/Nebula.ModConfig.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using Nebula.ModConfig.EntryTypes;
using Nebula.ModConfig.Toasts;
using Nebula.UI;
using Nebula.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Nebula.ModConfig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Nebula.ModConfig")]
[assembly: AssemblyTitle("Nebula.ModConfig")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Nebula.ModConfig
{
	public class CUIModConfigMenu : CUIMenu
	{
		public const int MODCONFIG_SUBSTATE = 268435456;

		public static Dictionary<Type, Type> entryTypes = new Dictionary<Type, Type>
		{
			{
				typeof(bool),
				typeof(CUIModConfigBoolEntry)
			},
			{
				typeof(int),
				typeof(CUIModConfigIntEntry)
			},
			{
				typeof(string),
				typeof(CUIModConfigStringEntry)
			},
			{
				typeof(Enum),
				typeof(CUIModConfigEnumGenericEntry)
			},
			{
				typeof(KeyCode),
				typeof(CUIModConfigKeyCodeEntry)
			}
		};

		public CUIButtonInput defaultButtonInput;

		public AudioClip applyChangesClip;

		public float applyChangesPitch = 1f;

		public float applyChangesVolume = 0.45f;

		public UIScrollView settingsScrollView;

		public float minSpringTargetY;

		public float maxSpringTargetY = 100f;

		private CUIOption _firstOption;

		public CUIButtonInput backButtonInput;

		public UIScrollView scrollView;

		[Header("Main")]
		public UIPanel mainPanel;

		public List<UITable> optionsTables;

		public List<CUIModConfigEntryBase> entries;

		public GameObject optionsRoot;

		private string _activeGuid = "";

		public bool optionsAreDirty
		{
			get
			{
				foreach (CUIModConfigEntryBase entry in entries)
				{
					if (entry.dirty)
					{
						return true;
					}
				}
				return false;
			}
			set
			{
				entries.ForEach(delegate(CUIModConfigEntryBase e)
				{
					e.dirty = value;
				});
			}
		}

		protected override void OnEnable()
		{
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			CUIButtonInput[] componentsInChildren = ((Component)base.buttonTable).GetComponentsInChildren<CUIButtonInput>();
			CUIButtonInput val = componentsInChildren[^1];
			CUIButtonInput[] array = componentsInChildren;
			for (int i = 0; i < array.Length; i++)
			{
				(val.selectOnDown = array[i]).selectOnUp = val;
			}
			((CUIMenu)this).OnEnable();
			foreach (UITable optionsTable in optionsTables)
			{
				List<Transform> list = new List<Transform>();
				for (int j = 0; j < ((Component)optionsTable).transform.childCount; j++)
				{
					list.Add(((Component)optionsTable).transform.GetChild(j));
				}
				list.Sort((Comparison<Transform>)UIGrid.SortByName);
				List<Transform> list2 = new List<Transform>();
				for (int k = 0; k < list.Count; k++)
				{
					if (Object.op_Implicit((Object)(object)((Component)list[k]).GetComponent<CUIButtonInput>()) && ((Component)list[k]).gameObject.activeSelf)
					{
						list2.Add(list[k]);
					}
				}
				for (int l = 0; l < list2.Count; l++)
				{
					CUIButtonInput component = ((Component)list2[l]).GetComponent<CUIButtonInput>();
					if (!Object.op_Implicit((Object)(object)component))
					{
						continue;
					}
					if (l == 0)
					{
						component.selectOnUp = ((Component)list2[list2.Count - 1]).GetComponent<CUIButtonInput>();
						if (list2.Count > 1)
						{
							component.selectOnDown = ((Component)list2[l + 1]).GetComponent<CUIButtonInput>();
						}
						else
						{
							component.selectOnDown = component;
						}
					}
					else if (l == list2.Count - 1)
					{
						if (list2.Count > 1)
						{
							component.selectOnUp = ((Component)list2[l - 1]).GetComponent<CUIButtonInput>();
						}
						else
						{
							component.selectOnUp = component;
						}
						component.selectOnDown = ((Component)list2[0]).GetComponent<CUIButtonInput>();
					}
					else
					{
						component.selectOnDown = ((Component)list2[l + 1]).GetComponent<CUIButtonInput>();
						component.selectOnUp = ((Component)list2[l - 1]).GetComponent<CUIButtonInput>();
					}
					BoxCollider component2 = ((Component)component).GetComponent<BoxCollider>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.center = new Vector3(320f, 0f, 0f);
						component2.size = new Vector3(640f, 20f, 0f);
					}
				}
			}
			base.buttonTable.ResetChildren();
			base.buttonTable.Reposition();
			CUIButtonInput.ProcessVerticalButtonTable(base.buttonTable.children, false);
			SetVerticalScrollbarEnabled(value: false);
			Messenger<GameObject>.AddListener("OnNewNGUISelection", (Callback<GameObject>)OnNewNGUISelection);
		}

		protected override void Update()
		{
			bool flag = Controls.player.GetButtonDown("Menu Cancel") || Input.GetKeyDown((KeyCode)27);
			bool flag2 = !Controls.Instance.isUsingKeyboardMouse || (Object)(object)UICamera.hoveredObject == (Object)null;
			if (flag && flag2)
			{
				AudioMenu.playCancel = true;
				if (Object.op_Implicit((Object)(object)UICamera.selectedObject) && Object.op_Implicit((Object)(object)optionsTables.Find((UITable tbl) => (Object)(object)UICamera.selectedObject.transform.parent == (Object)(object)((Component)tbl).transform)))
				{
					UICamera.selectedObject = ((Component)defaultButtonInput).gameObject;
				}
				else if (optionsAreDirty)
				{
					PopupConfirmationMenu();
				}
				else
				{
					ReturnToLastMenu();
				}
			}
		}

		private void PopupConfirmationMenu()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			AudioMenu.playConfirm = true;
			List<ConfirmationMenuDelegate> list = new List<ConfirmationMenuDelegate>
			{
				new ConfirmationMenuDelegate(OnApplyConfigsClicked),
				new ConfirmationMenuDelegate(OnDiscardConfigsClicked)
			};
			List<string> list2 = new List<string> { "APPLY", "DISCARD" };
			string text = "One or more configs have been modified. Apply changes?";
			CUIConfirmationMenu.Show(list2, list, text, "", 1);
		}

		protected override void OnDisable()
		{
			Messenger<GameObject>.RemoveListener("OnNewNGUISelection", (Callback<GameObject>)OnNewNGUISelection);
			((CUIMenu)this).OnDisable();
			if (_activeGuid != "")
			{
				SetActiveGUIDRootActive(value: false);
				_activeGuid = "";
				UIProgressBar verticalScrollBar = scrollView.verticalScrollBar;
				UIScrollBar val = (UIScrollBar)(object)((verticalScrollBar is UIScrollBar) ? verticalScrollBar : null);
				val.barSize = 1f;
				((UIProgressBar)val).value = 0f;
				SetVerticalScrollbarEnabled(value: false);
			}
		}

		public void SetVerticalScrollbarEnabled(bool value)
		{
			Collider component = ((Component)scrollView.verticalScrollBar.foregroundWidget).gameObject.GetComponent<Collider>();
			component.enabled = value;
		}

		private void SetActiveGUIDRootActive(bool value)
		{
			Transform gUIDRoot = GetGUIDRoot(_activeGuid);
			((Component)gUIDRoot).gameObject.SetActive(value);
			if (value)
			{
				_firstOption = ((Component)gUIDRoot.GetChild(0)).GetComponent<CUIOption>();
				scrollView.UpdateScrollbars(true);
				SetVerticalScrollbarEnabled(value: true);
			}
		}

		public Transform GetGUIDRoot(string guid)
		{
			return ((Component)scrollView).transform.Find("ROOT_" + guid);
		}

		private void OnNewNGUISelection(GameObject g)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)g) && (Object)(object)g.transform.parent == (Object)(object)optionsRoot.transform && !Controls.menuMouseControl)
			{
				Vector3[] worldCorners = ((UIRect)settingsScrollView.panel).worldCorners;
				Vector3 val = (worldCorners[2] + worldCorners[0]) * 0.5f;
				Transform cachedTransform = ((UIRect)settingsScrollView.panel).cachedTransform;
				Vector3 val2 = cachedTransform.InverseTransformPoint(g.transform.position);
				Vector3 val3 = cachedTransform.InverseTransformPoint(val);
				Vector3 val4 = val2 - val3;
				if (!settingsScrollView.canMoveHorizontally)
				{
					val4.x = 0f;
				}
				if (!settingsScrollView.canMoveVertically)
				{
					val4.y = 0f;
				}
				val4.z = 0f;
				Vector3 val5 = cachedTransform.localPosition - val4;
				val5.y = Mathf.Clamp(val5.y, minSpringTargetY, maxSpringTargetY);
				SpringPanel val6 = SpringPanel.Begin(((UIRect)settingsScrollView.panel).cachedGameObject, val5, 8f);
				val6.mThreshold = 0.25f;
			}
		}

		public void OnBackButtonClicked()
		{
			if (optionsAreDirty)
			{
				PopupConfirmationMenu();
			}
			else
			{
				ReturnToLastMenu();
			}
		}

		private void CacheAllSettings()
		{
			foreach (CUIModConfigEntryBase entry in entries)
			{
				if (entry.dirty)
				{
					((CUIOption)entry).CacheValues();
				}
			}
		}

		private void ReturnToLastMenu()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Game.Instance.menuSubstate = base.menuSubstateOnCancel;
		}

		public void OnEditButtonClicked(string guid)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			if (_activeGuid != "")
			{
				SetActiveGUIDRootActive(value: false);
			}
			_activeGuid = guid;
			if (_activeGuid != "")
			{
				SetActiveGUIDRootActive(value: true);
			}
			if ((int)UI.controlScheme == 1)
			{
				UICamera.selectedObject = ((Component)_firstOption).gameObject;
			}
		}

		public void OnModConfigButtonClicked()
		{
			Game.Instance.menuSubstate = (MenuSubstate)268435456;
		}

		public void OnApplyConfigsClicked()
		{
			CacheAllSettings();
			ReturnToLastMenu();
		}

		public void OnDiscardConfigsClicked()
		{
			optionsAreDirty = false;
			ReturnToLastMenu();
		}
	}
	public class ModConfigButton : MonoBehaviour
	{
		public CUIModConfigMenu configMenu;

		public string guid;

		public void OnButtonClicked()
		{
			configMenu.OnEditButtonClicked(guid);
		}
	}
	public static class ModConfigMenuCreator
	{
		public static void CreateConfigMenu()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			GameObject rootObject = GameObjectUtils.GetRootObject("# CUI_2D");
			Camera component = ((Component)rootObject.transform.FindChild("Camera")).GetComponent<Camera>();
			Transform val = ((Component)component).transform.FindChild("ROOT_Menus");
			MenuSubstateGate val2 = NGUITools.AddChild<MenuSubstateGate>(((Component)val).gameObject);
			((Object)val2).name = "GATE_ModConfig";
			val2.activeStateMask = (MenuSubstate)268435456;
			((Component)val2).transform.SetParent(val);
			UIAnchor val3 = NGUITools.AddChild<UIAnchor>(((Component)val2).gameObject);
			val3.uiCamera = component;
			val3.side = (Side)8;
			val3.runOnlyOnce = true;
			val3.relativeOffset = new Vector2(0f, -0.07f);
			((Object)val3).name = "ANCHOR_ModConfig";
			((Component)val3).transform.position = new Vector3(0f, -76f, 0f);
			((Component)val3).gameObject.SetActive(false);
			GameObjectUtils.CopyParentLayer(((Component)val3).gameObject);
			val2.gameObjects.Add(((Component)val3).gameObject);
			CUIModConfigMenu cUIModConfigMenu = NGUITools.AddChild<CUIModConfigMenu>(((Component)val3).gameObject);
			cUIModConfigMenu.applyChangesClip = Resources.Load<AudioClip>("AudioClip/beep_select_04");
			cUIModConfigMenu.applyChangesPitch = 0.3f;
			cUIModConfigMenu.applyChangesVolume = 0.58f;
			cUIModConfigMenu.minSpringTargetY = 1f;
			cUIModConfigMenu.maxSpringTargetY = 308f;
			cUIModConfigMenu.optionsTables = new List<UITable>();
			cUIModConfigMenu.entries = new List<CUIModConfigEntryBase>();
			((CUIMenu)cUIModConfigMenu).menuSubstateOnCancel = (MenuSubstate)4;
			((Object)cUIModConfigMenu).name = "ROOT_ModConfig";
			((Component)cUIModConfigMenu).transform.parent = ((Component)val3).transform;
			GameObjectUtils.CopyParentLayer(((Component)cUIModConfigMenu).gameObject);
			CreateConfigMenuChildren(cUIModConfigMenu);
			Transform val4 = val.FindChild("GATE_OptionsMenu/ANCHOR_OptionsMenu/ROOT_OptionsMenu");
			CreateConfigMenuButton(cUIModConfigMenu, ((Component)val4).GetComponent<CUIOptionsMenu>());
			ModConfigToastCreator.CreateToasts(val, component);
		}

		private static void CreateConfigMenuButton(CUIModConfigMenu cfgMenu, CUIOptionsMenu optionsMenu)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0081: Expected O, but got Unknown
			UIFactory.CreateButton(((Component)((CUIMenu)optionsMenu).buttonTable).gameObject, "011_BUTTON_ModConfig", new ButtonSettings
			{
				Size = new Vector3(256f, 20f, 0f),
				OnClick = new List<EventDelegate>
				{
					new EventDelegate(new Callback(cfgMenu.OnModConfigButtonClicked))
				}
			}, new LabelSettings
			{
				FontSize = 20,
				Width = 256,
				Text = "MOD SETTINGS"
			}, (Pivot)5);
		}

		private static void CreateConfigMenuChildren(CUIModConfigMenu cfgMenu)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			UIPanel val = NGUITools.AddChild<UIPanel>(((Component)cfgMenu).gameObject);
			val.renderQueue = (RenderQueue)0;
			val.startingRenderQueue = 3007;
			((Object)val).name = "PANEL_ModConfig";
			GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
			((CUIMenu)cfgMenu).panel = val;
			cfgMenu.mainPanel = val;
			Rigidbody val2 = ((Component)val).gameObject.AddComponent<Rigidbody>();
			val2.useGravity = false;
			val2.isKinematic = true;
			TweenAlpha val3 = ((Component)val).gameObject.AddComponent<TweenAlpha>();
			((Behaviour)val3).enabled = false;
			val3.from = 0f;
			CUISpringScroller val4 = NGUITools.AddChild<CUISpringScroller>(((Component)val).gameObject);
			((Object)val4).name = "MENU_ModConfig";
			GameObjectUtils.CopyParentLayer(((Component)val4).gameObject);
			CreateConfigMenuLeftPanel(val4, cfgMenu);
			CreateConfigMenuRightPanel(val4, cfgMenu);
		}

		private static void CreateConfigMenuLeftPanel(CUISpringScroller menuRoot, CUIModConfigMenu cfgMenu)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = NGUITools.AddChild(((Component)menuRoot).gameObject).transform;
			((Object)transform).name = "ROOT_Left";
			transform.localPosition = new Vector3(-32f, 0f, 0f);
			GameObjectUtils.CopyParentLayer(((Component)transform).gameObject);
			Transform transform2 = NGUITools.AddChild(((Component)transform).gameObject).transform;
			((Object)transform2).name = "000_ROOT_TITLE";
			transform2.localPosition = Vector3.zero;
			GameObjectUtils.CopyParentLayer(((Component)transform2).gameObject);
			UILabel val = UIFactory.CreateLabel(((Component)transform2).gameObject, "LABEL_Title", new LabelSettings
			{
				Text = "MOD SETTINGS",
				FontSize = 42,
				Width = 166,
				Font = StockFonts.serifGothic["Heavy"]
			}, (Pivot)8);
			((Component)val).transform.localPosition = new Vector3(0f, -8f, 0f);
			UITexture val2 = UIFactory.CreateTextureBackground(((Component)val).gameObject, new TextureSettings
			{
				Color = Color.white,
				Size = new Vector3(400f, 2f)
			}, (Pivot)5);
			((Component)val2).transform.localPosition = new Vector3(16f, 0f, 0f);
			CreateConfigMenuModButtons(transform, cfgMenu);
		}

		private static void CreateConfigMenuModButtons(Transform leftRoot, CUIModConfigMenu cfgMenu)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			UITable val = NGUITools.AddChild<UITable>(((Component)leftRoot).gameObject);
			val.columns = 1;
			val.direction = (Direction)0;
			val.sorting = (Sorting)1;
			val.padding = new Vector2(0f, 3f);
			((Object)val).name = "010_BUTTONS";
			GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
			((Component)val).transform.localPosition = new Vector3(-256f, -24f, 0f);
			((CUIMenu)cfgMenu).buttonTable = val;
			int num = 1;
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				BaseUnityPlugin instance = pluginInfo.Value.Instance;
				if (instance.Config.Count != 0)
				{
					BepInPlugin metadata = pluginInfo.Value.Metadata;
					UIButton val2 = GenerateModButton(num, metadata.GUID, metadata.Name.ToUpper(), new List<EventDelegate>(), ((Component)val).gameObject);
					if (num == 1)
					{
						((Component)val2).GetComponent<CUIButtonInput>().startsSelected = true;
						cfgMenu.defaultButtonInput = ((Component)val2).GetComponent<CUIButtonInput>();
					}
					ModConfigButton modConfigButton = ((Component)val2).gameObject.AddComponent<ModConfigButton>();
					modConfigButton.configMenu = cfgMenu;
					modConfigButton.guid = metadata.GUID;
					val2.onClick.Add(new EventDelegate(new Callback(modConfigButton.OnButtonClicked)));
					num++;
				}
			}
			UIButton val3 = GenerateModButton(num, "Back", "BACK", new List<EventDelegate>
			{
				new EventDelegate(new Callback(cfgMenu.OnBackButtonClicked))
			}, ((Component)val).gameObject);
			cfgMenu.backButtonInput = ((Component)val3).GetComponent<CUIButtonInput>();
		}

		private static UIButton GenerateModButton(int i, string name, string text, List<EventDelegate> onClick, GameObject root)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0063: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			UIButton val = UIFactory.CreateButton(root, (i * 10).ToString("D3") + "_BUTTON_" + name, new ButtonSettings
			{
				Size = new Vector3(256f, 20f, 0f),
				OnClick = onClick
			}, new LabelSettings
			{
				Text = text,
				FontSize = 20
			}, (Pivot)5);
			((Component)val).transform.localPosition = new Vector3(240f, (float)(15 - i * 30), 0f);
			return val;
		}

		private static void CreateConfigMenuRightPanel(CUISpringScroller menuRoot, CUIModConfigMenu cfgMenu)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			MouseControlGate val = NGUITools.AddChild<MouseControlGate>(((Component)menuRoot).gameObject);
			((Behaviour)val).enabled = false;
			((Object)val).name = "WIDGET_ScrollView";
			((Component)val).transform.localPosition = new Vector3(32f, 30f, 0f);
			GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
			cfgMenu.optionsRoot = ((Component)val).gameObject;
			UIPanel val2 = NGUITools.AddChild<UIPanel>(((Component)val).gameObject);
			val2.baseClipRegion = new Vector4(320f, -144f, 640f, 288f);
			val2.clipping = (Clipping)2;
			val2.renderQueue = (RenderQueue)0;
			val2.startingRenderQueue = 3007;
			((Object)val2).name = "PANEL_ScrollWindow";
			GameObjectUtils.CopyParentLayer(((Component)val2).gameObject);
			menuRoot.targetRoot = ((Component)val2).transform;
			UIScrollView val3 = ((Component)val2).gameObject.AddComponent<UIScrollView>();
			val3.dragEffect = (DragEffect)0;
			val3.restrictWithinPanel = true;
			val3.smoothDragStart = false;
			val3.iOSDragEmulation = false;
			val3.showScrollBars = (ShowCondition)0;
			val3.contentPivot = (Pivot)0;
			val3.movement = (Movement)3;
			val3.customMovement = Vector2.up;
			cfgMenu.settingsScrollView = val3;
			cfgMenu.scrollView = val3;
			menuRoot.settingsScrollView = val3;
			UIScrollBar val4 = UIFactory.CreateVerticalScrollBar(((Component)val).gameObject, "SLIDER_Scrollbar", 1f, val3);
			((Component)val4).transform.localPosition = new Vector3(-24f, 0f, 0f);
			val.gameObjects.Add(((Component)val4).gameObject);
			Rigidbody val5 = ((Component)val2).gameObject.AddComponent<Rigidbody>();
			val5.useGravity = false;
			val5.isKinematic = true;
			CUIScroller val6 = ((Component)val2).gameObject.AddComponent<CUIScroller>();
			val6.scrollView = val3;
			val6.useControlAxis = false;
			val6.mousewheelScrollSpeed = 100f;
			CreateConfigMenuModOptions(val2, cfgMenu);
		}

		private static void CreateConfigMenuModOptions(UIPanel panelRoot, CUIModConfigMenu cfgMenu)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				BaseUnityPlugin instance = pluginInfo.Value.Instance;
				if (instance.Config.Count != 0)
				{
					UITable val = NGUITools.AddChild<UITable>(((Component)panelRoot).gameObject);
					val.columns = 1;
					val.sorting = (Sorting)1;
					val.direction = (Direction)0;
					((Object)val).name = "ROOT_" + pluginInfo.Key;
					GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
					((Component)val).gameObject.SetActive(false);
					cfgMenu.optionsTables.Add(val);
					CreateConfigMenuOptionList(instance, ((Component)val).gameObject, cfgMenu);
					((Behaviour)val).enabled = true;
				}
			}
		}

		private static void CreateConfigMenuOptionList(BaseUnityPlugin plugin, GameObject parent, CUIModConfigMenu cfgMenu)
		{
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			SortedDictionary<string, List<ConfigEntryBase>> sortedDictionary = new SortedDictionary<string, List<ConfigEntryBase>>();
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in plugin.Config)
			{
				string section = item.Key.Section;
				if (!sortedDictionary.ContainsKey(section))
				{
					sortedDictionary[section] = new List<ConfigEntryBase>();
				}
				sortedDictionary[section].Add(item.Value);
			}
			int num = 0;
			foreach (KeyValuePair<string, List<ConfigEntryBase>> item2 in sortedDictionary)
			{
				GenerateModSectionLabel(num, item2.Key, parent);
				num++;
				foreach (ConfigEntryBase item3 in item2.Value)
				{
					Type type = item3.BoxedValue.GetType();
					Type type2 = type;
					while ((object)type2 != null && !CUIModConfigMenu.entryTypes.ContainsKey(type2))
					{
						type2 = type2.BaseType;
					}
					if ((object)type2 != null)
					{
						UIButton val = GenerateModButtonOption(num, item3.Definition.Key, item3, type2, parent);
						CUIModConfigEntryBase component = ((Component)val).GetComponent<CUIModConfigEntryBase>();
						component.SetupFromType(type);
						cfgMenu.entries.Add(component);
						if (num == 1)
						{
							((Component)val).GetComponent<CUIButtonInput>().startsSelected = true;
						}
						num++;
					}
				}
				UIFactory.CreateLabel(parent, (num * 10 + 9).ToString("D3") + "_SPACER_10", new LabelSettings
				{
					Color = Color.clear,
					FontSize = 10,
					Width = 100
				}, (Pivot)5);
			}
		}

		private static UILabel GenerateModSectionLabel(int i, string name, GameObject root)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			UILabel val = UIFactory.CreateLabel(root, (i * 10).ToString("D3") + "_LABEL_" + name, new LabelSettings
			{
				Text = TextUtils.PascalNameToTitle(name, true),
				Color = new Color(1f, 0.6431f, 0f),
				FontSize = 32,
				Width = 126
			}, (Pivot)3);
			((Component)val).transform.localPosition = new Vector3(0f, (float)(-15 - i * 30), 0f);
			return val;
		}

		private static UIButton GenerateModButtonOption(int i, string name, ConfigEntryBase cfgKeyValue, Type valueType, GameObject root)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0069: Expected O, but got Unknown
			//IL_0069: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			UIButton val = UIFactory.CreateButton(root, (i * 10).ToString("D3") + "_BUTTON_" + name, new ButtonSettings
			{
				Size = new Vector3(640f, 20f)
			}, new LabelSettings
			{
				Text = TextUtils.PascalNameToTitle(name, true),
				FontSize = 20,
				Width = 640
			}, (Pivot)3);
			((Component)val).transform.localPosition = new Vector3(0f, (float)(-15 - i * 30), 0f);
			((Component)val).GetComponent<CUIMenuAudioTrigger>().clipType = (AudioClipType)2;
			UITexture componentInChildren = ((Component)((Component)val).transform).GetComponentInChildren<UITexture>();
			((Component)componentInChildren).transform.localPosition = Vector3.zero;
			UILabel val2 = UIFactory.CreateLabel(((Component)val).gameObject, "LABEL_Value", new LabelSettings
			{
				Text = "VALUE",
				FontSize = 20,
				Width = 160
			}, (Pivot)5);
			((Component)val2).transform.localPosition = new Vector3(636f, 0f, 0f);
			CUIModConfigEntryBase cUIModConfigEntryBase = GenerateModButtonEntry(cfgKeyValue, valueType, val);
			((CUIOption)cUIModConfigEntryBase).valueLabel = val2;
			return val;
		}

		private static CUIModConfigEntryBase GenerateModButtonEntry(ConfigEntryBase cfgKeyValue, Type valueType, UIButton button)
		{
			Type type = CUIModConfigMenu.entryTypes[valueType];
			CUIModConfigEntryBase cUIModConfigEntryBase = (CUIModConfigEntryBase)(object)((Component)button).gameObject.AddComponent(type);
			cUIModConfigEntryBase.SetReferenceData(cfgKeyValue);
			return cUIModConfigEntryBase;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Nebula.ModConfig";

		public const string PLUGIN_NAME = "Nebula.ModConfig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Nebula.ModConfig.Toasts
{
	public class CUIConfigValueToast : CUIMenu
	{
		[Serializable]
		public class Query
		{
			[TextArea(2, 5)]
			public CUIModConfigEntryBase source;

			public MenuSubstate menuSubstateOnExit;

			public AudioClip clip;

			public string GetKeyText()
			{
				return $"Set value for \"{TextUtils.PascalNameToTitle(source.GetDataKey(), false)}.\"";
			}

			public Query(CUIModConfigEntryBase source, MenuSubstate menuSubstateOnExit)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				this.source = source;
				this.menuSubstateOnExit = menuSubstateOnExit;
			}
		}

		public enum State
		{
			Inactive,
			InitialDelay,
			Outro,
			Toast
		}

		public enum ToastType
		{
			None,
			String,
			KeyCode
		}

		public const int CONFIGTOAST_SUBSTATE = 536870912;

		public static CUIConfigValueToast instance;

		public static readonly List<string> buttonTitles = new List<string> { "APPLY", "DISCARD" };

		private static readonly Dictionary<string, ToastType> toastTypeNames = new Dictionary<string, ToastType>
		{
			{
				typeof(string).FullName,
				ToastType.String
			},
			{
				typeof(KeyCode).FullName,
				ToastType.KeyCode
			}
		};

		public readonly List<EventDelegate> callbackEvents = new List<EventDelegate>();

		public CUIButtonInput defaultButtonInput;

		public AudioClip applyChangesClip;

		public float applyChangesPitch = 1f;

		public float applyChangesVolume = 0.45f;

		[Header("Timings")]
		public float initialDelay = 0.1f;

		public float toastIntroDuration = 0.2f;

		public float toastOutroDuration = 0.2f;

		public float outroDelay = 0.25f;

		[Header("System")]
		public UIPanel toastPanel;

		public UILabel toastLabel;

		public UITexture toastLabelBackground;

		public UIInput inputField;

		public UIButton keycodeButton;

		public UILabel keycodeLabel;

		public List<UIButton> bottomButtons = new List<UIButton>();

		public List<UILabel> bottomButtonLabels = new List<UILabel>();

		public AudioSource audioSource;

		public UITable toastTable;

		public List<UITweener> transitionInTweens = new List<UITweener>();

		public List<UITweener> transitionOutTweens = new List<UITweener>();

		private float _delayRemaining = 1f;

		private KeyCode keyCode;

		private EventDelegate _callback;

		private static Query _query;

		private State _state = State.Outro;

		private static ToastType _type;

		public EventDelegate callback
		{
			set
			{
				_callback = value;
			}
		}

		public State state
		{
			get
			{
				return _state;
			}
			set
			{
				if (value != _state)
				{
					OnNewState(value, _state);
					_state = value;
				}
			}
		}

		public static ToastType type
		{
			get
			{
				return _type;
			}
			set
			{
				if (value != _type)
				{
					instance.OnNewType(value, _type);
					_type = value;
				}
			}
		}

		private void OnNewState(State newState, State oldState)
		{
			switch (newState)
			{
			case State.Inactive:
				ResetTweens();
				((Behaviour)toastPanel).enabled = false;
				break;
			case State.InitialDelay:
				_delayRemaining = initialDelay;
				break;
			case State.Outro:
				break;
			case State.Toast:
				((MonoBehaviour)this).StartCoroutine(ToastSequence());
				break;
			}
		}

		private void OnNewType(ToastType newType, ToastType oldType)
		{
			switch (oldType)
			{
			case ToastType.String:
				((Component)inputField).gameObject.SetActive(false);
				break;
			case ToastType.KeyCode:
				((Component)keycodeButton).gameObject.SetActive(false);
				break;
			}
			CUIButtonInput val = null;
			switch (newType)
			{
			case ToastType.String:
			{
				string valueStringRaw = _query.source.GetValueStringRaw();
				inputField.label.maxLineCount = TextUtils.GetLineCount(valueStringRaw);
				inputField.value = valueStringRaw;
				((Component)inputField).gameObject.SetActive(true);
				val = ((Component)inputField).GetComponent<CUIButtonInput>();
				break;
			}
			case ToastType.KeyCode:
				keycodeLabel.text = _query.source.GetValueStringUncolored();
				((Component)keycodeButton).gameObject.SetActive(true);
				val = ((Component)keycodeButton).GetComponent<CUIButtonInput>();
				break;
			default:
				throw new NotSupportedException("New toast type not recognized");
			case ToastType.None:
				break;
			}
			foreach (UIButton bottomButton in bottomButtons)
			{
				CUIButtonInput component = ((Component)bottomButton).GetComponent<CUIButtonInput>();
				component.selectOnDown = val;
				component.selectOnUp = val;
			}
		}

		protected override void OnEnable()
		{
			state = State.InitialDelay;
			((Behaviour)inputField).enabled = true;
			((CUIMenu)this).OnEnable();
		}

		protected override void Update()
		{
			switch (state)
			{
			case State.Inactive:
				break;
			case State.InitialDelay:
				if (_delayRemaining <= 0f)
				{
					state = State.Toast;
				}
				else
				{
					_delayRemaining -= Time.deltaTime;
				}
				break;
			case State.Outro:
				break;
			case State.Toast:
				ToastUpdate();
				break;
			}
		}

		private void ToastUpdate()
		{
			if (Controls.lockAll)
			{
				if (type == ToastType.KeyCode)
				{
					CaptureInput();
				}
				if (type == ToastType.String && !inputField.isSelected)
				{
					SetInputLock(lockAll: false);
				}
			}
			else if (inputField.isSelected)
			{
				SetInputLock(lockAll: true);
			}
			else
			{
				bool flag = Controls.player.GetButtonDown("Menu Cancel") || Input.GetKeyDown((KeyCode)27);
				bool flag2 = !Controls.Instance.isUsingKeyboardMouse || (Object)(object)UICamera.hoveredObject == (Object)null;
				if (flag && flag2)
				{
					AudioMenu.playCancel = true;
					OnDiscardImmediate();
				}
			}
		}

		private void SetInputLock(bool lockAll)
		{
			Controls.lockAll = true;
			if (type == ToastType.String)
			{
				((Behaviour)inputField).enabled = lockAll;
			}
			bottomButtons.ForEach(delegate(UIButton b)
			{
				((Component)b).gameObject.SetActive(!lockAll);
			});
		}

		private void CaptureInput()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Event current = Event.current;
			if (current.isKey)
			{
				KeyCode val = current.keyCode;
				if ((int)val != 0)
				{
					keyCode = val;
					keycodeLabel.text = ((object)(KeyCode)(ref val)).ToString().ToUpper();
					((UIWidget)keycodeLabel).SetDirty();
					SetInputLock(lockAll: false);
				}
			}
		}

		public static void ActivateWithQuery(CUIModConfigEntryBase source, MenuSubstate menuSubstateOnExit)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			_query = new Query(source, menuSubstateOnExit);
			Type valueType = source.GetValueType();
			if (!toastTypeNames.ContainsKey(valueType.FullName))
			{
				throw new NotSupportedException("Toast does not support config values of type " + valueType.FullName);
			}
			type = toastTypeNames[valueType.FullName];
			Game.Instance.menuSubstate = (MenuSubstate)536870912;
		}

		private IEnumerator ToastSequence()
		{
			_callback = null;
			toastLabel.text = _query.GetKeyText();
			((UIWidget)toastLabel).SetDirty();
			for (int i = 0; i < bottomButtonLabels.Count; i++)
			{
				if (buttonTitles.Count > i)
				{
					((Component)bottomButtons[i]).gameObject.SetActive(true);
					bottomButtonLabels[i].text = buttonTitles[i];
				}
				else
				{
					((Component)bottomButtons[i]).gameObject.SetActive(false);
				}
			}
			if ((Object)(object)_query.clip != (Object)null)
			{
				audioSource.PlayOneShot(_query.clip);
			}
			((Behaviour)toastPanel).enabled = true;
			((UIRect)toastPanel).alpha = 0f;
			toastPanel.Refresh();
			RepositionTable();
			PlayTweens(transitionInTweens);
			yield return (object)new WaitForSeconds(toastIntroDuration);
			while (_callback == null)
			{
				yield return null;
			}
			PlayTweens(transitionOutTweens);
			yield return (object)new WaitForSeconds(toastOutroDuration);
			((Behaviour)toastPanel).enabled = false;
			ResetTweens();
			yield return null;
			FireCallback();
			yield return null;
			state = State.Outro;
		}

		private void ResetTweens()
		{
			for (int i = 0; i < transitionOutTweens.Count; i++)
			{
				transitionOutTweens[i].ResetToBeginning();
				((Behaviour)transitionOutTweens[i]).enabled = false;
			}
			for (int j = 0; j < transitionInTweens.Count; j++)
			{
				transitionInTweens[j].ResetToBeginning();
				((Behaviour)transitionInTweens[j]).enabled = false;
			}
		}

		private void PlayTweens(List<UITweener> tweeners)
		{
			for (int i = 0; i < tweeners.Count; i++)
			{
				((Behaviour)tweeners[i]).enabled = true;
				tweeners[i].PlayForward();
			}
		}

		[ContextMenu("Reposition Table")]
		private void RepositionTable()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			toastTable.Reposition();
			((Component)toastLabel).transform.localPosition = new Vector3(10f, 0f, 0f);
			Vector3 localPosition = ((Component)toastTable).transform.localPosition;
			Bounds val = NGUIMath.CalculateRelativeWidgetBounds(((Component)toastTable).transform);
			localPosition.y = ((Bounds)(ref val)).extents.y;
			((Component)toastTable).transform.localPosition = localPosition;
			((UIWidget)toastLabelBackground).width = (int)((Bounds)(ref val)).extents.x * 2;
			((UIWidget)toastLabelBackground).height = (int)((Bounds)(ref val)).extents.y * 2;
		}

		private void FireCallback()
		{
			if (_callback != null)
			{
				_callback.Execute();
			}
		}

		public void OnApplyImmediate()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			string value = inputField.value;
			switch (_type)
			{
			case ToastType.String:
			{
				CUIModConfigEntry<string> cUIModConfigEntry2 = (CUIModConfigEntry<string>)_query.source;
				cUIModConfigEntry2.value = value;
				break;
			}
			case ToastType.KeyCode:
			{
				CUIModConfigEntry<KeyCode> cUIModConfigEntry = (CUIModConfigEntry<KeyCode>)_query.source;
				cUIModConfigEntry.value = keyCode;
				break;
			}
			}
			_callback = new EventDelegate(new Callback(ExitToQuerySubstate));
		}

		public void OnDiscardImmediate()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			_callback = new EventDelegate(new Callback(ExitToQuerySubstate));
		}

		private void ExitToQuerySubstate()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Game.Instance.menuSubstate = _query.menuSubstateOnExit;
			Controls.lockAll = false;
			type = ToastType.None;
		}

		public void OnKeyCodeClicked()
		{
			SetInputLock(lockAll: true);
		}

		public void OnInputFieldSubmit()
		{
			SetInputLock(lockAll: false);
			UICamera.selectedObject = ((Component)bottomButtons[0]).gameObject;
		}
	}
	internal static class ModConfigToastCreator
	{
		public static void CreateToasts(Transform menuRoot, Camera uiCam)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			MenuSubstateGate val = NGUITools.AddChild<MenuSubstateGate>(((Component)menuRoot).gameObject);
			((Object)val).name = "GATE_ConfigToast";
			val.activeStateMask = (MenuSubstate)536870912;
			((Component)val).transform.SetParent(menuRoot);
			UIAnchor val2 = NGUITools.AddChild<UIAnchor>(((Component)val).gameObject);
			val2.uiCamera = uiCam;
			val2.side = (Side)8;
			val2.runOnlyOnce = true;
			val2.relativeOffset = new Vector2(0f, -0.07f);
			((Object)val2).name = "ANCHOR_ConfigToast";
			((Component)val2).transform.position = new Vector3(0f, -76f, 0f);
			((Component)val2).gameObject.SetActive(false);
			GameObjectUtils.CopyParentLayer(((Component)val2).gameObject);
			val.gameObjects.Add(((Component)val2).gameObject);
			CUIConfigValueToast cUIConfigValueToast = (CUIConfigValueToast.instance = NGUITools.AddChild<CUIConfigValueToast>(((Component)val2).gameObject));
			cUIConfigValueToast.audioSource = ((Component)GameObjectUtils.GetRootObject("# AUDIO").transform.FindChild("AUDIO_StoryToast")).GetComponent<AudioSource>();
			cUIConfigValueToast.applyChangesClip = Resources.Load<AudioClip>("AudioClip/beep_select_04");
			cUIConfigValueToast.applyChangesPitch = 0.3f;
			cUIConfigValueToast.applyChangesVolume = 0.58f;
			((CUIMenu)cUIConfigValueToast).menuSubstateOnCancel = (MenuSubstate)268435456;
			((Object)cUIConfigValueToast).name = "ROOT_ConfigToast";
			cUIConfigValueToast.callbackEvents.Add(new EventDelegate(new Callback(cUIConfigValueToast.OnApplyImmediate)));
			cUIConfigValueToast.callbackEvents.Add(new EventDelegate(new Callback(cUIConfigValueToast.OnDiscardImmediate)));
			((Component)cUIConfigValueToast).transform.parent = ((Component)val2).transform;
			GameObjectUtils.CopyParentLayer(((Component)cUIConfigValueToast).gameObject);
			CreateConfigToastChildren(cUIConfigValueToast);
			cUIConfigValueToast.state = CUIConfigValueToast.State.Inactive;
		}

		private static void CreateConfigToastChildren(CUIConfigValueToast toast)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			UIPanel val = NGUITools.AddChild<UIPanel>(((Component)toast).gameObject);
			val.renderQueue = (RenderQueue)0;
			val.startingRenderQueue = 3038;
			((Object)val).name = "ROOT_ConfigEntry";
			GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
			toast.toastPanel = val;
			Rigidbody val2 = ((Component)val).gameObject.AddComponent<Rigidbody>();
			val2.useGravity = false;
			val2.isKinematic = true;
			TweenAlpha val3 = ((Component)val).gameObject.AddComponent<TweenAlpha>();
			val3.from = 0f;
			((UITweener)val3).duration = 0.2f;
			((Behaviour)val3).enabled = false;
			toast.transitionInTweens.Add((UITweener)(object)val3);
			TweenPosition val4 = ((Component)val).gameObject.AddComponent<TweenPosition>();
			val4.from = new Vector3(240f, 0f, 0f);
			((UITweener)val4).duration = 0.2f;
			val4.to = Vector3.zero;
			toast.transitionInTweens.Add((UITweener)(object)val4);
			TweenAlpha val5 = ((Component)val).gameObject.AddComponent<TweenAlpha>();
			val5.to = 0f;
			((UITweener)val5).duration = 0.2f;
			((Behaviour)val5).enabled = false;
			toast.transitionOutTweens.Add((UITweener)(object)val5);
			TweenPosition val6 = ((Component)val).gameObject.AddComponent<TweenPosition>();
			val6.to = new Vector3(-240f, 0f, 0f);
			((UITweener)val6).duration = 0.2f;
			val6.from = Vector3.zero;
			toast.transitionOutTweens.Add((UITweener)(object)val6);
			UITexture val7 = NGUITools.AddWidget<UITexture>(((Component)val).gameObject);
			((UIWidget)val7).color = new Color(0f, 0f, 0f, 0.9608f);
			((UIWidget)val7).width = 720;
			((UIWidget)val7).height = 115;
			((UIWidget)val7).depth = -1;
			((UIWidget)val7).mainTexture = (Texture)(object)Resources.Load<Texture2D>("ui/ngui/textures/fill_64x");
			((UIWidget)val7).pivot = (Pivot)4;
			((Component)val7).transform.localPosition = new Vector3(0f, 0f, 0f);
			toast.toastLabelBackground = val7;
			UITable val8 = NGUITools.AddChild<UITable>(((Component)val).gameObject);
			val8.columns = 1;
			val8.sorting = (Sorting)0;
			val8.direction = (Direction)0;
			((Object)val8).name = "TABLE_ConfigEntry";
			((Component)val8).transform.localPosition = new Vector3(-360f, 56f, 0f);
			GameObjectUtils.CopyParentLayer(((Component)val8).gameObject);
			toast.toastTable = val8;
			UILabel val9 = UIFactory.CreateLabel(((Component)val8).gameObject, "LABEL_Header", new LabelSettings
			{
				Text = "HEADER",
				Font = StockFonts.blender["Bold"],
				FontSize = 32,
				Width = 320
			}, (Pivot)0);
			((Component)val9).transform.localPosition = new Vector3(10f, 7f, 0f);
			toast.toastLabel = val9;
			CreateInputHandlers(toast, val8);
			CreateConfigToastButtons(toast, val8);
		}

		private static void CreateInputHandlers(CUIConfigValueToast toast, UITable table)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0178: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			((Color)(ref val))..ctor(0.25f, 0.25f, 0.25f);
			UIInput val2 = UIFactory.CreateInput(((Component)table).gameObject, "INPUT_Text", new InputFieldSettings
			{
				Font = StockFonts.blender["Bold"],
				Text = "Place text here",
				FontSize = 24,
				Width = 656,
				Overflow = (Overflow)1,
				BackgroundColor = new Color(val.r, val.g, val.b),
				StartsSelected = true
			}, (Pivot)4);
			val2.onSubmit = new List<EventDelegate>
			{
				new EventDelegate(new Callback(toast.OnInputFieldSubmit))
			};
			((Component)val2).transform.localPosition = new Vector3(0f, -16f, 0f);
			((Component)val2).gameObject.SetActive(false);
			toast.inputField = val2;
			UIButton val3 = UIFactory.CreateButton(((Component)table).gameObject, "BUTTON_KeyCode", new ButtonSettings
			{
				Size = new Vector3(360f, 40f),
				OnClick = new List<EventDelegate>
				{
					new EventDelegate(new Callback(toast.OnKeyCodeClicked))
				},
				Color = val,
				StartsSelected = true
			}, new LabelSettings
			{
				Width = 360,
				Effect = (Effect)0,
				Text = "KEYCODE",
				FontSize = 24
			}, (Pivot)4);
			((Component)val3).transform.localPosition = new Vector3(0f, -16f, 0f);
			((Component)val3).gameObject.SetActive(false);
			toast.keycodeButton = val3;
			CUIMenuAudioTrigger component = ((Component)val3).GetComponent<CUIMenuAudioTrigger>();
			component.clipType = (AudioClipType)2;
			toast.keycodeLabel = ((Component)val3).GetComponentInChildren<UILabel>();
		}

		private static void CreateConfigToastButtons(CUIConfigValueToast toast, UITable table)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			UIGrid val = NGUITools.AddChild<UIGrid>(((Component)table).gameObject);
			val.arrangement = (Arrangement)1;
			val.sorting = (Sorting)0;
			val.cellWidth = 400f;
			val.cellHeight = 400f;
			((Behaviour)val).enabled = false;
			((Component)val).transform.localPosition = new Vector3(0f, -116f, 0f);
			GameObjectUtils.CopyParentLayer(((Component)val).gameObject);
			List<string> buttonTitles = CUIConfigValueToast.buttonTitles;
			CUIButtonInput val2 = null;
			CUIButtonInput val3 = null;
			CUIButtonInput[] componentsInChildren = ((Component)table).GetComponentsInChildren<CUIButtonInput>();
			for (int i = 0; i < buttonTitles.Count; i++)
			{
				CUIButtonInput val4 = GenerateConfigToastButton(i, val, toast);
				((Component)val4).transform.localPosition = new Vector3((float)(-180 + 360 * i), 0f, 0f);
				if ((Object)(object)val3 != (Object)null)
				{
					val4.selectOnLeft = val3;
					val3.selectOnRight = val4;
					CUIButtonInput[] array = componentsInChildren;
					foreach (CUIButtonInput val5 in array)
					{
						val5.selectOnUp = val4;
					}
				}
				else
				{
					val2 = val4;
				}
				if (i == buttonTitles.Count - 1)
				{
					val2.selectOnLeft = val4;
					val4.selectOnRight = val2;
					CUIButtonInput[] array2 = componentsInChildren;
					foreach (CUIButtonInput val6 in array2)
					{
						val6.selectOnDown = val4;
					}
				}
			}
		}

		private static CUIButtonInput GenerateConfigToastButton(int i, UIGrid grid, CUIConfigValueToast toast)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00bf: Expected O, but got Unknown
			//IL_00bf: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			int num = i + 1;
			UIButton val = UIFactory.CreateButton(((Component)grid).gameObject, num.ToString("D3") + "_BUTTON", new ButtonSettings
			{
				Size = new Vector3(360f, 40f, 0f),
				OnClick = new List<EventDelegate> { toast.callbackEvents[i] },
				Color = new Color(0.1176f, 0.1176f, 0.1176f),
				DisabledColor = Color.black
			}, new LabelSettings
			{
				Width = 360,
				Text = "BUTTON " + num,
				FontSize = 20
			}, (Pivot)4);
			toast.bottomButtons.Add(val);
			UILabel componentInChildren = ((Component)val).GetComponentInChildren<UILabel>();
			toast.bottomButtonLabels.Add(componentInChildren);
			CUIButtonInput component = ((Component)val).GetComponent<CUIButtonInput>();
			if (i == 0)
			{
				component.startsSelected = true;
			}
			((Component)val).GetComponent<BoxCollider>().center = Vector3.zero;
			return component;
		}
	}
}
namespace Nebula.ModConfig.EntryTypes
{
	public class CUIModConfigBoolEntry : CUIModConfigEntry<bool>
	{
		private void ToggleValue()
		{
			base.value = !base.value;
		}

		protected override void AdjustValueBackward()
		{
			ToggleValue();
		}

		protected override void AdjustValueForward()
		{
			ToggleValue();
		}

		public override string GetValueStringUncolored()
		{
			return base.value ? "ON" : "OFF";
		}
	}
	public abstract class CUIModConfigCycleEntry<T> : CUIModConfigEntry<T>
	{
		public List<T> cycle { protected get; set; } = new List<T>();


		protected int GetValueIndex()
		{
			return cycle.IndexOf(base.value);
		}

		protected void CycleBy(int by)
		{
			int index = MathUtils.CanonicalMod(GetValueIndex() + by, cycle.Count);
			base.value = cycle[index];
		}

		protected override void AdjustValueForward()
		{
			CycleBy(1);
		}

		protected override void AdjustValueBackward()
		{
			CycleBy(-1);
		}
	}
	public abstract class CUIModConfigEntry<T> : CUIModConfigEntryBase
	{
		protected T _value;

		protected ConfigEntry<T> dataTyped
		{
			get
			{
				return (ConfigEntry<T>)(object)data;
			}
			set
			{
				data = (ConfigEntryBase)(object)value;
			}
		}

		public T value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				dirty = true;
			}
		}

		public void SetReferenceData(ConfigEntry<T> dataTyped)
		{
			this.dataTyped = dataTyped;
		}

		public override Type GetValueType()
		{
			return typeof(T);
		}

		protected override void CacheCurrentValue()
		{
			dataTyped.Value = value;
			dirty = false;
		}

		protected override void OnEnable()
		{
			if (!dirty)
			{
				_value = dataTyped.Value;
			}
			((CUIOption)this).RefreshButton(false);
		}

		protected abstract void AdjustValueForward();

		protected abstract void AdjustValueBackward();

		protected override void OnClick()
		{
			if (UICamera.currentTouchID == -2)
			{
				AdjustValueBackward();
			}
			else
			{
				AdjustValueForward();
			}
			((CUIOption)this).RefreshButton(false);
		}

		protected override void OnButtonRight()
		{
			AdjustValueForward();
			((CUIOption)this).RefreshButton(true);
		}

		protected override void OnButtonLeft()
		{
			AdjustValueBackward();
			((CUIOption)this).RefreshButton(true);
		}

		public override string GetValueStringRaw()
		{
			return value.ToString();
		}

		public override string GetValueStringUncolored()
		{
			return GetValueStringRaw().ToUpper();
		}

		protected override string GetValueString()
		{
			return $"[{((CUIOption)this).GetOptionColorMarkup()}]{GetValueStringUncolored()}";
		}

		public override string GetConfigString()
		{
			return "";
		}
	}
	public abstract class CUIModConfigEntryBase : CUIOption
	{
		[HideInInspector]
		protected ConfigEntryBase data;

		public bool dirty = false;

		public void SetReferenceData(ConfigEntryBase data)
		{
			this.data = data;
		}

		public string GetDataKey()
		{
			return data.Definition.Key;
		}

		public string GetDataSection()
		{
			return data.Definition.Section;
		}

		public abstract Type GetValueType();

		public abstract string GetValueStringRaw();

		public abstract string GetValueStringUncolored();

		public virtual void SetupFromType(Type type)
		{
		}
	}
	public abstract class CUIModConfigEnumEntry<TEnum> : CUIModConfigCycleEntry<TEnum> where TEnum : Enum
	{
		protected override void OnEnable()
		{
			if (base.cycle.Count == 0)
			{
				TEnum[] collection = (TEnum[])Enum.GetValues(typeof(TEnum));
				base.cycle = new List<TEnum>(collection);
			}
			base.OnEnable();
		}
	}
	public class CUIModConfigEnumGenericEntry : CUIModConfigCycleEntry<object>
	{
		protected override void CacheCurrentValue()
		{
			data.BoxedValue = base.value;
			dirty = false;
		}

		protected override void OnEnable()
		{
			if (!dirty)
			{
				_value = data.BoxedValue;
			}
			((CUIOption)this).RefreshButton(false);
		}

		public override void SetupFromType(Type type)
		{
			foreach (object value in Enum.GetValues(type))
			{
				base.cycle.Add(value);
			}
		}
	}
	public class CUIModConfigIntEntry : CUIModConfigEntry<int>
	{
		private void AdjustValueBy(int by)
		{
			base.value += by;
		}

		protected override void AdjustValueBackward()
		{
			AdjustValueBy(-1);
		}

		protected override void AdjustValueForward()
		{
			AdjustValueBy(1);
		}
	}
	public class CUIModConfigKeyCodeEntry : CUIModConfigEntry<KeyCode>
	{
		protected override void AdjustValueBackward()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			base.value = (KeyCode)((ConfigEntryBase)base.dataTyped).DefaultValue;
		}

		protected override void AdjustValueForward()
		{
			CUIConfigValueToast.ActivateWithQuery(this, (MenuSubstate)268435456);
		}
	}
	public class CUIModConfigStringEntry : CUIModConfigEntry<string>
	{
		public const int DISPLAY_LENGTH_MAX = 10;

		protected override void AdjustValueBackward()
		{
			base.value = (string)((ConfigEntryBase)base.dataTyped).DefaultValue;
		}

		protected override void AdjustValueForward()
		{
			CUIConfigValueToast.ActivateWithQuery(this, (MenuSubstate)268435456);
		}

		public override string GetValueStringUncolored()
		{
			if (base.value.Length <= 10)
			{
				return base.value;
			}
			string text = base.value.Substring(0, 7);
			return text.PadRight(10, '.');
		}
	}
}

plugins/Nebula.UI.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Nebula.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Nebula.UI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Nebula.UI")]
[assembly: AssemblyTitle("Nebula.UI")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Nebula.UI;

public class MOTDDatum
{
	public string motdPath;

	public string motd;

	public MOTDDatum(string motd, string motdPath = "WIDGET_MOTD/PANEL_ScrollWindow/010_LABEL_BlockText")
	{
		this.motd = motd;
		this.motdPath = motdPath;
	}
}
public class ButtonDatum
{
	public UIButton button;

	public string menuPath;

	public int priority;

	public MOTDDatum motdDatum;

	public ButtonDatum(UIButton button, string menuPath, int priority, MOTDDatum motdDatum = null)
	{
		this.button = button;
		this.menuPath = menuPath;
		this.priority = priority;
		this.motdDatum = motdDatum;
	}
}
[Obsolete("Use UIFactory.CreateButton")]
public static class ButtonFactory
{
	public static UIButton Create(ButtonFactoryDatum datum)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)((Component)GameObjectUtils.GetMenu(datum.menuPath ?? "")).transform.FindChild(datum.buttonsPath)).gameObject;
		return gameObject.CreateButton(datum.name, new UIFactory.ButtonSettings
		{
			OnClick = datum.onClick,
			Size = datum.buttonSize
		}, new UIFactory.LabelSettings
		{
			Text = datum.text,
			Font = datum.detail.font,
			FontSize = datum.fontSize,
			Color = datum.detail.color
		}, (Pivot)5);
	}

	public static List<UIButton> CreateMultiple(List<ButtonFactoryDatum> data)
	{
		return new List<UIButton>(LinqSubstitute.Remap<ButtonFactoryDatum, UIButton>((IEnumerable<ButtonFactoryDatum>)data, (Func<ButtonFactoryDatum, UIButton>)Create));
	}
}
[Obsolete("Use UIFactory.CreateButton")]
public class ButtonDetailDatum
{
	public Color color;

	public Font font;

	public ButtonDetailDatum(Color color, Font font = null)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		this.color = color;
		this.font = font ?? StockFonts.microgramma["BoldDynamic"];
	}
}
[Obsolete("Use UIFactory.CreateButton")]
public class ButtonFactoryDatum
{
	public string name;

	public string text;

	public List<EventDelegate> onClick;

	public int fontSize;

	public Vector3 buttonSize;

	public string menuPath;

	public string buttonsPath;

	public ButtonDetailDatum detail;

	public ButtonFactoryDatum(string name, string text, List<EventDelegate> onClick, int fontSize, Vector3 buttonSize, string menuPath, string buttonsPath, ButtonDetailDatum detail = null)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		this.name = name;
		this.text = text;
		this.onClick = onClick;
		this.fontSize = fontSize;
		this.buttonSize = buttonSize;
		this.menuPath = menuPath;
		this.buttonsPath = buttonsPath;
		this.detail = detail ?? new ButtonDetailDatum(Color.white);
	}
}
public class ButtonSpawner
{
	private const string type = "ButtonSpawner";

	public static Queue<ButtonDatum> buttonQueue = new Queue<ButtonDatum>();

	public static void InitQueue()
	{
		GameObject rootObject = GameObjectUtils.GetRootObject("# CUI_2D");
		Transform val = rootObject.transform.FindChild("Camera/ROOT_Menus");
		Debug.Log((object)string.Format("{0}: Resolving {1} buttons in queue...", "ButtonSpawner", buttonQueue.Count));
		foreach (ButtonDatum item in buttonQueue)
		{
			Transform val2 = val.FindChild(item.menuPath);
			string text = item.priority.ToString().PadLeft(3, '0');
			((Object)item.button).name = text + "_" + ((Object)item.button).name;
			if (item.motdDatum != null)
			{
				UILabel component = ((Component)val2.FindChild(item.motdDatum.motdPath)).GetComponent<UILabel>();
				((CUIMenu)(object)((Component)val2).GetComponent<CUIMainMenu>()).AddTooltip(component, ((Component)item.button).gameObject, item.motdDatum.motd);
			}
		}
		Debug.Log((object)"ButtonSpawner: Button creation complete.");
		buttonQueue.Clear();
	}
}
public class CUIInputField : MonoBehaviour
{
	public UIInput input;

	public UITexture background;

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		if (((UIWidget)background).pivot != ((UIWidget)input.label).pivot)
		{
			((UIWidget)background).pivot = ((UIWidget)input.label).pivot;
			((Component)background).transform.localPosition = Vector3.zero;
		}
	}
}
public static class StockFonts
{
	public static Dictionary<string, Font> serifGothic = new Dictionary<string, Font>
	{
		{
			"Normal",
			LoadFont("SerifGothicStd")
		},
		{
			"Black",
			LoadFont("SerifGothicStd-Black")
		},
		{
			"Bold",
			LoadFont("SerifGothicStd-Bold")
		},
		{
			"ExtraBold",
			LoadFont("SerifGothicStd-ExtraBold")
		},
		{
			"Heavy",
			LoadFont("SerifGothicStd-Heavy")
		},
		{
			"Light",
			LoadFont("SerifGothicStd-Light")
		}
	};

	public static Dictionary<string, Font> microgramma = new Dictionary<string, Font>
	{
		{
			"Bold",
			LoadFont("MicrogrammaExtDBold")
		},
		{
			"BoldDynamic",
			LoadFont("MicrogrammaExtDBold_Dynamic")
		},
		{
			"BoldStatic",
			LoadFont("MicrogrammaExtDBoldStatic_CockpitHUD")
		},
		{
			"Med",
			LoadFont("MicrogrammaExtDMed")
		},
		{
			"MedDynamic",
			LoadFont("MicrogrammaExtDMed_Dynamic")
		},
		{
			"MedStatic",
			LoadFont("MicrogrammaExtDMedStatic_CockpitHUD")
		}
	};

	public static Dictionary<string, Font> blender = new Dictionary<string, Font>
	{
		{
			"Bold",
			LoadFont("Blender-Bold")
		},
		{
			"Book",
			LoadFont("Blender-Book")
		}
	};

	private static Font LoadFont(string fontName)
	{
		return Resources.Load<Font>("ui/fonts/" + fontName);
	}
}
public static class UIFactory
{
	public class LabelSettings
	{
		public string Text { get; set; } = "";


		public Color Color { get; set; } = Color.white;


		public int FontSize { get; set; }

		public int Width { get; set; }

		public Font Font { get; set; } = StockFonts.microgramma["BoldDynamic"];


		public Effect Effect { get; set; } = (Effect)1;


		public int MaxLineCount { get; set; } = 1;


		public Overflow Overflow { get; set; } = (Overflow)2;

	}

	public class TextureSettings
	{
		public Vector3 Size { get; set; }

		public Color Color { get; set; } = Color.clear;

	}

	public class ButtonSettings : TextureSettings
	{
		public float TweenDuration { get; set; } = 0.01f;


		public Color HoverColor { get; set; } = new Color(0.7686f, 0.1804f, 0f);


		public Color PressedColor { get; set; } = new Color(0.7725f, 0.1808f, 0f);


		public Color DisabledColor { get; set; } = Color.gray;


		public List<EventDelegate> OnClick { get; set; } = new List<EventDelegate>();


		public bool UseSpriteAtlas { get; set; } = false;


		public bool StartsSelected { get; set; } = false;

	}

	public class InputFieldSettings : LabelSettings
	{
		public KeyboardType KeyboardType { get; set; } = (KeyboardType)0;


		public Color BackgroundColor { get; set; } = new Color(0.0392f, 0.0392f, 0.0392f);


		public Color SelectColor { get; set; } = new Color(0.7686f, 0.1804f, 0f, 0.2f);


		public bool StartsSelected { get; set; } = false;

	}

	public static UILabel CreateLabel(this GameObject root, string name, LabelSettings settings, Pivot pivot)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		UILabel val = NGUITools.AddWidget<UILabel>(root);
		((Object)val).name = name;
		val.text = settings.Text;
		val.effectStyle = settings.Effect;
		((UIWidget)val).color = settings.Color;
		((UIWidget)val).height = settings.FontSize * settings.MaxLineCount;
		val.maxLineCount = settings.MaxLineCount;
		((UIWidget)val).width = settings.Width;
		val.overflowMethod = settings.Overflow;
		((UIWidget)val).pivot = pivot;
		((Component)val).transform.localPosition = Vector3.zero;
		val.trueTypeFont = settings.Font;
		val.fontSize = settings.FontSize;
		return val;
	}

	public static UITexture CreateTextureBackground(this GameObject root, TextureSettings settings, Pivot pivot)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		Texture2D mainTexture = Resources.Load<Texture2D>("ui/ngui/textures/fill_64x");
		UITexture val = NGUITools.AddWidget<UITexture>(root);
		((Object)val).name = "TEXTURE_Background";
		((UIWidget)val).mainTexture = (Texture)(object)mainTexture;
		((UIWidget)val).color = settings.Color;
		((UIWidget)val).pivot = pivot;
		((Component)val).transform.localPosition = MathUtils.GetOffset(settings.Size, pivot);
		((UIWidget)val).shader = Shader.Find("Unlit/Transparent Colored");
		((UIWidget)val).width = (int)settings.Size.x;
		((UIWidget)val).height = (int)settings.Size.y;
		((UIWidget)val).depth = -1;
		return val;
	}

	public static UISprite AddSpriteComponent(this GameObject root, TextureSettings settings, Pivot pivot)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		UISprite val = root.AddComponent<UISprite>();
		((UIWidget)val).pivot = pivot;
		((Component)val).transform.localPosition = MathUtils.GetOffset(settings.Size, pivot);
		val.atlas = Resources.Load<UIAtlas>("ui/ngui/StarfighterAtlas");
		val.spriteName = "fill_64x";
		val.type = (Type)1;
		((UIWidget)val).width = (int)settings.Size.x;
		((UIWidget)val).height = (int)settings.Size.y;
		((UIWidget)val).color = settings.Color;
		val.tilingScaleX = 1f;
		return val;
	}

	public static UISprite CreateSprite(this GameObject root, string name, TextureSettings settings, Pivot pivot)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = NGUITools.AddChild(root);
		GameObjectUtils.CopyParentLayer(val);
		((Object)val).name = name;
		return val.AddSpriteComponent(settings, pivot);
	}

	private static BoxCollider CreateInteractionArea(this GameObject root, Vector3 size, Pivot pivot)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		BoxCollider val = root.AddComponent<BoxCollider>();
		val.size = size;
		val.center = MathUtils.GetOffset(size, pivot);
		((Collider)val).isTrigger = true;
		return val;
	}

	public static UIButton CreateButton(this GameObject root, string name, ButtonSettings settings, LabelSettings labelSettings, Pivot pivot)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		bool flag = labelSettings != null;
		GameObject val = NGUITools.AddChild(root);
		((Object)val).name = name;
		GameObjectUtils.CopyParentLayer(val);
		UIButton val2 = val.AddComponent<UIButton>();
		val2.onClick = settings.OnClick;
		((UIButtonColor)val2).hover = settings.HoverColor;
		((UIButtonColor)val2).pressed = settings.PressedColor;
		((UIButtonColor)val2).disabledColor = settings.DisabledColor;
		((UIButtonColor)val2).duration = 0.01f;
		val.CreateInteractionArea(settings.Size, pivot);
		CUIButtonInput val3 = val.AddComponent<CUIButtonInput>();
		val3.inputType = (InputType)0;
		val3.sendsOnClickOnConfirm = true;
		val3.startsSelected = settings.StartsSelected;
		CUIMenuAudioTrigger val4 = val.AddComponent<CUIMenuAudioTrigger>();
		val4.clipType = (AudioClipType)0;
		val4.trigger = (Trigger)1;
		GameObject val6;
		if (!settings.UseSpriteAtlas)
		{
			UITexture val5 = val.CreateTextureBackground(settings, pivot);
			val6 = ((Component)val5).gameObject;
		}
		else if (flag)
		{
			UISprite val7 = val.CreateSprite("SPRITE_Background", settings, pivot);
			((UIWidget)val7).depth = -1;
			val6 = ((Component)val7).gameObject;
		}
		else
		{
			val.AddSpriteComponent(settings, pivot);
			val6 = val;
		}
		TweenColor val8 = val6.gameObject.AddComponent<TweenColor>();
		val8.from = settings.HoverColor;
		val8.to = settings.Color;
		((UITweener)val8).duration = settings.TweenDuration;
		((UIButtonColor)val2).tweenTarget = val6;
		if (flag)
		{
			val.CreateLabel("LABEL_Button", labelSettings, pivot);
		}
		return val2;
	}

	public static CUIButtonTooltip AddTooltip(this CUIMenu menu, UILabel label, GameObject target, string text)
	{
		CUIButtonTooltip val = ((Component)menu).gameObject.AddComponent<CUIButtonTooltip>();
		val.label = label;
		val.target = target;
		val.text = text;
		return val;
	}

	public static UIScrollBar CreateVerticalScrollBar(this GameObject root, string name, float barSize, UIScrollView scrollView)
	{
		//IL_0011: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: 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)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		UIPanel val = NGUITools.AddChild<UIPanel>(root);
		val.showInPanelTool = false;
		val.renderQueue = (RenderQueue)1;
		Rigidbody val2 = ((Component)val).gameObject.AddComponent<Rigidbody>();
		val2.useGravity = false;
		val2.isKinematic = true;
		UIScrollBar val3 = ((Component)val).gameObject.AddComponent<UIScrollBar>();
		val3.barSize = barSize;
		((UIProgressBar)val3).fillDirection = (FillDirection)3;
		((Object)val3).name = name;
		GameObjectUtils.CopyParentLayer(((Component)val3).gameObject);
		((Behaviour)val3).enabled = true;
		scrollView.verticalScrollBar = (UIProgressBar)(object)val3;
		UISprite val4 = ((Component)val3).gameObject.CreateSprite("Background", new TextureSettings
		{
			Color = Color.black,
			Size = new Vector3(2f, 288f, 0f)
		}, (Pivot)1);
		((UIWidget)val4).depth = -1;
		((Component)val4).transform.localPosition = Vector3.zero;
		((UIProgressBar)val3).backgroundWidget = (UIWidget)(object)val4;
		((Component)val4).gameObject.CreateInteractionArea(new Vector3(16f, 288f, 0f), (Pivot)1);
		UIButton val5 = ((Component)val3).gameObject.CreateButton("Foreground", new ButtonSettings
		{
			Size = new Vector3(14f, 288f, 0f),
			Color = Color.gray,
			HoverColor = Color.white,
			PressedColor = new Color(1f, 0.67f, 0f),
			TweenDuration = 0.05f,
			UseSpriteAtlas = true
		}, null, (Pivot)1);
		((Component)val5).transform.localPosition = Vector3.zero;
		((UIProgressBar)val3).foregroundWidget = (UIWidget)(object)((Component)val5).GetComponent<UISprite>();
		return val3;
	}

	public static UIInput CreateInput(this GameObject root, string name, InputFieldSettings settings, Pivot pivot)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: 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)
		UILabel val = root.CreateLabel(name, settings, pivot);
		BoxCollider val2 = ((Component)val).gameObject.AddComponent<BoxCollider>();
		((Collider)val2).isTrigger = true;
		val2.size = new Vector3((float)((UIWidget)val).width, (float)((UIWidget)val).height, 0f);
		CUIButtonInput val3 = ((Component)val).gameObject.AddComponent<CUIButtonInput>();
		val3.inputType = (InputType)0;
		val3.sendsOnClickOnConfirm = true;
		val3.startsSelected = settings.StartsSelected;
		((Behaviour)val3).enabled = false;
		CUIMenuAudioTrigger val4 = ((Component)val).gameObject.AddComponent<CUIMenuAudioTrigger>();
		val4.clipType = (AudioClipType)2;
		val4.trigger = (Trigger)1;
		UIInput val5 = ((Component)val).gameObject.AddComponent<UIInput>();
		val5.keyboardType = settings.KeyboardType;
		val5.label = val;
		val5.selectionColor = settings.SelectColor;
		val5.caretColor = settings.Color;
		UITexture background = ((Component)val).gameObject.CreateTextureBackground(new TextureSettings
		{
			Size = new Vector3((float)((UIWidget)val).width, (float)((UIWidget)val).height),
			Color = settings.BackgroundColor
		}, pivot);
		CUIInputField cUIInputField = ((Component)val5).gameObject.AddComponent<CUIInputField>();
		cUIInputField.input = val5;
		cUIInputField.background = background;
		return val5;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "Nebula.UI";

	public const string PLUGIN_NAME = "Nebula.UI";

	public const string PLUGIN_VERSION = "1.0.0";
}

plugins/Nebula.Utils.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Nebula.Utils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Nebula.Utils")]
[assembly: AssemblyTitle("Nebula.Utils")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Nebula.Utils;

public static class GameObjectUtils
{
	public static T FirstByName<T>(this IEnumerable<Object> values, string name) where T : Object
	{
		Object obj = values.FirstOf((Object o) => o.name == name);
		return (T)(object)((obj is T) ? obj : null);
	}

	public static GameObject GetRootObject(string name)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		return ((IEnumerable<Object>)(object)((Scene)(ref activeScene)).GetRootGameObjects()).FirstByName<GameObject>(name);
	}

	public static CUIMenu GetMenu(string path)
	{
		return ((Component)GetRootObject("# CUI_2D").transform.FindChild("Camera/ROOT_Menus/" + path)).GetComponent<CUIMenu>();
	}

	public static void CopyParentLayer(this GameObject go)
	{
		go.layer = ((Component)go.transform.parent).gameObject.layer;
	}
}
[Obsolete("Linq is present in this version of dotnet without an external assembly. Therefore, this class and its extension methods should no longer be used.")]
public static class LinqSubstitute
{
	public static int Count<T>(this IEnumerable<T> values)
	{
		return new List<T>(values).Count;
	}

	public static T FirstOf<T>(this IEnumerable<T> values, Func<T, bool> predicate)
	{
		foreach (T value in values)
		{
			if (predicate(value))
			{
				return value;
			}
		}
		return default(T);
	}

	public static IEnumerable<U> Remap<T, U>(this IEnumerable<T> values, Func<T, U> remapper)
	{
		foreach (T item in values)
		{
			yield return remapper(item);
		}
	}

	public static Dictionary<T, U> Zipper<T, U>(this IEnumerable<T> keys, IEnumerable<U> values)
	{
		List<T> list = new List<T>(keys);
		List<U> list2 = new List<U>(values);
		if (list.Count != list2.Count)
		{
			throw new ArgumentException("Keys and values are not the same length");
		}
		Dictionary<T, U> dictionary = new Dictionary<T, U>();
		for (int i = 0; i < list.Count; i++)
		{
			dictionary.Add(list[i], list2[i]);
		}
		return dictionary;
	}
}
public static class MathUtils
{
	public static float CanonicalMod(this float a, float b)
	{
		return a - b * Mathf.Floor(a / b);
	}

	public static int CanonicalMod(this int a, int b)
	{
		return (int)((float)a).CanonicalMod((float)b);
	}

	public static Vector3 GetOffset(this Vector3 size, Pivot pivot)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected I4, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_006a: Invalid comparison between Unknown and I4
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Invalid comparison between Unknown and I4
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 zero = Vector3.zero;
		switch ((int)pivot)
		{
		case 0:
		case 3:
		case 6:
			zero.x = size.x / 2f;
			break;
		case 2:
		case 5:
		case 8:
			zero.x = (0f - size.x) / 2f;
			break;
		}
		if ((int)pivot > 2)
		{
			if (pivot - 6 <= 2)
			{
				zero.y = size.y / 2f;
			}
		}
		else
		{
			zero.y = (0f - size.y) / 2f;
		}
		return zero;
	}
}
public static class TextUtils
{
	public static string SpacePascalCase(this string pascal)
	{
		return Regex.Replace(pascal, "[a-z][A-Z]", (Match m) => m.Value[0] + " " + m.Value[1]);
	}

	public static string PascalNameToTitle(this string pascal, bool uppercase = true)
	{
		string text = pascal.SpacePascalCase().Replace(".", " // ");
		if (uppercase)
		{
			text = text.ToUpper();
		}
		return text;
	}

	public static int GetLineCount(this string multilineStr)
	{
		return multilineStr.Split(new char[1] { '\n' }).Length;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "Nebula.Utils";

	public const string PLUGIN_NAME = "Nebula.Utils";

	public const string PLUGIN_VERSION = "1.0.0";
}