Decompiled source of CyconiAPI v0.0.1

CyconiAPI.dll

Decompiled 2 years ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using CyconiAPI;
using MelonLoader;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CyconiAPI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CyconiAPI")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: MelonInfo(typeof(Main), "CyconiAPI", "0.0.1", "Cyconi", null)]
[assembly: MelonGame(null, "Lethal Company")]
[assembly: MelonColor(ConsoleColor.Green)]
[assembly: ComVisible(false)]
[assembly: Guid("bf5f29d8-8605-4439-9b77-6810f5c65722")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 CyconiAPI
{
	public class Main : MelonMod
	{
	}
	public class BackButton
	{
		public BackButton(Transform parent, UnityAction listener)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/BackButton");
			GameObject val2 = Object.Instantiate<GameObject>(val, parent);
			val2.transform.localScale = val.transform.localScale;
			val2.transform.position = val.transform.position;
			val2.transform.rotation = val.transform.rotation;
			SettingsOption component = val2.GetComponent<SettingsOption>();
			Object.Destroy((Object)(object)component);
			Button component2 = val2.GetComponent<Button>();
			component2.onClick = new ButtonClickedEvent();
			((UnityEventBase)component2.onClick).RemoveAllListeners();
			((UnityEvent)component2.onClick).AddListener(listener);
		}
	}
	public class Button
	{
		public Button(Transform parentMenu, string text, float x, float y, UnityAction listener)
		{
			//IL_004f: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/PleaseConfirmChangesPanel/Panel/Confirm");
			GameObject val2 = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)val2).name = text;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = text;
			((Component)val2.GetComponentInChildren<TextMeshProUGUI>()).gameObject.transform.localScale = new Vector3(1.3f, 1.3f, 1f);
			val2.transform.position = GridPos.GridCoord(x, y);
			val2.transform.localScale = new Vector3(0.6474f, 0.6474f, 0.9474f);
			val2.transform.rotation = val.transform.rotation;
			Object.Destroy((Object)(object)val2.GetComponent<SettingsOption>());
			Object.Destroy((Object)(object)val2.GetComponent<DeleteFileButton>());
			Button component = val2.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(listener);
		}

		public Button(Transform parentMenu, string text, Vector3 pos, UnityAction listener)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/PleaseConfirmChangesPanel/Panel/Confirm");
			GameObject val2 = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)val2).name = text;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = text ?? "";
			val2.transform.position = pos;
			val2.transform.localScale = new Vector3(2.7987f, 2.7987f, 2.7987f);
			val2.transform.rotation = val.transform.rotation;
			Button component = val2.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(listener);
		}
	}
	public class ClearButton
	{
		private bool isOn = false;

		public ClearButton(Transform parentMenu, string text, float x, float y, UnityAction listener)
		{
			//IL_0062: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/MicSettings/TalkMode");
			GameObject val2 = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)val2).name = text;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = text;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			val2.GetComponentInChildren<Image>().pixelsPerUnitMultiplier = 6f;
			val2.transform.position = GridPos.GridCoord(x, y);
			val2.transform.localScale = val.transform.localScale;
			val2.transform.rotation = val.transform.rotation;
			Object.Destroy((Object)(object)val2.GetComponent<SettingsOption>());
			Object.Destroy((Object)(object)val2.GetComponent<DeleteFileButton>());
			Button component = val2.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(listener);
		}
	}
	public class LongButton
	{
		public LongButton(Transform parentMenu, string text, Vector3 pos, bool isSubmenu, UnityAction listener)
		{
			//IL_0040: 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_0065: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Settings");
			GameObject val2 = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)val2).name = text;
			((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = "> " + text;
			val2.transform.position = pos;
			if (!isSubmenu)
			{
				val2.transform.localScale = new Vector3(2.7987f, 2.7987f, 2.7987f);
			}
			else
			{
				val2.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
			}
			val2.transform.rotation = val.transform.rotation;
			Button component = val2.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(listener);
		}
	}
	internal class GridPos
	{
		internal static Vector3 GridCoord(float x, float y)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.7f * (x - 1f) + -23.2f;
			float num2 = 0.2f * (y - 1f) + 58.28f;
			Vector3 result = default(Vector3);
			((Vector3)(ref result))..ctor(num, 0f - num2, 12.17f);
			return result;
		}
	}
	public class Menu
	{
		public Menu(Transform parent, GameObject menu)
		{
			//IL_002c: 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)
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel");
			menu.transform.SetParent(parent);
			menu.transform.localScale = val.transform.localScale;
			menu.transform.position = val.transform.position;
		}
	}
	public class ClearToggle
	{
		private bool isOn = false;

		public ClearToggle(Transform parentMenu, string textOff, string textOn, float x, float y, Action listenerOn, Action listenerOff)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			ClearToggle clearToggle = this;
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/MicSettings/TalkMode");
			GameObject button = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)button).name = "C_Toggle";
			((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
			((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			button.GetComponentInChildren<Image>().pixelsPerUnitMultiplier = 6f;
			button.transform.position = GridPos.GridCoord(x, y);
			button.transform.localScale = val.transform.localScale;
			button.transform.rotation = val.transform.rotation;
			Object.Destroy((Object)(object)button.GetComponent<SettingsOption>());
			Button component = button.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(new UnityAction(Toggle));
			void Toggle()
			{
				clearToggle.isOn = !clearToggle.isOn;
				if (clearToggle.isOn)
				{
					listenerOn();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOn;
				}
				else
				{
					listenerOff();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
				}
			}
		}
	}
	public class LongToggle
	{
		private bool isOn = false;

		public LongToggle(Transform parentMenu, string textOff, string textOn, Vector3 pos, bool isSubmenu, Action listenerOn, Action listenerOff)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			LongToggle longToggle = this;
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Settings");
			GameObject button = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)button).name = "L_Toggle";
			((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
			button.transform.position = pos;
			if (!isSubmenu)
			{
				button.transform.localScale = new Vector3(2.7987f, 2.7987f, 2.7987f);
			}
			else
			{
				button.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
			}
			button.transform.rotation = val.transform.rotation;
			Object.Destroy((Object)(object)button.GetComponent<SettingsOption>());
			Button component = button.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(new UnityAction(Toggle));
			void Toggle()
			{
				longToggle.isOn = !longToggle.isOn;
				if (longToggle.isOn)
				{
					listenerOn();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOn;
				}
				else
				{
					listenerOff();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
				}
			}
		}
	}
	public class Toggle
	{
		private bool isOn = false;

		public Toggle(Transform parentMenu, string textOff, string textOn, float x, float y, Action listenerOn, Action listenerOff)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			Toggle toggle = this;
			GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/PleaseConfirmChangesPanel/Panel/Confirm");
			GameObject button = Object.Instantiate<GameObject>(val, parentMenu);
			((Object)button).name = "Toggle";
			((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
			((Component)button.GetComponentInChildren<TextMeshProUGUI>()).gameObject.transform.localScale = new Vector3(1.3f, 1.3f, 1f);
			button.transform.position = GridPos.GridCoord(x, y);
			button.transform.localScale = new Vector3(0.6474f, 0.6474f, 0.9474f);
			button.transform.rotation = val.transform.rotation;
			Object.Destroy((Object)(object)button.GetComponent<SettingsOption>());
			Button component = button.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			((UnityEventBase)component.onClick).RemoveAllListeners();
			((UnityEvent)component.onClick).AddListener(new UnityAction(Toggle));
			void Toggle()
			{
				toggle.isOn = !toggle.isOn;
				if (toggle.isOn)
				{
					listenerOn();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOn;
				}
				else
				{
					listenerOff();
					((TMP_Text)button.GetComponentInChildren<TextMeshProUGUI>()).text = textOff;
				}
			}
		}
	}
}

CyconiAPI_Template.dll

Decompiled 2 years ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using CyconiAPI;
using CyconiAPI_Template;
using MelonLoader;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class1), "CyconiAPI_Template", "0.0.1", "Cyconi", null)]
[assembly: MelonGame(null, "Lethal Company")]
[assembly: AssemblyTitle("CyconiAPI_Template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CyconiAPI_Template")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b454420d-778c-4a62-af36-5bc58ffe2f42")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CyconiAPI_Template;

public class Class1 : MelonMod
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__7_0;

		public static UnityAction <>9__7_1;

		public static UnityAction <>9__7_2;

		public static Action <>9__7_3;

		public static Action <>9__7_4;

		public static UnityAction <>9__7_5;

		public static Action <>9__7_6;

		public static Action <>9__7_7;

		internal void <MenuInit>b__7_0()
		{
			menuButtons.SetActive(false);
			exampleMenu.SetActive(true);
		}

		internal void <MenuInit>b__7_1()
		{
			exampleMenu.SetActive(false);
			menuButtons.SetActive(true);
		}

		internal void <MenuInit>b__7_2()
		{
		}

		internal void <MenuInit>b__7_3()
		{
		}

		internal void <MenuInit>b__7_4()
		{
		}

		internal void <MenuInit>b__7_5()
		{
		}

		internal void <MenuInit>b__7_6()
		{
		}

		internal void <MenuInit>b__7_7()
		{
		}
	}

	public static GameObject exampleMenu;

	public static GameObject quickMenu;

	public static GameObject menuButtons;

	public static GameObject settingsPanel;

	public static GameObject backButton;

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		if (sceneName == "SampleSceneRelay")
		{
			LoadMenus();
		}
	}

	public static void LoadMenus()
	{
		MelonCoroutines.Start(WaitForMenu());
		static IEnumerator WaitForMenu()
		{
			while ((Object)(object)GameObject.Find("Systems/UI/Canvas/QuickMenu") == (Object)null)
			{
				yield return null;
			}
			yield return null;
			MenuInit();
		}
	}

	public static void MenuInit()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		//IL_004d: 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_00a4: 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_00a4: Expected O, but got Unknown
		//IL_00d3: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Expected O, but got Unknown
		//IL_0111: 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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Expected O, but got Unknown
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Expected O, but got Unknown
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			quickMenu = GameObject.Find("Systems/UI/Canvas/QuickMenu");
			menuButtons = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons");
			backButton = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/BackButton");
			exampleMenu = new GameObject("myMenu");
			new Menu(quickMenu.transform, exampleMenu);
			exampleMenu.SetActive(false);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(-22.9f, -58.48f, 12.17f);
			Transform transform = menuButtons.transform;
			Vector3 val2 = val;
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				UnityAction val3 = delegate
				{
					menuButtons.SetActive(false);
					exampleMenu.SetActive(true);
				};
				<>c.<>9__7_0 = val3;
				obj = (object)val3;
			}
			new Button(transform, "My Menu", val2, (UnityAction)obj);
			Transform transform2 = exampleMenu.transform;
			object obj2 = <>c.<>9__7_1;
			if (obj2 == null)
			{
				UnityAction val4 = delegate
				{
					exampleMenu.SetActive(false);
					menuButtons.SetActive(true);
				};
				<>c.<>9__7_1 = val4;
				obj2 = (object)val4;
			}
			new BackButton(transform2, (UnityAction)obj2);
			Transform transform3 = exampleMenu.transform;
			object obj3 = <>c.<>9__7_2;
			if (obj3 == null)
			{
				UnityAction val5 = delegate
				{
				};
				<>c.<>9__7_2 = val5;
				obj3 = (object)val5;
			}
			new ClearButton(transform3, "Clear Button", 1f, 1f, (UnityAction)obj3);
			new ClearToggle(exampleMenu.transform, "Clear Button Off", "Clear Button On", 2f, 1f, (Action)delegate
			{
			}, (Action)delegate
			{
			});
			Transform transform4 = exampleMenu.transform;
			object obj4 = <>c.<>9__7_5;
			if (obj4 == null)
			{
				UnityAction val6 = delegate
				{
				};
				<>c.<>9__7_5 = val6;
				obj4 = (object)val6;
			}
			new Button(transform4, "Normal Button", 1f, 2f, (UnityAction)obj4);
			new Toggle(exampleMenu.transform, "Normal Button Off", "Normal Button On", 2f, 2f, (Action)delegate
			{
			}, (Action)delegate
			{
			});
		}
		catch (Exception)
		{
		}
	}
}