using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Emblem;
using Emblem.Components;
using Emblem.Managers;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Emblem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Emblem")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e4927ee1-3a47-4f93-8784-804356949316")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("Darkbrewery.Emblem", "Emblem", "1.2.4")]
public class EmblemPlugin : BaseUnityPlugin
{
private UIComponent uiComponent;
private HeaderReplacement headerReplacement;
private Boardwalk boardwalk;
private BackgroundManager backgroundManager;
private LoadingText loadingText;
private MenuMoodSetter menuMoodSetter;
private Harmony harmony;
private Configurator configManager;
private CustomMediaManager customMediaManager;
private SceneManagerHelper sceneManagerHelper;
private InterfaceDecorator interfaceDecorator;
private VersionStyler versionStyler;
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
LogWarden.Initialize(((BaseUnityPlugin)this).Logger);
LogWarden.LogInfo("Stirring from darkness...");
try
{
harmony = new Harmony("com.darkbrewery.emblem.harmony");
configManager = new Configurator(((BaseUnityPlugin)this).Config);
customMediaManager = new CustomMediaManager();
uiComponent = new UIComponent(configManager);
backgroundManager = new BackgroundManager(configManager, customMediaManager);
headerReplacement = new HeaderReplacement(configManager, uiComponent, customMediaManager);
boardwalk = new Boardwalk(configManager);
loadingText = ((Component)this).gameObject.AddComponent<LoadingText>();
loadingText.Initialize(configManager);
menuMoodSetter = new MenuMoodSetter(configManager);
versionStyler = new VersionStyler(configManager);
interfaceDecorator = new InterfaceDecorator(uiComponent, backgroundManager, headerReplacement, boardwalk, loadingText, menuMoodSetter, versionStyler);
sceneManagerHelper = new SceneManagerHelper(interfaceDecorator);
harmony.PatchAll();
LogWarden.LogInfo("Successfully deployed, its intent shrouded");
}
catch (Exception arg)
{
LogWarden.LogError($"Error initializing Emblem plugin: {arg}");
}
}
}
public class DelayHelper : MonoBehaviour
{
public static void StartDelayedAction(float delayInSeconds, Action action)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new GameObject("DelayHelper").AddComponent<DelayHelper>().DelayedAction(delayInSeconds, action);
}
private void DelayedAction(float delayInSeconds, Action action)
{
((MonoBehaviour)this).StartCoroutine(DelayCoroutine(delayInSeconds, action));
}
private IEnumerator DelayCoroutine(float delayInSeconds, Action action)
{
yield return (object)new WaitForSeconds(delayInSeconds);
action?.Invoke();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class EmblemFolder
{
private readonly string basePluginsPath;
private readonly Dictionary<string, string> fullPathCache = new Dictionary<string, string>();
private readonly Dictionary<string, IEnumerable<string>> validPathsCache = new Dictionary<string, IEnumerable<string>>();
private readonly Lazy<IEnumerable<string>> emblemDirectories;
public EmblemFolder()
{
basePluginsPath = Path.Combine(Paths.BepInExRootPath, "plugins");
emblemDirectories = new Lazy<IEnumerable<string>>(() => FindEmblemDirectories());
}
private IEnumerable<string> FindEmblemDirectories()
{
try
{
return (from dir in Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories)
where Path.GetFileName(dir).Equals("Emblem", StringComparison.OrdinalIgnoreCase)
select dir).ToList();
}
catch (Exception ex)
{
LogWarden.LogError("[EmblemFolder] Error finding Emblem directories: " + ex.Message);
return new List<string>();
}
}
public string FindFullPath(string inputPath)
{
if (fullPathCache.TryGetValue(inputPath, out var value))
{
return value;
}
string path = ExtractRelativePathFromEmblem(inputPath);
string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories);
foreach (string text in directories)
{
if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase))
{
string text2 = Path.Combine(text, path);
if (File.Exists(text2) || Directory.Exists(text2))
{
fullPathCache[inputPath] = text2;
return text2;
}
}
}
LogWarden.LogError("[EmblemFolder] Could not find a valid path for: " + inputPath);
return null;
}
public IEnumerable<string> FindAllValidPaths(string inputPathPattern)
{
if (validPathsCache.TryGetValue(inputPathPattern, out var value))
{
return value;
}
string path = ExtractRelativePathFromEmblem(inputPathPattern);
string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories);
List<string> list = new List<string>();
string[] array = directories;
foreach (string text in array)
{
if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase))
{
string searchPattern = Path.Combine(text, path);
list.AddRange(Directory.GetFiles(text, searchPattern, SearchOption.AllDirectories));
}
}
validPathsCache[inputPathPattern] = list;
return list;
}
private string ExtractRelativePathFromEmblem(string path)
{
string[] array = path.Split(new char[2]
{
Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar
}, StringSplitOptions.RemoveEmptyEntries);
int num = Array.FindIndex(array, (string segment) => segment.Equals("Emblem", StringComparison.OrdinalIgnoreCase));
if (num != -1 && num < array.Length - 1)
{
return Path.Combine(array.Skip(num + 1).ToArray());
}
return path;
}
}
public class ImageFilters
{
private readonly Configurator configManager;
public ImageFilters(Configurator configManager)
{
this.configManager = configManager;
}
public void Blend(string targetImagePath, Color vignetteColor)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
if (configManager.enableRadiantTaper.Value)
{
Transform val = PathFinder.Probe(targetImagePath);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("ImageFilters.Blend: Image with path '" + targetImagePath + "' not found.");
return;
}
GameObject gameObject = ((Component)val).gameObject;
GameObject val2 = new GameObject("VignetteOverlay");
RectTransform val3 = val2.AddComponent<RectTransform>();
((Transform)val3).SetParent(gameObject.transform, false);
Image obj = val2.AddComponent<Image>();
Texture2D val4 = CreateVignetteTexture(((Texture)gameObject.GetComponent<Image>().sprite.texture).width, ((Texture)gameObject.GetComponent<Image>().sprite.texture).height, vignetteColor);
obj.sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f));
Rect rect = gameObject.GetComponent<RectTransform>().rect;
float width = ((Rect)(ref rect)).width;
rect = gameObject.GetComponent<RectTransform>().rect;
val3.sizeDelta = new Vector2(width, ((Rect)(ref rect)).height);
((Graphic)obj).raycastTarget = false;
}
}
private Texture2D CreateVignetteTexture(int width, int height, Color vignetteColor)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
//IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
Color val2 = default(Color);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
float distance2 = j;
float distance3 = width - j;
float distance4 = height - i;
float distance5 = i;
float num = Mathf.Max(CalculateExponentialBlend(distance2, width), CalculateExponentialBlend(distance3, width));
float num2 = Mathf.Max(CalculateExponentialBlend(distance4, height), CalculateExponentialBlend(distance5, height));
float num3 = Mathf.Max(num, num2);
((Color)(ref val2))..ctor(vignetteColor.r, vignetteColor.g, vignetteColor.b, num3);
val.SetPixel(j, i, val2);
}
}
val.Apply();
return val;
static float CalculateExponentialBlend(float distance, float totalDistance)
{
float num4 = 0.97f * totalDistance;
if (distance > num4)
{
return Mathf.Clamp01(Mathf.Pow((distance - num4) / (totalDistance - num4), 2f));
}
return 0f;
}
}
}
namespace Emblem
{
public class CRTEffect
{
private Volume volume;
public void SetupVolume(GameObject gameObject)
{
volume = gameObject.GetComponent<Volume>() ?? gameObject.AddComponent<Volume>();
if ((Object)(object)volume == (Object)null)
{
LogWarden.LogError("Failed to add or get Volume component on gameObject.");
return;
}
volume.isGlobal = true;
volume.priority = 2.1474836E+09f;
if ((Object)(object)volume.profile == (Object)null)
{
volume.profile = ScriptableObject.CreateInstance<VolumeProfile>();
if ((Object)(object)volume.profile == (Object)null)
{
LogWarden.LogError("Failed to create a new VolumeProfile.");
return;
}
}
((Behaviour)volume).enabled = true;
LogWarden.LogInfo("Volume component for CRT effects has been enabled.");
SetupCRTEffects();
}
private void SetupCRTEffects()
{
if ((Object)(object)volume.profile == (Object)null)
{
LogWarden.LogError("VolumeProfile is null in SetupCRTEffects.");
return;
}
ConfigureChromaticAberration();
ConfigureFilmGrain();
ConfigureVignette();
ConfigureLensDistortion();
}
private T GetOrAddEffect<T>(bool overrides = true) where T : VolumeComponent, new()
{
VolumeComponent? obj = volume.profile.components.Find((VolumeComponent x) => x is T);
return ((T)(object)((obj is T) ? obj : null)) ?? volume.profile.Add<T>(overrides);
}
private void ConfigureChromaticAberration()
{
ChromaticAberration orAddEffect = GetOrAddEffect<ChromaticAberration>(overrides: true);
((VolumeComponent)orAddEffect).active = true;
((VolumeParameter<float>)(object)orAddEffect.intensity).value = 0.04f;
}
private void ConfigureFilmGrain()
{
FilmGrain orAddEffect = GetOrAddEffect<FilmGrain>(overrides: true);
((VolumeComponent)orAddEffect).active = true;
((VolumeParameter<float>)(object)orAddEffect.intensity).value = 0.4f;
((VolumeParameter<FilmGrainLookup>)(object)orAddEffect.type).value = (FilmGrainLookup)2;
((VolumeParameter<float>)(object)orAddEffect.response).value = 0.2f;
}
private void ConfigureVignette()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
Vignette orAddEffect = GetOrAddEffect<Vignette>(overrides: true);
((VolumeComponent)orAddEffect).active = true;
((VolumeParameter<float>)(object)orAddEffect.intensity).value = 0.4f;
((VolumeParameter<Color>)(object)orAddEffect.color).value = Color.black;
((VolumeParameter<Vector2>)(object)orAddEffect.center).value = new Vector2(0.5f, 0.5f);
((VolumeParameter<float>)(object)orAddEffect.roundness).value = 1f;
((VolumeParameter<float>)(object)orAddEffect.smoothness).value = 0.5f;
}
private void ConfigureLensDistortion()
{
LensDistortion orAddEffect = GetOrAddEffect<LensDistortion>(overrides: true);
((VolumeComponent)orAddEffect).active = true;
((VolumeParameter<float>)(object)orAddEffect.intensity).value = 0.27f;
((VolumeParameter<float>)(object)orAddEffect.scale).value = 1.02f;
}
}
public static class ColorParser
{
public static Color RGBA(string rgbaString)
{
//IL_0071: 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)
string[] array = rgbaString.Split(new char[1] { ',' });
if (array.Length != 4)
{
return Color.white;
}
float num = Mathf.Clamp01((float)int.Parse(array[0]) / 255f);
float num2 = Mathf.Clamp01((float)int.Parse(array[1]) / 255f);
float num3 = Mathf.Clamp01((float)int.Parse(array[2]) / 255f);
float num4 = Mathf.Clamp01(float.Parse(array[3]));
return new Color(num, num2, num3, num4);
}
public static Color RGB(string rgbString)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
string[] array = rgbString.Split(new char[1] { ',' });
if (array.Length < 3 || array.Length > 4)
{
return Color.white;
}
float num = Mathf.Clamp01((float)int.Parse(array[0]) / 255f);
float num2 = Mathf.Clamp01((float)int.Parse(array[1]) / 255f);
float num3 = Mathf.Clamp01((float)int.Parse(array[2]) / 255f);
return new Color(num, num2, num3, 1f);
}
}
public static class LogWarden
{
private static ManualLogSource loggerInstance;
public static void Initialize(ManualLogSource logger)
{
loggerInstance = logger;
}
public static void LogError(string message)
{
ManualLogSource obj = loggerInstance;
if (obj != null)
{
obj.LogError((object)message);
}
}
public static void LogWarning(string message)
{
ManualLogSource obj = loggerInstance;
if (obj != null)
{
obj.LogWarning((object)message);
}
}
public static void LogInfo(string message)
{
ManualLogSource obj = loggerInstance;
if (obj != null)
{
obj.LogInfo((object)message);
}
}
}
public static class PathFinder
{
public static Transform Probe(string path)
{
Transform val = null;
string[] array = path.Split(new char[1] { '/' });
foreach (string text in array)
{
if ((Object)(object)val == (Object)null)
{
GameObject obj = GameObject.Find(text);
val = ((obj != null) ? obj.transform : null);
}
else
{
val = val.Find(text);
}
if ((Object)(object)val == (Object)null)
{
GameObject[] array2 = Resources.FindObjectsOfTypeAll<GameObject>();
foreach (GameObject val2 in array2)
{
if (((Object)val2).name == text)
{
val = val2.transform;
break;
}
}
}
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("Element '" + text + "' not found in path '" + path + "'.");
return null;
}
}
return val;
}
}
public class Configurator
{
public readonly ConfigFile config;
public ConfigEntry<bool> enableReplaceMainHeader { get; private set; }
public ConfigEntry<string> mainHeaderPath { get; private set; }
public ConfigEntry<float> mainHeaderYOffset { get; private set; }
public ConfigEntry<int> mainHeaderScale { get; private set; }
public ConfigEntry<int> mainHeaderAlpha { get; private set; }
public ConfigEntry<bool> enableMainBackground { get; private set; }
public ConfigEntry<string> mainBackgroundPath { get; private set; }
public ConfigEntry<string> mainBackgroundColor { get; private set; }
public ConfigEntry<bool> enableMenuColorChange { get; private set; }
public ConfigEntry<string> menuFontColor { get; private set; }
public ConfigEntry<string> menuRolloverBGColor { get; private set; }
public ConfigEntry<string> menuRolloverFontColor { get; private set; }
public ConfigEntry<bool> enableReplaceLoadHeader { get; private set; }
public ConfigEntry<string> loadHeaderPath { get; private set; }
public ConfigEntry<float> loadHeaderYOffset { get; private set; }
public ConfigEntry<int> loadHeaderScale { get; private set; }
public ConfigEntry<int> loadHeaderAlpha { get; private set; }
public ConfigEntry<bool> loadHeaderStretch { get; private set; }
public ConfigEntry<bool> enableLoadBackground { get; private set; }
public ConfigEntry<string> loadBackgroundPath { get; private set; }
public ConfigEntry<string> loadBackgroundColor { get; private set; }
public ConfigEntry<bool> enableLoadingTextChange { get; private set; }
public ConfigEntry<string> loadTextString { get; private set; }
public ConfigEntry<string> loadTextColor { get; private set; }
public ConfigEntry<float> loadTextSize { get; private set; }
public ConfigEntry<float> loadTextYOffset { get; private set; }
public ConfigEntry<bool> enableReplaceBorder { get; private set; }
public ConfigEntry<string> borderColor { get; private set; }
public ConfigEntry<float> borderPadding { get; private set; }
public ConfigEntry<bool> enableCustomVersion { get; private set; }
public ConfigEntry<string> versionTextString { get; private set; }
public ConfigEntry<string> versionColor { get; private set; }
public ConfigEntry<float> versionFontSize { get; private set; }
public ConfigEntry<float> versionYOffset { get; private set; }
public ConfigEntry<bool> enableRadiantTaper { get; private set; }
public ConfigEntry<bool> enableCRT { get; private set; }
public Configurator(ConfigFile config)
{
this.config = config;
Initialize();
}
private void Initialize()
{
enableReplaceMainHeader = BindConfig("1. Main Logo", "Enable", defaultValue: false, "Enable or disable header image replacement.");
mainHeaderPath = BindConfig("1. Main Logo", "Path", "Defaults/Header/HeaderWhite.png", "Relative to your /Emblem/ folder: Specify a .png file. A folder will randomly select an image starting with the prefix 'Header'. Leave blank to use nothing.");
mainHeaderYOffset = BindConfig("1. Main Logo", "Offset", 20f, "Vertical Y offset percentage from top. Set to -1 for no adjustment.");
mainHeaderScale = BindConfig("1. Main Logo", "Scale", 60, "Image scale. This will maintain aspect ratio. 100 for apx original size");
mainHeaderAlpha = BindConfig("1. Main Logo", "Alpha", 80, "Image transparency. 0 for invisible and 100 for completely opaque.");
enableMainBackground = BindConfig("2. Main Background", "Enable", defaultValue: true, "Enable or disable the custom main menu background.");
mainBackgroundPath = BindConfig("2. Main Background", "Path", "Defaults/Background", "Relative to your /Emblem/ folder: Specify a .png, .mp4. A folder will randomly select an image starting with the prefix 'Background'. Separate multiple mp4 paths with a | to pick one randomly");
mainBackgroundColor = BindConfig("2. Main Background", "Color", "0,0,0", "Background color for Main Menu Screen in RGB format (ex: '0,0,0' for black). No alpha value as this is the bottom layer");
enableMenuColorChange = BindConfig("3. Menu Colors", "Enable", defaultValue: false, "Do you even want to mess with menu colors?");
menuFontColor = BindConfig("3. Menu Colors", "Color", "230,100,65,1", "Color of menu font.");
menuRolloverBGColor = BindConfig("3. Menu Colors", "Highlight BG Color", "230,100,65,1", "Background color of a menu items on rollover.");
menuRolloverFontColor = BindConfig("3. Menu Colors", "Highlight Font Color", "0,0,0,1", "Font color of menu items on rollover.");
enableReplaceLoadHeader = BindConfig("4. Loading Image", "Enable", defaultValue: false, "Enable or disable loading image replacement.");
loadHeaderPath = BindConfig("4. Loading Image", "Path", "Defaults/Loading", "Relative to your /Emblem/ folder: Specify a .png file. A folder will randomly select an image starting with the prefix 'Loading'. Leave blank to use nothing");
loadHeaderYOffset = BindConfig("4. Loading Image", "Offset", 50f, "Vertical Y offset percentage from top. Set to -1 for no adjustment.");
loadHeaderScale = BindConfig("4. Loading Image", "Scale", 60, "Image scale. This will maintain aspect ratio.");
loadHeaderAlpha = BindConfig("4. Loading Image", "Alpha", 100, "Image transparency. 0 for invisible and 100 for completely opaque.");
loadHeaderStretch = BindConfig("4. Loading Image", "Stretch", defaultValue: false, "Stretch the loading image to fit the screen vertically. This will override scale and offset");
enableLoadBackground = BindConfig("5. Loading Background", "Enable", defaultValue: false, "Enable or disable the loading screen background.");
loadBackgroundPath = BindConfig("5. Loading Background", "Path", "Defaults/Background", "Relative to your /Emblem/ folder: Specify a .png, .mp4. A folder will randomly select an image starting with the prefix 'LoadBackground'. Separate multiple mp4 paths with a | to pick one randomly");
loadBackgroundColor = BindConfig("5. Loading Background", "Color", "0,0,0,1", "Background color for Loading Screen in RGBA format (ex: '255,255,255,1' for white).");
enableLoadingTextChange = BindConfig("6. Loading Text", "Enable", defaultValue: false, "Enable or disable the custom loading text feature.");
loadTextString = BindConfig("6. Loading Text", "Text", "Loading...", "Text displayed on the loading screen. Separate multiple texts with '|' to choose one at random");
loadTextColor = BindConfig("6. Loading Text", "Color", "255,139,0,1", "Color of the font in RGBA format (ex: '0,0,0,1' for blue).");
loadTextSize = BindConfig("6. Loading Text", "Font Size", 19.6f, "Size of the font used in the loading text.");
loadTextYOffset = BindConfig("6. Loading Text", "Offset", -1f, "Vertical Y offset percentage from top. Set to -1 for no adjustment.");
enableReplaceBorder = BindConfig("7. Borders", "Hide", defaultValue: false, "Enable or disable the corner borders.");
borderColor = BindConfig("7. Borders", "Color", "115,59,0,1", "The color of the border in RGBA format (ex: '0,255,0,1' for green).");
borderPadding = BindConfig("7. Borders", "Padding", 10f, "How far should the border be from corners of the screen.");
enableCustomVersion = BindConfig("8. Version Number", "Enable", defaultValue: false, "Play around in version styling? This will center the text and disable word wrapping");
versionTextString = BindConfig("8. Version Number", "Text", "[ %VERSION% ]", "Format string for the version text. Use %VERSION% for the original string.");
versionColor = BindConfig("8. Version Number", "Color", "230,100,65,0.45", "The color of the text in RGBA format (ex: '255,0,0,1' for red)..");
versionFontSize = BindConfig("8. Version Number", "Font Size", 16f, "Font size of the version text.");
versionYOffset = BindConfig("8. Version Number", "Offset", 95.8f, "Vertical Y offset percentage from top.");
enableRadiantTaper = BindConfig("9. Experimental", "Radiant Taper", defaultValue: false, "Use the vignette blending effect on background images?");
enableCRT = BindConfig("9. Experimental", "Retro TV Style", defaultValue: false, "Attempt to make the entire menu scene look like a CRT monitor?");
}
private ConfigEntry<T> BindConfig<T>(string section, string key, T defaultValue, string description)
{
return config.Bind<T>(section, key, defaultValue, description);
}
}
public static class UI
{
public const string MenuCont = "Canvas/MenuContainer";
public const string LoadScreen = "Canvas/LoadingScreen";
public const string MainBtns = "Canvas/MenuContainer/MainButtons";
public const string MainImg = "Canvas/MenuContainer/MainButtons/HeaderImage";
public const string LoadImg = "Canvas/MenuContainer/LoadingScreen/Image";
public const string CustBgImg = "Canvas/MenuContainer/MainButtons/Background";
public const string LoadTextCont = "Canvas/MenuContainer/LoadingTextContainer";
public const string LoadText = "Canvas/MenuContainer/LoadingTextContainer/LoadingText";
}
}
namespace Emblem.Managers
{
public class InterfaceDecorator
{
private readonly UIComponent uiComponent;
private readonly BackgroundManager backgroundManager;
private readonly HeaderReplacement headerReplacement;
private readonly Boardwalk boardwalk;
private readonly LoadingText loadingText;
private readonly MenuMoodSetter menuMoodSetter;
private readonly VersionStyler versionStyler;
public InterfaceDecorator(UIComponent uiComponent, BackgroundManager backgroundManager, HeaderReplacement headerReplacement, Boardwalk boardwalk, LoadingText loadingText, MenuMoodSetter menuMoodSetter, VersionStyler versionStyler)
{
this.uiComponent = uiComponent;
this.backgroundManager = backgroundManager;
this.headerReplacement = headerReplacement;
this.boardwalk = boardwalk;
this.loadingText = loadingText;
this.menuMoodSetter = menuMoodSetter;
this.versionStyler = versionStyler;
}
public void ApplyMainMenuCustomizations()
{
uiComponent.ResetRectTransformProperties();
uiComponent.CreateBackgrounds();
uiComponent.SetVolumeLayerMaskOnAllCameras(-1);
backgroundManager.ApplyMainMenuBackground();
backgroundManager.ApplyLoadingBackground();
headerReplacement.ReplaceMainImage();
headerReplacement.ReplaceLoadImage();
uiComponent.SetMainBackgroundColor();
loadingText.ApplyLoadingCustomizations();
menuMoodSetter.HarmonizeMenuHues();
boardwalk.ToggleBorder();
versionStyler.ApplyVersionStyling();
uiComponent.ApplyCRTEffectIfNeeded("Canvas");
DelayHelper.StartDelayedAction(0.3f, menuMoodSetter.HarmonizeMenuHues);
}
}
public class SceneManagerHelper
{
private readonly InterfaceDecorator interfaceDecorator;
public SceneManagerHelper(InterfaceDecorator interfaceDecorator)
{
this.interfaceDecorator = interfaceDecorator;
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name == "MainMenu")
{
LogWarden.LogInfo("[SceneManager] Applying customizations to MainMenu.");
interfaceDecorator.ApplyMainMenuCustomizations();
}
}
public void Unsubscribe()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
}
}
namespace Emblem.Components
{
public class BackgroundManager
{
private readonly Configurator configManager;
private readonly CustomMediaManager customMediaManager;
private readonly ImageFilters imageFilters;
public BackgroundManager(Configurator configManager, CustomMediaManager customMediaManager)
{
this.configManager = configManager;
this.customMediaManager = customMediaManager;
imageFilters = new ImageFilters(configManager);
}
public void ApplyMainMenuBackground()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (configManager.enableMainBackground.Value)
{
string value = configManager.mainBackgroundPath.Value;
Color backgroundColor = ColorParser.RGB(configManager.mainBackgroundColor.Value);
ApplyBackground("MenuContainer", value, "MainVideo", 0, "Background", backgroundColor);
}
}
public void ApplyLoadingBackground()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (configManager.enableLoadBackground.Value)
{
string value = configManager.loadBackgroundPath.Value;
Color backgroundColor = ColorParser.RGB(configManager.loadBackgroundColor.Value);
ApplyBackground("LoadingScreen", value, "LoadingVideo", 1, "LoadBackground", backgroundColor);
}
}
private void ApplyBackground(string parentObjectName, string backgroundPath, string videoObjectName, int siblingIndex, string imagePrefix, Color backgroundColor)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrEmpty(backgroundPath))
{
Transform obj = PathFinder.Probe(parentObjectName);
GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[CustomBackgroundManager] " + parentObjectName + " not found in the scene.");
}
else if (backgroundPath.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase))
{
HandleVideoBackground(val, backgroundPath, videoObjectName, siblingIndex);
}
else
{
HandleImageBackground(val, backgroundPath, siblingIndex, imagePrefix, backgroundColor);
}
}
}
private void HandleVideoBackground(GameObject parentObject, string backgroundPath, string videoObjectName, int siblingIndex)
{
string text = customMediaManager.LoadCustomVideoPath(backgroundPath);
if (text != null)
{
(parentObject.GetComponent<BackgroundVideoManager>() ?? parentObject.AddComponent<BackgroundVideoManager>()).InitializeVideo(parentObject, text, videoObjectName, siblingIndex);
}
}
private void HandleImageBackground(GameObject parentObject, string backgroundPath, int siblingIndex, string imagePrefix, Color backgroundColor)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
Sprite customSprite = customMediaManager.LoadCustomImage(backgroundPath, imagePrefix);
CreateBackgroundImage(parentObject.transform, customSprite, siblingIndex, backgroundColor, imagePrefix + "Image");
}
private void CreateBackgroundImage(Transform parentTransform, Sprite customSprite, int siblingIndex, Color backgroundColor, string objectName)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)customSprite == (Object)null)
{
LogWarden.LogError("[CustomBackgroundManager] No custom sprite provided for background image creation.");
return;
}
GameObject val = CreateBackgroundObject(parentTransform, objectName, siblingIndex);
Image val2 = SetImageComponent(val, customSprite);
AdjustImageToFit(parentTransform, ((Component)val2).GetComponent<RectTransform>(), customSprite);
ManageOtherUIElements(parentTransform);
imageFilters.Blend(((Object)val).name, backgroundColor);
}
private GameObject CreateBackgroundObject(Transform parentTransform, string objectName, int siblingIndex)
{
//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)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
GameObject val = new GameObject(objectName);
val.transform.SetParent(parentTransform, false);
val.transform.SetSiblingIndex(siblingIndex);
return val;
}
private Image SetImageComponent(GameObject backgroundImageObject, Sprite customSprite)
{
Image obj = backgroundImageObject.AddComponent<Image>();
obj.sprite = customSprite;
obj.preserveAspect = true;
return obj;
}
private void AdjustImageToFit(Transform parentTransform, RectTransform rectTransform, Sprite customSprite)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchorMin = new Vector2(0.5f, 0f);
rectTransform.anchorMax = new Vector2(0.5f, 1f);
rectTransform.pivot = new Vector2(0.5f, 0.5f);
Rect rect = ((Component)parentTransform).GetComponent<RectTransform>().rect;
float height = ((Rect)(ref rect)).height;
Bounds bounds = customSprite.bounds;
float num = ((Bounds)(ref bounds)).size.y * customSprite.pixelsPerUnit;
float num2 = height / num;
bounds = customSprite.bounds;
rectTransform.sizeDelta = new Vector2(((Bounds)(ref bounds)).size.x * customSprite.pixelsPerUnit * num2, 0f);
}
private void ManageOtherUIElements(Transform parentTransform)
{
Transform val = PathFinder.Probe("MenuContainer/MainButtons/HeaderImage");
if ((Object)(object)val != (Object)null)
{
val.SetSiblingIndex(1);
}
}
}
public class BackgroundVideoManager : MonoBehaviour
{
private VideoPlayer videoPlayer;
public string VideoPath { get; set; }
public void InitializeVideo(GameObject targetGameObject, string videoPath, string videoObjectName, int siblingIndex)
{
VideoPath = videoPath;
if ((Object)(object)targetGameObject == (Object)null)
{
LogWarden.LogError("[Video] Target GameObject not found in the scene.");
}
else
{
CreateBackgroundVideo(targetGameObject, videoObjectName, siblingIndex);
}
}
private void CreateBackgroundVideo(GameObject targetGameObject, string videoObjectName, int siblingIndex)
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
if (!string.IsNullOrEmpty(VideoPath))
{
string text = (VideoPath.StartsWith("file://", StringComparison.OrdinalIgnoreCase) ? VideoPath : ("file://" + VideoPath));
string text2 = text.Replace(Paths.BepInExRootPath, "");
text2 = text2.TrimStart(new char[1] { Path.DirectorySeparatorChar });
LogWarden.LogInfo("[Video] Initializing video with relative path: " + text2);
_ = ((Object)targetGameObject).name + "Video";
GameObject val = new GameObject(videoObjectName);
val.transform.SetParent(targetGameObject.transform, false);
val.transform.SetSiblingIndex(siblingIndex);
RawImage rawImage = val.AddComponent<RawImage>();
videoPlayer = val.AddComponent<VideoPlayer>();
AudioSource audioSource = val.AddComponent<AudioSource>();
ConfigureVideoPlayer(text, audioSource, rawImage);
AdjustRawImage(rawImage);
LogWarden.LogInfo("[Video] Background video added to the scene.");
}
}
private void ConfigureVideoPlayer(string fullPath, AudioSource audioSource, RawImage rawImage)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
videoPlayer.playOnAwake = true;
videoPlayer.isLooping = true;
videoPlayer.renderMode = (VideoRenderMode)2;
videoPlayer.audioOutputMode = (VideoAudioOutputMode)1;
videoPlayer.SetTargetAudioSource((ushort)0, audioSource);
videoPlayer.source = (VideoSource)1;
videoPlayer.url = fullPath;
videoPlayer.aspectRatio = (VideoAspectRatio)1;
RenderTexture val = new RenderTexture(1920, 1080, 0);
videoPlayer.targetTexture = val;
rawImage.texture = (Texture)(object)val;
videoPlayer.errorReceived += new ErrorEventHandler(OnVideoErrorReceived);
videoPlayer.prepareCompleted += new EventHandler(OnVideoPrepared);
videoPlayer.Prepare();
}
private void AdjustRawImage(RawImage rawImage)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_0050: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((Component)rawImage).GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.pivot = new Vector2(0.5f, 0.5f);
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
}
private void OnVideoErrorReceived(VideoPlayer source, string message)
{
LogWarden.LogError("Video Error: " + message);
}
private void OnVideoPrepared(VideoPlayer source)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
source.prepareCompleted -= new EventHandler(OnVideoPrepared);
LogWarden.LogInfo("[Video] Prepared and ready to play.");
source.Play();
}
}
public class Boardwalk
{
private readonly Configurator configManager;
public Boardwalk(Configurator configManager)
{
this.configManager = configManager;
}
public void ToggleBorder()
{
foreach (string item in new List<string> { "MainButtons", "LoadingScreen", "LobbyHostSettings", "DeleteFileConfirmation", "NewsPanel", "MenuNotification", "LANWarning", "LobbyList", "CreditsPanel" })
{
Transform val = PathFinder.Probe(item);
if ((Object)(object)val != (Object)null)
{
HideOriginalBorder(val);
if (item == "MainButtons" && !configManager.enableReplaceBorder.Value)
{
CreateBorderCopy(val);
}
}
else
{
LogWarden.LogWarning("[Border] " + item + " not found.");
}
}
}
private void HideOriginalBorder(Transform borderTransform)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0037: Unknown result type (might be due to invalid IL or missing references)
Image component = ((Component)borderTransform).GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).color = new Color(((Graphic)component).color.r, ((Graphic)component).color.g, ((Graphic)component).color.b, 0f);
}
else
{
LogWarden.LogWarning("[Border] No Image component found on " + ((Object)borderTransform).name);
}
}
private void CreateBorderCopy(Transform borderTransform)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)borderTransform).gameObject;
Image component = gameObject.GetComponent<Image>();
if ((Object)(object)component == (Object)null)
{
LogWarden.LogWarning("[Border] No Image component found on " + ((Object)borderTransform).name + ". Cannot clone.");
return;
}
GameObject val = new GameObject("Corners");
val.transform.SetParent(gameObject.transform.parent);
val.transform.SetSiblingIndex(3);
RectTransform rectTransform = ((Graphic)component).rectTransform;
RectTransform obj = val.AddComponent<RectTransform>();
((Transform)obj).localPosition = ((Transform)rectTransform).localPosition;
((Transform)obj).localRotation = ((Transform)rectTransform).localRotation;
((Transform)obj).localScale = ((Transform)rectTransform).localScale;
obj.anchorMin = rectTransform.anchorMin;
obj.anchorMax = rectTransform.anchorMax;
obj.anchoredPosition = rectTransform.anchoredPosition;
obj.sizeDelta = rectTransform.sizeDelta;
obj.pivot = rectTransform.pivot;
float value = configManager.borderPadding.Value;
obj.offsetMax = new Vector2(0f - value, 0f - value);
obj.offsetMin = new Vector2(value, value);
Image obj2 = val.AddComponent<Image>();
obj2.sprite = component.sprite;
obj2.type = component.type;
obj2.fillCenter = component.fillCenter;
((Graphic)obj2).color = ColorParser.RGBA(configManager.borderColor.Value);
obj2.pixelsPerUnitMultiplier = component.pixelsPerUnitMultiplier;
((Graphic)obj2).raycastTarget = false;
LogWarden.LogInfo("[Border] " + ((Object)borderTransform).name + " border cloned with padding " + value + " and color set to " + configManager.borderColor.Value + ".");
}
}
public class MenuMoodSetter
{
private readonly Configurator configManager;
private static HashSet<string> loggedMessages = new HashSet<string>();
public MenuMoodSetter(Configurator configManager)
{
this.configManager = configManager;
}
public void HarmonizeMenuHues()
{
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
if (!configManager.enableMenuColorChange.Value)
{
LogWarden.LogInfo("[MoodSetter] Menu color change is disabled.");
return;
}
LogOnce("[MoodSetter] Harmonizing menu hues...");
Transform val = PathFinder.Probe("MainButtons");
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[MoodSetter] MainButtons object not found.");
return;
}
LogOnce("[MoodSetter] MainButtons object found. Processing children...");
LogOnce("[MoodSetter] Painting menu font color: " + configManager.menuFontColor.Value);
LogOnce("[MoodSetter] Painting menu rollover font color: " + configManager.menuRolloverFontColor.Value);
LogOnce("[MoodSetter] Painting menu rollover background: " + configManager.menuRolloverBGColor.Value);
foreach (Transform item in val)
{
Transform val2 = item;
if (!((Object)(object)((Component)val2).GetComponent<Button>() == (Object)null))
{
DisableAnimator(val2);
SetupEventTriggers(val2);
SetTextColor(val2, configManager.menuFontColor.Value);
}
}
}
private void LogOnce(string message)
{
if (!loggedMessages.Contains(message))
{
LogWarden.LogInfo(message);
loggedMessages.Add(message);
}
}
private void DisableAnimator(Transform buttonTransform)
{
Animator component = ((Component)buttonTransform).GetComponent<Animator>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = false;
}
}
private void SetupEventTriggers(Transform buttonTransform)
{
EventTrigger orAddComponent = GetOrAddComponent<EventTrigger>(((Component)buttonTransform).gameObject);
AddEventTrigger(orAddComponent, (EventTriggerType)0, delegate
{
OnMouseEnter(buttonTransform);
});
AddEventTrigger(orAddComponent, (EventTriggerType)1, delegate
{
OnMouseExit(buttonTransform);
});
AddEventTrigger(orAddComponent, (EventTriggerType)4, delegate
{
ResetButtonState(buttonTransform);
});
}
private void OnMouseEnter(Transform buttonTransform)
{
SetTextColor(buttonTransform, configManager.menuRolloverFontColor.Value);
SetSelectionHighlight(buttonTransform, enabled: true, configManager.menuRolloverBGColor.Value);
}
private void OnMouseExit(Transform buttonTransform)
{
SetTextColor(buttonTransform, configManager.menuFontColor.Value);
SetSelectionHighlight(buttonTransform, enabled: false, "");
}
private void ResetButtonState(Transform buttonTransform)
{
SetTextColor(buttonTransform, configManager.menuFontColor.Value);
SetSelectionHighlight(buttonTransform, enabled: false, "");
}
private void SetTextColor(Transform buttonTransform, string colorString)
{
//IL_001f: 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)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
TMP_Text componentInChildren = ((Component)buttonTransform).GetComponentInChildren<TMP_Text>();
if (!((Object)(object)componentInChildren == (Object)null))
{
string text = RemoveColorTags(componentInChildren.text);
Color val = ColorParser.RGBA(colorString);
string text2 = ColorUtility.ToHtmlStringRGB(new Color(val.r, val.g, val.b));
componentInChildren.text = "<color=#" + text2 + ">" + text + "</color>";
componentInChildren.alpha = val.a;
}
}
private string RemoveColorTags(string text)
{
return Regex.Replace(text, "<color=#[0-9A-Fa-f]{6,8}>(.*?)</color>", "$1");
}
private void SetSelectionHighlight(Transform buttonTransform, bool enabled, string colorString)
{
//IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
Transform val = buttonTransform.Find("SelectionHighlight");
Image val2 = default(Image);
if (!((Object)(object)val == (Object)null) && ((Component)val).TryGetComponent<Image>(ref val2))
{
((Behaviour)val2).enabled = enabled;
if (enabled)
{
Color color = ColorParser.RGBA(colorString);
((Graphic)val2).color = color;
}
}
}
private T GetOrAddComponent<T>(GameObject obj) where T : Component
{
return obj.GetComponent<T>() ?? obj.AddComponent<T>();
}
private void AddEventTrigger(EventTrigger trigger, EventTriggerType type, UnityAction<BaseEventData> action)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
Entry val = new Entry
{
eventID = type
};
((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action);
trigger.triggers.Add(val);
}
}
public class VersionStyler
{
private Configurator configManager;
public VersionStyler(Configurator config)
{
configManager = config;
}
public void ApplyVersionStyling()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
if (!configManager.enableCustomVersion.Value)
{
LogWarden.LogInfo("[VersionStyler] Custom version styling is disabled.");
return;
}
Transform val = PathFinder.Probe("Canvas/MenuContainer/VersionNum");
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[VersionStyler] Version number GameObject not found.");
return;
}
TextMeshProUGUI val2 = default(TextMeshProUGUI);
if (!((Component)val).TryGetComponent<TextMeshProUGUI>(ref val2))
{
LogWarden.LogError("[VersionStyler] TextMeshPro component not found on Version number GameObject.");
return;
}
string value = configManager.versionTextString.Value;
string text = ((TMP_Text)val2).text;
string text2 = value.Replace("%VERSION%", text);
Color val3 = ColorParser.RGBA(configManager.versionColor.Value);
((TMP_Text)val2).text = "<color=#" + ColorUtility.ToHtmlStringRGB(val3) + ">" + text2 + "</color>";
((TMP_Text)val2).alpha = val3.a;
((TMP_Text)val2).fontSize = configManager.versionFontSize.Value;
((TMP_Text)val2).enableWordWrapping = false;
((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
float num = 1f - configManager.versionYOffset.Value / 100f;
RectTransform component = ((Component)val2).GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.5f, num);
component.anchorMax = new Vector2(0.5f, num);
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = new Vector2(0f, 0f);
Color val4 = ColorParser.RGBA(configManager.versionColor.Value);
float value2 = configManager.versionYOffset.Value;
LogWarden.LogInfo("[VersionStyler] Text set to " + ((TMP_Text)val2).text);
LogWarden.LogInfo($"[VersionStyler] Applied styling - Color {ColorUtility.ToHtmlStringRGBA(val4)}, Font Size {configManager.versionFontSize.Value}, Y Offset {value2}%");
}
}
public class CustomMediaManager
{
private EmblemFolder emblemFolder;
public CustomMediaManager()
{
emblemFolder = new EmblemFolder();
}
public string LoadCustomVideoPath(string path)
{
string text = path;
if (path.Contains("|"))
{
string[] array = path.Split(new char[1] { '|' });
text = array[Random.Range(0, array.Length)];
}
string text2 = emblemFolder.FindFullPath(text);
if (text2 == null || !text2.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase))
{
LogWarden.LogError("[VideoManage] Failed to find video at path: " + text);
return null;
}
if (!Path.IsPathRooted(text2))
{
text2 = Path.Combine(Paths.BepInExRootPath, "plugins", text2);
LogWarden.LogInfo("[Video] Using absolute path for video: " + text2);
}
return text2;
}
public Sprite LoadCustomImage(string path, string imagePrefix)
{
//IL_0072: 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)
string imagePath = GetImagePath(path, imagePrefix);
if (imagePath == null)
{
LogWarden.LogError("[ImgManage] Failed to find image at path: " + path);
return null;
}
try
{
byte[] imageBytes = File.ReadAllBytes(imagePath);
Texture2D val = LoadTextureFromBytes(imageBytes);
if ((Object)(object)val == (Object)null)
{
return null;
}
string logPathForBepInEx = GetLogPathForBepInEx(imagePath);
LogWarden.LogInfo("[ImgManage] File ripped from " + logPathForBepInEx + ".");
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
catch (Exception ex)
{
LogWarden.LogError("[ImgManage] Failed to read image bytes from path: " + imagePath + ". Exception: " + ex.Message);
return null;
}
}
private Texture2D LoadTextureFromBytes(byte[] imageBytes)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
if (!ImageConversion.LoadImage(val, imageBytes, true))
{
LogWarden.LogError("[ImgManage] Failed to load image data into texture.");
return null;
}
((Texture)val).filterMode = (FilterMode)1;
((Texture)val).wrapMode = (TextureWrapMode)1;
return val;
}
private string GetLogPathForBepInEx(string fullPath)
{
int startIndex = fullPath.IndexOf("BepInEx") + "BepInEx".Length;
return fullPath.Substring(startIndex).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
}
private string GetImagePath(string path, string imagePrefix = null)
{
string text = emblemFolder.FindFullPath(path);
if (text != null && text.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
{
return text;
}
if (text != null && Directory.Exists(text) && !string.IsNullOrEmpty(imagePrefix))
{
return GetRandomPrefixFile(text, imagePrefix, ".png");
}
LogWarden.LogError("[ImgManage] Path does not exist or is not a valid PNG file: " + path);
return null;
}
private string GetRandomPrefixFile(string directory, string filePrefix, string extension)
{
string[] files = Directory.GetFiles(directory, filePrefix + "*.png");
if (files.Length != 0)
{
return files[new Random().Next(files.Length)];
}
return GetRandomPngFile(directory);
}
private string GetRandomPngFile(string directory)
{
string[] files = Directory.GetFiles(directory, "*.png");
if (files.Length == 0)
{
LogWarden.LogError("[ImgManage] No PNG files found in directory " + directory + ".");
return null;
}
return files[new Random().Next(files.Length)];
}
}
public class HeaderReplacement
{
private readonly Configurator configManager;
private readonly CustomMediaManager customMediaManager;
private readonly UIComponent uiComponent;
public HeaderReplacement(Configurator configManager, UIComponent uiComponent, CustomMediaManager customMediaManager)
{
this.configManager = configManager;
this.customMediaManager = customMediaManager;
this.uiComponent = uiComponent;
}
public void ReplaceMainImage()
{
ReplaceImage("Canvas/MenuContainer/MainButtons/HeaderImage", configManager.mainHeaderPath.Value, configManager.enableReplaceMainHeader.Value, isHeader: true);
}
public void ReplaceLoadImage()
{
ReplaceImage("Canvas/MenuContainer/LoadingScreen/Image", configManager.loadHeaderPath.Value, configManager.enableReplaceLoadHeader.Value, isHeader: false);
}
private void ReplaceImage(string uiPath, string imagePath, bool isEnabled, bool isHeader)
{
if (isEnabled && TryGetImageComponent(uiPath, out var targetImage))
{
if (!TryLoadCustomSprite(imagePath, isHeader, out var customSprite))
{
HideOriginalImage(targetImage);
return;
}
SetupImage(targetImage, customSprite, isHeader);
ApplyImageModifications(targetImage, isHeader, uiPath);
LogWarden.LogInfo("[ImgReplace] " + uiPath + " image replaced and resized successfully.");
}
}
private void HideOriginalImage(Image targetImage)
{
((Behaviour)targetImage).enabled = false;
LogWarden.LogInfo("[ImgReplace] Original image hidden due to missing custom sprite.");
}
private bool TryGetImageComponent(string uiPath, out Image targetImage)
{
targetImage = GetImageComponent(uiPath);
return (Object)(object)targetImage != (Object)null;
}
private bool TryLoadCustomSprite(string imagePath, bool isHeader, out Sprite customSprite)
{
customSprite = null;
if (string.IsNullOrWhiteSpace(imagePath))
{
LogWarden.LogInfo("[ImgManage] Skipping image load for " + (isHeader ? "header" : "loading") + " due to blank path.");
return false;
}
customSprite = customMediaManager.LoadCustomImage(imagePath, isHeader ? "Header" : "Loading");
if ((Object)(object)customSprite == (Object)null)
{
LogWarden.LogError("[ImgManage] Failed to find image at path: " + imagePath);
}
return (Object)(object)customSprite != (Object)null;
}
private void SetupImage(Image targetImage, Sprite customSprite, bool isHeader)
{
targetImage.sprite = customSprite;
targetImage.preserveAspect = true;
ResetImageProperties(((Graphic)targetImage).rectTransform);
SetImageTransparency(targetImage, isHeader ? configManager.mainHeaderAlpha.Value : configManager.loadHeaderAlpha.Value, isHeader ? "Header Image" : "Loading Header Image");
}
private void ApplyImageModifications(Image targetImage, bool isHeader, string uiPath)
{
if (isHeader || !configManager.loadHeaderStretch.Value)
{
SetImageYOffset(((Graphic)targetImage).rectTransform, isHeader ? configManager.mainHeaderYOffset.Value : configManager.loadHeaderYOffset.Value, isHeader);
SetImageSize(((Graphic)targetImage).rectTransform, isHeader ? configManager.mainHeaderScale.Value : configManager.loadHeaderScale.Value, targetImage.sprite);
}
if (!isHeader && configManager.loadHeaderStretch.Value && uiPath == "Canvas/MenuContainer/LoadingScreen/Image")
{
StretchLoadingImage(((Graphic)targetImage).rectTransform);
}
}
private Image GetImageComponent(string uiPath)
{
Transform val = PathFinder.Probe(uiPath);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[ImgReplace] Failed to find UI element at path '" + uiPath + "'.");
return null;
}
Image component = ((Component)val).GetComponent<Image>();
if ((Object)(object)component == (Object)null)
{
LogWarden.LogError("[ImgReplace] Image component not found on UI element at path '" + uiPath + "'.");
return null;
}
return component;
}
private void ResetImageProperties(RectTransform rectTransform)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = Vector2.zero;
rectTransform.offsetMax = Vector2.zero;
rectTransform.pivot = new Vector2(0.5f, 0.5f);
((Transform)rectTransform).localScale = Vector3.one;
((Transform)rectTransform).rotation = Quaternion.identity;
rectTransform.sizeDelta = Vector2.zero;
rectTransform.anchoredPosition = Vector2.zero;
rectTransform.anchoredPosition3D = Vector3.zero;
((Transform)rectTransform).localRotation = Quaternion.identity;
}
public void SetImageTransparency(Image image, int transparencyPercent, string imageName)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0038: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)image == (Object)null)
{
LogWarden.LogError("[UI] Image component not found.");
return;
}
float num = (float)transparencyPercent / 100f;
Color color = ((Graphic)image).color;
((Graphic)image).color = new Color(color.r, color.g, color.b, num);
LogWarden.LogInfo($"[UI] {imageName} transparency set to {num * 100f}%.");
}
private void SetImageYOffset(RectTransform rectTransform, float yOffsetPercent, bool isHeader)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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)
float num = 1f - yOffsetPercent / 100f;
rectTransform.anchorMin = new Vector2(0.5f, num);
rectTransform.anchorMax = new Vector2(0.5f, num);
rectTransform.pivot = new Vector2(0.5f, 0.5f);
rectTransform.anchoredPosition = new Vector2(0f, 0f);
string arg = (isHeader ? "Header" : "Loading image");
LogWarden.LogInfo($"[UI] {arg} Y offset set to {yOffsetPercent}% from the top.");
}
private void SetImageSize(RectTransform rectTransform, int scaleValue, Sprite sprite)
{
//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)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Rect rect = sprite.rect;
float width = ((Rect)(ref rect)).width;
rect = sprite.rect;
float height = ((Rect)(ref rect)).height;
float num = (float)scaleValue / 250f;
float num2 = width * num;
float num3 = height * num;
rectTransform.sizeDelta = new Vector2(num2, num3);
}
public void StretchLoadingImage(RectTransform rectTransform)
{
//IL_0015: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rectTransform == (Object)null)
{
LogWarden.LogError("[UI] Loading image RectTransform not found.");
return;
}
((Transform)rectTransform).localScale = Vector3.one;
rectTransform.pivot = new Vector2(0.5f, 0.5f);
if (configManager.loadHeaderStretch.Value)
{
rectTransform.anchorMin = new Vector2(0f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.sizeDelta = Vector2.zero;
LogWarden.LogInfo("[UI] Loading image stretched to fill screen vertically.");
}
}
}
public class LoadingText : MonoBehaviour
{
private Configurator configManager;
public void Initialize(Configurator configManager)
{
this.configManager = configManager;
}
public void ApplyLoadingCustomizations()
{
RectTransform val = FindLoadingTextContainer();
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[LoadText] LoadingTextContainer not found.");
return;
}
SetSiblingIndex((Transform)(object)val);
if (configManager.enableLoadingTextChange.Value)
{
SetLoadingText(val, configManager.loadTextString.Value);
}
else
{
LogWarden.LogInfo("[LoadText] Loading text change is disabled by configuration.");
}
}
private void SetLoadingText(RectTransform loadingTextContainer, string text)
{
string[] array = text.Split(new char[1] { '|' });
string text2 = array[Random.Range(0, array.Length)];
if (array.Length > 1)
{
LogWarden.LogInfo($"[LoadText] Found {array.Length} strings.");
}
if (configManager.enableLoadingTextChange.Value)
{
SetTextProperties((Transform)(object)loadingTextContainer, text2);
}
}
private RectTransform FindLoadingTextContainer()
{
Transform val = PathFinder.Probe("Canvas/MenuContainer/LoadingTextContainer");
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[LoadText] Loading text container not found at path: Canvas/MenuContainer/LoadingTextContainer.");
return null;
}
return ((Component)val).GetComponent<RectTransform>();
}
private void SetSiblingIndex(Transform loadingTextContainer)
{
loadingTextContainer.SetSiblingIndex(9);
}
private void SetTextProperties(Transform loadingTextContainer, string text)
{
string text2 = "Canvas/MenuContainer/LoadingTextContainer/LoadingText";
Transform val = PathFinder.Probe(((Object)loadingTextContainer).name + "/" + text2);
TextMeshProUGUI val2 = default(TextMeshProUGUI);
RectTransform loadingTextContainer2 = default(RectTransform);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[LoadText] TMP component not found at path '" + ((Object)loadingTextContainer).name + "/" + text2 + "'.");
}
else if (!((Component)val).TryGetComponent<TextMeshProUGUI>(ref val2))
{
LogWarden.LogError("[LoadText] TMP component not found on object at path '" + ((Object)loadingTextContainer).name + "/" + text2 + "'.");
}
else if (!((Component)loadingTextContainer).TryGetComponent<RectTransform>(ref loadingTextContainer2))
{
LogWarden.LogError("[LoadText] RectTransform component not found on '" + ((Object)loadingTextContainer).name + "'.");
}
else
{
AdjustTextContainerAnchors(loadingTextContainer2);
((TMP_Text)val2).text = text;
((TMP_Text)val2).enableWordWrapping = false;
((TMP_Text)val2).fontSize = configManager.loadTextSize.Value;
SetTextColor(val2);
LogWarden.LogInfo($"[LoadText] Set to: {text} with font size: {configManager.loadTextSize.Value}");
}
}
private void SetTextColor(TextMeshProUGUI loadingTextTMP)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
try
{
Color color = ColorParser.RGBA(configManager.loadTextColor.Value);
((Graphic)loadingTextTMP).color = color;
LogWarden.LogInfo("[LoadText] Font color set to: " + configManager.loadTextColor.Value);
}
catch (Exception ex)
{
LogWarden.LogError("[LoadText] Error setting font color using ColorParser: " + ex.Message);
}
}
private void AdjustTextContainerAnchors(RectTransform loadingTextContainer)
{
//IL_0045: 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_005c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
float value = configManager.loadTextYOffset.Value;
if (value == -1f)
{
LogWarden.LogInfo("[LoadText] No vertical adjustment applied.");
return;
}
float num = 1f - value / 100f;
num = Mathf.Clamp(num, 0f, 1f);
loadingTextContainer.pivot = new Vector2(loadingTextContainer.pivot.x, num);
loadingTextContainer.anchorMin = new Vector2(loadingTextContainer.anchorMin.x, num);
loadingTextContainer.anchorMax = new Vector2(loadingTextContainer.anchorMax.x, num);
Vector2 anchoredPosition = loadingTextContainer.anchoredPosition;
loadingTextContainer.anchoredPosition = new Vector2(anchoredPosition.x, 0f);
LogWarden.LogInfo($"[LoadText] Vertical position adjusted with Y Offset: {value}");
}
}
public class UIComponent
{
private readonly Configurator configManager;
public UIComponent(Configurator configManager)
{
this.configManager = configManager;
}
public void ResetRectTransformProperties()
{
//IL_00a2: 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)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
List<string> obj = new List<string> { "MainButtons", "LoadingScreen", "LobbyHostSettings", "LobbyList" };
List<string> list = new List<string>();
foreach (string item in obj)
{
Transform val = PathFinder.Probe(item);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[UI] " + item + " Transform not found.");
return;
}
RectTransform component = ((Component)val).GetComponent<RectTransform>();
if ((Object)(object)component == (Object)null)
{
LogWarden.LogError("[UI] " + item + " does not have a RectTransform component.");
return;
}
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = Vector2.zero;
component.anchoredPosition3D = Vector3.zero;
val.localPosition = Vector3.zero;
val.localScale = Vector3.one;
list.Add(item);
}
if (list.Any())
{
LogWarden.LogInfo("[UI] De-borking... " + string.Join(", ", list) + ".");
}
}
public void CreateBackgrounds()
{
CreateLoadingBackground();
(string, string)[] array = new(string, string)[2]
{
("MenuContainer/SettingsPanel", "SettingsBackground"),
("MenuContainer/LobbyList", "LobbyBackground")
};
for (int i = 0; i < array.Length; i++)
{
var (path, name) = array[i];
CreateCommonBackground(path, name);
}
}
private void CreateLoadingBackground()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Color val = ColorParser.RGBA(configManager.loadBackgroundColor.Value);
CreateBackground("LoadingScreen", "LoadingBackground", val, val.a);
}
private void CreateCommonBackground(string path, string name)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Color black = Color.black;
black.a = 0.95f;
CreateBackground(path, name, black, black.a);
}
private void CreateBackground(string path, string name, Color backgroundColor, float alpha)
{
//IL_0027: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0076: 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)
Transform val = PathFinder.Probe(path);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("CreateBackgrounds: '" + path + "' Transform not found using PathFinder.");
return;
}
GameObject val2 = new GameObject(name);
val2.transform.SetParent(val, false);
val2.transform.SetSiblingIndex(0);
((Graphic)val2.AddComponent<Image>()).color = backgroundColor;
RectTransform component = val2.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.sizeDelta = Vector2.zero;
}
public void SetMainBackgroundColor()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Transform val = PathFinder.Probe("Canvas/MenuContainer");
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[UI] Canvas/MenuContainer element not found.");
return;
}
((Graphic)(((Component)val).GetComponent<Image>() ?? ((Component)val).gameObject.AddComponent<Image>())).color = ColorParser.RGB(configManager.mainBackgroundColor.Value);
LogWarden.LogInfo("[UI] Menu container color set to " + configManager.mainBackgroundColor.Value + ".");
}
public void SetVolumeLayerMaskOnAllCameras(int layerMask)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
Camera[] array = Object.FindObjectsOfType<Camera>();
foreach (Camera val in array)
{
HDAdditionalCameraData component = ((Component)val).GetComponent<HDAdditionalCameraData>();
if ((Object)(object)component != (Object)null)
{
component.volumeLayerMask = LayerMask.op_Implicit(layerMask);
Debug.Log((object)$"Set volumeLayerMask to {layerMask} on camera {((Object)val).name}");
}
}
}
public void ApplyCRTEffectIfNeeded(string volumeGameObjectName)
{
Transform val = PathFinder.Probe(volumeGameObjectName);
if ((Object)(object)val == (Object)null)
{
LogWarden.LogError("[UI] " + volumeGameObjectName + " GameObject not found.");
return;
}
GameObject gameObject = ((Component)val).gameObject;
if (configManager.enableCRT.Value)
{
new CRTEffect().SetupVolume(gameObject);
}
else
{
LogWarden.LogInfo("[UI] CRT effect is not enabled. Skipping CRT effect setup for " + volumeGameObjectName + ".");
}
}
}
}