using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TestMod.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("TestMod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyTitle("TestMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 TestMod
{
[BepInPlugin("TestMod", "TestMod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("TestMod");
private static Plugin _instance;
internal ManualLogSource Mls;
public PlayerControllerB controller { get; private set; }
public GameObject hangarShip { get; private set; }
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
Assets.PopulateAssets();
Mls = Logger.CreateLogSource("TestMod");
Mls.LogInfo((object)"Plugin TestMod (1.0.0) is loaded!");
_harmony.PatchAll(typeof(PluginInfo));
_harmony.PatchAll(typeof(ShipInsidePatch));
}
}
public static class Assets
{
public static string mainAssetBundleName = "shipinsidenew";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().FullName.Split(',')[0];
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TestMod";
public const string PLUGIN_NAME = "TestMod";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace TestMod.Patches
{
[HarmonyPatch(typeof(StartOfRound))]
internal class ShipInsidePatch
{
private static bool _hasRun;
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void ShipInsideMeshColorPatch()
{
//IL_004f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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)
if (_hasRun)
{
return;
}
_hasRun = true;
Mesh mesh = Assets.MainAssetBundle.LoadAsset<Mesh>("ShipInsideNew");
GameObject val = GameObject.Find("ShipInside");
MeshFilter component = val.GetComponent<MeshFilter>();
component.mesh = mesh;
Renderer component2 = val.GetComponent<Renderer>();
Color color = component2.material.color;
string text = "#6d119e";
Color val2 = default(Color);
if (ColorUtility.TryParseHtmlString(text, ref val2))
{
Color val3 = val2;
Debug.Log((object)("Converted Color: " + ((object)(Color)(ref val3)).ToString()));
Material[] materials = component2.materials;
for (int i = 0; i < materials.Length; i++)
{
materials[i].color = val2;
}
component2.materials = materials;
}
else
{
Debug.Log((object)"Invalid Hex Code");
}
}
}
}