using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CorporateRestructureWeather")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3907534055430bb1ce01c63f347eeb15c3f20bba")]
[assembly: AssemblyProduct("CorporateRestructureWeather")]
[assembly: AssemblyTitle("CorporateRestructureWeather")]
[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 CorporateRestructureWeather
{
[BepInPlugin("CorporateRestructureWeather", "CorporateRestructureWeather", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("CatsArmy.CorporateRestructureWeather");
public static Plugin Instance { get; private set; }
private void Awake()
{
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
Instance._harmony.PatchAll(typeof(WeatherPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CorporateRestructureWeather is loaded!");
}
}
}
internal class WeatherPatch
{
private const string White = "FFFFFF";
private const string Green = "69FF6B";
private const string Yellow = "FFDC00";
private const string Orange = "FF9300";
private const string Red = "FF0000";
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")]
private static void ColorWeather(ref TextMeshProUGUI ___screenLevelDescription, ref SelectableLevel ___currentLevel)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
LevelWeatherType currentWeather = ___currentLevel.currentWeather;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("Orbiting: " + ___currentLevel.PlanetName + "\n");
stringBuilder.Append($"Weather: <color=#{GetHexColor(currentWeather)}>{currentWeather}</color>\n");
stringBuilder.Append(___currentLevel.LevelDescription ?? "");
((TMP_Text)___screenLevelDescription).text = stringBuilder.ToString();
}
private static string GetHexColor(LevelWeatherType currentWeather)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected I4, but got Unknown
return (currentWeather - -1) switch
{
0 => "69FF6B",
1 => "69FF6B",
2 => "FFDC00",
4 => "FFDC00",
3 => "FF9300",
5 => "FF9300",
6 => "FF0000",
_ => "FFFFFF",
};
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "CorporateRestructureWeather";
public const string PLUGIN_NAME = "CorporateRestructureWeather";
public const string PLUGIN_VERSION = "1.0.0";
}
}