using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MorePeak.MonoBehaviours;
using Photon.Pun;
using TMPro;
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("MorePeak")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+880fc0d843c29e90145ae173cb47bba04fddd828")]
[assembly: AssemblyProduct("MorePeak")]
[assembly: AssemblyTitle("MorePeak")]
[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 MorePeak
{
[BepInPlugin("com.smckeen.morepeak", "MorePeak", "1.9.0")]
public class MorePeakPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(MapBaker), "GetLevel")]
private static class MapBaker_GetLevel_Patch
{
private static bool hasLoggedLevels;
private static bool Prefix(MapBaker __instance, int levelIndex, ref string __result)
{
try
{
if (__instance?.AllLevels == null || __instance.AllLevels.Length == 0)
{
return true;
}
if (!hasLoggedLevels)
{
ModLogger.LogInfo((object)"=== AVAILABLE LEVELS ===");
for (int i = 0; i < __instance.AllLevels.Length; i++)
{
string path = __instance.AllLevels[i] ?? "Unknown";
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
ModLogger.LogInfo((object)$"Level {i}: {fileNameWithoutExtension}");
}
ModLogger.LogInfo((object)"========================");
ModLogger.LogInfo((object)"You can now set 'SelectedLevel' in the config file to any of these level names, or keep it as 'Random'");
hasLoggedLevels = true;
}
if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)
{
ModLogger.LogInfo((object)"[CLIENT] Non-master client called GetLevel - using original method");
return true;
}
int instanceID = ((Object)__instance).GetInstanceID();
float time = Time.time;
if (lastRandomizeTime.ContainsKey(instanceID) && time - lastRandomizeTime[instanceID] < 1f)
{
return true;
}
lastRandomizeTime[instanceID] = time;
if (lastRandomizeTime.Count > 10)
{
List<int> list = new List<int>();
float num = time - 300f;
foreach (KeyValuePair<int, float> item in lastRandomizeTime)
{
if (item.Value < num)
{
list.Add(item.Key);
}
}
foreach (int item2 in list)
{
lastRandomizeTime.Remove(item2);
}
if (list.Count > 0)
{
ModLogger.LogDebug((object)$"Cleaned up {list.Count} old randomize time entries");
}
}
string text = selectedLevelConfig?.Value?.Trim() ?? "Random";
string text2 = (PhotonNetwork.InRoom ? "[MASTER]" : "[OFFLINE]");
if (text.Equals("Daily", StringComparison.OrdinalIgnoreCase))
{
ModLogger.LogInfo((object)(text2 + " Using vanilla daily map"));
return true;
}
if (text.Equals("Random", StringComparison.OrdinalIgnoreCase))
{
int num2 = Random.Range(0, __instance.AllLevels.Length);
string path2 = __instance.AllLevels[num2] ?? "";
__result = Path.GetFileNameWithoutExtension(path2);
ModLogger.LogInfo((object)$"{text2} Random level selected: {__result} (index {num2})");
currentLevelName = __result;
showLevelGUI = true;
return false;
}
if (text.Contains(","))
{
string[] array = text.Split(',');
List<string> list2 = new List<string>();
string[] array2 = array;
foreach (string text3 in array2)
{
string value = text3.Trim();
if (string.IsNullOrEmpty(value))
{
continue;
}
for (int k = 0; k < __instance.AllLevels.Length; k++)
{
string path3 = __instance.AllLevels[k] ?? "";
string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(path3);
if (fileNameWithoutExtension2.Equals(value, StringComparison.OrdinalIgnoreCase))
{
list2.Add(fileNameWithoutExtension2);
break;
}
}
}
if (list2.Count > 0)
{
string text4 = list2[Random.Range(0, list2.Count)];
__result = text4;
ModLogger.LogInfo((object)$"{text2} Random level from list selected: {__result} (from {list2.Count} valid options)");
currentLevelName = __result;
showLevelGUI = true;
return false;
}
ModLogger.LogWarning((object)("No valid levels found in list '" + text + "'! Using random level instead."));
int num3 = Random.Range(0, __instance.AllLevels.Length);
string path4 = __instance.AllLevels[num3] ?? "";
__result = Path.GetFileNameWithoutExtension(path4);
ModLogger.LogInfo((object)$"{text2} Fallback random level: {__result} (index {num3})");
currentLevelName = __result;
showLevelGUI = true;
return false;
}
for (int l = 0; l < __instance.AllLevels.Length; l++)
{
string path5 = __instance.AllLevels[l] ?? "";
string fileNameWithoutExtension3 = Path.GetFileNameWithoutExtension(path5);
if (fileNameWithoutExtension3.Equals(text, StringComparison.OrdinalIgnoreCase))
{
__result = fileNameWithoutExtension3;
ModLogger.LogInfo((object)$"{text2} Specific level selected: {__result} (index {l})");
currentLevelName = __result;
showLevelGUI = true;
return false;
}
}
ModLogger.LogWarning((object)("Level '" + text + "' not found! Using random level instead."));
int num4 = Random.Range(0, __instance.AllLevels.Length);
string path6 = __instance.AllLevels[num4] ?? "";
__result = Path.GetFileNameWithoutExtension(path6);
ModLogger.LogInfo((object)$"{text2} Fallback random level: {__result} (index {num4})");
currentLevelName = __result;
showLevelGUI = true;
return false;
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error in MapBaker.GetLevel patch: " + ex.Message));
return true;
}
}
}
[HarmonyPatch(typeof(AirportCheckInKiosk), "BeginIslandLoadRPC")]
private static class AirportCheckInKiosk_BeginIslandLoadRPC_Patch
{
private static void Prefix(string sceneName, int ascent)
{
try
{
currentLevelName = sceneName;
showLevelGUI = true;
string arg = (PhotonNetwork.IsMasterClient ? "[MASTER]" : "[CLIENT]");
ModLogger.LogInfo((object)$"{arg} Loading level: {sceneName} (ascent: {ascent})");
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error in BeginIslandLoadRPC patch: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(LoadingScreenHandler), "LoadSceneProcess")]
private static class LoadingScreenHandler_LoadSceneProcess_Patch
{
private static void Prefix(string sceneName)
{
try
{
if (sceneName.Equals("Airport", StringComparison.OrdinalIgnoreCase))
{
showLevelGUI = false;
currentLevelName = "";
ModLogger.LogInfo((object)"Clearing level GUI - returning to Airport");
}
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error in LoadSceneProcess patch: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(NetworkConnector), "OnLeftRoom")]
private static class NetworkConnector_OnLeftRoom_Patch
{
private static void Postfix()
{
try
{
showLevelGUI = false;
currentLevelName = "";
ModLogger.LogInfo((object)"Clearing level GUI - left multiplayer room");
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error in OnLeftRoom patch: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(LevelGeneration), "RandomizeBiomeVariants")]
private static class LevelGeneration_RandomizeBiomeVariants_Patch
{
private static void Postfix()
{
try
{
Random.InitState(Random.Range(0, int.MaxValue));
}
catch (Exception ex)
{
ManualLogSource modLogger = ModLogger;
if (modLogger != null)
{
modLogger.LogError((object)("Error in biome variant randomization: " + ex.Message));
}
}
}
}
[HarmonyPatch(typeof(GUIManager), "Start")]
private static class GUIManagerPatch
{
[HarmonyPostfix]
public static void Postfix(GUIManager __instance)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)((Component)__instance).GetComponentInChildren<AscentUI>()).transform;
RectTransform val = (RectTransform)Object.Instantiate<Transform>(transform, transform.parent);
((Object)val).name = "MorePeakLevelDisplay";
Object.Destroy((Object)(object)((Component)val).GetComponent<AscentUI>());
((Component)val).gameObject.AddComponent<MorePeakHUD>();
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(1f, 1f);
val.anchorMin = val2;
Vector2 pivot = (val.anchorMax = val2);
val.pivot = pivot;
val.anchoredPosition = Vector2.zero;
}
}
private static ManualLogSource ModLogger;
internal static ConfigEntry<string> selectedLevelConfig;
internal static ConfigEntry<bool> showCurrentLevelGUIConfig;
internal static ConfigEntry<bool> showSelectedLevelConfigGUIConfig;
private static readonly Dictionary<int, float> lastRandomizeTime = new Dictionary<int, float>();
private const float RANDOMIZE_COOLDOWN = 1f;
internal static string currentLevelName = "";
private static bool showLevelGUI = false;
private static Texture2D guiBackgroundTexture;
private static bool showSettingsGUI = false;
private static Rect settingsWindowRect = new Rect(0f, 0f, 330f, 200f);
private static string tempSelectedLevel = "";
private static bool tempShowCurrentLevel = true;
private static bool tempShowSelectedLevelConfig = true;
private static Vector2 scrollPosition = Vector2.zero;
private static Texture2D settingsCogTexture;
private static int onGUICallCount = 0;
private static GUIStyle cachedCogStyle;
private static GUIStyle cachedLabelStyle;
private static GUIStyle cachedTextFieldStyle;
private static GUIStyle cachedButtonStyle;
private static GUIStyle cachedToggleStyle;
private static GUIStyle cachedWindowStyle;
private static Texture2D cachedDarkBackgroundTexture;
private static Texture2D cachedButtonBackgroundTexture;
private static Texture2D cachedButtonHoverTexture;
private static Texture2D cachedButtonActiveTexture;
private static Texture2D cachedTextFieldBackgroundTexture;
private static Texture2D cachedWindowBackgroundTexture;
private void Awake()
{
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
ModLogger = ((BaseUnityPlugin)this).Logger;
LoadSettingsCogTexture();
selectedLevelConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "SelectedLevel", "Random", "Set to 'Daily' for the daily map, 'Random' for random levels, specify exact level name (e.g., 'Level_0'), or specify multiple levels separated by commas for random selection from that list (e.g., 'Level_0, Level_1, Level_2')");
showCurrentLevelGUIConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI", "ShowCurrentLevel", false, "Whether to show the current level name on screen during gameplay");
showSelectedLevelConfigGUIConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI", "ShowSelectedLevelConfig", false, "Whether to show the selected level configuration on screen during gameplay");
ModLogger.LogInfo((object)"MorePeak v1.9.0 loaded!");
ModLogger.LogInfo((object)("Config: SelectedLevel = " + selectedLevelConfig.Value));
ModLogger.LogInfo((object)("Config: ShowCurrentLevel = " + showCurrentLevelGUIConfig.Value));
ModLogger.LogInfo((object)("Config: ShowSelectedLevelConfig = " + showSelectedLevelConfigGUIConfig.Value));
ModLogger.LogInfo((object)"Available levels will be listed when you start a game.");
Harmony val = new Harmony("com.smckeen.morepeak");
val.PatchAll();
}
private void OnGUI()
{
onGUICallCount++;
if (onGUICallCount % 60 == 0)
{
ModLogger.LogDebug((object)$"OnGUI called {onGUICallCount} times, showLevelGUI={showLevelGUI}");
}
if (cachedCogStyle == null)
{
ModLogger.LogDebug((object)"Initializing cached styles in OnGUI");
InitializeCachedStyles();
}
DrawSettingsCog();
if (showSettingsGUI)
{
ModLogger.LogDebug((object)"Drawing settings window");
DrawSettingsWindow();
}
if (showLevelGUI && !string.IsNullOrEmpty(currentLevelName) && cachedCogStyle == null)
{
ModLogger.LogDebug((object)"Initializing cached styles in OnGUI");
InitializeCachedStyles();
}
}
private void OnDestroy()
{
if ((Object)(object)guiBackgroundTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)guiBackgroundTexture);
guiBackgroundTexture = null;
}
if ((Object)(object)settingsCogTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)settingsCogTexture);
settingsCogTexture = null;
}
if ((Object)(object)cachedDarkBackgroundTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedDarkBackgroundTexture);
cachedDarkBackgroundTexture = null;
}
if ((Object)(object)cachedButtonBackgroundTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedButtonBackgroundTexture);
cachedButtonBackgroundTexture = null;
}
if ((Object)(object)cachedButtonHoverTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedButtonHoverTexture);
cachedButtonHoverTexture = null;
}
if ((Object)(object)cachedButtonActiveTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedButtonActiveTexture);
cachedButtonActiveTexture = null;
}
if ((Object)(object)cachedTextFieldBackgroundTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedTextFieldBackgroundTexture);
cachedTextFieldBackgroundTexture = null;
}
if ((Object)(object)cachedWindowBackgroundTexture != (Object)null)
{
Object.DestroyImmediate((Object)(object)cachedWindowBackgroundTexture);
cachedWindowBackgroundTexture = null;
}
cachedCogStyle = null;
cachedLabelStyle = null;
cachedTextFieldStyle = null;
cachedButtonStyle = null;
cachedToggleStyle = null;
cachedWindowStyle = null;
}
private Texture2D MakeTexture(int width, int height, Color color)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_002e: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = color;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(array);
val.Apply();
return val;
}
private void DrawSettingsCog()
{
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Expected O, but got Unknown
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
if (showLevelGUI)
{
if (showSettingsGUI)
{
showSettingsGUI = false;
}
ModLogger.LogDebug((object)"Settings cog hidden - in a round (showLevelGUI = true)");
return;
}
ModLogger.LogDebug((object)"Drawing settings cog - not in a round");
float num = 32f;
float num2 = (float)Screen.width - num - 10f;
float num3 = 10f;
ModLogger.LogDebug((object)$"Settings cog position: x={num2}, y={num3}, size={num}");
ModLogger.LogDebug((object)$"Screen size: {Screen.width}x{Screen.height}");
if ((Object)(object)settingsCogTexture != (Object)null)
{
ModLogger.LogDebug((object)"Using settings cog texture");
GUIStyle val = cachedCogStyle ?? GUI.skin.button;
if (!GUI.Button(new Rect(num2, num3, num, num), (Texture)(object)settingsCogTexture, val))
{
return;
}
ModLogger.LogInfo((object)"Settings cog clicked!");
showSettingsGUI = !showSettingsGUI;
if (showSettingsGUI)
{
tempSelectedLevel = selectedLevelConfig.Value;
tempShowCurrentLevel = showCurrentLevelGUIConfig.Value;
tempShowSelectedLevelConfig = showSelectedLevelConfigGUIConfig.Value;
float num4 = num2 - 330f + num;
float num5 = num3 + num + 5f;
if (num4 < 10f)
{
num4 = 10f;
}
if (num5 + 200f > (float)(Screen.height - 10))
{
num5 = Screen.height - 210;
}
settingsWindowRect = new Rect(num4, num5, 330f, 200f);
ModLogger.LogInfo((object)"Settings window opened");
}
else
{
ModLogger.LogInfo((object)"Settings window closed");
}
return;
}
ModLogger.LogDebug((object)"Using fallback text cog (⚙)");
GUIStyle val2 = new GUIStyle(cachedCogStyle ?? GUI.skin.button);
val2.fontSize = 14;
val2.fontStyle = (FontStyle)1;
val2.normal.textColor = Color.white;
val2.hover.textColor = Color.yellow;
if (!GUI.Button(new Rect(num2, num3, num, num), "⚙", val2))
{
return;
}
ModLogger.LogInfo((object)"Settings cog clicked!");
showSettingsGUI = !showSettingsGUI;
if (showSettingsGUI)
{
tempSelectedLevel = selectedLevelConfig.Value;
tempShowCurrentLevel = showCurrentLevelGUIConfig.Value;
tempShowSelectedLevelConfig = showSelectedLevelConfigGUIConfig.Value;
float num6 = num2 - 330f + num;
float num7 = num3 + num + 5f;
if (num6 < 10f)
{
num6 = 10f;
}
if (num7 + 200f > (float)(Screen.height - 10))
{
num7 = Screen.height - 210;
}
settingsWindowRect = new Rect(num6, num7, 330f, 200f);
ModLogger.LogInfo((object)"Settings window opened");
}
else
{
ModLogger.LogInfo((object)"Settings window closed");
}
}
private void DrawSettingsWindow()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
GUI.color = new Color(0f, 0f, 0f, 0.9f);
GUI.Box(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), "");
GUI.color = Color.white;
GUIStyle val = cachedWindowStyle ?? GUI.skin.window;
settingsWindowRect = GUI.Window(12345, settingsWindowRect, new WindowFunction(DrawSettingsWindowContents), "MorePeak Settings", val);
}
private void DrawSettingsWindowContents(int windowID)
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
float num = 30f;
float num2 = 25f;
float num3 = 150f;
float num4 = 150f;
GUIStyle val = cachedLabelStyle ?? GUI.skin.label;
GUIStyle val2 = cachedTextFieldStyle ?? GUI.skin.textField;
GUIStyle val3 = cachedButtonStyle ?? GUI.skin.button;
GUIStyle val4 = cachedToggleStyle ?? GUI.skin.toggle;
GUI.Label(new Rect(10f, num, num3, 20f), "Selected Level:", val);
num += num2;
string text = GUI.TextField(new Rect(10f, num, num4, 20f), tempSelectedLevel, val2);
if (text != tempSelectedLevel)
{
tempSelectedLevel = text;
selectedLevelConfig.Value = tempSelectedLevel;
((BaseUnityPlugin)this).Config.Save();
ModLogger.LogInfo((object)("SelectedLevel updated to: " + tempSelectedLevel));
}
num += num2 + 5f;
if (GUI.Button(new Rect(10f, num, 70f, 20f), "Random", val3))
{
tempSelectedLevel = "Random";
selectedLevelConfig.Value = tempSelectedLevel;
((BaseUnityPlugin)this).Config.Save();
ModLogger.LogInfo((object)"SelectedLevel set to Random");
}
if (GUI.Button(new Rect(85f, num, 70f, 20f), "Daily", val3))
{
tempSelectedLevel = "Daily";
selectedLevelConfig.Value = tempSelectedLevel;
((BaseUnityPlugin)this).Config.Save();
ModLogger.LogInfo((object)"SelectedLevel set to Daily");
}
num += num2 + 10f;
GUI.Label(new Rect(10f, num, num3, 20f), "Display Options:", val);
num += num2;
bool flag = GUI.Toggle(new Rect(10f, num, num4, 20f), tempShowCurrentLevel, "Show Current Level", val4);
if (flag != tempShowCurrentLevel)
{
tempShowCurrentLevel = flag;
showCurrentLevelGUIConfig.Value = tempShowCurrentLevel;
((BaseUnityPlugin)this).Config.Save();
ModLogger.LogInfo((object)("ShowCurrentLevel updated to: " + tempShowCurrentLevel));
}
num += num2;
bool flag2 = GUI.Toggle(new Rect(10f, num, num4, 20f), tempShowSelectedLevelConfig, "Show Config", val4);
if (flag2 != tempShowSelectedLevelConfig)
{
tempShowSelectedLevelConfig = flag2;
showSelectedLevelConfigGUIConfig.Value = tempShowSelectedLevelConfig;
((BaseUnityPlugin)this).Config.Save();
ModLogger.LogInfo((object)("ShowSelectedLevelConfig updated to: " + tempShowSelectedLevelConfig));
}
num += num2 + 10f;
if (GUI.Button(new Rect(10f, num, 70f, 20f), "Close", val3))
{
showSettingsGUI = false;
}
if (GUI.Button(new Rect(((Rect)(ref settingsWindowRect)).width - 25f, 5f, 20f, 20f), "X", val3))
{
showSettingsGUI = false;
}
GUI.DragWindow();
}
private void LoadSettingsCogTexture()
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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)
//IL_0041: Expected O, but got Unknown
try
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MorePeak.assets.settings-cog.png");
if (stream != null)
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
settingsCogTexture = new Texture2D(2, 2);
ImageConversion.LoadImage(settingsCogTexture, array);
ModLogger.LogInfo((object)"Settings cog texture loaded successfully from embedded resource");
}
else
{
ModLogger.LogWarning((object)"settings-cog.png embedded resource not found");
settingsCogTexture = MakeTexture(32, 32, Color.gray);
}
}
catch (Exception ex)
{
ModLogger.LogError((object)("Error loading settings cog texture: " + ex.Message));
settingsCogTexture = MakeTexture(32, 32, Color.gray);
}
}
private void InitializeCachedStyles()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected O, but got Unknown
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Expected O, but got Unknown
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Expected O, but got Unknown
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Expected O, but got Unknown
ModLogger.LogDebug((object)"Initializing cached styles and textures");
cachedDarkBackgroundTexture = MakeTexture(2, 2, new Color(0f, 0f, 0f, 0.7f));
cachedButtonBackgroundTexture = MakeTexture(2, 2, new Color(0.2f, 0.2f, 0.2f, 0.8f));
cachedButtonHoverTexture = MakeTexture(2, 2, new Color(0.3f, 0.3f, 0.3f, 0.9f));
cachedButtonActiveTexture = MakeTexture(2, 2, new Color(0.4f, 0.4f, 0.4f, 0.9f));
cachedTextFieldBackgroundTexture = MakeTexture(2, 2, new Color(0.2f, 0.2f, 0.2f, 0.9f));
cachedWindowBackgroundTexture = MakeTexture(2, 2, new Color(0.1f, 0.1f, 0.1f, 0.95f));
ModLogger.LogDebug((object)"Cached textures created");
cachedCogStyle = new GUIStyle(GUI.skin.button);
cachedCogStyle.normal.background = cachedButtonBackgroundTexture;
cachedCogStyle.hover.background = cachedButtonHoverTexture;
cachedCogStyle.active.background = cachedButtonActiveTexture;
cachedLabelStyle = new GUIStyle(GUI.skin.label);
cachedLabelStyle.fontSize = 12;
cachedLabelStyle.wordWrap = true;
cachedLabelStyle.normal.textColor = Color.white;
cachedTextFieldStyle = new GUIStyle(GUI.skin.textField);
cachedTextFieldStyle.fontSize = 12;
cachedTextFieldStyle.normal.background = cachedTextFieldBackgroundTexture;
cachedTextFieldStyle.normal.textColor = Color.white;
cachedButtonStyle = new GUIStyle(GUI.skin.button);
cachedButtonStyle.fontSize = 12;
cachedButtonStyle.normal.background = cachedButtonBackgroundTexture;
cachedButtonStyle.hover.background = cachedButtonHoverTexture;
cachedButtonStyle.normal.textColor = Color.white;
cachedButtonStyle.hover.textColor = Color.yellow;
cachedToggleStyle = new GUIStyle(GUI.skin.toggle);
cachedToggleStyle.fontSize = 12;
cachedToggleStyle.normal.textColor = Color.white;
cachedWindowStyle = new GUIStyle(GUI.skin.window);
cachedWindowStyle.fontSize = 14;
cachedWindowStyle.normal.background = cachedWindowBackgroundTexture;
cachedWindowStyle.onNormal.background = cachedWindowBackgroundTexture;
ModLogger.LogDebug((object)"Cached styles created successfully");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "MorePeak";
public const string PLUGIN_NAME = "MorePeak";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace MorePeak.MonoBehaviours
{
internal sealed class MorePeakHUD : MonoBehaviour
{
private TMP_Text tmpText;
private void Start()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
tmpText = ((Component)this).GetComponent<TMP_Text>();
tmpText.fontSize = 24f;
tmpText.alignment = (TextAlignmentOptions)260;
tmpText.outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue);
tmpText.outlineWidth = 0.055f;
tmpText.autoSizeTextContainer = true;
}
private void Update()
{
if ((Object)(object)tmpText != (Object)null)
{
List<string> list = new List<string>();
if (MorePeakPlugin.showCurrentLevelGUIConfig.Value)
{
list.Add("Current Level: " + MorePeakPlugin.currentLevelName);
}
if (MorePeakPlugin.showSelectedLevelConfigGUIConfig.Value)
{
list.Add("Config: " + MorePeakPlugin.selectedLevelConfig.Value);
}
if (list.Count > 0)
{
((Component)tmpText).gameObject.SetActive(true);
tmpText.text = string.Join("\n", list);
}
else
{
((Component)tmpText).gameObject.SetActive(false);
}
}
}
}
}