using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using Gacheak.Patches;
using Gacheak.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("0x28913.Gacheak")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("0x28913.Gacheak")]
[assembly: AssemblyTitle("Gacheak")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace Gacheak
{
internal static class LocalizationPatcher
{
private static readonly Dictionary<Language, Dictionary<string, string>> overridesByLanguage = new Dictionary<Language, Dictionary<string, string>>();
internal static void Load()
{
overridesByLanguage.Clear();
string text = Path.Combine(Plugin.AssetDir, "LocalizationPatches");
if (!Directory.Exists(text))
{
Plugin.Log.LogInfo((object)("No LocalizationPatches directory found at " + text + ", skipping"));
return;
}
string[] files = Directory.GetFiles(text, "patch-*.csv");
foreach (string filePath in files)
{
LoadPatchFile(filePath);
}
Plugin.Log.LogInfo((object)$"Loaded localization patches for {overridesByLanguage.Count} language(s)");
}
private static void LoadPatchFile(string filePath)
{
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);
string value = fileNameWithoutExtension.Substring("patch-".Length);
if (!Enum.TryParse<Language>(value, out Language result))
{
Plugin.Log.LogWarning((object)("Could not parse language from patch file '" + Path.GetFileName(filePath) + "'"));
return;
}
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string[] source = File.ReadAllLines(filePath);
int num = 0;
foreach (string item in source.Skip(1))
{
if (!string.IsNullOrWhiteSpace(item))
{
string[] array = CSVReader.SplitCsvLine(item, true);
if (array.Length < 2)
{
Plugin.Log.LogWarning((object)("Skipping malformed patch line in " + Path.GetFileName(filePath) + ": " + item));
continue;
}
dictionary[array[0].ToUpperInvariant()] = array[1];
num++;
}
}
overridesByLanguage[result] = dictionary;
Plugin.Log.LogInfo((object)$"Loaded {num} overrides for {result} from {Path.GetFileName(filePath)}");
}
internal static void DumpLanguage(Language language)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
DumpTable(LocalizedText.mainTable, "main", language);
DumpTable(LocalizedText.dialogueTable, "dialogue", language);
}
private static void DumpTable(Dictionary<string, List<string>>? table, string tableName, Language language)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected I4, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
if (table == null)
{
Plugin.Log.LogWarning((object)(tableName + " table is null, skipping dump"));
return;
}
int num = (int)language;
List<string> list = new List<string> { "key,text" };
foreach (var (s, list3) in table)
{
if (num < list3.Count)
{
list.Add(CsvEscape(s) + "," + CsvEscape(list3[num]));
}
}
string text2 = Path.Combine(Plugin.AssetDir, $"translation-{tableName}-{language}.csv");
Plugin.Log.LogInfo((object)("Writing localization dump to " + text2));
File.WriteAllText(text2, string.Join("\n", list));
Plugin.Log.LogInfo((object)$"Dumped {list.Count - 1} entries from {tableName} table for {language} to {text2}");
}
internal static bool TryGetOverride(string id, Language language, out string result)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
result = null;
if (!overridesByLanguage.TryGetValue(language, out Dictionary<string, string> value))
{
return false;
}
return value.TryGetValue(id.ToUpperInvariant(), out result);
}
private static string CsvEscape(string s)
{
if (s.Contains(',') || s.Contains('"') || s.Contains('\n'))
{
return "\"" + s.Replace("\"", "\"\"") + "\"";
}
return s;
}
}
[HarmonyPatch(typeof(LocalizedText), "GetText", new Type[]
{
typeof(string),
typeof(bool)
})]
internal static class LocalizedTextPatch
{
[HarmonyPostfix]
private static void Postfix(string id, ref string __result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (LocalizationPatcher.TryGetOverride(id, LocalizedText.CURRENT_LANGUAGE, out string result))
{
__result = result;
}
}
}
[HarmonyPatch(typeof(LocalizedText), "GetText", new Type[]
{
typeof(string),
typeof(Language)
})]
internal static class LocalizedTextForLanguagePatch
{
[HarmonyPostfix]
private static void Postfix(string id, Language language, ref string __result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (LocalizationPatcher.TryGetOverride(id, language, out string result))
{
__result = result;
}
}
}
internal class MusicPatcher
{
private readonly string sceneName;
private readonly string objectNamePrefix;
private AudioClip? customClip;
private MusicPatcher(string sceneName, string objectNamePrefix)
{
this.sceneName = sceneName;
this.objectNamePrefix = objectNamePrefix;
}
internal static IEnumerator Patch(string sceneName, string objectNamePrefix, string replacementFileName)
{
MusicPatcher patch = new MusicPatcher(sceneName, objectNamePrefix);
SceneManager.sceneLoaded += patch.OnSceneLoaded;
yield return Res.LoadAudioClip(replacementFileName, delegate(AudioClip? clip)
{
patch.customClip = clip;
Plugin.Log.LogInfo((object)((clip != null) ? ("Custom clip loaded for " + sceneName + "/" + objectNamePrefix) : ("FAILED to load custom clip for " + sceneName + "/" + objectNamePrefix)));
});
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == sceneName)
{
patch.TrySwap();
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (!(((Scene)(ref scene)).name != sceneName))
{
TrySwap();
}
}
private void TrySwap()
{
if (customClip == null)
{
return;
}
AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
foreach (AudioSource val in array)
{
if (((Object)((Component)val).gameObject).name.StartsWith(objectNamePrefix) && !((Object)(object)val.clip == (Object)(object)customClip))
{
Plugin.Log.LogInfo((object)("Swapping clip on " + ((Object)((Component)val).gameObject).name));
val.Stop();
val.clip = customClip;
val.Play();
}
}
}
}
[HarmonyPatch(typeof(SFX_Instance), "GetClip")]
internal static class SfxPatcher
{
private static readonly Dictionary<string, AudioClip?> swaps = new Dictionary<string, AudioClip>();
internal static IEnumerator Patch(string sfxName, string fileName)
{
swaps[sfxName] = null;
yield return Res.LoadAudioClip(fileName, delegate(AudioClip? clip)
{
swaps[sfxName] = clip;
Plugin.Log.LogInfo((object)((clip != null) ? ("Loaded SFX swap for '" + sfxName + "'") : ("FAILED to load SFX swap for '" + sfxName + "'")));
});
}
[HarmonyPrefix]
private static bool GetClip_Prefix(SFX_Instance __instance, ref AudioClip __result)
{
foreach (KeyValuePair<string, AudioClip> swap in swaps)
{
swap.Deconstruct(out var key, out var value);
string text = key;
AudioClip val = value;
if (!((Object)(object)val == (Object)null))
{
bool num;
if (!text.EndsWith('*'))
{
num = ((Object)__instance).name == text;
}
else
{
string name = ((Object)__instance).name;
key = text;
num = name.StartsWith(key.Substring(0, key.Length - 1));
}
if (num)
{
__result = val;
Plugin.Log.LogDebug((object)("Patching audio clip for " + ((Object)__instance).name));
return false;
}
}
}
return true;
}
}
[BepInPlugin("0x28913.Gacheak", "Gacheak", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static readonly string AssetDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public const string Id = "0x28913.Gacheak";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "Gacheak";
public static string Version => "0.1.0";
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
new Harmony("0x28913.Gacheak").PatchAll();
LocalizationPatcher.Load();
LogoPatch.HookIn();
((MonoBehaviour)this).StartCoroutine(InitAll());
Log.LogInfo((object)("Plugin " + Name + " is loaded. AssetDir: " + AssetDir));
}
private IEnumerator InitAll()
{
List<Coroutine> list = new List<Coroutine>
{
((MonoBehaviour)this).StartCoroutine(SfxPatcher.Patch("SFXI Impact Basketball", "Sfx/spank-dribble.wav")),
((MonoBehaviour)this).StartCoroutine(SfxPatcher.Patch("SFXI UI Titlescreen button*", "Sfx/woo.wav")),
((MonoBehaviour)this).StartCoroutine(MusicPatcher.Patch("Title", "Music Title", "Sfx/title-music.ogg")),
((MonoBehaviour)this).StartCoroutine(MusicPatcher.Patch("Airport", "Music Airport", "Sfx/airport-music.ogg"))
};
foreach (Coroutine item in list)
{
yield return item;
}
Log.LogDebug((object)"All assets loaded");
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)291))
{
ModDebug.DumpScene();
}
}
}
}
namespace Gacheak.Utils
{
internal static class ModDebug
{
internal static void DumpScene()
{
//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)
Scene activeScene = SceneManager.GetActiveScene();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"--- Hierarchy of scene '{((Scene)(ref activeScene)).name}' at t={Time.realtimeSinceStartup:F3} ---");
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
foreach (GameObject val in rootGameObjects)
{
DumpRecursive(val.transform, 0, stringBuilder);
}
stringBuilder.AppendLine("--- Hierarchy dump end ---");
string text = Path.Combine(Plugin.AssetDir, $"scene-dump-{((Scene)(ref activeScene)).name}-{Time.frameCount}.txt");
File.WriteAllText(text, stringBuilder.ToString());
Plugin.Log.LogInfo((object)("Wrote scene dump to " + text));
}
private static void DumpRecursive(Transform t, int depth, StringBuilder sb)
{
//IL_0216: 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_0339: Expected O, but got Unknown
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
string text = new string(' ', depth * 2);
Component[] components = ((Component)t).GetComponents<Component>();
string text2 = string.Join(", ", components.Select((Component c) => ((object)c)?.GetType().Name ?? "null"));
sb.AppendLine($"{text}{((Object)t).name} [active={((Component)t).gameObject.activeSelf}/{((Component)t).gameObject.activeInHierarchy}] [{text2}]");
Component[] array = components;
foreach (Component val in array)
{
Image val2 = (Image)(object)((val is Image) ? val : null);
if (val2 == null)
{
CanvasRenderer val3 = (CanvasRenderer)(object)((val is CanvasRenderer) ? val : null);
if (val3 == null)
{
Canvas val4 = (Canvas)(object)((val is Canvas) ? val : null);
if (val4 == null)
{
RectTransform val5 = (RectTransform)(object)((val is RectTransform) ? val : null);
if (val5 == null)
{
SpriteRenderer val6 = (SpriteRenderer)(object)((val is SpriteRenderer) ? val : null);
if (val6 == null)
{
RawImage val7 = (RawImage)(object)((val is RawImage) ? val : null);
if (val7 != null)
{
object arg = ((Behaviour)val7).enabled;
Texture texture = val7.texture;
sb.AppendLine(string.Format("{0} RawImage: enabled={1} texture={2}", text, arg, ((texture != null) ? ((Object)texture).name : null) ?? "null"));
}
}
else
{
object[] obj = new object[4]
{
text,
((Renderer)val6).enabled,
null,
null
};
Sprite sprite = val6.sprite;
obj[2] = ((sprite != null) ? ((Object)sprite).name : null) ?? "null";
obj[3] = val6.color;
sb.AppendLine(string.Format("{0} SpriteRenderer: enabled={1} sprite={2} color={3}", obj));
}
}
else
{
sb.AppendLine($"{text} RectTransform: anchoredPosition={val5.anchoredPosition} sizeDelta={val5.sizeDelta} localScale={((Transform)val5).localScale}");
}
}
else
{
sb.AppendLine($"{text} Canvas: enabled={((Behaviour)val4).enabled} renderMode={val4.renderMode}");
}
}
else
{
sb.AppendLine($"{text} CanvasRenderer: cull={val3.cull} alpha={val3.GetAlpha():F2}");
}
}
else
{
string[] array2 = new string[5];
object[] obj2 = new object[4]
{
text,
((Behaviour)val2).enabled,
null,
null
};
Sprite sprite2 = val2.sprite;
obj2[2] = ((sprite2 != null) ? ((Object)sprite2).name : null) ?? "null";
obj2[3] = ((Graphic)val2).color;
array2[0] = string.Format("{0} Image: enabled={1} sprite={2} color={3} ", obj2);
array2[1] = "canvasRenderer.cull=";
CanvasRenderer component = ((Component)val2).GetComponent<CanvasRenderer>();
array2[2] = ((component != null) ? component.cull.ToString() : null) ?? "n/a";
array2[3] = " alpha=";
CanvasRenderer canvasRenderer = ((Graphic)val2).canvasRenderer;
array2[4] = ((canvasRenderer != null) ? canvasRenderer.GetAlpha().ToString("F2") : null) ?? "n/a";
sb.AppendLine(string.Concat(array2));
}
}
foreach (Transform item in t)
{
Transform t2 = item;
DumpRecursive(t2, depth + 1, sb);
}
}
internal static void DumpAirportText()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource log = Plugin.Log;
Scene val = SceneManager.GetActiveScene();
log.LogInfo((object)("--- TMP_Text in scene '" + ((Scene)(ref val)).name + "' ---"));
int num = 0;
TMP_Text[] array = Resources.FindObjectsOfTypeAll<TMP_Text>();
foreach (TMP_Text val2 in array)
{
val = ((Component)val2).gameObject.scene;
if (((Scene)(ref val)).IsValid())
{
Plugin.Log.LogInfo((object)(GetPath(val2.transform) + " | text: \"" + val2.text + "\""));
num++;
}
}
Plugin.Log.LogInfo((object)$"--- {num} TMP_Text found ---");
}
private static void DumpAirportHierarchy()
{
GameObject val = GameObject.Find("Airport");
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogWarning((object)"Airport GameObject not found");
return;
}
Plugin.Log.LogInfo((object)"--- Airport hierarchy AudioSources ---");
Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true);
foreach (Transform val2 in componentsInChildren)
{
AudioSource component = ((Component)val2).GetComponent<AudioSource>();
if (!((Object)(object)component == (Object)null))
{
ManualLogSource log = Plugin.Log;
string[] obj = new string[8]
{
"AudioSource on ",
GetPath(val2),
" | clip: ",
null,
null,
null,
null,
null
};
AudioClip clip = component.clip;
obj[3] = ((clip != null) ? ((Object)clip).name : null) ?? "null";
obj[4] = " | ";
obj[5] = $"playing: {component.isPlaying} | loop: {component.loop} | ";
obj[6] = "scripts: ";
obj[7] = string.Join(", ", from c in ((Component)val2).GetComponents<MonoBehaviour>()
select ((object)c).GetType().Name);
log.LogInfo((object)string.Concat(obj));
}
}
}
private static void DumpMusicTaggedObjects()
{
Plugin.Log.LogInfo((object)"--- Objects tagged Music ---");
GameObject[] array;
try
{
array = GameObject.FindGameObjectsWithTag("Music");
}
catch (UnityException)
{
Plugin.Log.LogWarning((object)"Music tag not defined or lookup failed");
return;
}
if (array.Length == 0)
{
Plugin.Log.LogInfo((object)"No objects tagged Music found");
return;
}
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
AudioSource component = val.GetComponent<AudioSource>();
ManualLogSource log = Plugin.Log;
string text = $"Tagged Music: {GetPath(val.transform)} | active: {val.activeInHierarchy} | ";
object obj;
if (!((Object)(object)component != (Object)null))
{
obj = "none";
}
else
{
AudioClip clip = component.clip;
obj = string.Format("clip {0}, playing {1}", ((clip != null) ? ((Object)clip).name : null) ?? "null", component.isPlaying);
}
log.LogInfo((object)(text + "AudioSource: " + (string?)obj));
}
}
private static void DumpEnableMusicInstances()
{
Plugin.Log.LogInfo((object)"--- EnableMusic instances ---");
EnableMusic[] array = Object.FindObjectsOfType<EnableMusic>(true);
if (array.Length == 0)
{
Plugin.Log.LogInfo((object)"No EnableMusic instances found");
return;
}
EnableMusic[] array2 = array;
foreach (EnableMusic val in array2)
{
GameObject music = val.music;
AudioSource val2 = (((Object)(object)music != (Object)null) ? music.GetComponent<AudioSource>() : null);
ManualLogSource log = Plugin.Log;
string[] obj = new string[5]
{
$"EnableMusic on {GetPath(((Component)val).transform)} | enable: {val.enable} | ",
"music: ",
((Object)(object)music != (Object)null) ? GetPath(music.transform) : "null",
" | AudioSource: ",
null
};
object obj2;
if (!((Object)(object)val2 != (Object)null))
{
obj2 = "none";
}
else
{
AudioClip clip = val2.clip;
obj2 = string.Format("clip {0}, playing {1}", ((clip != null) ? ((Object)clip).name : null) ?? "null", val2.isPlaying);
}
obj[4] = (string)obj2;
log.LogInfo((object)string.Concat(obj));
}
}
private static string GetPath(Transform t)
{
string text = ((Object)t).name;
while ((Object)(object)t.parent != (Object)null)
{
t = t.parent;
text = ((Object)t).name + "/" + text;
}
return text;
}
}
internal static class Res
{
internal static IEnumerator LoadAudioClip(string fileName, Action<AudioClip?> onLoaded)
{
string text = Path.Combine(Plugin.AssetDir, fileName);
if (!File.Exists(text))
{
Plugin.Log.LogWarning((object)("Audio file not found: " + text));
onLoaded(null);
yield break;
}
string text2 = Path.GetExtension(fileName).ToLowerInvariant();
AudioType val;
switch (text2)
{
case ".wav":
val = (AudioType)20;
break;
case ".ogg":
val = (AudioType)14;
break;
case ".mp3":
val = (AudioType)13;
break;
case ".aiff":
case ".aif":
val = (AudioType)2;
break;
default:
val = (AudioType)0;
break;
}
AudioType val2 = val;
if ((int)val2 == 0)
{
Plugin.Log.LogError((object)("Unsupported audio file extension '" + text2 + "' for " + fileName));
onLoaded(null);
yield break;
}
UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + text, val2);
try
{
yield return www.SendWebRequest();
if ((int)www.result != 1)
{
Plugin.Log.LogError((object)("Failed to load " + fileName + ": " + www.error));
onLoaded(null);
}
else
{
onLoaded(DownloadHandlerAudioClip.GetContent(www));
}
}
finally
{
((IDisposable)www)?.Dispose();
}
}
}
}
namespace Gacheak.Patches
{
internal static class LogoPatch
{
private const string LogoPath = "MainMenu/Canvas/MainPage/Logo/Logo";
private const string ShadowPath = "MainMenu/Canvas/MainPage/Logo/Shadow";
private static Sprite? customLogoSprite;
internal static void HookIn()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_006f: 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)
string text = Path.Combine(Plugin.AssetDir, "logo.png");
if (!File.Exists(text))
{
Plugin.Log.LogWarning((object)("Logo file not found: " + text));
return;
}
byte[] array = File.ReadAllBytes(text);
Texture2D val = new Texture2D(2, 2);
if (!ImageConversion.LoadImage(val, array))
{
Plugin.Log.LogError((object)"Failed to decode logo.png");
return;
}
customLogoSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
Plugin.Log.LogInfo((object)"Custom logo sprite loaded");
SceneManager.sceneLoaded += delegate
{
TrySwap();
};
}
private static void TrySwap()
{
if ((Object)(object)customLogoSprite == (Object)null)
{
return;
}
Image[] array = Resources.FindObjectsOfTypeAll<Image>();
foreach (Image val in array)
{
string name = ((Object)((Component)val).gameObject).name;
if (!(name != "Logo") || !(name != "Shadow"))
{
TrySwapSingle(val);
}
}
}
private static void TrySwapSingle(Image img)
{
if (!((Object)(object)customLogoSprite == (Object)null))
{
string path = GetPath(((Component)img).transform);
if ((!(path != "MainMenu/Canvas/MainPage/Logo/Logo") || !(path != "MainMenu/Canvas/MainPage/Logo/Shadow")) && !((Object)(object)img.sprite == (Object)(object)customLogoSprite))
{
img.sprite = customLogoSprite;
Plugin.Log.LogInfo((object)("Swapped sprite on " + path + ", hidden until reveal delay elapses"));
}
}
}
private static string GetPath(Transform t)
{
string text = ((Object)t).name;
while ((Object)(object)t.parent != (Object)null)
{
t = t.parent;
text = ((Object)t).name + "/" + text;
}
return text;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}