using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CG.Client.Ship;
using CG.Client.Ship.Views;
using CG.Ship.Hull;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VFX;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AirlockDoorColor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("0.0.4.0")]
[assembly: AssemblyInformationalVersion("0.0.4+3bbc94d59759051ca88a11bd2635082f8d1c44e2")]
[assembly: AssemblyProduct("AirlockDoorColor")]
[assembly: AssemblyTitle("Changes the open airlock door button color from green to white. Client Side.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.4.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 AirlockDoorColor
{
[HarmonyPatch(typeof(AirlockButtonPanel), "UpdateDiodes")]
internal class AirlockButtonPanelPatch
{
private static Color closedColor = new Color(0f, 6f, 0f, 1f);
private static Color unsafeColor = new Color(0f, 0f, 0f, 1f);
private static void Postfix(Airlock ____airlock, Diode ___diodeInnerDoor, Diode ___diodeOuterDoor)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_00bd: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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)
for (int i = 0; i < ____airlock.airlockDoors.Count; i++)
{
AirlockDoor val = ____airlock.airlockDoors[i];
if ((int)val.airlockDoorType == 0)
{
bool flag = !((AbstractDoor)val).IsLocked && (val.IsSafe || !____airlock.IsSafetyEnabled);
MaterialUtils.UpdateRendererMaterials(___diodeInnerDoor._materialData, "_EmissiveColor", ((AbstractDoor)val).IsOpen ? Configs.CurrentColor : (flag ? closedColor : unsafeColor));
}
else
{
bool flag2 = !((AbstractDoor)val).IsLocked && (val.IsSafe || !____airlock.IsSafetyEnabled);
MaterialUtils.UpdateRendererMaterials(___diodeOuterDoor._materialData, "_EmissiveColor", ((AbstractDoor)val).IsOpen ? Configs.CurrentColor : (flag2 ? closedColor : unsafeColor));
}
}
}
}
[BepInPlugin("18107.AirlockDoorColor", "Airlock Door Color", "0.0.4")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(AirlockButtonPanelPatch), "18107.AirlockDoorColor");
Configs.Load(this);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 18107.AirlockDoorColor is loaded!");
}
}
internal class Configs
{
internal static Color DefaultColor = new Color(5.2f, 5.2f, 6f, 1f);
internal static Color CurrentColor;
internal static ConfigEntry<float> OpenDoorColorR;
internal static ConfigEntry<float> OpenDoorColorG;
internal static ConfigEntry<float> OpenDoorColorB;
internal static ConfigEntry<float> OpenDoorColorA;
internal static void UpdateColorConfig()
{
OpenDoorColorR.Value = CurrentColor.r;
OpenDoorColorG.Value = CurrentColor.g;
OpenDoorColorB.Value = CurrentColor.b;
OpenDoorColorA.Value = CurrentColor.a;
}
internal static void Load(BepinPlugin plugin)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
OpenDoorColorR = ((BaseUnityPlugin)plugin).Config.Bind<float>("DoorColor", "DoorColorR", 5.2f, (ConfigDescription)null);
OpenDoorColorG = ((BaseUnityPlugin)plugin).Config.Bind<float>("DoorColor", "DoorColorG", 5.2f, (ConfigDescription)null);
OpenDoorColorB = ((BaseUnityPlugin)plugin).Config.Bind<float>("DoorColor", "DoorColorB", 6f, (ConfigDescription)null);
OpenDoorColorA = ((BaseUnityPlugin)plugin).Config.Bind<float>("DoorColor", "DoorColorA", 1f, (ConfigDescription)null);
CurrentColor = new Color(OpenDoorColorR.Value, OpenDoorColorG.Value, OpenDoorColorB.Value, OpenDoorColorA.Value);
}
}
internal class ConfigGUI : ModSettingsMenu
{
public override string Name()
{
return "Airlock Door Color";
}
public override void Draw()
{
//IL_0015: 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)
if (GUITools.DrawColorPicker(new Rect(8f, 58f, 480f, 160f), "Open Door Color", ref Configs.CurrentColor, Configs.DefaultColor, false, 0f, 20f))
{
Configs.UpdateColorConfig();
}
}
}
public class MyPluginInfo
{
public const string PLUGIN_GUID = "18107.AirlockDoorColor";
public const string PLUGIN_NAME = "AirlockDoorColor";
public const string USERS_PLUGIN_NAME = "Airlock Door Color";
public const string PLUGIN_VERSION = "0.0.4";
public const string PLUGIN_DESCRIPTION = "Changes the open airlock door button color from green to white. Client Side.";
public const string PLUGIN_ORIGINAL_AUTHOR = "18107";
public const string PLUGIN_AUTHORS = "18107, Dragon";
public const string PLUGIN_THUNDERSTORE_ID = "NihilityShift/Airlock_Door_Color";
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)8;
public override string Author => "18107, Dragon";
public override string Description => "Sets airlock button color for open doors to white";
}
}