Decompiled source of Nebula v1.1.0

plugins/Nebula.dll

Decompiled 8 months 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.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("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("Nebula")]
[assembly: AssemblyTitle("Nebula")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.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", "1.1.0")]
	[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;
			((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 = "1.1.0";
	}
}

plugins/Nebula.Missions.dll

Decompiled 8 months 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.UI.dll

Decompiled 8 months 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;
	}
}
public static class ButtonFactory
{
	public static UIButton Create(ButtonFactoryDatum datum)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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 UIFactory.CreateButton(gameObject, datum.buttonSize, datum.name, datum.text, datum.onClick, datum.fontSize, datum.detail.color, datum.detail.font);
	}

	public static List<UIButton> CreateMultiple(List<ButtonFactoryDatum> data)
	{
		return new List<UIButton>(LinqSubstitute.Remap<ButtonFactoryDatum, UIButton>((IEnumerable<ButtonFactoryDatum>)data, (Func<ButtonFactoryDatum, UIButton>)Create));
	}
}
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"];
	}
}
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 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")
		}
	};

	private static Font LoadFont(string fontName)
	{
		return Resources.Load<Font>("ui/fonts/" + fontName);
	}
}
public static class UIFactory
{
	public static UILabel CreateLabel(this GameObject root, string name, string text, Color color, int fontSize, int width, Font ttf = null, Effect effect = 1)
	{
		//IL_0023: 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_005b: Unknown result type (might be due to invalid IL or missing references)
		UILabel val = NGUITools.AddChild<UILabel>(root);
		((Object)val).name = "LABEL_" + name;
		val.text = text;
		val.effectStyle = effect;
		((UIWidget)val).color = color;
		((UIWidget)val).height = fontSize;
		((UIWidget)val).width = width;
		val.overflowMethod = (Overflow)2;
		((UIWidget)val).pivot = (Pivot)5;
		((Component)val).transform.localPosition = Vector3.zero;
		val.trueTypeFont = ttf ?? StockFonts.microgramma["BoldDynamic"];
		val.fontSize = fontSize;
		return val;
	}

	public static UITexture CreateTextureBackground(this GameObject root, Color fromColor, int width, int height)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: 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_0081: 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)
		Texture2D mainTexture = Resources.Load<Texture2D>("ui/ngui/textures/fill_64x");
		UITexture val = NGUITools.AddChild<UITexture>(root);
		((Object)val).name = "TEXTURE_Background";
		((UIWidget)val).mainTexture = (Texture)(object)mainTexture;
		((UIWidget)val).color = Color.clear;
		((UIWidget)val).pivot = (Pivot)5;
		((Component)val).transform.localPosition = new Vector3(16f, 0f, 0f);
		((UIWidget)val).width = width;
		((UIWidget)val).height = height;
		((UIWidget)val).depth = -1;
		TweenColor val2 = ((Component)val).gameObject.AddComponent<TweenColor>();
		val2.from = fromColor;
		val2.to = Color.clear;
		((UITweener)val2).duration = 0.01f;
		return val;
	}

	public static UIButton CreateButton(GameObject root, Vector3 size, string name, string text, List<EventDelegate> onClick, int fontSize, Color color, Font ttf = null)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = NGUITools.AddChild(root);
		((Object)val).name = "BUTTON_" + name;
		BoxCollider val2 = val.AddComponent<BoxCollider>();
		val2.size = size;
		val2.center = new Vector3((0f - size.x) / 2f, 2f, 0f);
		UIButton val3 = val.AddComponent<UIButton>();
		val3.onClick = onClick;
		((UIButtonColor)val3).hover = new Color(0.7686f, 0.1804f, 0f);
		((UIButtonColor)val3).pressed = new Color(0.7725f, 0.1808f, 0f);
		((UIButtonColor)val3).duration = 0.01f;
		CUIButtonInput val4 = val.AddComponent<CUIButtonInput>();
		val4.inputType = (InputType)0;
		val4.sendsOnClickOnConfirm = true;
		CUIMenuAudioTrigger val5 = val.AddComponent<CUIMenuAudioTrigger>();
		val5.clipType = (AudioClipType)0;
		val5.trigger = (Trigger)1;
		val.CreateLabel("Button", text, color, fontSize, (int)size.x, ttf, (Effect)1);
		UITexture val6 = val.CreateTextureBackground(((UIButtonColor)val3).hover, (int)size.x, (int)size.y);
		((UIButtonColor)val3).tweenTarget = ((Component)val6).gameObject;
		return val3;
	}

	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 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 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
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 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 PluginInfo
{
	public const string PLUGIN_GUID = "Nebula.Utils";

	public const string PLUGIN_NAME = "Nebula.Utils";

	public const string PLUGIN_VERSION = "1.0.0";
}