Decompiled source of Cubs Hangar Ship v0.0.2

HangarShip.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HangarShip;
using Il2CppSystem;
using MelonLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(ModMain), "Hangar Ship Unlocked", "0.0.2", "GraciousCub5622", null)]
[assembly: MelonGame("Keepsake Games", "Jump Space")]
[assembly: AssemblyTitle("HangarShip")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HangarShip")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2e09da81-a53c-4a57-afc2-808734dc3fb0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HangarShip;

public class ModMain : MelonMod
{
	[CompilerGenerated]
	private sealed class <DelayedActivate>d__3 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ModMain <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DelayedActivate>d__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(3f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				EnableShip.Activate();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public override void OnInitializeMelon()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		((MelonBase)this).LoggerInstance.Msg("HangarShip Melon Enabled");
		new GameObject("MenuGUI").AddComponent<MenuGUI>();
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		if (sceneName == "Dest_Lobby_Start_Art")
		{
			MelonCoroutines.Start(DelayedActivate());
			((MelonBase)this).LoggerInstance.Msg($"Scene {sceneName} with build index {buildIndex} has been loaded!");
		}
	}

	private void DrawMenu()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		GUI.Box(new Rect(0f, 0f, 300f, 500f), "My Menu");
	}

	[IteratorStateMachine(typeof(<DelayedActivate>d__3))]
	private IEnumerator DelayedActivate()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayedActivate>d__3(0)
		{
			<>4__this = this
		};
	}
}
public class MenuGUI : MonoBehaviour
{
	private string userInput = "Type here...";

	private bool showMenu = true;

	private void OnGUI()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		if (showMenu)
		{
			GUI.Box(new Rect(10f, 10f, 320f, 180f), "Test Menu");
			GUI.Label(new Rect(20f, 40f, 280f, 20f), "Some random test text goes here.");
			userInput = GUI.TextField(new Rect(20f, 70f, 280f, 25f), userInput);
			if (GUI.Button(new Rect(20f, 110f, 280f, 30f), "Click Me"))
			{
				Debug.Log(Object.op_Implicit("Button clicked! Input was: " + userInput));
			}
		}
	}
}
public static class EnableShip
{
	public static void Activate()
	{
		try
		{
			GameObject val = GameObject.Find("PF_LocalSpace");
			if ((Object)(object)val != (Object)null)
			{
				Transform val2 = val.transform.Find("PlayerShip");
				if ((Object)(object)val2 != (Object)null)
				{
					((Component)val2).gameObject.SetActive(true);
					Transform val3 = val2.Find("PF_SpaceShip/ExteriorGameplay/GrapplePoints");
					if ((Object)(object)val3 != (Object)null)
					{
						for (int i = 1; i <= 14; i++)
						{
							string text = $"PF_GrapplePoint_Floor_{i:00}";
							Transform val4 = val3.Find(text);
							if ((Object)(object)val4 != (Object)null)
							{
								((Component)val4).gameObject.SetActive(true);
							}
						}
						Transform val5 = val3.Find("PF_GrapplePoint_Edge");
						if ((Object)(object)val5 != (Object)null)
						{
							((Component)val5).gameObject.SetActive(true);
						}
					}
				}
			}
			GameObject val6 = GameObject.Find("Gameplay");
			if ((Object)(object)val6 != (Object)null)
			{
				Transform val7 = val6.transform.Find("PF_Dockingnode");
				if ((Object)(object)val7 == (Object)null)
				{
					MelonLogger.Error("docking not found");
				}
				Transform val8 = val7.Find("ShipFlyDirector");
				if ((Object)(object)val8 == (Object)null)
				{
					MelonLogger.Error("shipFly not found");
				}
				Transform val9 = val8.Find("CinematicShipParent");
				if ((Object)(object)val9 == (Object)null)
				{
					MelonLogger.Error("parent not found");
				}
				Transform val10 = val9.Find("CinematicShipParent_TRANSFORM");
				if ((Object)(object)val10 == (Object)null)
				{
					MelonLogger.Error("transform not found");
				}
				Transform val11 = val10.Find("Cinematic Ship");
				if ((Object)(object)val11 == (Object)null)
				{
					MelonLogger.Error("root not found");
				}
				Transform val12 = val11.Find("Exterior");
				if ((Object)(object)val12 != (Object)null)
				{
					((Component)val12).gameObject.SetActive(false);
				}
				Transform val13 = val11.Find("ExteriorGameplay");
				if ((Object)(object)val13 != (Object)null)
				{
					((Component)val13).gameObject.SetActive(false);
				}
				Transform val14 = val11.Find("TransitionGameplay");
				if ((Object)(object)val14 != (Object)null)
				{
					((Component)val14).gameObject.SetActive(false);
				}
				Transform val15 = val11.Find("Interior_NoCulling");
				if ((Object)(object)val15 != (Object)null)
				{
					((Component)val15).gameObject.SetActive(false);
				}
				Transform val16 = val11.Find("Interior");
				if ((Object)(object)val16 != (Object)null)
				{
					((Component)val16).gameObject.SetActive(false);
				}
				Transform val17 = val11.Find("InteriorGameplay");
				if ((Object)(object)val17 != (Object)null)
				{
					((Component)val17).gameObject.SetActive(false);
				}
				Transform val18 = val6.transform.Find("PF_KillTrigger");
				if ((Object)(object)val18 != (Object)null)
				{
					((Component)val18).gameObject.SetActive(false);
				}
			}
		}
		catch
		{
		}
	}

	private static Transform FindDeepChild(Transform parent, string name)
	{
		for (int i = 0; i < parent.childCount; i++)
		{
			Transform child = parent.GetChild(i);
			if (((Object)child).name == name)
			{
				return child;
			}
			Transform val = FindDeepChild(child, name);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}
}