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.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using MenuLib.Structs; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Zichen-REPOSettings-1.0.2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+32c11006eb1c1cd412ae63df2b933665e2f66441")] [assembly: AssemblyProduct("Zichen-REPOSettings-1.0.2")] [assembly: AssemblyTitle("Zichen-REPOSettings-1.0.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOSettings { [BepInPlugin("zichen.reposettings", "REPOSettings", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private sealed class CompatibilityReport { private readonly List _disabledFeatures = new List(); private readonly List _details = new List(); public bool HasIssues => _disabledFeatures.Count > 0; public static CompatibilityReport CreateHealthy() { return new CompatibilityReport(); } public static CompatibilityReport Build() { CompatibilityReport compatibilityReport = new CompatibilityReport(); RequireType(typeof(MenuPageMain), "主菜单入口", compatibilityReport, "主菜单入口"); RequireType(typeof(MenuPageEsc), "ESC 菜单入口", compatibilityReport, "ESC 菜单入口"); RequireType(typeof(MenuManager), "菜单管理器", compatibilityReport, "菜单页开关与弹窗"); RequireType(typeof(MenuPage), "菜单页面", compatibilityReport, "菜单页开关与弹窗"); RequireType(typeof(MenuButton), "菜单按钮", compatibilityReport, "菜单按钮行为"); RequireType(typeof(MapToolController), "地图工具", compatibilityReport, "地图开合动画"); RequireType(typeof(SemiUI), "半屏 UI", compatibilityReport, "准备界面与提示 UI"); RequireType(typeof(WorldSpaceUIParent), "世界空间 UI", compatibilityReport, "世界空间 UI 动画"); RequireField(typeof(GameManager), "connectRandom", compatibilityReport, "公开房/私人房确认跳过"); RequireField(typeof(MenuManager), "currentMenuPageIndex", compatibilityReport, "大厅与联机提示识别"); RequireField(typeof(MenuManager), "currentMenuPage", compatibilityReport, "菜单关闭动画"); RequireField(typeof(MenuPage), "originalPosition", compatibilityReport, "菜单打开动画"); RequireField(typeof(MenuPage), "popUpAnimation", compatibilityReport, "菜单开关动画"); RequireField(typeof(MenuPage), "rectTransform", compatibilityReport, "菜单开关动画"); RequireField(typeof(MenuElementServer), "introDone", compatibilityReport, "房间列表入场动画"); RequireField(typeof(MenuElementRegion), "introLerp", compatibilityReport, "地区列表入场动画"); RequireMethod(typeof(MenuManager), "PagePopUpTwoOptions", new Type[11] { typeof(MenuButtonPopUp), typeof(string), typeof(LocalizedAsset), typeof(Color), typeof(string), typeof(LocalizedAsset), typeof(string), typeof(LocalizedAsset), typeof(string), typeof(LocalizedAsset), typeof(bool) }, compatibilityReport, "公开房/私人房确认跳过"); RequireMethod(typeof(MenuPageMain), "Start", Type.EmptyTypes, compatibilityReport, "主菜单入口"); RequireMethod(typeof(MenuPageEsc), "Start", Type.EmptyTypes, compatibilityReport, "ESC 菜单入口"); RequireMethod(typeof(MenuPage), "StateOpening", Type.EmptyTypes, compatibilityReport, "菜单打开动画"); RequireMethod(typeof(MenuPage), "StateClosing", Type.EmptyTypes, compatibilityReport, "菜单关闭动画"); RequireMethod(typeof(MenuButton), "OnHovering", Type.EmptyTypes, compatibilityReport, "菜单按钮位移动画"); RequireMethod(typeof(MapToolController), "Update", Type.EmptyTypes, compatibilityReport, "地图开合动画"); DetectLoadedCompanions(compatibilityReport); return compatibilityReport; } public void AddPatchFailure(string featureName, string patchName, string reason) { AddDisabledFeature(featureName); _details.Add("Patch failed: " + patchName + " -> " + reason); } public string BuildLogMessage() { if (!HasIssues) { return "Compatibility self-check passed."; } string text = ((_disabledFeatures.Count == 0) ? "暂无明确功能降级" : string.Join(";", _disabledFeatures.Distinct().ToArray())); return "Compatibility self-check found possible game API changes. Affected features: " + text; } public string BuildPopupMessage(bool english) { if (!HasIssues) { return null; } if (english) { string text = "REPOSettings detected possible game API changes and entered compatibility mode.\nPotentially affected features:"; foreach (string item in _disabledFeatures.Distinct().Take(6)) { text = text + "\n- " + item; } if (_disabledFeatures.Count == 0) { text += "\n- Some menu or effect features may be limited"; } return text + "\n\nPlease wait for an updated version if something does not work as expected."; } string text2 = "检测到游戏接口可能已变化,REPOSettings 已进入兼容模式。\n以下功能可能受影响:"; foreach (string item2 in _disabledFeatures.Distinct().Take(6)) { text2 = text2 + "\n- " + item2; } if (_disabledFeatures.Count == 0) { text2 += "\n- 部分菜单或特效功能可能受限"; } return text2 + "\n\n如遇异常,请等待新版本适配。"; } public IEnumerable GetDetailMessages() { return _details.Distinct().ToArray(); } private static void RequireType(Type type, string apiName, CompatibilityReport report, string affectedFeature) { if (!(type != null)) { report.AddDisabledFeature(affectedFeature); report._details.Add("Missing type: " + apiName); } } private static void RequireField(Type type, string fieldName, CompatibilityReport report, string affectedFeature) { if (!(AccessTools.Field(type, fieldName) != null)) { report.AddDisabledFeature(affectedFeature); report._details.Add("Missing field: " + type.FullName + "." + fieldName); } } private static void RequireMethod(Type type, string methodName, Type[] parameterTypes, CompatibilityReport report, string affectedFeature) { if (!(type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, parameterTypes ?? Type.EmptyTypes, null) != null)) { report.AddDisabledFeature(affectedFeature); string text = ((parameterTypes == null || parameterTypes.Length == 0) ? "()" : ("(" + string.Join(", ", parameterTypes.Select((Type parameterType) => parameterType.Name).ToArray()) + ")")); report._details.Add("Missing method: " + type.FullName + "." + methodName + text); } } private static void DetectLoadedCompanions(CompatibilityReport report) { try { if (Chainloader.PluginInfos.ContainsKey("nickklmao.repoconfig")) { report._details.Add("Detected REPOConfig: menu entry will coexist with Mods."); } if (Chainloader.PluginInfos.ContainsKey("zichen.moreui")) { report._details.Add("Detected MoreUI: some local UI/effect toggles may overlap."); } } catch (Exception ex) { report._details.Add("Failed to scan loaded plugins: " + ex.Message); } } private void AddDisabledFeature(string feature) { if (!_disabledFeatures.Contains(feature)) { _disabledFeatures.Add(feature); } } } [HarmonyPatch(typeof(MenuManager), "Start")] private static class MenuManagerStartPatch { private static bool _done; private static void Postfix() { if (!_done) { _done = true; TryShowCompatibilityPopup(); } } } internal sealed class CfgI18N { public string SectionCN; public string SectionEN; public string KeyCN; public string KeyEN; public string DisplayEN; public string DescCN; public string DescEN; public ConfigurationManagerAttributes Attrs; public string ValueEN; public string ValueCN; public ConfigEntry ReadOnlyEntry; public ConfigEntryBase Entry; public bool ChineseOnly; } internal sealed class LiveLabel { public WeakReference Tmp; public WeakReference UIElement; public CfgI18N I18N; public bool IsSection; } internal sealed class LiveValue { public WeakReference InputField; public CfgI18N I18N; } internal sealed class LiveSliderOptions { public WeakReference Slider; public CfgI18N I18N; public string[] OptionsCN; public string[] OptionsEN; } internal sealed class LiveToggleButtons { public WeakReference LeftTmp; public WeakReference RightTmp; public bool IsLanguage; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static EventHandler <>9__27_0; public static BuilderDelegate <>9__27_1; public static Func <>9__30_0; public static Func <>9__31_0; public static Func <>9__31_1; public static ShouldCloseMenuDelegate <>9__36_0; public static Func, string> <>9__43_0; public static Func, string> <>9__43_3; public static Func, ConfigEntryBase> <>9__44_0; public static Func, bool> <>9__44_1; public static Func, bool> <>9__44_2; public static Func <>9__53_0; public static Func <>9__62_0; public static Converter <>9__253_0; internal void b__27_0(object sender, EventArgs args) { RefreshAllI18N(); } internal void b__27_1(Transform parent) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) REPOButton button = (_escapeMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, parent, new Vector2(0f, 0f))); ((MonoBehaviour)_instance).StartCoroutine(AdjustEscapeButtonPosition(parent, button)); } internal bool b__30_0(Transform child) { if (!((Object)child).name.Contains("Menu Button")) { return false; } TextMeshProUGUI componentInChildren = ((Component)child).GetComponentInChildren(true); return string.Equals((componentInChildren == null) ? null : ((TMP_Text)componentInChildren).text?.Trim(), "设置", StringComparison.Ordinal); } internal bool b__31_0(Transform transform) { return ((Object)transform).name.Contains("Menu Button"); } internal float b__31_1(Transform transform) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return transform.localPosition.y; } internal bool b__36_0() { return true; } internal string b__43_0(ConfigEntry entry) { return ((ConfigEntryBase)entry).Definition.Section; } internal string b__43_3(ConfigEntry entry) { return ((ConfigEntryBase)entry).Definition.Section; } internal ConfigEntryBase b__44_0(KeyValuePair configEntry) { return configEntry.Value; } internal bool b__44_1(ConfigEntry entry) { if (((ConfigEntryBase)entry).Definition.Section != "A.Mod Info") { return ((ConfigEntryBase)entry).Definition.Section != "A.REPOSettings Info"; } return false; } internal bool b__44_2(ConfigEntry entry) { return ((ConfigEntryBase)entry).Definition.Section != "K.Performance"; } internal bool b__53_0(TextMeshProUGUI t) { if (!((Object)((Component)t).gameObject).name.Contains("Title") && !((Object)((Component)t).gameObject).name.Contains("Header")) { return ((Object)((TMP_Text)t).transform.parent).name.Contains("Title"); } return true; } internal bool b__62_0(Type type) { return type != null; } internal string b__253_0(Component component) { if (!((Object)(object)component == (Object)null)) { return ((object)component).GetType().Name; } return "null"; } } [CompilerGenerated] private sealed class d__30 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Transform parent; public REPOButton button; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)parent == (Object)null || (Object)(object)button == (Object)null) { return false; } Transform val = ResolveButtonParent(parent); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = ((IEnumerable)val).Cast().FirstOrDefault((Func)delegate(Transform child) { if (!((Object)child).name.Contains("Menu Button")) { return false; } TextMeshProUGUI componentInChildren = ((Component)child).GetComponentInChildren(true); return string.Equals((componentInChildren == null) ? null : ((TMP_Text)componentInChildren).text?.Trim(), "设置", StringComparison.Ordinal); }); if ((Object)(object)val2 == (Object)null) { Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)"REPOSettings: ESC settings button not found, keeping default position"); } return false; } Vector3 localPosition = val2.localPosition; ((Component)button).transform.localPosition = new Vector3(localPosition.x + 96f, localPosition.y, localPosition.z); Plugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"REPOSettings: adjusted escape button next to settings at pos={((Component)button).transform.localPosition}"); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__35 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: { <>1__state = -1; _isInitializingCustomUI = false; _isRenderingOurCustomSettings = false; Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[REPOSettings Debug] Custom UI initialization completed, protection flag disabled."); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__66 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string compatibilityMessage; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__66(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Time.unscaledTime + 15f; break; case 1: <>1__state = -1; break; } if (!_compatibilityPopupShown && Time.unscaledTime < 5__2) { MenuManager instance = MenuManager.instance; if ((Object)(object)instance != (Object)null && !IsPopupSlotBusy(instance)) { _compatibilityPopupShown = true; _compatibilityPopupWaiting = false; instance.PagePopUp(GetLocalizedText("兼容模式提示", "Compatibility Notice"), Color.yellow, compatibilityMessage, "OK", false); return false; } <>2__current = null; <>1__state = 1; return true; } _compatibilityPopupWaiting = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "zichen.reposettings"; public const string PluginName = "REPOSettings"; public const string PluginVersion = "1.0.2"; private const string SettingsButtonText = "更多设置"; private const string SettingsButtonTextEnglish = "More Settings"; private const float MainMenuRowStepY = 30f; private static readonly Vector2 QuickSettingsBackButtonPosition = new Vector2(66f, 18f); private static readonly Vector2 QuickSettingsResetButtonPosition = new Vector2(138f, 265f); private const string VersionInfoSection = "A.Mod Info"; private const string LanguageKey = "REPOSettingsLanguage"; private static readonly Dictionary SectionEnglishNames = new Dictionary { ["A.Mod Info"] = "A.Mod Info\u200b", ["B.Global"] = "B.Global", ["C.StartupTransitions"] = "C.Startup & Transitions", ["D.LobbyOnline"] = "D.Lobby & Online", ["E.GunfireEffects"] = "E.Gunfire Effects", ["E.MeleeEffects"] = "E.Melee Effects\u200b", ["F.ScreenCamera"] = "F.Screen & Camera", ["G.WeaponsArms"] = "G.Weapons & Arms", ["H.TumbleMotion"] = "H.Tumble & Motion", ["I.DeathStatus"] = "I.Death & Status", ["J.ValuableEffects"] = "J.Valuable Effects", ["K.Performance"] = "K.Performance", ["L.WorldSpaceUI"] = "L.World Space UI", ["M.UpgradeStand"] = "M.Upgrade Stand", ["N.CosmeticMachine"] = "N.Cosmetic Machine", ["O.ResultScreen"] = "O.Result Screen", ["P.UIPrompts"] = "P.UI & Prompts", ["Q.PotionUpgrade"] = "Q.Potion Upgrade" }; private static readonly Dictionary InfoEnglishNames = new Dictionary { ["REPOSettingsModName"] = "Mod Name", ["REPOSettingsModVersion"] = "Mod Version", ["模组名称"] = "Mod Name", ["模组版本号"] = "Mod Version" }; private static readonly Dictionary KeyEnglishNames = new Dictionary { ["启用"] = "Enable Config", ["关闭开枪间隔(主机)"] = "Disable Gunfire Cooldown (Host)\u200b", ["关闭武器震动"] = "Disable Melee Shake", ["关闭武器造伤间隔(主机)"] = "Disable Melee Hit Freeze (Host)\u200b", ["显示FPS数值"] = "Show FPS Counter", ["界面语言"] = "UI Language", ["关闭启动画面"] = "Disable Splash Screen", ["关闭开场手臂动画"] = "Disable Arm Intro", ["关闭加载与切场动画"] = "Disable Loading & Transition", ["关闭大厅页面切换动画"] = "Disable Lobby Page Animation", ["关闭按钮弹窗动画"] = "Disable Popup Animation", ["关闭房间列表入场动画"] = "Disable Server List Intro", ["关闭地区列表入场动画"] = "Disable Region List Intro", ["关闭菜单加载图标动画"] = "Disable Menu Loading Icon", ["关闭主菜单按钮位移动画"] = "Disable Main Menu Motion", ["关闭加入玩家提示淡入"] = "Disable Join Prompt Fade", ["关闭左侧准备界面淡入动画"] = "Disable Prep UI Fade", ["关闭结算页淡入淡出"] = "Disable Result Fade", ["关闭月相变化界面"] = "Disable Moon Phase UI", ["关闭主菜单卡车动画"] = "Disable Truck Menu Animation", ["跳过公开游戏加入确认"] = "Skip Public Join Confirm", ["跳过私人游戏默认确认"] = "Skip Private Host Confirm", ["跳过公开/私人游戏区服前提示"] = "Skip Region Entry Prompt", ["关闭屏幕噪点遮罩"] = "Disable Screen Overlay", ["关闭镜头噪声"] = "Disable Camera Noise", ["关闭第一人称镜头动画"] = "Disable Camera Motion", ["关闭镜头震动"] = "Disable Camera Shake", ["关闭屏幕故障闪屏"] = "Disable Camera Glitch", ["关闭影怪血管屏幕特效"] = "Disable Shadow Vein Effect", ["关闭临时后处理特效"] = "Disable Post Processing", ["关闭低血量红框"] = "Disable Hurt Vignette", ["关闭打开地图动画"] = "Disable Map Open Animation", ["关闭第一人称手臂动作"] = "Disable Arm Animation", ["关闭摔倒特效"] = "Disable Tumble Effects", ["关闭开枪扳机动画"] = "Disable Trigger Animation", ["关闭开枪震动"] = "Disable Gunfire Shake", ["关闭开枪后坐力(主机)"] = "Disable Recoil (Host)\u200b", ["关闭开枪枪口特效"] = "Disable Muzzle Effects", ["关闭开枪黑烟特效"] = "Disable Gun Smoke", ["关闭死亡与复活特效"] = "Disable Death & Revive Effects", ["关闭蜘蛛贴脸屏幕效果"] = "Disable Spider Screen Effect", ["关闭地图贵重物标记"] = "Disable Valuable Map Markers", ["关闭贵重物发现提示"] = "Disable Valuable Discover Prompt", ["关闭贵重物动态灯光与粒子"] = "Disable Valuable Effects", ["关闭世界空间UI动画"] = "Disable World Space UI Motion", ["关闭重构装备镜头震动"] = "Disable Reroll Equipment Shake", ["关闭重构装备运转特效与表现"] = "Disable Reroll Equipment Animations", ["关闭重构装备损坏起火特效"] = "Disable Reroll Equipment Broken Fire", ["关闭吃药水升级粒子特效"] = "Disable Potion Upgrade Particles", ["关闭吃药水升级屏幕故障特效"] = "Disable Potion Upgrade Screen Glitch", ["关闭吃药水升级镜头震动"] = "Disable Potion Upgrade Camera Shake", ["关闭外观机抓取光束与粒子"] = "Disable Cosmetic Grab Beam", ["关闭外观机镜头震动"] = "Disable Cosmetic Machine Shake", ["关闭外观机转盘与屏幕表现"] = "Disable Cosmetic Screen Motion", ["关闭外观机循环灯光与音效"] = "Disable Cosmetic Loop Effects", ["关闭结算页抖动"] = "Disable Result Shake", ["关闭结算页代币粒子"] = "Disable Result Token Particles", ["快速跳过结算表现"] = "Quick Skip Result Screen", ["关闭电池UI弹跳与闪烁"] = "Disable Battery UI Motion", ["关闭手电开关动画"] = "Disable Flashlight Animation", ["关闭手电闪烁表现"] = "Disable Flashlight Flicker", ["关闭大厅聊天跳动动画"] = "Disable Lobby Chat Motion", ["关闭指引箭头"] = "Disable Guide Arrow", ["关闭大字提示"] = "Disable Big Messages", ["关闭载具速度粒子"] = "Disable Vehicle Speed Particles", ["关闭铀伤害屏幕特效"] = "Disable Uranium Effect", ["关闭翻滚翅膀UI"] = "Disable Tumble Wings UI", ["关闭教程提示"] = "Disable Tutorial Tips", ["关闭竞技场大字提示"] = "Disable Arena Messages", ["关闭竞技场警示灯"] = "Disable Arena Warning Lights", ["关闭竞速计时器动画"] = "Disable Race Timer Motion", ["关闭卡车屏幕加载条动画"] = "Disable Truck Loading Bar", ["关闭卡车聊天框动画"] = "Disable Truck Chat Motion", ["关闭电池条浮动特效"] = "Disable Battery Bar Effect", ["关闭价值屏幕跳字特效"] = "Disable Value Screen Effect", ["关闭教程UI动画"] = "Disable Tutorial UI Motion" }; private static Plugin _instance; private static REPOPopupPage _currentSettingsPage; private static REPOPopupPage _currentSectionPage; private static string _currentSectionName; private static Hook _mainMenuStartHook; private static REPOButton _escapeMenuButton; private static REPOButton _mainMenuButton; private static bool _isInitializingCustomUI; private static bool _isRenderingOurCustomSettings; internal static bool IsInPlayerUpgradeSequence; private static TextMeshProUGUI _quickSettingsTitleTMP; private static REPOButton _quickSettingsBackButton; private static REPOButton _quickSettingsResetButton; private static TextMeshProUGUI _sectionTitleTMP; private static CompatibilityReport _compatibilityReport = CompatibilityReport.CreateHealthy(); private static bool _compatibilityPopupShown; private static bool _compatibilityPopupWaiting; private static readonly FieldRef PagePopUpScheduledRef = AccessTools.FieldRefAccess("pagePopUpScheduled"); private static readonly FieldRef CurrentMenuPageIndexRef = AccessTools.FieldRefAccess("currentMenuPageIndex"); private const string ModuleDisplayName = "更多设置选项"; private static Harmony _harmony; private static ConfigEntry _cfgShowFpsCounter; private static ConfigEntry _cfgModEnabled; private static ConfigEntry displayLanguage; private static ConfigEntry _cfgDisableSplashScreen; private static ConfigEntry _cfgDisableArmIntroAnimation; private static ConfigEntry _cfgDisableLoadingAnimation; private static ConfigEntry _cfgDisableVideoOverlay; private static ConfigEntry _cfgDisableCameraNoise; private static ConfigEntry _cfgDisableCameraAnimation; private static ConfigEntry _cfgDisableCameraShake; private static ConfigEntry _cfgDisableCameraGlitch; private static ConfigEntry _cfgDisableEnemyShadowVeinScreenEffect; private static ConfigEntry _cfgDisablePostProcessingOverrides; private static ConfigEntry _cfgDisableHurtVignette; private static ConfigEntry _cfgDisableMapOpenAnimation; private static ConfigEntry _cfgDisableFirstPersonArmAnimations; private static ConfigEntry _cfgDisableGunfireCooldown; private static ConfigEntry _cfgDisableMeleeShake; private static ConfigEntry _cfgDisableMeleeCooldown; internal static bool IsInItemMeleeSwingHit; private static ConfigEntry _cfgDisableGunTriggerAnimation; private static ConfigEntry _cfgDisableGunFireShake; private static ConfigEntry _cfgDisableGunRecoil; private static ConfigEntry _cfgDisableGunMuzzleEffects; private static ConfigEntry _cfgDisableGunSmokeEffects; private static ConfigEntry _cfgDisableDeathAndReviveEffects; private static ConfigEntry _cfgDisableSpiderScreenEffects; private static ConfigEntry _cfgDisableTumbleVisualEffects; private static ConfigEntry _cfgDisablePhysImpactVisualEffects; private static ConfigEntry _cfgThrottleValuableExtractionTracking; private static ConfigEntry _cfgThrottleEnemyInvestigate; private static ConfigEntry _cfgSkipPublicGameJoinConfirm; private static ConfigEntry _cfgSkipPrivateGameConfirm; private static ConfigEntry _cfgDisableLobbyPageAnimations; private static ConfigEntry _cfgDisablePopupAnimations; private static ConfigEntry _cfgDisableServerListEntryAnimations; private static ConfigEntry _cfgDisableRegionListEntryAnimations; private static ConfigEntry _cfgDisableMenuLoadingGraphicsAnimations; private static ConfigEntry _cfgDisableMenuButtonMotion; private static ConfigEntry _cfgEnableValuableMapMarkers; private static ConfigEntry _cfgEnableValuableDiscoverPrompts; private static ConfigEntry _cfgEnableValuableDynamicEffects; private static ConfigEntry _cfgDisableWorldSpaceUiAnimations; private static ConfigEntry _cfgDisableUpgradeStandCameraShake; private static ConfigEntry _cfgDisableUpgradeStandAnimations; private static ConfigEntry _cfgDisableUpgradeStandBrokenFire; private static ConfigEntry _cfgDisableUpgradePotionParticles; private static ConfigEntry _cfgDisableUpgradeScreenGlitch; private static ConfigEntry _cfgDisableUpgradeCameraShake; private static ConfigEntry _cfgDisableCosmeticMachineGrabBeamEffects; private static ConfigEntry _cfgDisableCosmeticMachineCameraShake; private static ConfigEntry _cfgDisableCosmeticMachineScreenAnimations; private static ConfigEntry _cfgDisableCosmeticMachineLoopEffects; private static ConfigEntry _cfgDisableResultScreenFade; private static ConfigEntry _cfgDisableResultScreenShake; private static ConfigEntry _cfgDisableResultScreenTokenParticles; private static ConfigEntry _cfgQuickSkipResultScreen; private static ConfigEntry _cfgDisableBatteryUiAnimations; private static ConfigEntry _cfgDisableFlashlightAnimations; private static ConfigEntry _cfgDisableFlashlightFlicker; private static ConfigEntry _cfgDisableLobbyChatAnimations; private static ConfigEntry _cfgDisableLobbyJoiningPromptFade; private static ConfigEntry _cfgDisableLeftPrepUiFade; private static ConfigEntry _cfgDisableMoonPhaseUi; private static ConfigEntry _cfgDisableMainMenuTruckAnimation; private static ConfigEntry _cfgDisableGuideArrowUi; private static ConfigEntry _cfgDisableBigMessageUi; private static ConfigEntry _cfgDisableVehicleSpeedParticles; private static ConfigEntry _cfgDisableUraniumScreenEffects; private static ConfigEntry _cfgDisableTumbleWingsUi; private static ConfigEntry _cfgDisableTutorialTips; private static ConfigEntry _cfgDisableArenaMessages; private static ConfigEntry _cfgDisableArenaWarningLights; private static ConfigEntry _cfgDisableArenaRaceTimerAnimations; private static ConfigEntry _cfgDisableTruckScreenLoadingBarAnimation; private static ConfigEntry _cfgDisableTruckScreenChatAnimations; private static ConfigEntry _cfgDisableBatteryBarEffects; private static ConfigEntry _cfgDisableValueScreenEffects; private static ConfigEntry _cfgDisableTutorialUiAnimations; private static readonly Dictionary ValuableTrackingNextRunTimes = new Dictionary(); private static readonly Dictionary ImpactInvestigateNextRunTimes = new Dictionary(); private static float _nextGlobalInvestigateTime; private static GUIStyle _fpsLabelStyle; private static float _fpsAccumulatedTime; private static int _fpsAccumulatedFrames; private static float _fpsDisplayValue; private float _lastLabelRefreshTime; private float _lastNetSyncTime; internal static readonly Dictionary _cfgByEnSection = new Dictionary(StringComparer.Ordinal); internal static readonly Dictionary _cfgByCnSection = new Dictionary(StringComparer.Ordinal); internal static readonly Dictionary _cfgByEnKey = new Dictionary(StringComparer.Ordinal); internal static readonly Dictionary> _cfgByKeyOnly = new Dictionary>(StringComparer.Ordinal); internal static readonly Dictionary> _cfgByKeyCnOnly = new Dictionary>(StringComparer.Ordinal); private static readonly List _cfgI18Ns = new List(64); private static readonly string[] _chineseModKeywords = new string[6] { "chinese", "简体", "繁體", "繁体", "汉化", "中文" }; private static readonly string[] _chineseEnvironmentPluginGuids = new string[1] { "gravydevsupreme.xunity.autotranslator" }; private static readonly List _liveLabels = new List(64); private static LiveLabel _pendingSectionLabel; private static readonly List _liveValues = new List(8); private static readonly List _liveSliderOptions = new List(4); private static readonly List _liveToggleButtons = new List(16); private static readonly Dictionary _labelTmpFieldCache = new Dictionary(8); private static readonly Dictionary _sliderStringOptionsPropCache = new Dictionary(4); private static readonly Dictionary _toggleLeftTmpCache = new Dictionary(4); private static readonly Dictionary _toggleRightTmpCache = new Dictionary(4); private static readonly Dictionary _pendingKeyMatchIndex = new Dictionary(StringComparer.Ordinal); internal static string _currentRenderingConfigFilePath; internal static bool _createModEntriesPatchInstalled; private static readonly Dictionary _inputStringSystemFieldCache = new Dictionary(4); private static readonly Dictionary _inputStringSystemSetValueCache = new Dictionary(4); private static readonly Dictionary _enumNameCNtoEN = new Dictionary(StringComparer.Ordinal) { ["中文"] = "Chinese", ["文字显示"] = "Text Mode", ["原生UI显示"] = "Native UI" }; private static readonly Dictionary _enumNameENtoCN = new Dictionary(StringComparer.Ordinal) { ["English"] = "英语", ["Chinese"] = "中文" }; public static Plugin Instance => _instance; private void Awake() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown _instance = this; InitializeIntegratedFeatures(); TryHookREPOConfig(_harmony); if (displayLanguage != null) { displayLanguage.SettingChanged += delegate { RefreshAllI18N(); }; } _mainMenuStartHook = new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), typeof(Plugin).GetMethod("MenuPageMainStartHook", BindingFlags.Static | BindingFlags.NonPublic)); object obj = <>c.<>9__27_1; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) REPOButton button = (_escapeMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, parent, new Vector2(0f, 0f))); ((MonoBehaviour)_instance).StartCoroutine(AdjustEscapeButtonPosition(parent, button)); }; <>c.<>9__27_1 = val; obj = (object)val; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj); ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPOSettings: side-button mode active"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPOSettings v1.0.2 loaded."); } private void OnDestroy() { Hook mainMenuStartHook = _mainMenuStartHook; if (mainMenuStartHook != null) { mainMenuStartHook.Dispose(); } } private static void MenuPageMainStartHook(Action orig, MenuPageMain self) { orig(self); CreateMainMenuButton(((Component)self).transform); TryShowCompatibilityPopup(); } [IteratorStateMachine(typeof(d__30))] private static IEnumerator AdjustEscapeButtonPosition(Transform parent, REPOButton button) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { parent = parent, button = button }; } private static void CreateMainMenuButton(Transform parent) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)"REPOSettings: main parent missing"); } return; } Transform val = ResolveButtonParent(parent); if ((Object)(object)val == (Object)null) { Plugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)("REPOSettings: main button parent missing, root=" + ((Object)parent).name)); } return; } if ((Object)(object)((Component)val).GetComponent() == (Object)null) { VerticalLayoutGroup obj = ((Component)val).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; } Transform val2 = FindOrCleanupManagedButton(val); if ((Object)(object)val2 != (Object)null) { TextMeshProUGUI componentInChildren = ((Component)val2).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = GetLocalizedText("更多设置", "More Settings"); } _mainMenuButton = ((Component)val2).GetComponent(); Plugin instance3 = _instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)$"REPOSettings: main button already exists at pos={val2.localPosition}"); } return; } REPOButton val3 = (_mainMenuButton = MenuAPI.CreateREPOButton(GetLocalizedText("更多设置", "More Settings"), (Action)OpenQuickSettingsPage, val, new Vector2(0f, 0f))); List list = (from Transform transform in (IEnumerable)val where ((Object)transform).name.Contains("Menu Button") orderby transform.localPosition.y descending select transform).ToList(); int index = Math.Max(list.Count - 2, 0); list.Insert(index, ((Component)val3).transform); Transform val4 = list[list.Count - 1]; ((Component)val3).transform.SetSiblingIndex(val4.GetSiblingIndex()); float num = 230f; foreach (Transform item in list) { item.localPosition = new Vector3(item.localPosition.x, num, item.localPosition.z); num -= 30f; } Plugin instance4 = _instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)$"REPOSettings: inserted main default button at pos={((Component)val3).transform.localPosition}"); } } private static Transform ResolveButtonParent(Transform root) { if ((Object)(object)root == (Object)null) { return null; } Transform val = root.Find("Buttons"); if ((Object)(object)val != (Object)null) { return val; } return root; } private static Transform FindOrCleanupManagedButton(Transform parent) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown List list = new List(); foreach (Transform item in parent) { Transform val = item; if (((Object)val).name.Contains("Menu Button")) { TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren(true); string a = ((!((Object)(object)componentInChildren != (Object)null)) ? string.Empty : ((TMP_Text)componentInChildren).text?.Trim()); if (string.Equals(a, "更多设置", StringComparison.Ordinal) || string.Equals(a, "More Settings", StringComparison.Ordinal)) { list.Add(val); } } } if (list.Count <= 1) { return list.FirstOrDefault(); } Transform result = list[0]; for (int i = 1; i < list.Count; i++) { Object.Destroy((Object)(object)((Component)list[i]).gameObject); } Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"REPOSettings: cleaned duplicate settings buttons, removed={list.Count - 1}"); } return result; } private static void OpenQuickSettingsPage() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown _isRenderingOurCustomSettings = true; _isInitializingCustomUI = true; if ((Object)(object)_instance != (Object)null) { ((BaseUnityPlugin)_instance).Logger.LogInfo((object)string.Format("[REPOSettings Debug] displayLanguage={0}, IsEnglishUiEnabled={1}, UseChinese={2}", displayLanguage?.Value.ToString() ?? "null", IsEnglishUiEnabled(), UseChinese())); } Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"REPOSettings: OpenQuickSettingsPage invoked"); } string localizedText = GetLocalizedText("更多设置", "More Settings"); REPOPopupPage page = MenuAPI.CreateREPOPopupPage(localizedText, (PresetSide)0, false, true, 0f); _currentSettingsPage = page; _quickSettingsTitleTMP = FindTitleTMP(page); if ((Object)(object)_quickSettingsTitleTMP != (Object)null) { ((TMP_Text)_quickSettingsTitleTMP).fontStyle = (FontStyles)0; } page.scrollView.scrollSpeed = 3f; REPOPopupPage obj = page; Padding maskPadding = page.maskPadding; maskPadding.top = 35f; obj.maskPadding = maskPadding; page.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002f: 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) _quickSettingsBackButton = MenuAPI.CreateREPOButton(GetLocalizedText("返回", "Back"), (Action)delegate { page.ClosePage(true); }, parent, QuickSettingsBackButtonPosition); _quickSettingsResetButton = MenuAPI.CreateREPOButton(GetLocalizedText("重置全部设置", "Reset All Settings"), (Action)ConfirmResetAllManagedEntries, parent, QuickSettingsResetButtonPosition); ((TMP_Text)_quickSettingsResetButton.labelTMP).fontStyle = (FontStyles)0; }); string modInfoSection = "A.Mod Info"; page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_002d: 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) REPOButton obj3 = MenuAPI.CreateREPOButton(GetDisplaySectionName(modInfoSection), (Action)delegate { OpenSectionPage(modInfoSection); }, scrollView, default(Vector2)); ((TMP_Text)obj3.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj3).rectTransform; }, 0f, 0f); foreach (IGrouping> fpsPlusBoolSectionEntry in GetFpsPlusBoolSectionEntries()) { string sectionName = fpsPlusBoolSectionEntry.Key; page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_002d: 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) REPOButton obj2 = MenuAPI.CreateREPOButton(GetDisplaySectionName(sectionName), (Action)delegate { OpenSectionPage(sectionName); }, scrollView, default(Vector2)); ((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj2).rectTransform; }, 0f, 0f); } page.OpenPage(false); if ((Object)(object)_instance != (Object)null) { ((MonoBehaviour)_instance).StartCoroutine(ResetInitializingFlagCoroutine()); } else { _isInitializingCustomUI = false; _isRenderingOurCustomSettings = false; } Plugin instance2 = _instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)"REPOSettings: popup opened"); } } [IteratorStateMachine(typeof(d__35))] private static IEnumerator ResetInitializingFlagCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__35(0); } private static void OpenSectionPage(string sectionName) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown _isRenderingOurCustomSettings = true; _isInitializingCustomUI = true; MenuAPI.CloseAllPagesAddedOnTop(); REPOPopupPage val = (_currentSectionPage = MenuAPI.CreateREPOPopupPage(GetDisplaySectionName(sectionName), (PresetSide)1, false, false, 8f)); _currentSectionName = sectionName; _sectionTitleTMP = FindTitleTMP(val); if ((Object)(object)_sectionTitleTMP != (Object)null) { ((TMP_Text)_sectionTitleTMP).fontStyle = (FontStyles)0; } val.scrollView.scrollSpeed = 3f; object obj = <>c.<>9__36_0; if (obj == null) { ShouldCloseMenuDelegate val2 = () => true; <>c.<>9__36_0 = val2; obj = (object)val2; } val.onEscapePressed = (ShouldCloseMenuDelegate)obj; if (sectionName == "A.Mod Info") { if (displayLanguage != null) { AddLanguageToggle(val, displayLanguage); } AddInfoField(val, GetDisplayInfoName("REPOSettingsModName"), GetInfoEntryValue("REPOSettingsModName")); AddInfoField(val, GetDisplayInfoName("REPOSettingsModVersion"), GetInfoEntryValue("REPOSettingsModVersion")); } foreach (ConfigEntry item in from entry in GetDisplayedFpsPlusBoolEntries() where ((ConfigEntryBase)entry).Definition.Section == sectionName select entry) { AddBoolToggle(val, item); } val.OpenPage(true); if ((Object)(object)_instance != (Object)null) { ((MonoBehaviour)_instance).StartCoroutine(ResetInitializingFlagCoroutine()); } else { _isInitializingCustomUI = false; _isRenderingOurCustomSettings = false; } Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("REPOSettings: section page opened -> " + sectionName)); } } private static void ConfirmResetAllManagedEntries() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.OpenPopup(GetLocalizedText("重置全部配置", "Reset All Settings"), Color.red, GetLocalizedText("确定将这页里的所有配置恢复为默认值吗?", "Reset all settings on this page to their defaults?"), (Action)ResetAllManagedEntries, (Action)null); } private static void ResetAllManagedEntries() { foreach (ConfigEntry displayedFpsPlusBoolEntry in GetDisplayedFpsPlusBoolEntries()) { ((ConfigEntryBase)displayedFpsPlusBoolEntry).BoxedValue = ((ConfigEntryBase)displayedFpsPlusBoolEntry).DefaultValue; } Plugin instance = _instance; if (instance != null) { ConfigFile config = ((BaseUnityPlugin)instance).Config; if (config != null) { config.Save(); } } if ((Object)(object)_currentSectionPage != (Object)null && !string.IsNullOrWhiteSpace(_currentSectionName)) { _currentSectionPage.ClosePage(true); _currentSectionPage = null; OpenSectionPage(_currentSectionName); return; } REPOPopupPage currentSettingsPage = _currentSettingsPage; if (currentSettingsPage != null) { currentSettingsPage.ClosePage(true); } _currentSettingsPage = null; OpenQuickSettingsPage(); } private static void AddBoolToggle(REPOPopupPage page, ConfigEntry entry) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_006d: 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) string localizedText = GetLocalizedText("开", "On"); string localizedText2 = GetLocalizedText("关", "Off"); bool value2 = entry.Value; string displayKeyName = GetDisplayKeyName(((ConfigEntryBase)entry).Definition.Key); Action obj = delegate(bool value) { if (!_isInitializingCustomUI) { entry.Value = value; SavePluginConfig("zichen.reposettings"); } }; bool flag = value2; string text = localizedText; string text2 = localizedText2; REPOToggle obj2 = MenuAPI.CreateREPOToggle(displayKeyName, obj, scrollView, default(Vector2), text, text2, flag); ((TMP_Text)obj2.labelTMP).fontSize = 24f; ((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj2).rectTransform; }, 0f, 0f); } private static void AddLanguageToggle(REPOPopupPage page, ConfigEntry entry) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown if ((Object)(object)_instance != (Object)null) { ((BaseUnityPlugin)_instance).Logger.LogInfo((object)string.Format("[REPOSettings Debug] AddLanguageToggle entry.Value={0}, IsEnglishUiEnabled={1}, GetLocalizedText={2}", entry.Value, IsEnglishUiEnabled(), GetLocalizedText("语言", "Language"))); } page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) string text = "中文"; string text2 = "English"; bool flag = entry.Value == DisplayLanguage.中文; string displayKeyName = GetDisplayKeyName("REPOSettingsLanguage"); Action obj = delegate(bool value) { if (!_isInitializingCustomUI) { DisplayLanguage displayLanguage = ((!value) ? DisplayLanguage.English : DisplayLanguage.中文); if (entry.Value != displayLanguage) { entry.Value = displayLanguage; SavePluginConfig("zichen.reposettings"); } } }; bool flag2 = flag; string text3 = text; string text4 = text2; REPOToggle obj2 = MenuAPI.CreateREPOToggle(displayKeyName, obj, scrollView, default(Vector2), text3, text4, flag2); ((TMP_Text)obj2.labelTMP).fontSize = 24f; ((TMP_Text)obj2.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj2).rectTransform; }, 0f, 0f); } private static void AddInfoField(REPOPopupPage page, string labelText, string valueText) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) string stableValue = valueText ?? string.Empty; REPOInputField inputField = null; inputField = MenuAPI.CreateREPOInputField(labelText, (Action)delegate(string value) { if ((Object)(object)inputField != (Object)null) { string text = stableValue; if (labelText.Contains("Name") || labelText.Contains("名称")) { text = GetLocalizedText("更多设置选项", "REPOSettings Options "); } else if (labelText.Contains("Version") || labelText.Contains("版本")) { text = "1.0.2"; } if (value != text) { inputField.inputStringSystem.SetValue(text, false); } } }, scrollView, Vector2.zero, false, string.Empty, stableValue); ((TMP_Text)inputField.labelTMP).fontStyle = (FontStyles)0; inputField.inputStringSystem.inputTMP.fontStyle = (FontStyles)0; inputField.inputStringSystem.SetValue(stableValue, false); return ((REPOElement)inputField).rectTransform; }, 0f, 0f); } private static void RefreshSettingsPages() { } private static IEnumerable>> GetFpsPlusBoolSectionEntries() { List> entries = GetDisplayedFpsPlusBoolEntries().ToList(); return from section in entries.Select((ConfigEntry entry) => ((ConfigEntryBase)entry).Definition.Section).Distinct().ToList() select (from entry in entries where ((ConfigEntryBase)entry).Definition.Section == section group entry by ((ConfigEntryBase)entry).Definition.Section).First(); } private static IEnumerable> GetDisplayedFpsPlusBoolEntries() { Plugin instance = _instance; if (((instance != null) ? ((BaseUnityPlugin)instance).Config : null) == null) { return Enumerable.Empty>(); } return from entry in ((IEnumerable>)((BaseUnityPlugin)_instance).Config).Select((KeyValuePair configEntry) => configEntry.Value).OfType>() where ((ConfigEntryBase)entry).Definition.Section != "A.Mod Info" && ((ConfigEntryBase)entry).Definition.Section != "A.REPOSettings Info" where ((ConfigEntryBase)entry).Definition.Section != "K.Performance" select entry; } private static string GetInfoEntryValue(string keyEN) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Plugin instance = _instance; if (((instance != null) ? ((BaseUnityPlugin)instance).Config : null) == null) { return string.Empty; } ConfigEntry val = default(ConfigEntry); if (((BaseUnityPlugin)_instance).Config.TryGetEntry(new ConfigDefinition("A.Mod Info", keyEN), ref val) && val != null) { return val.Value; } return string.Empty; } private static string GetDisplaySectionName(string rawSectionName) { switch (rawSectionName) { case "A.Mod Info": case "A.REPOSettings Info": case "A.模组信息": { string text = (IsEnglishUiEnabled() ? "A.Mod Info\u200b" : "A.模组信息"); if ((Object)(object)_instance != (Object)null) { ((BaseUnityPlugin)_instance).Logger.LogInfo((object)$"[REPOSettings Debug] GetDisplaySectionName raw={rawSectionName} result={text} IsEnglishUiEnabled={IsEnglishUiEnabled()}"); } return text; } default: { if (_cfgByEnSection.TryGetValue(rawSectionName, out var value)) { if (IsEnglishUiEnabled()) { if (!SectionEnglishNames.TryGetValue(rawSectionName, out var value2)) { return value.SectionEN; } return value2; } return value.SectionCN; } return GetLocalizedMappedText(rawSectionName, SectionEnglishNames); } } } private static string GetDisplayKeyName(string rawKeyName) { if (rawKeyName == "REPOSettingsLanguage") { return GetLocalizedText("语言", "Language "); } if (_cfgByKeyOnly.TryGetValue(rawKeyName, out var value) && value != null && value.Count > 0) { CfgI18N cfgI18N = value[0]; if (IsEnglishUiEnabled()) { if (cfgI18N.DisplayEN != null) { return GetUIVariant(cfgI18N.DisplayEN); } if (KeyEnglishNames.TryGetValue(cfgI18N.KeyCN, out var value2)) { return GetUIVariant(value2); } return GetUIVariant(cfgI18N.KeyEN); } return cfgI18N.KeyCN; } return GetUIVariant(GetLocalizedMappedText(rawKeyName, KeyEnglishNames)); } private static string GetDisplayInfoName(string rawKeyName) { if (rawKeyName == "REPOSettingsModName") { return GetLocalizedText("模组名称", "Mod Name"); } if (rawKeyName == "REPOSettingsModVersion") { return GetLocalizedText("模组版本号", "Mod Version"); } return GetLocalizedMappedText(rawKeyName, InfoEnglishNames); } private static string GetLocalizedMappedText(string chineseText, Dictionary englishMap) { if (!IsEnglishUiEnabled()) { return chineseText; } if (!englishMap.TryGetValue(chineseText, out var value)) { return chineseText; } return value; } private static string GetLocalizedText(string chineseText, string englishText) { if (!IsEnglishUiEnabled()) { return chineseText; } return englishText; } private static void SavePluginConfig(string pluginGuid) { if (Chainloader.PluginInfos.TryGetValue(pluginGuid, out var value)) { object obj; if (value == null) { obj = null; } else { BaseUnityPlugin instance = value.Instance; obj = ((instance != null) ? instance.Config : null); } if (obj != null) { value.Instance.Config.Save(); } } } internal static string GetUIVariant(string text) { if (string.IsNullOrEmpty(text)) { return text; } switch (text) { case "A.Mod Info": case "A.REPOSettings Info": case "A.REPO Settings Info": return "A.Mod Info\u200b"; case "Language": return "Language\u200b"; case "Mod Name": return "Mod Name\u200b"; case "Mod Version": return "Mod Version\u200b"; case "REPOSettings Options": return "REPOSettings Options\u200b"; default: return text; } } private static TextMeshProUGUI FindTitleTMP(REPOPopupPage page) { if ((Object)(object)page == (Object)null) { return null; } return ((IEnumerable)((Component)page).gameObject.GetComponentsInChildren(true)).FirstOrDefault((Func)((TextMeshProUGUI t) => ((Object)((Component)t).gameObject).name.Contains("Title") || ((Object)((Component)t).gameObject).name.Contains("Header") || ((Object)((TMP_Text)t).transform.parent).name.Contains("Title"))); } private static void PatchHarmonySafely() { foreach (Type loadableType in GetLoadableTypes(typeof(Plugin).Assembly)) { if (loadableType == null || !loadableType.GetCustomAttributes(typeof(HarmonyPatch), inherit: true).Any()) { continue; } try { _harmony.CreateClassProcessor(loadableType).Patch(); } catch (Exception ex) { string patchFeatureName = GetPatchFeatureName(loadableType); _compatibilityReport.AddPatchFailure(patchFeatureName, loadableType.Name, ex.Message); Plugin instance = _instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("Skipped Harmony patch " + loadableType.FullName + ": " + ex.Message)); } } } } private static string GetPatchFeatureName(Type patchType) { string text = patchType?.Name ?? "未知功能"; if (text.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) >= 0) { return "菜单与界面"; } if (text.IndexOf("Camera", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("PostProcessing", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Vignette", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("MapTool", StringComparison.OrdinalIgnoreCase) >= 0) { return "屏幕与镜头效果"; } if (text.IndexOf("Gun", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Arm", StringComparison.OrdinalIgnoreCase) >= 0) { return "武器与手臂表现"; } if (text.IndexOf("Valuable", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Phys", StringComparison.OrdinalIgnoreCase) >= 0) { return "贵重物与表现优化"; } if (text.IndexOf("WorldSpace", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Tutorial", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Message", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("UI", StringComparison.OrdinalIgnoreCase) >= 0) { return "UI 与提示"; } return text; } private static IEnumerable GetLoadableTypes(Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type type) => type != null); } } private static void TryShowCompatibilityPopup() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (_compatibilityPopupShown || !_compatibilityReport.HasIssues || (Object)(object)MenuManager.instance == (Object)null) { return; } string text = _compatibilityReport.BuildPopupMessage(IsEnglishUiEnabled()); if (!string.IsNullOrWhiteSpace(text)) { if (IsPopupSlotBusy(MenuManager.instance)) { StartCompatibilityPopupWait(text); return; } _compatibilityPopupShown = true; MenuManager.instance.PagePopUpScheduled(GetLocalizedText("兼容模式提示", "Compatibility Notice"), Color.yellow, text, "OK", false); } } private static bool IsPopupSlotBusy(MenuManager menuManager) { //IL_0027: 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_002b: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if ((Object)(object)menuManager == (Object)null) { return true; } if (PagePopUpScheduledRef.Invoke(menuManager)) { return true; } MenuPageIndex val = CurrentMenuPageIndexRef.Invoke(menuManager); if ((int)val != 9) { return (int)val == 7; } return true; } private static void StartCompatibilityPopupWait(string compatibilityMessage) { if (!_compatibilityPopupWaiting && !((Object)(object)_instance == (Object)null)) { _compatibilityPopupWaiting = true; ((MonoBehaviour)_instance).StartCoroutine(WaitAndShowCompatibilityPopup(compatibilityMessage)); } } [IteratorStateMachine(typeof(d__66))] private static IEnumerator WaitAndShowCompatibilityPopup(string compatibilityMessage) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__66(0) { compatibilityMessage = compatibilityMessage }; } public static bool IsStaticModEnabled() { if (_cfgModEnabled != null) { return _cfgModEnabled.Value; } return false; } public static bool IsEnglishUiEnabled() { if (displayLanguage != null) { return displayLanguage.Value == DisplayLanguage.English; } return false; } private void InitializeIntegratedFeatures() { DetachFromManager(); ResetConfigIfVersionChanged(); BindConfig(); CleanupLegacyConfigFile(); _compatibilityReport = CompatibilityReport.Build(); ApplyPatches(); if (_compatibilityReport.HasIssues) { ((BaseUnityPlugin)this).Logger.LogWarning((object)_compatibilityReport.BuildLogMessage()); foreach (string detailMessage in _compatibilityReport.GetDetailMessages()) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Compatibility detail: " + detailMessage)); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"更多设置选项 integrated into REPOSettings v1.0.2."); } private void Update() { if (Time.unscaledTime - _lastLabelRefreshTime > 0.2f) { _lastLabelRefreshTime = Time.unscaledTime; RefreshLiveLabels(); } UpdateFpsCounter(); if (IsStaticModEnabled()) { if (DisableCameraAnimationEnabled() && (Object)(object)GameplayManager.instance != (Object)null) { GameplayManager.instance.OverrideCameraAnimation(0f, 0.2f); } if (DisableCameraNoiseEnabled() && (Object)(object)GameplayManager.instance != (Object)null) { GameplayManager.instance.OverrideCameraNoise(0f, 0.2f); } if (Time.unscaledTime - _lastNetSyncTime > 1f) { _lastNetSyncTime = Time.unscaledTime; SyncConfigToRoomProperties(); } } } private void SyncConfigToRoomProperties() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown if (!PhotonNetwork.InRoom || !SemiFunc.IsMasterClient()) { return; } Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom == null) { return; } bool flag = IsFeatureEnabled(_cfgDisableGunfireCooldown); bool flag2 = IsFeatureEnabled(_cfgDisableMeleeCooldown); bool flag3 = IsFeatureEnabled(_cfgDisableGunRecoil); bool flag4 = false; if (((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunfireCooldown", out object value)) { if (!(value is bool flag5) || flag5 != flag) { flag4 = true; } } else { flag4 = true; } if (((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableMeleeCooldown", out object value2)) { if (!(value2 is bool flag6) || flag6 != flag2) { flag4 = true; } } else { flag4 = true; } if (((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunRecoil", out object value3)) { if (!(value3 is bool flag7) || flag7 != flag3) { flag4 = true; } } else { flag4 = true; } if (flag4) { Hashtable val = new Hashtable(); val[(object)"Zichen_DisableGunfireCooldown"] = flag; val[(object)"Zichen_DisableMeleeCooldown"] = flag2; val[(object)"Zichen_DisableGunRecoil"] = flag3; currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[REPOSettings Sync] Host synced custom properties: Gunfire={flag}, Melee={flag2}, Recoil={flag3}"); } } internal static bool IsHostDisableGunfireCooldownEnabled() { if (PhotonNetwork.InRoom) { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != null && ((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunfireCooldown", out object value) && value is bool) { return (bool)value; } } return false; } internal static bool IsHostDisableMeleeCooldownEnabled() { if (PhotonNetwork.InRoom) { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != null && ((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableMeleeCooldown", out object value) && value is bool) { return (bool)value; } } return false; } internal static bool IsHostDisableGunRecoilEnabled() { if (PhotonNetwork.InRoom) { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != null && ((Dictionary)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"Zichen_DisableGunRecoil", out object value) && value is bool) { return (bool)value; } } return false; } private void OnGUI() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (IsStaticModEnabled() && _cfgShowFpsCounter != null && _cfgShowFpsCounter.Value) { EnsureFpsLabelStyle(); GUI.Label(new Rect(12f, 12f, 160f, 28f), $"FPS: {Mathf.RoundToInt(_fpsDisplayValue)}", _fpsLabelStyle); } } private void BindConfig() { DisplayLanguage defaultVal = DetectDefaultLanguage(); displayLanguage = BindI18N("A.Mod Info", "A.模组信息", "REPOSettingsLanguage", "语言", "Switch display language.", "切换显示语言。", defaultVal, null, 1000, null, "Language"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "REPOSettingsModName", "模组名称", "REPOSettings Options", "更多设置选项", 990, null, "Mod Name"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "REPOSettingsModVersion", "模组版本号", "1.0.2", "1.0.2", 980, null, "Mod Version"); _cfgModEnabled = BindI18N("B.Global", "B.全局设置", "REPOSettingsEnabled", "启用", "Disable to turn off all features.", "总开关", defaultVal: true, null, 990, null, "Enable Config"); _cfgShowFpsCounter = BindI18N("B.Global", "B.全局设置", "REPOSettingsShowFps", "显示FPS数值", "Show FPS counter in the top-left corner.", "左上角实时显示FPS", defaultVal: true, null, 980, null, "Show FPS Counter"); _cfgDisableSplashScreen = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableSplashScreen", "关闭启动画面", "Disable splash screen.", "关闭启动画面", defaultVal: true); _cfgDisableArmIntroAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableArmIntroAnimation", "关闭开场手臂动画", "Disable arm intro animation.", "关闭开场手臂", defaultVal: false); _cfgDisableLoadingAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLoadingAnimation", "关闭加载与切场动画", "Disable loading & transition animations.", "关闭加载切场", defaultVal: false); _cfgDisableLobbyPageAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLobbyPageAnimations", "关闭大厅页面切换动画", "Disable lobby page transition animations.", "关闭大厅页面切换动画", defaultVal: false); _cfgDisablePopupAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisablePopupAnimations", "关闭按钮弹窗动画", "Disable popup animations.", "关闭按钮弹窗动画", defaultVal: false); _cfgDisableServerListEntryAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableServerListEntryAnimations", "关闭房间列表入场动画", "Disable server list entry animations.", "关闭房间列表入场动画", defaultVal: false); _cfgDisableRegionListEntryAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableRegionListEntryAnimations", "关闭地区列表入场动画", "Disable region list entry animations.", "关闭地区列表入场动画", defaultVal: false); _cfgDisableMenuLoadingGraphicsAnimations = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMenuLoadingGraphicsAnimations", "关闭菜单加载图标动画", "Disable menu loading graphic animations.", "关闭菜单加载图标动画", defaultVal: false); _cfgDisableMenuButtonMotion = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMenuButtonMotion", "关闭主菜单按钮位移动画", "Disable main menu button motion.", "关闭主菜单按钮位移动画", defaultVal: false); _cfgDisableLobbyJoiningPromptFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLobbyJoiningPromptFade", "关闭加入玩家提示淡入", "Disable joining prompt fade.", "关闭加入玩家提示淡入", defaultVal: false); _cfgDisableLeftPrepUiFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableLeftPrepUiFade", "关闭左侧准备界面淡入动画", "Disable left prep UI fade.", "关闭左侧准备界面淡入动画", defaultVal: false); _cfgDisableResultScreenFade = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableResultScreenFade", "关闭结算页淡入淡出", "Disable result screen fade.", "关闭结算页淡入淡出", defaultVal: false); _cfgDisableMoonPhaseUi = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMoonPhaseUi", "关闭月相变化界面", "Disable moon phase UI.", "关闭月相变化界面", defaultVal: false); _cfgDisableMainMenuTruckAnimation = BindI18N("C.StartupTransitions", "C.启动与切场", "DisableMainMenuTruckAnimation", "关闭主菜单卡车动画", "Disable main menu truck animation.", "关闭主菜单卡车动画", defaultVal: false); _cfgSkipPublicGameJoinConfirm = BindI18N("D.LobbyOnline", "D.大厅与联机", "SkipPublicGameJoinConfirm", "跳过公开游戏加入确认", "Skip public game join confirmation.", "跳过公开房加入提示", defaultVal: true); _cfgSkipPrivateGameConfirm = BindI18N("D.LobbyOnline", "D.大厅与联机", "SkipPrivateGameConfirm", "跳过私人游戏默认确认", "Skip private game default confirmation.", "跳过私人房默认提示", defaultVal: true); _cfgDisableGunfireCooldown = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunfireCooldown", "关闭开枪间隔(主机)", "Disable gunfire cooldown. (Host)\u200b", "关闭开枪重新装填和射击间隔 (主机)", defaultVal: true); _cfgDisableGunTriggerAnimation = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunTriggerAnimation", "关闭开枪扳机动画", "Disable gun trigger animation.", "关闭扳机动画", defaultVal: true); _cfgDisableGunFireShake = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunFireShake", "关闭开枪震动", "Disable gunfire shake.", "关闭开枪震动", defaultVal: true); _cfgDisableGunRecoil = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunRecoil", "关闭开枪后坐力(主机)", "Disable gun recoil. (Host)\u200b", "关闭开枪后坐力 (主机)", defaultVal: true); _cfgDisableGunMuzzleEffects = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunMuzzleEffects", "关闭开枪枪口特效", "Disable muzzle effects.", "关闭枪口火焰火花", defaultVal: true); _cfgDisableGunSmokeEffects = BindI18N("E.GunfireEffects", "E.开枪表现", "DisableGunSmokeEffects", "关闭开枪黑烟特效", "Disable gun smoke effects.", "关闭枪口和落点黑烟", defaultVal: true); _cfgDisableMeleeShake = BindI18N("E.MeleeEffects", "E.近战表现", "DisableMeleeShake", "关闭武器震动", "Disable melee shake.", "关闭近战击中震动", defaultVal: true); _cfgDisableMeleeCooldown = BindI18N("E.MeleeEffects", "E.近战表现", "DisableMeleeCooldown", "关闭武器造伤间隔(主机)", "Disable melee hit freeze. (Host)\u200b", "关闭近战受击卡顿 (主机)", defaultVal: true); _cfgDisableVideoOverlay = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableVideoOverlay", "关闭屏幕噪点遮罩", "Disable screen noise overlay.", "关闭噪点遮罩", defaultVal: false); _cfgDisableCameraNoise = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraNoise", "关闭镜头噪声", "Disable camera noise.", "关闭镜头噪声", defaultVal: false); _cfgDisableCameraAnimation = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraAnimation", "关闭第一人称镜头动画", "Disable first-person camera motion.", "关闭走路跳跃镜头动画", defaultVal: false); _cfgDisableCameraShake = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraShake", "关闭镜头震动", "Disable camera shake.", "关闭镜头震动", defaultVal: false); _cfgDisableCameraGlitch = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableCameraGlitch", "关闭屏幕故障闪屏", "Disable screen glitch effect.", "关闭故障闪屏", defaultVal: false); _cfgDisableEnemyShadowVeinScreenEffect = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableEnemyShadowVeinScreenEffect", "关闭影怪血管屏幕特效", "Disable shadow enemy vein screen effect.", "关闭影怪血管屏幕特效", defaultVal: false); _cfgDisablePostProcessingOverrides = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisablePostProcessingOverrides", "关闭临时后处理特效", "Disable temporary post-processing overrides.", "关闭临时后处理", defaultVal: false); _cfgDisableHurtVignette = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableHurtVignette", "关闭低血量红框", "Disable hurt vignette.", "关闭低血量红框", defaultVal: false); _cfgDisableMapOpenAnimation = BindI18N("F.ScreenCamera", "F.屏幕与镜头效果", "DisableMapOpenAnimation", "关闭打开地图动画", "Disable map open animation.", "关闭地图开合动画", defaultVal: false); _cfgDisableFirstPersonArmAnimations = BindI18N("G.WeaponsArms", "G.武器与手臂表现", "DisableFirstPersonArmAnimations", "关闭第一人称手臂动作", "Disable first-person arm animations.", "关闭手臂摆动", defaultVal: false); _cfgDisableTumbleVisualEffects = BindI18N("H.TumbleMotion", "H.摔倒与动作表现", "DisableTumbleVisualEffects", "关闭摔倒特效", "Disable tumble visual effects.", "关闭摔倒粒子", defaultVal: false); _cfgDisableDeathAndReviveEffects = BindI18N("I.DeathStatus", "I.死亡与状态表现", "DisableDeathAndReviveEffects", "关闭死亡与复活特效", "Disable death and revive effects.", "关闭死亡复活特效", defaultVal: false); _cfgDisableSpiderScreenEffects = BindI18N("I.DeathStatus", "I.死亡与状态表现", "DisableSpiderScreenEffects", "关闭蜘蛛贴脸屏幕效果", "Disable spider screen effects.", "关闭蜘蛛贴脸效果", defaultVal: false); _cfgEnableValuableMapMarkers = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableMapMarkers", "关闭地图贵重物标记", "Disable valuable map markers.", "关闭地图贵重物标记", defaultVal: false); _cfgEnableValuableDiscoverPrompts = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableDiscoverPrompts", "关闭贵重物发现提示", "Disable valuable discover prompts.", "关闭贵重物发现提示", defaultVal: false); _cfgEnableValuableDynamicEffects = BindI18N("J.ValuableEffects", "J.贵重物表现", "DisableValuableDynamicEffects", "关闭贵重物动态灯光与粒子", "Disable valuable dynamic effects.", "关闭贵重物灯光粒子", defaultVal: false); _cfgDisablePhysImpactVisualEffects = BindI18N("K.Performance", "K.性能优化", "DisablePhysImpactVisualEffects", "关闭物体碰撞粒子与灯光", "Disable physics impact visual effects.", "关闭碰撞粒子灯光", defaultVal: false); _cfgThrottleValuableExtractionTracking = BindI18N("K.Performance", "K.性能优化", "ThrottleValuableExtractionTracking", "贵重物距离跟踪降频", "Throttle valuable extraction tracking.", "降低距离跟踪频率", defaultVal: false); _cfgThrottleEnemyInvestigate = BindI18N("K.Performance", "K.性能优化", "ThrottleEnemyInvestigate", "敌人调查触发节流", "Throttle enemy investigate triggers.", "限制高频调查触发", defaultVal: false); _cfgDisableWorldSpaceUiAnimations = BindI18N("L.WorldSpaceUI", "L.世界空间UI", "DisableWorldSpaceUiAnimations", "关闭世界空间UI动画", "Disable world space UI animations.", "关闭名字弹字和TTS动画", defaultVal: false); _cfgDisableUpgradeStandCameraShake = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandCameraShake", "关闭重构装备镜头震动", "Disable Reroll Equipment Shake", "关闭重构装备时的镜头晃动表现", defaultVal: false); _cfgDisableUpgradeStandAnimations = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandAnimations", "关闭重构装备运转特效与表现", "Disable Reroll Equipment Animations", "关闭重构(洗装备)运转时的声光特效与表现", defaultVal: false); _cfgDisableUpgradeStandBrokenFire = BindI18N("M.UpgradeStand", "M.升级台表现", "DisableUpgradeStandBrokenFire", "关闭重构装备损坏起火特效", "Disable Reroll Equipment Broken Fire", "关闭重构台用尽损坏起火时的粒子与爆裂音效", defaultVal: false); _cfgDisableCosmeticMachineGrabBeamEffects = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineGrabBeamEffects", "关闭外观机抓取光束与粒子", "Disable cosmetic machine grab beam effects.", "关闭外观机抓取光束粒子", defaultVal: false); _cfgDisableCosmeticMachineCameraShake = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineCameraShake", "关闭外观机镜头震动", "Disable cosmetic machine camera shake.", "关闭外观机镜头震动", defaultVal: false); _cfgDisableCosmeticMachineScreenAnimations = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineScreenAnimations", "关闭外观机转盘与屏幕表现", "Disable cosmetic machine screen animations.", "关闭外观机转盘屏幕表现", defaultVal: false); _cfgDisableCosmeticMachineLoopEffects = BindI18N("N.CosmeticMachine", "N.外观机表现", "DisableCosmeticMachineLoopEffects", "关闭外观机循环灯光与音效", "Disable cosmetic machine loop effects.", "关闭外观机循环灯光音效", defaultVal: false); _cfgDisableResultScreenShake = BindI18N("O.ResultScreen", "O.结算表现", "DisableResultScreenShake", "关闭结算页抖动", "Disable result screen shake.", "关闭结算页抖动", defaultVal: false); _cfgDisableResultScreenTokenParticles = BindI18N("O.ResultScreen", "O.结算表现", "DisableResultScreenTokenParticles", "关闭结算页代币粒子", "Disable result screen token particles.", "关闭结算页代币粒子", defaultVal: false); _cfgQuickSkipResultScreen = BindI18N("O.ResultScreen", "O.结算表现", "QuickSkipResultScreen", "快速跳过结算表现", "Quickly skip the result screen.", "快速跳过结算表现", defaultVal: false); _cfgDisableUpgradePotionParticles = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradePotionParticles", "关闭吃药水升级粒子特效", "Disable Potion Upgrade Particles", "关闭玩家购买升级(吃属性药水)瞬间生成的黄色粒子", defaultVal: true); _cfgDisableUpgradeScreenGlitch = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradeScreenGlitch", "关闭吃药水升级屏幕故障特效", "Disable Potion Upgrade Screen Glitch", "关闭吃药水升级时产生的屏幕波纹故障闪屏与对应声效", defaultVal: true); _cfgDisableUpgradeCameraShake = BindI18N("Q.PotionUpgrade", "Q.使用药水表现", "DisableUpgradeCameraShake", "关闭吃药水升级镜头震动", "Disable Potion Upgrade Camera Shake", "关闭吃药水升级瞬间玩家本地以及队友传来的镜头震动", defaultVal: true); _cfgDisableBatteryUiAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBatteryUiAnimations", "关闭电池UI弹跳与闪烁", "Disable battery UI animations.", "关闭电池UI弹跳闪烁", defaultVal: false); _cfgDisableFlashlightAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableFlashlightAnimations", "关闭手电开关动画", "Disable flashlight animations.", "关闭手电开关动画", defaultVal: false); _cfgDisableFlashlightFlicker = BindI18N("P.UIPrompts", "P.UI与提示", "DisableFlashlightFlicker", "关闭手电闪烁表现", "Disable flashlight flicker.", "关闭手电闪烁表现", defaultVal: false); _cfgDisableLobbyChatAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableLobbyChatAnimations", "关闭大厅聊天跳动动画", "Disable lobby chat animations.", "关闭大厅聊天跳动动画", defaultVal: false); _cfgDisableGuideArrowUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableGuideArrowUi", "关闭指引箭头", "Disable guide arrow UI.", "关闭指引箭头", defaultVal: false); _cfgDisableBigMessageUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBigMessageUi", "关闭大字提示", "Disable big message UI.", "关闭大字提示", defaultVal: false); _cfgDisableVehicleSpeedParticles = BindI18N("P.UIPrompts", "P.UI与提示", "DisableVehicleSpeedParticles", "关闭载具速度粒子", "Disable vehicle speed particles.", "关闭载具速度粒子", defaultVal: false); _cfgDisableUraniumScreenEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableUraniumScreenEffects", "关闭铀伤害屏幕特效", "Disable uranium screen effects.", "关闭铀伤害屏幕特效", defaultVal: false); _cfgDisableTumbleWingsUi = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTumbleWingsUi", "关闭翻滚翅膀UI", "Disable tumble wings UI.", "关闭翻滚翅膀UI", defaultVal: false); _cfgDisableTutorialTips = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTutorialTips", "关闭教程提示", "Disable tutorial tips.", "关闭教程提示", defaultVal: false); _cfgDisableArenaMessages = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaMessages", "关闭竞技场大字提示", "Disable arena messages.", "关闭竞技场大字提示", defaultVal: false); _cfgDisableArenaWarningLights = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaWarningLights", "关闭竞技场警示灯", "Disable arena warning lights.", "关闭竞技场警示灯", defaultVal: false); _cfgDisableArenaRaceTimerAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableArenaRaceTimerAnimations", "关闭竞速计时器动画", "Disable arena race timer animations.", "关闭竞速计时器动画", defaultVal: false); _cfgDisableTruckScreenLoadingBarAnimation = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTruckScreenLoadingBarAnimation", "关闭卡车屏幕加载条动画", "Disable truck screen loading bar animation.", "关闭卡车屏幕加载条动画", defaultVal: false); _cfgDisableTruckScreenChatAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTruckScreenChatAnimations", "关闭卡车聊天框动画", "Disable truck chat animations.", "关闭卡车聊天框动画", defaultVal: false); _cfgDisableBatteryBarEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableBatteryBarEffects", "关闭电池条浮动特效", "Disable battery bar effects.", "关闭电池条浮动特效", defaultVal: false); _cfgDisableValueScreenEffects = BindI18N("P.UIPrompts", "P.UI与提示", "DisableValueScreenEffects", "关闭价值屏幕跳字特效", "Disable value screen effects.", "关闭价值屏幕跳字特效", defaultVal: false); _cfgDisableTutorialUiAnimations = BindI18N("P.UIPrompts", "P.UI与提示", "DisableTutorialUiAnimations", "关闭教程UI动画", "Disable tutorial UI animations.", "关闭教程UI动画", defaultVal: false); RefreshAllI18N(); } private void ResetConfigIfVersionChanged() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; string text = ReadConfigPluginVersion(configFilePath); if (!string.IsNullOrWhiteSpace(text) && !(text == "1.0.2")) { ((BaseUnityPlugin)this).Config.Clear(); if (File.Exists(configFilePath)) { File.Delete(configFilePath); } ((BaseUnityPlugin)this).Config.Reload(); ((BaseUnityPlugin)this).Logger.LogWarning((object)"Config version changed. Old config was reset to defaults."); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to reset config by version: " + ex.Message)); } } private static string ReadConfigPluginVersion(string configPath) { if (!File.Exists(configPath)) { return null; } string input = File.ReadAllText(configPath); Match match = Regex.Match(input, "(?m)^REPOSettingsModVersion\\s*=\\s*(.+?)\\s*$"); if (!match.Success) { match = Regex.Match(input, "(?m)^模组版本号\\s*=\\s*(.+?)\\s*$"); } if (!match.Success) { match = Regex.Match(input, "(?m)^Mod Version\\s*=\\s*(.+?)\\s*$"); } if (!match.Success) { return null; } return match.Groups[1].Value.Trim(); } private void CleanupLegacyConfigFile() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; if (File.Exists(configFilePath)) { string text = File.ReadAllText(configFilePath); if (text.Contains("[基础配置]") || text.Contains("[版本信息]") || text.Contains("[全局设置]") || text.Contains("[显示]") || text.Contains("[模组信息]") || text.Contains("[增加UI]") || text.Contains("[A.启动与切场]") || text.Contains("[B.屏幕与镜头效果]") || text.Contains("[C.武器与手臂表现]") || text.Contains("[D.摔倒与动作表现]") || text.Contains("[E.开枪表现]") || text.Contains("[F.死亡与状态表现]") || text.Contains("[G.贵重物表现]") || text.Contains("[H.性能优化]") || text.Contains("[I.大厅与联机]") || text.Contains("[J.大厅与菜单动画]") || text.Contains("[K.世界空间UI]") || text.Contains("[L.升级台演出]") || text.Contains("[M.外观机演出]") || text.Contains("[N.结算演出]") || text.Contains("[O.UI与提示]") || Regex.IsMatch(text, "(?m)^模组启用\\s*=") || Regex.IsMatch(text, "(?m)^界面语言\\s*=") || text.Contains("[B.启动与切场]") || text.Contains("[C.屏幕与镜头效果]") || text.Contains("[D.武器与手臂表现]") || text.Contains("[E.摔倒与动作表现]") || text.Contains("[F.开枪表现]") || text.Contains("[G.死亡与状态表现]") || text.Contains("[H.贵重物表现]") || text.Contains("[J.世界空间UI]") || text.Contains("[K.升级台演出]") || text.Contains("[L.外观机演出]") || text.Contains("[M.结算演出]") || text.Contains("[N.UI与提示]") || text.Contains("[B.全局设置]") || text.Contains("[C.启动与切场]") || text.Contains("[D.大厅与联机]") || text.Contains("[E.屏幕与镜头效果]") || text.Contains("[F.武器与手臂表现]") || text.Contains("[G.摔倒与动作表现]") || text.Contains("[H.开枪表现]") || text.Contains("[I.死亡与状态表现]") || text.Contains("[J.贵重物表现]") || text.Contains("[K.性能优化]") || text.Contains("[L.世界空间UI]") || text.Contains("[M.升级台演出]") || text.Contains("[N.外观机演出]") || text.Contains("[O.结算演出]") || text.Contains("[P.UI与提示]")) { File.Delete(configFilePath); ((BaseUnityPlugin)this).Config.Save(); ((BaseUnityPlugin)this).Logger.LogWarning((object)"Legacy config layout detected and rebuilt to current structure."); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to cleanup legacy config: " + ex.Message)); } } private void DetachFromManager() { ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private static void ApplyPatches() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (_harmony == null) { _harmony = new Harmony("zichen.reposettings"); PatchHarmonySafely(); } } private static bool IsFeatureEnabled(ConfigEntry configEntry) { if (IsStaticModEnabled() && configEntry != null) { return configEntry.Value; } return false; } private static void EnsureFpsLabelStyle() { //IL_0012: 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_0024: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (_fpsLabelStyle == null) { _fpsLabelStyle = new GUIStyle(GUI.skin.label) { fontSize = 18 }; _fpsLabelStyle.normal.textColor = Color.white; } } private static void UpdateFpsCounter() { _fpsAccumulatedTime += Time.unscaledDeltaTime; _fpsAccumulatedFrames++; if (!(_fpsAccumulatedTime < 1f)) { _fpsDisplayValue = (float)_fpsAccumulatedFrames / _fpsAccumulatedTime; _fpsAccumulatedTime = 0f; _fpsAccumulatedFrames = 0; } } internal static bool DisableSplashScreenEnabled() { return IsFeatureEnabled(_cfgDisableSplashScreen); } internal static bool DisableArmIntroAnimationEnabled() { return IsFeatureEnabled(_cfgDisableArmIntroAnimation); } internal static bool DisableLoadingAnimationEnabled() { return IsFeatureEnabled(_cfgDisableLoadingAnimation); } internal static bool DisableVideoOverlayEnabled() { return IsFeatureEnabled(_cfgDisableVideoOverlay); } internal static bool DisableCameraNoiseEnabled() { return IsFeatureEnabled(_cfgDisableCameraNoise); } internal static bool DisableCameraAnimationEnabled() { return IsFeatureEnabled(_cfgDisableCameraAnimation); } internal static bool DisableCameraShakeEnabled() { return IsFeatureEnabled(_cfgDisableCameraShake); } internal static bool DisableCameraGlitchEnabled() { return IsFeatureEnabled(_cfgDisableCameraGlitch); } internal static bool DisableEnemyShadowVeinScreenEffectEnabled() { return IsFeatureEnabled(_cfgDisableEnemyShadowVeinScreenEffect); } internal static bool DisablePostProcessingOverridesEnabled() { return IsFeatureEnabled(_cfgDisablePostProcessingOverrides); } internal static bool DisableHurtVignetteEnabled() { return IsFeatureEnabled(_cfgDisableHurtVignette); } internal static bool DisableMapOpenAnimationEnabled() { return IsFeatureEnabled(_cfgDisableMapOpenAnimation); } internal static bool DisableFirstPersonArmAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableFirstPersonArmAnimations); } internal static bool DisableGunfireCooldownEnabled() { if (!IsFeatureEnabled(_cfgDisableGunfireCooldown)) { return IsHostDisableGunfireCooldownEnabled(); } return true; } internal static bool DisableMeleeShakeEnabled() { return IsFeatureEnabled(_cfgDisableMeleeShake); } internal static bool DisableMeleeCooldownEnabled() { if (!IsFeatureEnabled(_cfgDisableMeleeCooldown)) { return IsHostDisableMeleeCooldownEnabled(); } return true; } internal static bool DisableGunTriggerAnimationEnabled() { return IsFeatureEnabled(_cfgDisableGunTriggerAnimation); } internal static bool DisableGunFireShakeEnabled() { return IsFeatureEnabled(_cfgDisableGunFireShake); } internal static bool DisableGunRecoilEnabled() { if (!IsFeatureEnabled(_cfgDisableGunRecoil)) { return IsHostDisableGunRecoilEnabled(); } return true; } internal static bool DisableGunMuzzleEffectsEnabled() { return IsFeatureEnabled(_cfgDisableGunMuzzleEffects); } internal static bool DisableGunSmokeEffectsEnabled() { return IsFeatureEnabled(_cfgDisableGunSmokeEffects); } internal static bool DisableDeathAndReviveEffectsEnabled() { return IsFeatureEnabled(_cfgDisableDeathAndReviveEffects); } internal static bool DisableSpiderScreenEffectsEnabled() { return IsFeatureEnabled(_cfgDisableSpiderScreenEffects); } internal static bool DisableTumbleVisualEffectsEnabled() { return IsFeatureEnabled(_cfgDisableTumbleVisualEffects); } internal static bool DisablePhysImpactVisualEffectsEnabled() { return IsFeatureEnabled(_cfgDisablePhysImpactVisualEffects); } internal static bool ThrottleValuableExtractionTrackingEnabled() { return IsFeatureEnabled(_cfgThrottleValuableExtractionTracking); } internal static bool ThrottleEnemyInvestigateEnabled() { return IsFeatureEnabled(_cfgThrottleEnemyInvestigate); } internal static bool SkipPublicGameJoinConfirmEnabled() { return IsFeatureEnabled(_cfgSkipPublicGameJoinConfirm); } internal static bool SkipPrivateGameConfirmEnabled() { return IsFeatureEnabled(_cfgSkipPrivateGameConfirm); } internal static bool DisableLobbyPageAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableLobbyPageAnimations); } internal static bool DisablePopupAnimationsEnabled() { return IsFeatureEnabled(_cfgDisablePopupAnimations); } internal static bool DisableServerListEntryAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableServerListEntryAnimations); } internal static bool DisableRegionListEntryAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableRegionListEntryAnimations); } internal static bool DisableMenuLoadingGraphicsAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableMenuLoadingGraphicsAnimations); } internal static bool DisableMenuButtonMotionEnabled() { return IsFeatureEnabled(_cfgDisableMenuButtonMotion); } internal static bool EnableValuableMapMarkersEnabled() { return !IsFeatureEnabled(_cfgEnableValuableMapMarkers); } internal static bool EnableValuableDiscoverPromptsEnabled() { return !IsFeatureEnabled(_cfgEnableValuableDiscoverPrompts); } internal static bool EnableValuableDynamicEffectsEnabled() { return !IsFeatureEnabled(_cfgEnableValuableDynamicEffects); } internal static bool DisableWorldSpaceUiAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableWorldSpaceUiAnimations); } internal static bool DisableUpgradeStandCameraShakeEnabled() { return IsFeatureEnabled(_cfgDisableUpgradeStandCameraShake); } internal static bool DisableUpgradeStandAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableUpgradeStandAnimations); } internal static bool DisableUpgradeStandBrokenFireEnabled() { return IsFeatureEnabled(_cfgDisableUpgradeStandBrokenFire); } internal static bool DisableUpgradePotionParticlesEnabled() { return IsFeatureEnabled(_cfgDisableUpgradePotionParticles); } internal static bool DisableUpgradeScreenGlitchEnabled() { return IsFeatureEnabled(_cfgDisableUpgradeScreenGlitch); } internal static bool DisableUpgradeCameraShakeEnabled() { return IsFeatureEnabled(_cfgDisableUpgradeCameraShake); } internal static bool DisableCosmeticMachineGrabBeamEffectsEnabled() { return IsFeatureEnabled(_cfgDisableCosmeticMachineGrabBeamEffects); } internal static bool DisableCosmeticMachineCameraShakeEnabled() { return IsFeatureEnabled(_cfgDisableCosmeticMachineCameraShake); } internal static bool DisableCosmeticMachineScreenAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableCosmeticMachineScreenAnimations); } internal static bool DisableCosmeticMachineLoopEffectsEnabled() { return IsFeatureEnabled(_cfgDisableCosmeticMachineLoopEffects); } internal static bool DisableResultScreenFadeEnabled() { return IsFeatureEnabled(_cfgDisableResultScreenFade); } internal static bool DisableResultScreenShakeEnabled() { return IsFeatureEnabled(_cfgDisableResultScreenShake); } internal static bool DisableResultScreenTokenParticlesEnabled() { return IsFeatureEnabled(_cfgDisableResultScreenTokenParticles); } internal static bool QuickSkipResultScreenEnabled() { return IsFeatureEnabled(_cfgQuickSkipResultScreen); } internal static bool DisableBatteryUiAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableBatteryUiAnimations); } internal static bool DisableFlashlightAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableFlashlightAnimations); } internal static bool DisableFlashlightFlickerEnabled() { return IsFeatureEnabled(_cfgDisableFlashlightFlicker); } internal static bool DisableLobbyChatAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableLobbyChatAnimations); } internal static bool DisableLobbyJoiningPromptFadeEnabled() { return IsFeatureEnabled(_cfgDisableLobbyJoiningPromptFade); } internal static bool DisableLeftPrepUiFadeEnabled() { return IsFeatureEnabled(_cfgDisableLeftPrepUiFade); } internal static bool DisableMoonPhaseUiEnabled() { return IsFeatureEnabled(_cfgDisableMoonPhaseUi); } internal static bool DisableMainMenuTruckAnimationEnabled() { return IsFeatureEnabled(_cfgDisableMainMenuTruckAnimation); } internal static bool DisableGuideArrowUiEnabled() { return IsFeatureEnabled(_cfgDisableGuideArrowUi); } internal static bool DisableBigMessageUiEnabled() { return IsFeatureEnabled(_cfgDisableBigMessageUi); } internal static bool DisableVehicleSpeedParticlesEnabled() { return IsFeatureEnabled(_cfgDisableVehicleSpeedParticles); } internal static bool DisableUraniumScreenEffectsEnabled() { return IsFeatureEnabled(_cfgDisableUraniumScreenEffects); } internal static bool DisableTumbleWingsUiEnabled() { return IsFeatureEnabled(_cfgDisableTumbleWingsUi); } internal static bool DisableTutorialTipsEnabled() { return IsFeatureEnabled(_cfgDisableTutorialTips); } internal static bool DisableArenaMessagesEnabled() { return IsFeatureEnabled(_cfgDisableArenaMessages); } internal static bool DisableArenaWarningLightsEnabled() { return IsFeatureEnabled(_cfgDisableArenaWarningLights); } internal static bool DisableArenaRaceTimerAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableArenaRaceTimerAnimations); } internal static bool DisableTruckScreenLoadingBarAnimationEnabled() { return IsFeatureEnabled(_cfgDisableTruckScreenLoadingBarAnimation); } internal static bool DisableTruckScreenChatAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableTruckScreenChatAnimations); } internal static bool DisableBatteryBarEffectsEnabled() { return IsFeatureEnabled(_cfgDisableBatteryBarEffects); } internal static bool DisableValueScreenEffectsEnabled() { return IsFeatureEnabled(_cfgDisableValueScreenEffects); } internal static bool DisableTutorialUiAnimationsEnabled() { return IsFeatureEnabled(_cfgDisableTutorialUiAnimations); } internal static void LogPopupEvent(string stage, MenuButtonPopUp menuButtonPopUp, string detail = null) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)menuButtonPopUp == (Object)null)) { string text = "Unknown"; if ((Object)(object)MenuManager.instance != (Object)null) { text = Traverse.Create((object)MenuManager.instance).Field("currentMenuPageIndex").GetValue()?.ToString() ?? "Unknown"; } string transformPath = GetTransformPath(((Component)menuButtonPopUp).transform); string text2 = (string.IsNullOrWhiteSpace(menuButtonPopUp.headerText) ? "" : menuButtonPopUp.headerText); string text3 = (string.IsNullOrWhiteSpace(menuButtonPopUp.bodyText) ? "" : menuButtonPopUp.bodyText); string text4 = (string.IsNullOrWhiteSpace(menuButtonPopUp.option1Text) ? "" : menuButtonPopUp.option1Text); string text5 = (string.IsNullOrWhiteSpace(menuButtonPopUp.option2Text) ? "" : menuButtonPopUp.option2Text); string text6 = string.Join(",", Array.ConvertAll(((Component)menuButtonPopUp).GetComponents(), (Component component) => (!((Object)(object)component == (Object)null)) ? ((object)component).GetType().Name : "null")); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[Popup:" + stage + "] page=" + text + " path=" + transformPath + " header=" + text2 + " body=" + text3 + " option1=" + text4 + " option2=" + text5 + " components=[" + text6 + "] detail=" + (detail ?? ""))); } } private static string GetTransformPath(Transform transform) { if ((Object)(object)transform == (Object)null) { return ""; } string text = ((Object)transform).name; Transform parent = transform.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } internal static bool IsLeftPrepSemiUi(SemiUI semiUi) { if (!(semiUi is LevelUI) && !(semiUi is GoalUI) && !(semiUi is HaulUI) && !(semiUi is StatsUI)) { return semiUi is MissionUI; } return true; } internal static void SnapSemiUiVisible(SemiUI semiUi) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)semiUi == (Object)null)) { Vector2 value = Traverse.Create((object)semiUi).Field("showPosition").GetValue(); Traverse.Create((object)semiUi).Field("showTimer").SetValue((object)0f); Traverse.Create((object)semiUi).Field("hideTimer").SetValue((object)0f); Traverse.Create((object)semiUi).Field("hidePositionCurrent").SetValue((object)value); Traverse.Create((object)semiUi).Field("showAnimationEvaluation").SetValue((object)1f); Traverse.Create((object)semiUi).Field("hideAnimationEvaluation").SetValue((object)0f); Traverse.Create((object)semiUi).Field("animationEval").SetValue((object)1f); RectTransform value2 = Traverse.Create((object)semiUi).Field("textRectTransform").GetValue(); if ((Object)(object)value2 != (Object)null) { ((Transform)value2).localPosition = Vector2.op_Implicit(value); } Component value3 = Traverse.Create((object)semiUi).Field("uiText").GetValue(); if ((Object)(object)value3 != (Object)null) { Traverse.Create((object)value3).Property("enabled", (object[])null).SetValue((object)true); } Traverse.Create((object)semiUi).Field("isHidden").SetValue((object)false); } } internal static bool ShouldRunValuableTracking(ValuableObject valuableObject) { if (!ThrottleValuableExtractionTrackingEnabled() || (Object)(object)valuableObject == (Object)null) { return true; } int instanceID = ((Object)valuableObject).GetInstanceID(); float unscaledTime = Time.unscaledTime; if (ValuableTrackingNextRunTimes.TryGetValue(instanceID, out var value) && unscaledTime < value) { return false; } ValuableTrackingNextRunTimes[instanceID] = unscaledTime + 0.75f; return true; } internal static bool ShouldRunImpactInvestigate(PhysGrabObjectImpactDetector impactDetector, float radius) { if (!ThrottleEnemyInvestigateEnabled() || (Object)(object)impactDetector == (Object)null) { return true; } float num = ((radius >= 10f) ? 0.2f : ((radius >= 3f) ? 0.35f : 0.5f)); int instanceID = ((Object)impactDetector).GetInstanceID(); float unscaledTime = Time.unscaledTime; if (ImpactInvestigateNextRunTimes.TryGetValue(instanceID, out var value) && unscaledTime < value) { return false; } ImpactInvestigateNextRunTimes[instanceID] = unscaledTime + num; return true; } internal static bool ShouldRunGlobalInvestigate(float radius, bool pathfindOnly) { if (!ThrottleEnemyInvestigateEnabled() || pathfindOnly || radius > 5f) { return true; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextGlobalInvestigateTime) { return false; } _nextGlobalInvestigateTime = unscaledTime + 0.2f; return true; } internal static bool ShouldAllowCameraShakeAtPosition(Vector3 position) { //IL_004d: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (IsInPlayerUpgradeSequence && DisableUpgradeCameraShakeEnabled()) { return false; } if (IsInItemMeleeSwingHit && DisableMeleeShakeEnabled()) { return false; } if (DisableCameraShakeEnabled()) { return false; } if (DisableUpgradeStandCameraShakeEnabled()) { UpgradeStand[] array = Object.FindObjectsOfType(); foreach (UpgradeStand val in array) { if ((Object)(object)val != (Object)null && Vector3.Distance(((Component)val).transform.position, position) <= 12f) { return false; } } } if (DisableCosmeticMachineCameraShakeEnabled()) { CosmeticShopMachine[] array2 = Object.FindObjectsOfType(); foreach (CosmeticShopMachine val2 in array2) { if ((Object)(object)val2 != (Object)null && Vector3.Distance(((Component)val2).transform.position, position) <= 10f) { return false; } } } return true; } internal static void CompleteSplashScreen() { SemiFunc.SplashScreenCompleted(); if ((Object)(object)SplashScreenUI.instance != (Object)null) { ((Component)SplashScreenUI.instance).gameObject.SetActive(false); } long num = 0L; if ((Object)(object)SteamManager.instance != (Object)null && Traverse.Create((object)SteamManager.instance).Field("lobbyIdToAutoJoin").GetValue() is long num2) { num = num2; } if ((Object)(object)SteamManager.instance != (Object)null && num != 0L) { SteamManager.instance.StartAutoJoiningLobby(); return; } if ((Object)(object)RunManager.instance != (Object)null) { Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true); } if ((Object)(object)GameDirector.instance != (Object)null) { GameDirector.instance.OutroStart(); } if ((Object)(object)ResultScreenUI.instance != (Object)null) { ResultScreenUI.instance.Disable(); } if ((Object)(object)NetworkManager.instance != (Object)null) { Traverse.Create((object)NetworkManager.instance).Field("leavePhotonRoom").SetValue((object)true); } } public static bool UseChinese() { if ((Object)(object)Instance == (Object)null || displayLanguage == null) { return false; } return displayLanguage.Value == DisplayLanguage.中文; } private static DisplayLanguage DetectDefaultLanguage() { try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { string text = pluginInfo.Key ?? string.Empty; string text2 = ((pluginInfo.Value == null || pluginInfo.Value.Metadata == null) ? string.Empty : (pluginInfo.Value.Metadata.Name ?? string.Empty)); for (int i = 0; i < _chineseModKeywords.Length; i++) { string value = _chineseModKeywords[i]; if ((!string.IsNullOrEmpty(text) && text.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(text2) && text2.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0)) { return DisplayLanguage.中文; } } for (int j = 0; j < _chineseEnvironmentPluginGuids.Length; j++) { if (string.Equals(text, _chineseEnvironmentPluginGuids[j], StringComparison.OrdinalIgnoreCase)) { return DisplayLanguage.中文; } } } } catch { } return DisplayLanguage.English; } private ConfigEntry BindI18N(string sectEN, string sectCN, string keyEN, string keyCN, string descEN, string descCN, T defaultVal, AcceptableValueBase acceptableValues = null, int? order = null, Action customDrawer = null, string displayEN = null) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes(); if (order.HasValue) { configurationManagerAttributes.Order = order.Value; } if (customDrawer != null) { configurationManagerAttributes.CustomDrawer = customDrawer; } CfgI18N cfgI18N = NewI18N(sectEN, sectCN, keyEN, keyCN, descEN, descCN, configurationManagerAttributes, readOnly: false); cfgI18N.DisplayEN = displayEN; if (!string.IsNullOrEmpty(displayEN)) { RegisterCustomDisplayKey(displayEN, cfgI18N); } ApplyI18N(cfgI18N); return (ConfigEntry)(object)(cfgI18N.Entry = (ConfigEntryBase)(object)((BaseUnityPlugin)this).Config.Bind(sectEN, keyEN, defaultVal, new ConfigDescription(descEN, acceptableValues, new object[1] { configurationManagerAttributes }))); } private void BindReadOnlyI18N(string sectEN, string sectCN, string keyEN, string keyCN, string valueEN, string valueCN, int? order = null, Action customDrawer = null, string displayEN = null) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { ReadOnly = true }; if (order.HasValue) { configurationManagerAttributes.Order = order.Value; } if (customDrawer != null) { configurationManagerAttributes.CustomDrawer = customDrawer; } CfgI18N cfgI18N = NewI18N(sectEN, sectCN, keyEN, keyCN, string.Empty, string.Empty, configurationManagerAttributes, readOnly: true); cfgI18N.ValueEN = valueEN; cfgI18N.ValueCN = valueCN; cfgI18N.DisplayEN = displayEN; if (!string.IsNullOrEmpty(displayEN)) { RegisterCustomDisplayKey(displayEN, cfgI18N); } ApplyI18N(cfgI18N); cfgI18N.ReadOnlyEntry = ((BaseUnityPlugin)this).Config.Bind(sectEN, keyEN, UseChinese() ? valueCN : valueEN, new ConfigDescription(string.Empty, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); cfgI18N.Entry = (ConfigEntryBase)(object)cfgI18N.ReadOnlyEntry; string text = (UseChinese() ? valueCN : valueEN); if (cfgI18N.ReadOnlyEntry.Value != text) { cfgI18N.ReadOnlyEntry.Value = text; } } private static void RegisterCustomDisplayKey(string displayEN, CfgI18N i18n) { if (!string.IsNullOrEmpty(displayEN) && i18n != null) { string key = displayEN.Trim(); if (!_cfgByKeyOnly.TryGetValue(key, out var value)) { value = new List(2); _cfgByKeyOnly[key] = value; } if (!value.Contains(i18n)) { value.Add(i18n); } } } private static CfgI18N NewI18N(string sectEN, string sectCN, string keyEN, string keyCN, string descEN, string descCN, ConfigurationManagerAttributes attrs, bool readOnly) { CfgI18N cfgI18N = new CfgI18N { SectionEN = sectEN, SectionCN = sectCN, KeyEN = keyEN, KeyCN = keyCN, DescEN = descEN, DescCN = descCN, Attrs = attrs }; ApplyI18N(cfgI18N); _cfgI18Ns.Add(cfgI18N); _cfgByEnSection[sectEN] = cfgI18N; _cfgByCnSection[sectCN] = cfgI18N; string text = FixNamingForLookup(sectEN); if (!string.Equals(text, sectEN, StringComparison.Ordinal)) { _cfgByEnSection[text] = cfgI18N; _cfgByEnSection[text.Trim()] = cfgI18N; } if (SectionEnglishNames != null && SectionEnglishNames.TryGetValue(sectEN, out var value) && !string.IsNullOrEmpty(value)) { _cfgByEnSection[value] = cfgI18N; _cfgByEnSection[value.Trim()] = cfgI18N; } _cfgByEnKey[sectEN + "\0" + keyEN] = cfgI18N; if (!_cfgByKeyOnly.TryGetValue(keyEN, out var value2)) { value2 = new List(2); _cfgByKeyOnly[keyEN] = value2; } value2.Add(cfgI18N); if (!_cfgByKeyCnOnly.TryGetValue(keyCN, out var value3)) { value3 = new List(2); _cfgByKeyCnOnly[keyCN] = value3; } value3.Add(cfgI18N); string text2 = FixNamingForLookup(keyEN); if (!string.Equals(text2, keyEN, StringComparison.Ordinal)) { if (!_cfgByKeyOnly.TryGetValue(text2, out var value4)) { value4 = new List(2); _cfgByKeyOnly[text2] = value4; } if (!value4.Contains(cfgI18N)) { value4.Add(cfgI18N); } } return cfgI18N; } private static void ApplyI18N(CfgI18N i18n) { if (i18n == null || i18n.Attrs == null) { return; } bool flag = UseChinese(); i18n.Attrs.Category = (flag ? i18n.SectionCN : i18n.SectionEN); i18n.Attrs.DispName = (flag ? i18n.KeyCN : (i18n.DisplayEN ?? i18n.KeyEN)); i18n.Attrs.Description = (flag ? i18n.DescCN : i18n.DescEN); if (i18n.ReadOnlyEntry != null) { string text = (flag ? i18n.ValueCN : i18n.ValueEN); if (i18n.ReadOnlyEntry.Value != text) { i18n.ReadOnlyEntry.Value = text; } } } private static void RefreshAllI18N() { for (int i = 0; i < _cfgI18Ns.Count; i++) { ApplyI18N(_cfgI18Ns[i]); } RefreshLiveLabels(); if ((Object)(object)_escapeMenuButton != (Object)null && (Object)(object)_escapeMenuButton.labelTMP != (Object)null) { ((TMP_Text)_escapeMenuButton.labelTMP).text = GetLocalizedText("更多设置", "More Settings "); } if ((Object)(object)_mainMenuButton != (Object)null && (Object)(object)_mainMenuButton.labelTMP != (Object)null) { ((TMP_Text)_mainMenuButton.labelTMP).text = GetLocalizedText("更多设置", "More Settings "); } bool flag = UseChinese(); if ((Object)(object)_quickSettingsTitleTMP != (Object)null) { ((TMP_Text)_quickSettingsTitleTMP).text = (flag ? "更多设置" : "More Settings "); } if ((Object)(object)_quickSettingsBackButton != (Object)null && (Object)(object)_quickSettingsBackButton.labelTMP != (Object)null) { ((TMP_Text)_quickSettingsBackButton.labelTMP).text = (flag ? "返回" : "Back "); } if ((Object)(object)_quickSettingsResetButton != (Object)null && (Object)(object)_quickSettingsResetButton.labelTMP != (Object)null) { ((TMP_Text)_quickSettingsResetButton.labelTMP).text = (flag ? "重置全部设置" : "Reset All Settings "); } if ((Object)(object)_sectionTitleTMP != (Object)null && !string.IsNullOrEmpty(_currentSectionName)) { ((TMP_Text)_sectionTitleTMP).text = GetDisplaySectionName(_currentSectionName); } } private static string FixNamingForLookup(string input) { if (string.IsNullOrEmpty(input)) { return input; } input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } internal static void TryHookREPOConfig(Harmony h) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0162: 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_018a: Expected O, but got Unknown //IL_018a: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("MenuLib.MenuAPI"); if (type == null) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"MenuLib not detected, skip REPOConfig bilingual hook."); } return; } HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "Postfix", (Type[])null, (Type[])null)); HashSet hashSet = new HashSet(StringComparer.Ordinal) { "CreateREPOLabel", "CreateREPOToggle", "CreateREPOSlider", "CreateREPOInputField", "CreateREPOButton" }; int num = 0; foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(type)) { if (!hashSet.Contains(declaredMethod.Name)) { continue; } ParameterInfo[] parameters = declaredMethod.GetParameters(); if (parameters.Length != 0 && !(parameters[0].ParameterType != typeof(string))) { try { h.Patch((MethodBase)declaredMethod, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch { } } } try { Type type2 = AccessTools.TypeByName("REPOConfig.ConfigMenu"); if (type2 != null) { MethodInfo methodInfo = AccessTools.Method(type2, "CreateModEntries", (Type[])null, (Type[])null); if (methodInfo != null) { h.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "CreateModEntriesPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "CreateModEntriesPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _createModEntriesPatchInstalled = true; } } } catch { } if (num > 0) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"REPOConfig bilingual hook attached ({num} UI creation methods)."); } } else { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"REPOConfig: no patchable UI creation methods found."); } } } catch (Exception ex) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)("REPOConfig hook failed: " + ex.Message)); } } } internal static void RegisterLiveLabelIfMatched(string label, object uiElement) { if (string.IsNullOrEmpty(label) || uiElement == null) { return; } string text = label.Trim(); bool flag = IsRenderingOurMod(); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[REPOSettings Debug] RegisterLiveLabelIfMatched label={label} (trimmed={text}), isRenderingOur={flag}"); } CfgI18N value2; List value3; List value5; if (_cfgByEnSection.TryGetValue(text, out var value)) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)("[REPOSettings Debug] Match section EN: " + text)); } RegisterOneLiveLabel(uiElement, value, isSection: true); } else if (_cfgByCnSection.TryGetValue(text, out value2)) { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)("[REPOSettings Debug] Match section CN: " + text)); } RegisterOneLiveLabel(uiElement, value2, isSection: true); } else if (_cfgByKeyOnly.TryGetValue(text, out value3) && value3 != null && value3.Count > 0) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)$"[REPOSettings Debug] Match key EN: {text}, count={value3.Count}"); } if (value3.Count == 1) { RegisterOneLiveLabel(uiElement, value3[0], isSection: false); return; } if (!_pendingKeyMatchIndex.TryGetValue(text, out var value4)) { value4 = 0; } if (value4 >= value3.Count) { value4 = 0; } RegisterOneLiveLabel(uiElement, value3[value4], isSection: false); _pendingKeyMatchIndex[text] = value4 + 1; } else if (_cfgByKeyCnOnly.TryGetValue(text, out value5) && value5 != null && value5.Count > 0) { Plugin instance5 = Instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)$"[REPOSettings Debug] Match key CN: {text}, count={value5.Count}"); } if (value5.Count == 1) { RegisterOneLiveLabel(uiElement, value5[0], isSection: false); return; } if (!_pendingKeyMatchIndex.TryGetValue(text, out var value6)) { value6 = 0; } if (value6 >= value5.Count) { value6 = 0; } RegisterOneLiveLabel(uiElement, value5[value6], isSection: false); _pendingKeyMatchIndex[text] = value6 + 1; } else { Plugin instance6 = Instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogInfo((object)("[REPOSettings Debug] No match found for label=" + label)); } } } private static void RegisterOneLiveLabel(object uiElement, CfgI18N i18n, bool isSection) { bool flag = IsOwnEntry(i18n); bool flag2 = IsRenderingOurMod(); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[REPOSettings Debug] RegisterOneLiveLabel keyEN={i18n.KeyEN}, isSection={isSection}, own={flag}, our={flag2}"); } if (!flag) { return; } if (!flag2) { if (!isSection) { return; } TextMeshProUGUI labelTmp = GetLabelTmp(uiElement); if ((Object)(object)labelTmp != (Object)null) { _pendingSectionLabel = new LiveLabel { Tmp = new WeakReference(labelTmp), UIElement = new WeakReference(uiElement), I18N = i18n, IsSection = true }; Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)("[REPOSettings Debug] Section matched outside main render lifecycle, staged as pending: " + i18n.SectionEN)); } } return; } TextMeshProUGUI labelTmp2 = GetLabelTmp(uiElement); if ((Object)(object)labelTmp2 == (Object)null) { return; } bool flag3 = UseChinese(); string text = ((!isSection) ? (flag3 ? i18n.KeyCN : GetUIVariant(i18n.DisplayEN ?? i18n.KeyEN)) : (flag3 ? i18n.SectionCN : GetUIVariant(i18n.SectionEN))); string text2 = ((TMP_Text)labelTmp2).text; if (!string.IsNullOrEmpty(text)) { try { ((TMP_Text)labelTmp2).text = text; Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)$"[REPOSettings Debug] Set text for {i18n.KeyEN} (isSection={isSection}): before='{text2}', after='{((TMP_Text)labelTmp2).text}', target='{text}'"); } SyncUIElementStringFields(uiElement, text); } catch (Exception ex) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogWarning((object)("[REPOSettings Debug] Failed to set text: " + ex.Message)); } } } _liveLabels.Add(new LiveLabel { Tmp = new WeakReference(labelTmp2), UIElement = new WeakReference(uiElement), I18N = i18n, IsSection = isSection }); if (!isSection && i18n.ReadOnlyEntry != null) { Object val = (Object)((uiElement is Object) ? uiElement : null); if (val != null && AccessTools.Field(uiElement.GetType(), "inputStringSystem") != null) { _liveValues.Add(new LiveValue { InputField = new WeakReference(val), I18N = i18n }); TrySetInputFieldValue(val, flag3 ? i18n.ValueCN : GetUIVariant(i18n.ValueEN)); } } if (!isSection) { Type type = uiElement.GetType(); if (!_toggleLeftTmpCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "leftButtonTMP"); _toggleLeftTmpCache[type] = value; } if (!_toggleRightTmpCache.TryGetValue(type, out var value2)) { value2 = AccessTools.Field(type, "rightButtonTMP"); _toggleRightTmpCache[type] = value2; } if (value != null && value2 != null) { object? value3 = value.GetValue(uiElement); TextMeshProUGUI val2 = (TextMeshProUGUI)((value3 is TextMeshProUGUI) ? value3 : null); object? value4 = value2.GetValue(uiElement); TextMeshProUGUI val3 = (TextMeshProUGUI)((value4 is TextMeshProUGUI) ? value4 : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null) { bool isLanguage = i18n.KeyEN == "REPOSettingsLanguage"; _liveToggleButtons.Add(new LiveToggleButtons { LeftTmp = new WeakReference(val2), RightTmp = new WeakReference(val3), IsLanguage = isLanguage }); ApplyToggleButtonText(val2, val3, flag3, isLanguage); } } } if (isSection || i18n.Entry == null || !i18n.Entry.SettingType.IsSubclassOf(typeof(Enum))) { return; } Object val4 = (Object)((uiElement is Object) ? uiElement : null); if (val4 != null) { Type type2 = uiElement.GetType(); if (!_sliderStringOptionsPropCache.TryGetValue(type2, out var value5)) { value5 = AccessTools.Property(type2, "stringOptions"); _sliderStringOptionsPropCache[type2] = value5; } if (value5 != null) { string[] names = Enum.GetNames(i18n.Entry.SettingType); string[] array = BuildEnumOptionsCN(names); string[] array2 = BuildEnumOptionsEN(names); LiveSliderOptions item = new LiveSliderOptions { Slider = new WeakReference(val4), I18N = i18n, OptionsCN = array, OptionsEN = array2 }; _liveSliderOptions.Add(item); TrySetSliderOptions(val4, value5, flag3 ? array : array2); } } } private static bool IsOwnEntry(CfgI18N i18n) { if (i18n == null) { return false; } if (i18n.Entry == null) { return false; } Plugin instance = Instance; if ((Object)(object)instance == (Object)null) { return false; } return i18n.Entry.ConfigFile == ((BaseUnityPlugin)instance).Config; } private static bool IsRenderingOurMod() { if (_isRenderingOurCustomSettings) { return true; } if (!_createModEntriesPatchInstalled) { return true; } if (_currentRenderingConfigFilePath == null) { return false; } Plugin instance = Instance; if ((Object)(object)instance == (Object)null) { return false; } return string.Equals(_currentRenderingConfigFilePath, ((BaseUnityPlugin)instance).Config.ConfigFilePath, StringComparison.OrdinalIgnoreCase); } private static TextMeshProUGUI GetLabelTmp(object uiElement) { try { Type type = uiElement.GetType(); if (!_labelTmpFieldCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "labelTMP"); _labelTmpFieldCache[type] = value; } return (TextMeshProUGUI)((value == null) ? null : /*isinst with value type is only supported in some contexts*/); } catch { return null; } } private static void SyncUIElementStringFields(object uiElement, string text) { if (uiElement == null || string.IsNullOrEmpty(text)) { return; } try { Type type = uiElement.GetType(); while (type != null && type != typeof(object)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(string) && fieldInfo.GetValue(uiElement) is string text2 && (string.Equals(text2, "A.REPOSettings Info", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.REPOSettings Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.REPOSettings Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.REPO Settings Info", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.REPO Settings Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.REPO Settings Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.Mod Info", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.Mod Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.Mod Info ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.Mod Info\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "A.模组信息", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Language", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Language ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Language\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "语言", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Name", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Name ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Name\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "模组名称", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Version", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Version ", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Mod Version\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "模组版本号", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭开枪间隔", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭开枪间隔(主机)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Gunfire Cooldown", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Gunfire Cooldown (Host)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Gunfire Cooldown\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Gunfire Cooldown (Host)\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭武器震动", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Shake", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Shake\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭武器造伤间隔", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭武器造伤间隔(主机)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Hit Freeze", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Hit Freeze (Host)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Hit Freeze\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Melee Hit Freeze (Host)\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭开枪后坐力", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭开枪后坐力(主机)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Recoil", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Recoil (Host)", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Recoil (Host)\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭吃药水升级粒子特效", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Particles", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Particles\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭吃药水升级屏幕故障特效", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Screen Glitch", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Screen Glitch\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭吃药水升级镜头震动", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Camera Shake", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Potion Upgrade Camera Shake\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭重构装备镜头震动", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Shake", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Shake\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭重构装备运转特效与表现", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Animations", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Animations\u200b", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "关闭重构装备损坏起火特效", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Broken Fire", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Disable Reroll Equipment Broken Fire\u200b", StringComparison.OrdinalIgnoreCase))) { fieldInfo.SetValue(uiElement, text); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[REPOSettings Debug] SyncField '" + fieldInfo.Name + "' on " + type.Name + " from '" + text2 + "' to '" + text + "'")); } } } type = type.BaseType; } } catch (Exception ex) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)("[REPOSettings Debug] SyncUIElementStringFields failed: " + ex.Message)); } } } internal static void RefreshLiveLabels() { bool flag = UseChinese(); for (int num = _liveLabels.Count - 1; num >= 0; num--) { LiveLabel liveLabel = _liveLabels[num]; if (!liveLabel.Tmp.TryGetTarget(out var target) || (Object)(object)target == (Object)null || (Object)(object)((Component)target).gameObject == (Object)null) { _liveLabels.RemoveAt(num); } else { string text = ((!liveLabel.IsSection) ? (flag ? liveLabel.I18N.KeyCN : GetUIVariant(liveLabel.I18N.DisplayEN ?? liveLabel.I18N.KeyEN)) : (flag ? liveLabel.I18N.SectionCN : GetUIVariant(liveLabel.I18N.SectionEN))); try { if (((TMP_Text)target).text != text) { ((TMP_Text)target).text = text; if (liveLabel.UIElement != null && liveLabel.UIElement.TryGetTarget(out var target2) && target2 != null) { SyncUIElementStringFields(target2, text); } } } catch { _liveLabels.RemoveAt(num); } } } for (int num2 = _liveValues.Count - 1; num2 >= 0; num2--) { LiveValue liveValue = _liveValues[num2]; if (!liveValue.InputField.TryGetTarget(out var target3) || target3 == (Object)null) { _liveValues.RemoveAt(num2); } else { string newVal = (flag ? liveValue.I18N.ValueCN : GetUIVariant(liveValue.I18N.ValueEN)); if (!TrySetInputFieldValue(target3, newVal)) { _liveValues.RemoveAt(num2); } } } for (int num3 = _liveSliderOptions.Count - 1; num3 >= 0; num3--) { LiveSliderOptions liveSliderOptions = _liveSliderOptions[num3]; if (!liveSliderOptions.Slider.TryGetTarget(out var target4) || target4 == (Object)null) { _liveSliderOptions.RemoveAt(num3); } else { Type type = ((object)target4).GetType(); if (!_sliderStringOptionsPropCache.TryGetValue(type, out var value) || value == null) { _liveSliderOptions.RemoveAt(num3); } else { TrySetSliderOptions(target4, value, flag ? liveSliderOptions.OptionsCN : liveSliderOptions.OptionsEN); } } } for (int num4 = _liveToggleButtons.Count - 1; num4 >= 0; num4--) { LiveToggleButtons liveToggleButtons = _liveToggleButtons[num4]; if (!liveToggleButtons.LeftTmp.TryGetTarget(out var target5) || (Object)(object)target5 == (Object)null || !liveToggleButtons.RightTmp.TryGetTarget(out var target6) || (Object)(object)target6 == (Object)null) { _liveToggleButtons.RemoveAt(num4); } else { ApplyToggleButtonText(target5, target6, flag, liveToggleButtons.IsLanguage); } } _pendingKeyMatchIndex.Clear(); } private static string[] BuildEnumOptionsCN(string[] enumNames) { string[] array = new string[enumNames.Length]; for (int i = 0; i < enumNames.Length; i++) { array[i] = (_enumNameENtoCN.TryGetValue(enumNames[i], out var value) ? value : enumNames[i]); } return array; } private static string[] BuildEnumOptionsEN(string[] enumNames) { string[] array = new string[enumNames.Length]; for (int i = 0; i < enumNames.Length; i++) { array[i] = (_enumNameCNtoEN.TryGetValue(enumNames[i], out var value) ? value : enumNames[i]); } return array; } private static void TrySetSliderOptions(Object sliderObj, PropertyInfo prop, string[] options) { try { prop.SetValue(sliderObj, options); } catch { } } private static void ApplyToggleButtonText(TextMeshProUGUI leftTmp, TextMeshProUGUI rightTmp, bool cn, bool isLanguage) { try { if (isLanguage) { ((TMP_Text)leftTmp).text = (cn ? "中文" : "Chinese"); ((TMP_Text)rightTmp).text = (cn ? "英文" : "English"); } else { ((TMP_Text)leftTmp).text = (cn ? "开" : "ON"); ((TMP_Text)rightTmp).text = (cn ? "关" : "OFF"); } } catch { } } private static bool TrySetInputFieldValue(Object ifObj, string newVal) { try { Type type = ((object)ifObj).GetType(); if (!_inputStringSystemFieldCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "inputStringSystem"); _inputStringSystemFieldCache[type] = value; } if (value == null) { return false; } object value2 = value.GetValue(ifObj); if (value2 == null) { return false; } Type type2 = value2.GetType(); if (!_inputStringSystemSetValueCache.TryGetValue(type2, out var value3)) { value3 = AccessTools.Method(type2, "SetValue", new Type[2] { typeof(string), typeof(bool) }, (Type[])null); _inputStringSystemSetValueCache[type2] = value3; } if (value3 == null) { return false; } value3.Invoke(value2, new object[2] { newVal ?? string.Empty, false }); return true; } catch { return false; } } internal static void ConfirmPendingSectionLabel() { if (_pendingSectionLabel == null) { return; } if (_pendingSectionLabel.Tmp.TryGetTarget(out var target) && (Object)(object)target != (Object)null) { string obj = (UseChinese() ? _pendingSectionLabel.I18N.SectionCN : GetUIVariant(_pendingSectionLabel.I18N.SectionEN)); string text2 = (((TMP_Text)target).text = obj); if (_pendingSectionLabel.UIElement.TryGetTarget(out var target2) && target2 != null) { SyncUIElementStringFields(target2, text2); } _liveLabels.Add(_pendingSectionLabel); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[REPOSettings Debug] Confirmed pending section: " + text2)); } } _pendingSectionLabel = null; } internal static void ClearPendingSectionLabel() { _pendingSectionLabel = null; } } [HarmonyPatch(typeof(SplashScreen), "StateWait")] internal static class SplashScreenStateWaitPatch { private static bool Prefix(SplashScreen __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if (!Plugin.DisableSplashScreenEnabled()) { return true; } if ((Object)(object)VideoOverlay.Instance != (Object)null) { VideoOverlay.Instance.Override(0.01f, 0f, 30f); } if ((Object)(object)GameDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2) { return false; } Plugin.CompleteSplashScreen(); Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(ArmIntroController), "Start")] internal static class ArmIntroControllerStartPatch { private static void Postfix(ArmIntroController __instance) { if (Plugin.DisableArmIntroAnimationEnabled()) { Object.Destroy((Object)(object)((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(LoadingUI), "StartLoading")] internal static class LoadingUIStartLoadingPatch { private static bool Prefix(LoadingUI __instance) { if (!Plugin.DisableLoadingAnimationEnabled()) { return true; } Traverse.Create((object)__instance).Field("levelAnimationStarted").SetValue((object)true); Traverse.Create((object)__instance).Field("levelAnimationCompleted").SetValue((object)true); if ((Object)(object)RunManager.instance != (Object)null) { Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true); } ((Component)__instance).gameObject.SetActive(false); return false; } } [HarmonyPatch(typeof(LoadingUI), "LevelAnimationStart")] internal static class LoadingUILevelAnimationStartPatch { private static bool Prefix(LoadingUI __instance) { if (!Plugin.DisableLoadingAnimationEnabled()) { return true; } Traverse.Create((object)__instance).Field("levelAnimationStarted").SetValue((object)true); Traverse.Create((object)__instance).Field("levelAnimationCompleted").SetValue((object)true); ((Component)__instance).gameObject.SetActive(false); if ((Object)(object)PlayerController.instance != (Object)null && (Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) { PlayerController.instance.playerAvatarScript.LoadingLevelAnimationCompleted(); } return false; } } [HarmonyPatch(typeof(LoadingUI), "LateUpdate")] internal static class LoadingUILateUpdatePatch { private static bool Prefix(LoadingUI __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableLoadingAnimationEnabled()) { return true; } if ((Object)(object)__instance.fadeImage != (Object)null) { ((Graphic)__instance.fadeImage).color = Color.clear; } if ((Object)(object)__instance.fadeBehindImage != (Object)null) { ((Component)__instance.fadeBehindImage).gameObject.SetActive(false); } return false; } } [HarmonyPatch(typeof(VideoOverlay), "Update")] internal static class VideoOverlayUpdatePatch { private static bool Prefix(VideoOverlay __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableVideoOverlayEnabled()) { return true; } if ((Object)(object)__instance.RawImage != (Object)null) { ((Graphic)__instance.RawImage).color = new Color(1f, 1f, 1f, 0f); } return false; } } [HarmonyPatch(typeof(CameraShake), "Shake")] internal static class CameraShakeShakePatch { private static bool Prefix() { if (Plugin.IsInPlayerUpgradeSequence && Plugin.DisableUpgradeCameraShakeEnabled()) { return false; } return !Plugin.DisableCameraShakeEnabled(); } } [HarmonyPatch(typeof(CameraShake), "ShakeDistance")] internal static class CameraShakeShakeDistancePatch { private static bool Prefix(float strength, float distanceMin, float distanceMax, Vector3 position, float time) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Plugin.ShouldAllowCameraShakeAtPosition(position); } } [HarmonyPatch(typeof(CameraBob), "Update")] internal static class CameraBobUpdatePatch { private static void Postfix(CameraBob __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableCameraAnimationEnabled()) { ((Component)__instance).transform.localPosition = Vector3.zero; ((Component)__instance).transform.localRotation = Quaternion.identity; } } } [HarmonyPatch(typeof(CameraJump), "Update")] internal static class CameraJumpUpdatePatch { private static void Postfix(CameraJump __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableCameraAnimationEnabled()) { ((Component)__instance).transform.localPosition = Vector3.zero; ((Component)__instance).transform.localRotation = Quaternion.identity; } } } [HarmonyPatch(typeof(CameraCrouchPosition), "Update")] internal static class CameraCrouchPositionUpdatePatch { private static void Postfix(CameraCrouchPosition __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableCameraAnimationEnabled()) { ((Component)__instance).transform.localPosition = Vector3.zero; } } } [HarmonyPatch(typeof(CameraCrawlPosition), "Update")] internal static class CameraCrawlPositionUpdatePatch { private static void Postfix(CameraCrawlPosition __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableCameraAnimationEnabled()) { ((Component)__instance).transform.localPosition = Vector3.zero; } } } [HarmonyPatch(typeof(CameraCrouchRotation), "Update")] internal static class CameraCrouchRotationUpdatePatch { private static void Postfix(CameraCrouchRotation __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableCameraAnimationEnabled()) { ((Component)__instance).transform.localRotation = Quaternion.identity; } } } [HarmonyPatch(typeof(CameraGlitch), "Update")] internal static class CameraGlitchUpdatePatch { private static bool Prefix(CameraGlitch __instance) { if (!Plugin.DisableCameraGlitchEnabled()) { return true; } if ((Object)(object)__instance.ActiveParent != (Object)null) { __instance.ActiveParent.SetActive(false); } Sound doNotLookEffectSound = __instance.doNotLookEffectSound; if (doNotLookEffectSound != null) { doNotLookEffectSound.PlayLoop(false, 2f, 1f, 1f, 1f); } Traverse.Create((object)__instance).Field("doNotLookEffectTimer").SetValue((object)0f); Traverse.Create((object)__instance).Field("doNotLookEffectImpulseTimer").SetValue((object)0f); return false; } } [HarmonyPatch(typeof(CameraGlitch), "DoNotLookEffectSet")] internal static class CameraGlitchDoNotLookEffectSetPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayLong")] internal static class CameraGlitchPlayLongPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayShort")] internal static class CameraGlitchPlayShortPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayTiny")] internal static class CameraGlitchPlayTinyPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayLongHurt")] internal static class CameraGlitchPlayLongHurtPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayShortHurt")] internal static class CameraGlitchPlayShortHurtPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayLongHeal")] internal static class CameraGlitchPlayLongHealPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayShortHeal")] internal static class CameraGlitchPlayShortHealPatch { private static bool Prefix() { return !Plugin.DisableCameraGlitchEnabled(); } } [HarmonyPatch(typeof(CameraGlitch), "PlayUpgrade")] internal static class CameraGlitchPlayUpgradePatch { private static bool Prefix() { if (Plugin.DisableCameraGlitchEnabled() || Plugin.DisableUpgradeScreenGlitchEnabled()) { return false; } return true; } } [HarmonyPatch(typeof(PostProcessing), "LensDistortionOverride")] internal static class PostProcessingLensDistortionOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "VignetteOverride")] internal static class PostProcessingVignetteOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "BloomOverride")] internal static class PostProcessingBloomOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "SaturationOverride")] internal static class PostProcessingSaturationOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "ContrastOverride")] internal static class PostProcessingContrastOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "ResolutionOverride")] internal static class PostProcessingResolutionOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(PostProcessing), "GrainIntensityOverride")] internal static class PostProcessingGrainIntensityOverridePatch { private static bool Prefix() { return !Plugin.DisablePostProcessingOverridesEnabled(); } } [HarmonyPatch(typeof(HurtVignette), "Update")] internal static class HurtVignetteUpdatePatch { private static bool Prefix(HurtVignette __instance) { //IL_001e: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableHurtVignetteEnabled()) { return true; } if ((Object)(object)__instance.image != (Object)null) { ((Graphic)__instance.image).color = __instance.inactiveColor; } if ((Object)(object)__instance.rectTransform != (Object)null) { ((Transform)__instance.rectTransform).localScale = Vector3.one * __instance.inactiveScale; } return false; } } [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] internal static class PlayerAvatarRightArmUpdatePatch { private static void Postfix(PlayerAvatarRightArm __instance) { //IL_001d: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableFirstPersonArmAnimationsEnabled()) { if ((Object)(object)__instance.rightArmTransform != (Object)null) { __instance.rightArmTransform.localEulerAngles = __instance.basePose; } if ((Object)(object)__instance.rightArmParentTransform != (Object)null) { __instance.rightArmParentTransform.localRotation = Quaternion.identity; __instance.rightArmParentTransform.localScale = Vector3.one; } } } } [HarmonyPatch(typeof(PlayerAvatarLeftArm), "Update")] internal static class PlayerAvatarLeftArmUpdatePatch { private static void Postfix(PlayerAvatarLeftArm __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableFirstPersonArmAnimationsEnabled() && (Object)(object)__instance.leftArmTransform != (Object)null) { __instance.leftArmTransform.localEulerAngles = __instance.basePose; } } } [HarmonyPatch(typeof(PlayerArmBackaway), "Update")] internal static class PlayerArmBackawayUpdatePatch { private static void Postfix(PlayerArmBackaway __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableFirstPersonArmAnimationsEnabled()) { ((Component)__instance).transform.localPosition = Vector3.zero; } } } [HarmonyPatch(typeof(ItemGun), "MuzzleFlash")] internal static class ItemGunMuzzleFlashPatch { private static bool Prefix() { return !Plugin.DisableGunMuzzleEffectsEnabled(); } } [HarmonyPatch(typeof(ItemGunMuzzleFlash), "ActivateAllEffects")] internal static class ItemGunMuzzleFlashActivateAllEffectsPatch { private static void Postfix(ItemGunMuzzleFlash __instance) { if (!Plugin.DisableGunSmokeEffectsEnabled()) { return; } Transform val = ((Component)__instance).transform.Find("Particle Smoke"); if (!((Object)(object)val == (Object)null)) { ParticleSystem component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.Stop(true, (ParticleSystemStopBehavior)0); ((Component)component).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(ItemGun), "StartTriggerAnimation")] internal static class ItemGunStartTriggerAnimationPatch { private static bool Prefix() { return !Plugin.DisableGunTriggerAnimationEnabled(); } } [HarmonyPatch(typeof(ItemGunBullet), "ActivateAll")] internal static class ItemGunBulletActivateAllPatch { private static void Postfix(ItemGunBullet __instance) { if (!Plugin.DisableGunSmokeEffectsEnabled()) { return; } Transform val = ((Component)__instance).transform.Find("Hit Effect"); if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.Find("Particle Smoke"); if (!((Object)(object)val2 == (Object)null)) { ParticleSystem component = ((Component)val2).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.Stop(true, (ParticleSystemStopBehavior)0); ((Component)component).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(ItemGun), "ShootRPC")] internal static class ItemGunShootRpcPatch { private struct GunShootState { internal float GunRecoilForce; internal float CameraShakeMultiplier; } private static void Prefix(ItemGun __instance, ref GunShootState __state) { __state = new GunShootState { GunRecoilForce = __instance.gunRecoilForce, CameraShakeMultiplier = __instance.cameraShakeMultiplier }; if (Plugin.DisableGunRecoilEnabled()) { __instance.gunRecoilForce = 0f; } if (Plugin.DisableGunFireShakeEnabled()) { __instance.cameraShakeMultiplier = 0f; } } private static void Postfix(ItemGun __instance, GunShootState __state) { __instance.gunRecoilForce = __state.GunRecoilForce; __instance.cameraShakeMultiplier = __state.CameraShakeMultiplier; } } [HarmonyPatch(typeof(ItemGun), "StateReloading")] internal static class ItemGunStateReloadingPatch { private static readonly FieldRef StateTimeMaxRef = AccessTools.FieldRefAccess("stateTimeMax"); private static void Postfix(ItemGun __instance) { if (Plugin.DisableGunfireCooldownEnabled()) { StateTimeMaxRef.Invoke(__instance) = 0f; } } } [HarmonyPatch(typeof(ItemMelee), "SwingHitRPC")] internal static class ItemMeleeSwingHitRpcPatch { private static float _savedHitFreeze; private static void Prefix(ItemMelee __instance) { _savedHitFreeze = __instance.hitFreeze; if (Plugin.DisableMeleeCooldownEnabled()) { __instance.hitFreeze = 0f; } Plugin.IsInItemMeleeSwingHit = true; } private static void Postfix(ItemMelee __instance) { __instance.hitFreeze = _savedHitFreeze; Plugin.IsInItemMeleeSwingHit = false; } } [HarmonyPatch(typeof(ItemMelee), "DinkRPC")] internal static class ItemMeleeDinkRpcPatch { private static float _savedHitFreeze; private static void Prefix(ItemMelee __instance) { _savedHitFreeze = __instance.hitFreeze; if (Plugin.DisableMeleeCooldownEnabled()) { __instance.hitFreeze = 0f; } } private static void Postfix(ItemMelee __instance) { __instance.hitFreeze = _savedHitFreeze; } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "Start")] internal static class PhysGrabObjectImpactDetectorStartPatch { private static void Postfix(PhysGrabObjectImpactDetector __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (Plugin.DisablePhysImpactVisualEffectsEnabled()) { if ((Object)(object)__instance.particles != (Object)null) { ((Component)__instance.particles).gameObject.SetActive(false); } __instance.onImpactLight = new UnityEvent(); __instance.onBreakLight = new UnityEvent(); } } } [HarmonyPatch(typeof(PhysObjectParticles), "ImpactSmoke")] internal static class PhysObjectParticlesImpactSmokePatch { private static bool Prefix() { return !Plugin.DisablePhysImpactVisualEffectsEnabled(); } } [HarmonyPatch(typeof(PhysObjectParticles), "DestroyParticles", new Type[] { typeof(Vector3), typeof(Vector3), typeof(bool) })] internal static class PhysObjectParticlesDestroyParticlesPatch { private static bool Prefix() { return !Plugin.DisablePhysImpactVisualEffectsEnabled(); } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "ImpactEffectRPC")] internal static class PhysGrabObjectImpactDetectorImpactEffectRpcPatch { private static bool Prefix() { return !Plugin.DisablePhysImpactVisualEffectsEnabled(); } } [HarmonyPatch(typeof(ValuableObject), "UpdateExtractionTracking")] internal static class ValuableObjectUpdateExtractionTrackingPatch { private static bool Prefix(ValuableObject __instance) { return Plugin.ShouldRunValuableTracking(__instance); } } [HarmonyPatch(typeof(Map), "AddValuable")] internal static class MapAddValuablePatch { private static bool Prefix() { return Plugin.EnableValuableMapMarkersEnabled(); } } [HarmonyPatch(typeof(MenuManager), "PagePopUpTwoOptions")] internal static class MenuManagerPagePopUpTwoOptionsPatch { private static readonly FieldRef ConnectRandomRef = AccessTools.FieldRefAccess("connectRandom"); private static readonly FieldRef CurrentMenuPageIndexRef = AccessTools.FieldRefAccess("currentMenuPageIndex"); private static bool Prefix(MenuButtonPopUp menuButtonPopUp, string popUpHeader, Color popUpHeaderColor, string popUpText, string option1Text, string option2Text, bool richText) { if ((Object)(object)menuButtonPopUp == (Object)null) { return true; } string arg = (((Object)(object)MenuManager.instance != (Object)null) ? ((object)(MenuPageIndex)(ref CurrentMenuPageIndexRef.Invoke(MenuManager.instance))).ToString() : "Unknown"); string arg2 = (((Object)(object)GameManager.instance != (Object)null) ? ConnectRandomRef.Invoke(GameManager.instance).ToString() : "Unknown"); Plugin.LogPopupEvent("Seen", menuButtonPopUp, $"currentPage={arg}, multiplayer={SemiFunc.MainMenuIsMultiplayer()}, connectRandom={arg2}"); string header = (popUpHeader ?? string.Empty).ToLowerInvariant(); string body = (popUpText ?? string.Empty).ToLowerInvariant(); if (Plugin.SkipPublicGameJoinConfirmEnabled()) { MenuElementServer component = ((Component)menuButtonPopUp).GetComponent(); if ((Object)(object)component != (Object)null) { Plugin.LogPopupEvent("AutoSkipPublic", menuButtonPopUp, "source=MenuElementServer"); component.OnButton(); return false; } if (IsPublicGamePopup(header, body)) { Plugin.LogPopupEvent("AutoSkipPublic", menuButtonPopUp, "reason=public_popup_text_rule"); UnityEvent option1Event = menuButtonPopUp.option1Event; if (option1Event != null) { option1Event.Invoke(); } return false; } } if (Plugin.SkipPrivateGameConfirmEnabled() && IsPrivateGamePopup(header, body)) { Plugin.LogPopupEvent("AutoSkipPrivate", menuButtonPopUp, "reason=private_popup_text_rule"); UnityEvent option1Event2 = menuButtonPopUp.option1Event; if (option1Event2 != null) { option1Event2.Invoke(); } return false; } return true; } private static bool IsPrivateGamePopup(string header, string body) { if (!header.Contains("host") && !body.Contains("best computer")) { return body.Contains("are you this friend"); } return true; } private static bool IsPublicGamePopup(string header, string body) { if (!header.Contains("warning") && !body.Contains("random players")) { return body.Contains("mean people"); } return true; } } [HarmonyPatch(typeof(MenuPageEsc), "ButtonEventQuitToMenu")] internal static class MenuPageEscQuitToMenuPatch { private static void Prefix() { if (Plugin.DisableLoadingAnimationEnabled() && !((Object)(object)RunManager.instance == (Object)null)) { Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true); } } } [HarmonyPatch(typeof(MenuPageLobby), "ButtonLeave")] internal static class MenuPageLobbyButtonLeavePatch { private static void Prefix() { if (Plugin.DisableLoadingAnimationEnabled() && !((Object)(object)RunManager.instance == (Object)null)) { Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true); } } } [HarmonyPatch(typeof(RunManager), "LeaveToMainMenu")] internal static class RunManagerLeaveToMainMenuPatch { private static void Prefix() { if (Plugin.DisableLoadingAnimationEnabled() && !((Object)(object)RunManager.instance == (Object)null)) { Traverse.Create((object)RunManager.instance).Field("skipLoadingUI").SetValue((object)true); } } } [HarmonyPatch(typeof(MenuPage), "StateOpening")] internal static class MenuPageStateOpeningPatch { private static readonly FieldRef OriginalPositionRef = AccessTools.FieldRefAccess("originalPosition"); private static readonly FieldRef PopUpAnimationRef = AccessTools.FieldRefAccess("popUpAnimation"); private static readonly FieldRef RectTransformRef = AccessTools.FieldRefAccess("rectTransform"); private static bool Prefix(MenuPage __instance) { //IL_0040: 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) bool num = (PopUpAnimationRef.Invoke(__instance) ? Plugin.DisablePopupAnimationsEnabled() : Plugin.DisableLobbyPageAnimationsEnabled()); RectTransform val = RectTransformRef.Invoke(__instance); if (!num || (Object)(object)val == (Object)null) { return true; } ((Transform)val).localPosition = Vector2.op_Implicit(OriginalPositionRef.Invoke(__instance)); __instance.PageStateSet((PageState)1); return false; } } [HarmonyPatch(typeof(MenuPage), "StateClosing")] internal static class MenuPageStateClosingPatch { private static readonly FieldRef CurrentMenuPageRef = AccessTools.FieldRefAccess("currentMenuPage"); private static readonly FieldRef PopUpAnimationRef = AccessTools.FieldRefAccess("popUpAnimation"); private static bool Prefix(MenuPage __instance) { if (!(PopUpAnimationRef.Invoke(__instance) ? Plugin.DisablePopupAnimationsEnabled() : Plugin.DisableLobbyPageAnimationsEnabled())) { return true; } if ((Object)(object)MenuManager.instance != (Object)null && (Object)(object)CurrentMenuPageRef.Invoke(MenuManager.instance) == (Object)(object)__instance) { CurrentMenuPageRef.Invoke(MenuManager.instance) = null; } UnityEvent onPageEnd = __instance.onPageEnd; if (onPageEnd != null) { onPageEnd.Invoke(); } MenuManager instance = MenuManager.instance; if (instance != null) { instance.PageRemove(__instance); } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(MenuElementServer), "UpdateIntro")] internal static class MenuElementServerUpdateIntroPatch { private static readonly FieldRef IntroDoneRef = AccessTools.FieldRefAccess("introDone"); private static bool Prefix(MenuElementServer __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableServerListEntryAnimationsEnabled()) { return true; } if ((Object)(object)__instance.animationTransform != (Object)null) { __instance.animationTransform.anchoredPosition = Vector2.zero; } IntroDoneRef.Invoke(__instance) = true; return false; } } [HarmonyPatch(typeof(MenuElementRegion), "UpdateIntro")] internal static class MenuElementRegionUpdateIntroPatch { private static readonly FieldRef IntroLerpRef = AccessTools.FieldRefAccess("introLerp"); private static bool Prefix(MenuElementRegion __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableRegionListEntryAnimationsEnabled()) { return true; } if ((Object)(object)__instance.animationTransform != (Object)null) { __instance.animationTransform.anchoredPosition = Vector2.zero; } IntroLerpRef.Invoke(__instance) = 1f; __instance.animationSkip = true; return false; } } [HarmonyPatch(typeof(MenuLoadingGraphics), "Update")] internal static class MenuLoadingGraphicsUpdatePatch { private static bool Prefix(MenuLoadingGraphics __instance) { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableMenuLoadingGraphicsAnimationsEnabled()) { return true; } Component value = Traverse.Create((object)__instance).Field("loadingCanvasGroup").GetValue(); if ((Object)(object)value == (Object)null) { return true; } if (!Traverse.Create((object)__instance).Field("loadingActive").GetValue()) { return false; } if (Traverse.Create((object)__instance).Field("loadingDone").GetValue()) { float num = Traverse.Create((object)value).Property("alpha", (object[])null).GetValue() - Time.deltaTime * 5f; Traverse.Create((object)value).Property("alpha", (object[])null).SetValue((object)num); if (num <= 0.01f) { Traverse.Create((object)value).Property("alpha", (object[])null).SetValue((object)0f); value.gameObject.SetActive(false); Traverse.Create((object)__instance).Field("loadingActive").SetValue((object)false); } } else { float value2 = Traverse.Create((object)value).Property("alpha", (object[])null).GetValue(); Traverse.Create((object)value).Property("alpha", (object[])null).SetValue((object)Mathf.Clamp01(value2 + Time.deltaTime * 5f)); } if ((Object)(object)__instance.loadingCircle != (Object)null) { ((Transform)__instance.loadingCircle).localEulerAngles = Vector3.zero; } if ((Object)(object)__instance.loadingHourglass != (Object)null) { ((Transform)__instance.loadingHourglass).localEulerAngles = Vector3.zero; } Traverse.Create((object)__instance).Field("hourglassLerp").SetValue((object)0f); return false; } } [HarmonyPatch(typeof(MenuButton), "OnHovering")] internal static class MenuButtonOnHoveringPatch { private static readonly FieldRef ButtonTextSelectedOriginalPosRef = AccessTools.FieldRefAccess("buttonTextSelectedOriginalPos"); private static void Postfix(MenuButton __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableMenuButtonMotionEnabled() && !((Object)(object)__instance == (Object)null)) { Component value = Traverse.Create((object)__instance).Field("buttonText").GetValue(); if (!((Object)(object)value == (Object)null)) { value.transform.localPosition = ButtonTextSelectedOriginalPosRef.Invoke(__instance); } } } } [HarmonyPatch(typeof(MapToolController), "Update")] internal static class MapToolControllerUpdatePatch { private static readonly FieldRef ActiveRef = AccessTools.FieldRefAccess("Active"); private static readonly FieldRef HideLerpRef = AccessTools.FieldRefAccess("HideLerp"); private static readonly FieldRef PhotonViewRef = AccessTools.FieldRefAccess("photonView"); private static void Postfix(MapToolController __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableMapOpenAnimationEnabled() || (Object)(object)__instance == (Object)null) { return; } PhotonView val = PhotonViewRef.Invoke(__instance); int num; float num2; if (GameManager.Multiplayer()) { if ((Object)(object)val != (Object)null) { num = (val.IsMine ? 1 : 0); if (num != 0) { goto IL_0044; } } else { num = 0; } num2 = 0f; goto IL_0049; } num = 1; goto IL_0044; IL_0049: float num3 = num2; Vector3 localScale = Vector3.one; bool flag = ActiveRef.Invoke(__instance); if (num == 0 && (Object)(object)__instance.FollowTransformClient != (Object)null) { localScale = __instance.FollowTransformClient.localScale; } HideLerpRef.Invoke(__instance) = (flag ? 0f : 1f); if (flag) { ((Component)__instance).transform.parent.localScale = localScale; if ((Object)(object)__instance.LocalShadowsParent != (Object)null) { __instance.LocalShadowsParent.transform.localScale = localScale; } if ((Object)(object)__instance.HideTransform != (Object)null) { __instance.HideTransform.localRotation = Quaternion.identity; } } else { ((Component)__instance).transform.parent.localScale = Vector3.zero; if ((Object)(object)__instance.LocalShadowsParent != (Object)null) { __instance.LocalShadowsParent.transform.localScale = Vector3.zero; } if ((Object)(object)__instance.HideTransform != (Object)null) { __instance.HideTransform.localRotation = Quaternion.Euler(num3, 0f, 0f); } } return; IL_0044: num2 = 90f; goto IL_0049; } } [HarmonyPatch(typeof(ValuableDiscover), "New")] internal static class ValuableDiscoverNewPatch { private static bool Prefix() { return Plugin.EnableValuableDiscoverPromptsEnabled(); } } [HarmonyPatch(typeof(ValuableFlashlight), "Update")] internal static class ValuableFlashlightUpdatePatch { private static void Postfix(ValuableFlashlight __instance) { if (!Plugin.EnableValuableDynamicEffectsEnabled() && (Object)(object)__instance.bigLight != (Object)null) { __instance.bigLight.SetActive(false); } } } [HarmonyPatch(typeof(ValuableStarWand), "SparklesVFX")] internal static class ValuableStarWandSparklesVfxPatch { private static bool Prefix(ValuableStarWand __instance) { if (Plugin.EnableValuableDynamicEffectsEnabled()) { return true; } if ((Object)(object)__instance.particle != (Object)null && __instance.particle.isPlaying) { __instance.particle.Stop(true); } return false; } } [HarmonyPatch(typeof(ValuableWizardTimeGlass), "Update")] internal static class ValuableWizardTimeGlassUpdatePatch { private static void Postfix(ValuableWizardTimeGlass __instance) { if (!Plugin.EnableValuableDynamicEffectsEnabled()) { Sound soundTimeGlassLoop = __instance.soundTimeGlassLoop; if (soundTimeGlassLoop != null) { soundTimeGlassLoop.PlayLoop(false, 0.8f, 0.8f, 1f, 1f); } if ((Object)(object)__instance.particleSystemGlitter != (Object)null && __instance.particleSystemGlitter.isPlaying) { __instance.particleSystemGlitter.Stop(true); } if ((Object)(object)__instance.particleSystemSwirl != (Object)null && __instance.particleSystemSwirl.isPlaying) { __instance.particleSystemSwirl.Stop(true); } if ((Object)(object)__instance.timeGlassLight != (Object)null) { __instance.timeGlassLight.intensity = 0f; ((Component)__instance.timeGlassLight).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(ValuableLovePotion), "Update")] internal static class ValuableLovePotionUpdatePatch { private static void Postfix(ValuableLovePotion __instance) { if (!Plugin.EnableValuableDynamicEffectsEnabled()) { ParticleSystem componentInChildren = ((Component)__instance).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.isPlaying) { componentInChildren.Stop(true); } } } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "EnemyInvestigate")] internal static class PhysGrabObjectImpactDetectorEnemyInvestigatePatch { private static bool Prefix(PhysGrabObjectImpactDetector __instance, float radius) { return Plugin.ShouldRunImpactInvestigate(__instance, radius); } } [HarmonyPatch(typeof(EnemyDirector), "SetInvestigate")] internal static class EnemyDirectorSetInvestigatePatch { private static bool Prefix(float radius, bool pathfindOnly = false) { return Plugin.ShouldRunGlobalInvestigate(radius, pathfindOnly); } } [HarmonyPatch(typeof(PlayerDeathEffects), "Trigger")] internal static class PlayerDeathEffectsTriggerPatch { private static bool Prefix(PlayerDeathEffects __instance) { if (!Plugin.DisableDeathAndReviveEffectsEnabled()) { return true; } ((Component)__instance).gameObject.SetActive(false); return false; } } [HarmonyPatch(typeof(ReviveScreenEffect), "Active")] internal static class ReviveScreenEffectActivePatch { private static bool Prefix(ReviveScreenEffect __instance) { if (!Plugin.DisableDeathAndReviveEffectsEnabled()) { return true; } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(ScreenSpiderEffect), "Update")] internal static class ScreenSpiderEffectUpdatePatch { private static bool Prefix(ScreenSpiderEffect __instance) { if (!Plugin.DisableSpiderScreenEffectsEnabled()) { return true; } Sound spiderLoop = __instance.spiderLoop; if (spiderLoop != null) { spiderLoop.PlayLoop(false, 10f, 1f, 1f, 1f); } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "PowerupJumpEffect")] internal static class PlayerAvatarVisualsPowerupJumpEffectPatch { private static bool Prefix() { return !Plugin.DisableTumbleVisualEffectsEnabled(); } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "TumbleBreakFreeEffect")] internal static class PlayerAvatarVisualsTumbleBreakFreeEffectPatch { private static bool Prefix() { return !Plugin.DisableTumbleVisualEffectsEnabled(); } } [HarmonyPatch(typeof(PlayerTumble), "TumbleImpactRPC")] internal static class PlayerTumbleImpactRpcPatch { private static void Postfix(PlayerTumble __instance) { if (Plugin.DisableTumbleVisualEffectsEnabled() && (Object)(object)__instance.impactParticle != (Object)null) { __instance.impactParticle.Stop(true, (ParticleSystemStopBehavior)0); ((Component)__instance.impactParticle).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(WorldSpaceUIParent), "Update")] internal static class WorldSpaceUIParentUpdatePatch { private static readonly FieldRef HideTimerRef = AccessTools.FieldRefAccess("hideTimer"); private static void Postfix(WorldSpaceUIParent __instance) { if (Plugin.DisableWorldSpaceUiAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { Component value = Traverse.Create((object)__instance).Field("canvasGroup").GetValue(); if (!((Object)(object)value == (Object)null)) { float num = ((HideTimerRef.Invoke(__instance) > 0f) ? 0f : 1f); Traverse.Create((object)__instance).Field("hideAlpha").SetValue((object)num); Traverse.Create((object)value).Property("alpha", (object[])null).SetValue((object)num); } } } } [HarmonyPatch(typeof(WorldSpaceUIValue), "Update")] internal static class WorldSpaceUIValueUpdatePatch { private static readonly FieldRef ShowTimerRef = AccessTools.FieldRefAccess("showTimer"); private static readonly FieldRef ScaleRef = AccessTools.FieldRefAccess("scale"); private static readonly FieldRef CurveLerpRef = AccessTools.FieldRefAccess("curveLerp"); private static readonly FieldRef CurrentPhysGrabObjectRef = AccessTools.FieldRefAccess("currentPhysGrabObject"); private static readonly FieldRef CurrentStaticGrabObjectRef = AccessTools.FieldRefAccess("currentStaticGrabObject"); private static void Postfix(WorldSpaceUIValue __instance) { //IL_0068: 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) if (Plugin.DisableWorldSpaceUiAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { if (ShowTimerRef.Invoke(__instance) > 0f) { CurveLerpRef.Invoke(__instance) = 1f; ((Component)__instance).transform.localScale = ScaleRef.Invoke(__instance); return; } CurveLerpRef.Invoke(__instance) = 0f; ((Component)__instance).transform.localScale = Vector3.zero; CurrentPhysGrabObjectRef.Invoke(__instance) = null; CurrentStaticGrabObjectRef.Invoke(__instance) = null; } } } [HarmonyPatch(typeof(WorldSpaceUIValueLost), "Update")] internal static class WorldSpaceUIValueLostUpdatePatch { private static readonly FieldRef TimerRef = AccessTools.FieldRefAccess("timer"); private static readonly FieldRef ScaleRef = AccessTools.FieldRefAccess("scale"); private static void Postfix(WorldSpaceUIValueLost __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableWorldSpaceUiAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { Traverse.Create((object)__instance).Field("positionOffset").SetValue((object)Vector3.zero); if (TimerRef.Invoke(__instance) > 0f) { ((Component)__instance).transform.localScale = ScaleRef.Invoke(__instance); return; } (((Object)(object)WorldSpaceUIParent.instance == (Object)null) ? null : Traverse.Create((object)WorldSpaceUIParent.instance).Field("valueLostList").GetValue>())?.Remove(__instance); Object.Destroy((Object)(object)((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(WorldSpaceUITTS), "Update")] internal static class WorldSpaceUITTSUpdatePatch { private static readonly FieldRef FollowTransformRef = AccessTools.FieldRefAccess("followTransform"); private static readonly FieldRef FollowPositionRef = AccessTools.FieldRefAccess("followPosition"); private static readonly FieldRef OffsetPositionRef = AccessTools.FieldRefAccess("offsetPosition"); private static readonly FieldRef TextAlphaTargetRef = AccessTools.FieldRefAccess("textAlphaTarget"); private static readonly FieldRef TextAlphaRef = AccessTools.FieldRefAccess("textAlpha"); private static readonly FieldRef CurveLerpRef = AccessTools.FieldRefAccess("curveLerp"); private static void Postfix(WorldSpaceUITTS __instance) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableWorldSpaceUiAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return; } Component value = Traverse.Create((object)__instance).Field("text").GetValue(); if (!((Object)(object)value == (Object)null)) { Transform val = FollowTransformRef.Invoke(__instance); if ((Object)(object)val != (Object)null) { Vector3 val2 = val.position + OffsetPositionRef.Invoke(__instance); FollowPositionRef.Invoke(__instance) = val2; Traverse.Create((object)__instance).Field("worldPosition").SetValue((object)val2); } CurveLerpRef.Invoke(__instance) = 1f; TextAlphaRef.Invoke(__instance) = TextAlphaTargetRef.Invoke(__instance); Traverse.Create((object)value).Property("color", (object[])null).SetValue((object)new Color(1f, 1f, 1f, TextAlphaRef.Invoke(__instance))); } } } [HarmonyPatch(typeof(WorldSpaceUIPlayerName), "Update")] internal static class WorldSpaceUIPlayerNameUpdatePatch { private static readonly FieldRef PlayerAvatarRef = AccessTools.FieldRefAccess("playerAvatar"); private static readonly FieldRef ShowTimerRef = AccessTools.FieldRefAccess("showTimer"); private static readonly FieldRef FollowTargetRef = AccessTools.FieldRefAccess("followTarget"); private static readonly FieldRef FollowTargetYRef = AccessTools.FieldRefAccess("followTargetY"); private static void Postfix(WorldSpaceUIPlayerName __instance) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f6: 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) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableWorldSpaceUiAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return; } PlayerAvatar val = PlayerAvatarRef.Invoke(__instance); Component value = Traverse.Create((object)__instance).Field("text").GetValue(); if (!((Object)(object)val == (Object)null) && !((Object)(object)value == (Object)null)) { Vector3 position = val.playerAvatarVisuals.headLookAtTransform.position; position.y = ((Component)val.playerAvatarVisuals).transform.position.y; if ((Object)(object)val == (Object)(object)SessionManager.instance.CrownedPlayerGet()) { position.y += 0.02f; } float num = val.playerAvatarVisuals.headLookAtTransform.position.y - ((Component)val.playerAvatarVisuals).transform.position.y + 0.35f; FollowTargetRef.Invoke(__instance) = position; FollowTargetYRef.Invoke(__instance) = num; Traverse.Create((object)__instance).Field("worldPosition").SetValue((object)(position + Vector3.up * num)); bool value2 = Traverse.Create((object)val).Field("isDisabled").GetValue(); bool flag = !Object.op_Implicit((Object)(object)SpectateCamera.instance) && !value2 && ShowTimerRef.Invoke(__instance) > 0f; Traverse.Create((object)value).Property("color", (object[])null).SetValue((object)new Color(1f, 1f, 1f, flag ? 0.5f : 0f)); } } } [HarmonyPatch(typeof(UpgradeStand), "Start")] internal static class UpgradeStandStartPatch { private static void Postfix(UpgradeStand __instance) { if ((Object)(object)__instance == (Object)null) { return; } if (Plugin.DisableUpgradeStandAnimationsEnabled()) { if ((Object)(object)__instance.hatchParticles != (Object)null) { ((Component)__instance.hatchParticles).gameObject.SetActive(false); } if ((Object)(object)__instance.rollingParticles != (Object)null) { ((Component)__instance.rollingParticles).gameObject.SetActive(false); } if ((Object)(object)__instance.buildUpParticles != (Object)null) { ((Component)__instance.buildUpParticles).gameObject.SetActive(false); } if (__instance.soundButtonPress != null) { __instance.soundButtonPress.Volume = 0f; } if (__instance.soundHatchClose != null) { __instance.soundHatchClose.Volume = 0f; } if (__instance.soundRollStart != null) { __instance.soundRollStart.Volume = 0f; } if (__instance.soundRolling != null) { __instance.soundRolling.Volume = 0f; } if (__instance.soundRollEnd != null) { __instance.soundRollEnd.Volume = 0f; } if (__instance.soundHatchOpen != null) { __instance.soundHatchOpen.Volume = 0f; } if (__instance.soundRerollStart != null) { __instance.soundRerollStart.Volume = 0f; } if (__instance.soundRerollEnd != null) { __instance.soundRerollEnd.Volume = 0f; } if (__instance.soundRerollTick != null) { __instance.soundRerollTick.Volume = 0f; } if (__instance.soundFinalRollSqueak != null) { __instance.soundFinalRollSqueak.Volume = 0f; } if (__instance.soundHatchCloseImpact != null) { __instance.soundHatchCloseImpact.Volume = 0f; } if (__instance.soundHatchOpenImpact != null) { __instance.soundHatchOpenImpact.Volume = 0f; } if (__instance.soundBuildUpLoop != null) { __instance.soundBuildUpLoop.Volume = 0f; } } if (Plugin.DisableUpgradeStandBrokenFireEnabled()) { if ((Object)(object)__instance.particleButtonBreak != (Object)null) { ((Component)__instance.particleButtonBreak).gameObject.SetActive(false); } if ((Object)(object)__instance.particleFireLoop != (Object)null) { ((Component)__instance.particleFireLoop).gameObject.SetActive(false); } if (__instance.soundButtonBreak != null) { __instance.soundButtonBreak.Volume = 0f; } if (__instance.soundLilButtonFire != null) { __instance.soundLilButtonFire.Volume = 0f; } } } } [HarmonyPatch(typeof(UpgradeStand), "Update")] internal static class UpgradeStandUpdatePatch { private static void Postfix(UpgradeStand __instance) { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } if (Plugin.DisableUpgradeStandAnimationsEnabled()) { ParticleSystem hatchParticles = __instance.hatchParticles; if (hatchParticles != null) { hatchParticles.Stop(true); } ParticleSystem rollingParticles = __instance.rollingParticles; if (rollingParticles != null) { rollingParticles.Stop(true); } ParticleSystem buildUpParticles = __instance.buildUpParticles; if (buildUpParticles != null) { buildUpParticles.Stop(true); } Sound soundBuildUpLoop = __instance.soundBuildUpLoop; if (soundBuildUpLoop != null) { soundBuildUpLoop.Stop(); } if ((Object)(object)__instance.buildUpLight != (Object)null) { __instance.buildUpLight.intensity = 0f; ((Component)__instance.buildUpLight).gameObject.SetActive(false); } } if (Plugin.DisableUpgradeStandBrokenFireEnabled()) { ParticleSystem particleButtonBreak = __instance.particleButtonBreak; if (particleButtonBreak != null) { particleButtonBreak.Stop(true); } ParticleSystem particleFireLoop = __instance.particleFireLoop; if (particleFireLoop != null) { particleFireLoop.Stop(true); } Sound soundLilButtonFire = __instance.soundLilButtonFire; if (soundLilButtonFire != null) { soundLilButtonFire.Stop(); } if ((Object)(object)__instance.fireLight != (Object)null) { __instance.fireLight.intensity = 0f; ((Component)__instance.fireLight).gameObject.SetActive(false); } } if (Plugin.DisableUpgradeStandAnimationsEnabled()) { string text = ((object)(State)(ref __instance.currentState)).ToString(); Vector3 value = Traverse.Create((object)__instance).Field("hatchOriginalPosition").GetValue(); Vector3 value2 = Traverse.Create((object)__instance).Field("hatchOriginalScale").GetValue(); Quaternion value3 = Traverse.Create((object)__instance).Field("compartmentOriginalRotation").GetValue(); Vector3 value4 = Traverse.Create((object)__instance).Field("allMeshesOriginalPosition").GetValue(); Quaternion value5 = Traverse.Create((object)__instance).Field("allMeshesOriginalRotation").GetValue(); int num; switch (text) { default: num = ((text == "RerollRollEnd") ? 1 : 0); break; case "RerollCloseHatch": case "RerollRollStart": case "RerollRolling": num = 1; break; } bool flag = (byte)num != 0; if ((Object)(object)__instance.hatch != (Object)null) { __instance.hatch.localPosition = (Vector3)(flag ? new Vector3(value.x, -0.146f, value.z) : value); __instance.hatch.localScale = (flag ? new Vector3(value2.x, 1f, value2.z) : new Vector3(value2.x, 0.655f, value2.z)); } if ((Object)(object)__instance.upgradeCompartment != (Object)null) { __instance.upgradeCompartment.localRotation = value3; } if ((Object)(object)__instance.allMeshesTransform != (Object)null) { __instance.allMeshesTransform.localPosition = value4; __instance.allMeshesTransform.localRotation = value5; } } } } [HarmonyPatch(typeof(CosmeticShopMachineAnimator), "GrabBeamLogic")] internal static class CosmeticShopMachineAnimatorGrabBeamLogicPatch { private static bool Prefix(CosmeticShopMachineAnimator __instance) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineGrabBeamEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } List value = Traverse.Create((object)__instance).Field("grabBeamRenderers").GetValue>(); List value2 = Traverse.Create((object)__instance).Field("grabOrbTransforms").GetValue>(); List value3 = Traverse.Create((object)__instance).Field("grabOrbParticles").GetValue>(); if (value != null) { foreach (LineRenderer item in value) { if ((Object)(object)item != (Object)null) { ((Renderer)item).enabled = false; item.widthMultiplier = 0f; } } } if (value2 != null) { foreach (Transform item2 in value2) { if ((Object)(object)item2 != (Object)null) { item2.localScale = Vector3.zero; ((Component)item2).gameObject.SetActive(false); } } } if (value3 != null) { foreach (ParticleSystem item3 in value3) { if (item3 != null) { item3.Stop(true); } } } Traverse.Create((object)__instance).Field("grabBeamActive").SetValue((object)false); Traverse.Create((object)__instance).Field("grabBeamScaleLerp").SetValue((object)0f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachineAnimator), "TokenParticlesStart")] internal static class CosmeticShopMachineAnimatorTokenParticlesStartPatch { private static bool Prefix(CosmeticShopMachineAnimator __instance) { if (!Plugin.DisableCosmeticMachineGrabBeamEffectsEnabled()) { return true; } ParticleSystem tokenParticleSparkles = __instance.tokenParticleSparkles; if (tokenParticleSparkles != null) { tokenParticleSparkles.Stop(true); } return false; } } [HarmonyPatch(typeof(CosmeticShopMachineAnimator), "ArrowLogic")] internal static class CosmeticShopMachineAnimatorArrowLogicPatch { private static bool Prefix(CosmeticShopMachineAnimator __instance) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineLoopEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Material value = Traverse.Create((object)__instance).Field("arrowMaterial").GetValue(); int value2 = Traverse.Create((object)__instance).Field("shaderEmissionColor").GetValue(); if ((Object)(object)value != (Object)null) { value.SetColor(value2, Color.black); } Traverse.Create((object)__instance).Field("arrowEmissionLerp").SetValue((object)1f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachineAnimator), "PlateLogic")] internal static class CosmeticShopMachineAnimatorPlateLogicPatch { private static bool Prefix(CosmeticShopMachineAnimator __instance) { if (!Plugin.DisableCosmeticMachineLoopEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } List value = Traverse.Create((object)__instance).Field("plateLights").GetValue>(); if (value != null) { foreach (Light item in value) { if ((Object)(object)item != (Object)null) { item.intensity = 0f; } } } Traverse.Create((object)__instance).Field("plateEmissionLerp").SetValue((object)0f); Traverse.Create((object)__instance).Field("plateLightLerp").SetValue((object)0f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachineAnimator), "AudioLogic")] internal static class CosmeticShopMachineAnimatorAudioLogicPatch { private static bool Prefix(CosmeticShopMachineAnimator __instance) { if (!Plugin.DisableCosmeticMachineLoopEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } object value = Traverse.Create((object)__instance).Field("soundBaseIdleLoop").GetValue(); object value2 = Traverse.Create((object)__instance).Field("soundBaseShakeLoop").GetValue(); Traverse.Create(value).Method("Stop", Array.Empty()).GetValue(); Traverse.Create(value2).Method("Stop", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(CosmeticShopMachine), "ScreenSpinLogic")] internal static class CosmeticShopMachineScreenSpinLogicPatch { private static bool Prefix(CosmeticShopMachine __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineScreenAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse.Create((object)__instance).Field("screenSpinningFast").SetValue((object)false); if ((Object)(object)__instance.screenSpinTransform != (Object)null) { __instance.screenSpinTransform.localRotation = Quaternion.identity; } if ((Object)(object)__instance.screenSpinSettleTransform != (Object)null) { __instance.screenSpinSettleTransform.localRotation = Quaternion.identity; } Traverse.Create((object)__instance).Field("screenSpinStopped").SetValue((object)true); Traverse.Create((object)__instance).Field("screenSpinStarted").SetValue((object)false); Traverse.Create((object)__instance).Field("screenSpinSpeed").SetValue((object)0f); Traverse.Create((object)__instance).Field("screenSpinSettleLerp").SetValue((object)1f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachine), "ScreenBaseIconAnimation")] internal static class CosmeticShopMachineScreenBaseIconAnimationPatch { private static bool Prefix(CosmeticShopMachine __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineScreenAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.screenBaseIconTransform != (Object)null) { __instance.screenBaseIconTransform.localPosition = Vector3.zero; } Traverse.Create((object)__instance).Field("screenBaseIconTransformLerp").SetValue((object)1f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachine), "ScreenCurrencyIconAnimation")] internal static class CosmeticShopMachineScreenCurrencyIconAnimationPatch { private static bool Prefix(CosmeticShopMachine __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineScreenAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.screenCurrencyIconTransform != (Object)null) { __instance.screenCurrencyIconTransform.localPosition = Vector3.zero; } if ((Object)(object)__instance.screenCurrencyIconImpulseTransform != (Object)null) { __instance.screenCurrencyIconImpulseTransform.localPosition = Vector3.zero; __instance.screenCurrencyIconImpulseTransform.localScale = Vector3.one; } Traverse.Create((object)__instance).Field("screenCurrencyIconTransformLerp").SetValue((object)1f); Traverse.Create((object)__instance).Field("screenCurrencyIconImpulseLerp").SetValue((object)0f); return false; } } [HarmonyPatch(typeof(CosmeticShopMachine), "ScreenCosmeticAnimation")] internal static class CosmeticShopMachineScreenCosmeticAnimationPatch { private static bool Prefix(CosmeticShopMachine __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableCosmeticMachineScreenAnimationsEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.cosmeticTransform != (Object)null) { __instance.cosmeticTransform.localPosition = Vector3.zero; } if ((Object)(object)__instance.playerTransform != (Object)null) { __instance.playerTransform.localPosition = Vector3.zero; __instance.playerTransform.localRotation = Quaternion.identity; __instance.playerTransform.localScale = Vector3.one; } if ((Object)(object)__instance.playerSpinTransform != (Object)null) { __instance.playerSpinTransform.localEulerAngles = Vector3.zero; } Traverse.Create((object)__instance).Field("cosmeticTransformLerp").SetValue((object)1f); Traverse.Create((object)__instance).Field("playerPoseLerp").SetValue((object)0f); Traverse.Create((object)__instance).Field("playerSpinLerp").SetValue((object)1f); return false; } } [HarmonyPatch(typeof(ResultScreenUI), "Update")] internal static class ResultScreenUiUpdatePatch { private static void Postfix(ResultScreenUI __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 if (Plugin.QuickSkipResultScreenEnabled() && !((Object)(object)__instance == (Object)null) && !((Object)(object)GameDirector.instance == (Object)null) && (int)GameDirector.instance.currentState == 4) { Traverse.Create((object)__instance).Method("FinishResultScreen", Array.Empty()).GetValue(); } } } [HarmonyPatch(typeof(ResultScreenUI), "FadeLogic")] internal static class ResultScreenUiFadeLogicPatch { private static bool Prefix(ResultScreenUI __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableResultScreenFadeEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.fadeImage != (Object)null) { ((Graphic)__instance.fadeImage).color = Color.clear; } return false; } } [HarmonyPatch(typeof(ResultScreenUI), "ShakeLogic")] internal static class ResultScreenUiShakeLogicPatch { private static bool Prefix(ResultScreenUI __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableResultScreenShakeEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.shakeTransformBack != (Object)null) { __instance.shakeTransformBack.anchoredPosition = Vector2.zero; } if ((Object)(object)__instance.shakeTransformFront != (Object)null) { __instance.shakeTransformFront.anchoredPosition = Vector2.zero; } if ((Object)(object)__instance.shakeTransformRotation != (Object)null) { ((Transform)__instance.shakeTransformRotation).localRotation = Quaternion.identity; } return false; } } [HarmonyPatch(typeof(ResultScreenUI), "AnimationEventTokenParticles")] internal static class ResultScreenUiAnimationEventTokenParticlesPatch { private static bool Prefix(ResultScreenUI __instance) { if (!Plugin.DisableResultScreenTokenParticlesEnabled() || (Object)(object)__instance == (Object)null) { return true; } ParticleSystem tokenTrailParticle = __instance.tokenTrailParticle; if (tokenTrailParticle != null) { tokenTrailParticle.Stop(true); } return false; } } [HarmonyPatch(typeof(BatteryVisualLogic), "Update")] internal static class BatteryVisualLogicUpdatePatch { private static void Postfix(BatteryVisualLogic __instance) { //IL_0021: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableBatteryUiAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { Vector3 value = Traverse.Create((object)__instance).Field("targetPosition").GetValue(); float value2 = Traverse.Create((object)__instance).Field("targetScaleOriginal").GetValue(); float value3 = Traverse.Create((object)__instance).Field("targetRotationOriginal").GetValue(); ((Component)__instance).transform.localPosition = value; ((Component)__instance).transform.localRotation = Quaternion.Euler(0f, 0f, value3); ((Component)__instance).transform.localScale = Vector3.one * value2; RawImage value4 = Traverse.Create((object)__instance).Field("batteryDrain").GetValue(); RawImage value5 = Traverse.Create((object)__instance).Field("batteryCharge").GetValue(); GameObject value6 = Traverse.Create((object)__instance).Field("batteryOutVisual").GetValue(); GameObject value7 = Traverse.Create((object)__instance).Field("batteryChargeNeededVisual").GetValue(); if (value4 != null) { ((Component)value4).gameObject.SetActive(false); } if (value5 != null) { ((Component)value5).gameObject.SetActive(false); } if (value6 != null) { value6.SetActive(false); } if (value7 != null) { value7.SetActive(false); } } } } [HarmonyPatch(typeof(FlashlightController), "Update")] internal static class FlashlightControllerUpdatePatch { private static void Postfix(FlashlightController __instance) { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } if (Plugin.DisableFlashlightFlickerEnabled()) { Traverse.Create((object)__instance).Field("flickerIntensity").SetValue((object)0f); Traverse.Create((object)__instance).Field("flickerLerp").SetValue((object)0f); Traverse.Create((object)__instance).Field("flickerMultiplier").SetValue((object)1f); Traverse.Create((object)__instance).Field("flickerMultiplierTarget").SetValue((object)1f); } if (!Plugin.DisableFlashlightAnimationsEnabled()) { return; } if (Traverse.Create((object)__instance).Field("active").GetValue()) { if ((Object)(object)__instance.mesh != (Object)null) { ((Renderer)__instance.mesh).enabled = true; } if ((Object)(object)__instance.meshShadows != (Object)null) { ((Renderer)__instance.meshShadows).enabled = true; } if ((Object)(object)__instance.spotlight != (Object)null) { ((Behaviour)__instance.spotlight).enabled = true; } if ((Object)(object)__instance.halo != (Object)null) { __instance.halo.enabled = true; } if ((Object)(object)__instance.hideTransform != (Object)null) { __instance.hideTransform.localPosition = Vector3.zero; __instance.hideTransform.localRotation = Quaternion.identity; } if ((Object)(object)__instance.clickTransform != (Object)null) { __instance.clickTransform.localRotation = Quaternion.identity; } Traverse.Create((object)__instance).Field("hiddenScale").SetValue((object)1f); Traverse.Create((object)__instance).Field("baseIntensity").SetValue((object)1f); Traverse.Create((object)__instance).Field("click").SetValue((object)false); Traverse.Create((object)__instance).Field("currentState").SetValue((object)3); } else { if ((Object)(object)__instance.mesh != (Object)null) { ((Renderer)__instance.mesh).enabled = false; } if ((Object)(object)__instance.meshShadows != (Object)null) { ((Renderer)__instance.meshShadows).enabled = false; } if ((Object)(object)__instance.spotlight != (Object)null) { ((Behaviour)__instance.spotlight).enabled = false; } if ((Object)(object)__instance.halo != (Object)null) { __instance.halo.enabled = false; } Traverse.Create((object)__instance).Field("hiddenScale").SetValue((object)0f); Traverse.Create((object)__instance).Field("currentState").SetValue((object)0); } } } [HarmonyPatch(typeof(LobbyChatUI), "Update")] internal static class LobbyChatUiUpdatePatch { private static void Postfix(LobbyChatUI __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableLobbyChatAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { Component value = Traverse.Create((object)__instance).Field("uiText").GetValue(); if ((Object)(object)value != (Object)null) { Traverse.Create((object)value).Property("color", (object[])null).SetValue((object)Color.white); } } } } [HarmonyPatch(typeof(MenuPageLobby), "Update")] internal static class MenuPageLobbyUpdatePatch { private static void Postfix(MenuPageLobby __instance) { if (Plugin.DisableLobbyJoiningPromptFadeEnabled() && !((Object)(object)__instance == (Object)null)) { Component value = Traverse.Create((object)__instance).Field("joiningPlayersCanvasGroup").GetValue(); if (!((Object)(object)value == (Object)null)) { List value2 = Traverse.Create((object)__instance).Field("joiningPlayers").GetValue>(); float value3 = Traverse.Create((object)__instance).Field("joiningPlayersEndTimer").GetValue(); float num = (((value2 != null && value2.Count > 0) || value3 > 0f) ? 1f : 0f); Traverse.Create((object)value).Property("alpha", (object[])null).SetValue((object)num); } } } } [HarmonyPatch(typeof(SemiUI), "Show")] internal static class SemiUiShowPatch { private static void Postfix(SemiUI __instance) { if (Plugin.DisableLeftPrepUiFadeEnabled() && Plugin.IsLeftPrepSemiUi(__instance)) { Plugin.SnapSemiUiVisible(__instance); } } } [HarmonyPatch(typeof(MoonUI), "Check")] internal static class MoonUiCheckPatch { private static bool Prefix(MoonUI __instance) { if (!Plugin.DisableMoonPhaseUiEnabled()) { return true; } if ((Object)(object)RunManager.instance != (Object)null) { Traverse.Create((object)RunManager.instance).Field("moonLevelChanged").SetValue((object)false); } if ((Object)(object)__instance != (Object)null) { __instance.SetState((State)0); if ((Object)(object)__instance.objectActive != (Object)null) { __instance.objectActive.SetActive(false); } } return false; } } [HarmonyPatch(typeof(ArrowUI), "ArrowShow")] internal static class ArrowUiArrowShowPatch { private static bool Prefix(ArrowUI __instance) { if (!Plugin.DisableGuideArrowUiEnabled()) { return true; } if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.arrowMesh != (Object)null) { ((Renderer)__instance.arrowMesh).enabled = false; } return false; } } [HarmonyPatch(typeof(ArrowUI), "ArrowShowWorldPos")] internal static class ArrowUiArrowShowWorldPosPatch { private static bool Prefix(ArrowUI __instance) { if (!Plugin.DisableGuideArrowUiEnabled()) { return true; } if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.arrowMesh != (Object)null) { ((Renderer)__instance.arrowMesh).enabled = false; } return false; } } [HarmonyPatch(typeof(BigMessageUI), "BigMessage")] internal static class BigMessageUiBigMessagePatch { private static bool Prefix(BigMessageUI __instance) { if (!Plugin.DisableBigMessageUiEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse.Create((object)__instance).Field("bigMessageTimer").SetValue((object)0f); Traverse.Create((object)__instance).Method("Hide", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(VehicleUI), "ShowSpeed")] internal static class VehicleUiShowSpeedPatch { private static void Postfix(VehicleUI __instance) { if (Plugin.DisableVehicleSpeedParticlesEnabled() && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.speedParticles == (Object)null)) { __instance.speedParticles.Stop(true, (ParticleSystemStopBehavior)0); } } } [HarmonyPatch(typeof(UraniumHurtVignette), "HurtVignette")] internal static class UraniumHurtVignettePatch { private static bool Prefix() { return !Plugin.DisableUraniumScreenEffectsEnabled(); } } [HarmonyPatch(typeof(TumbleWingsUI), "Update")] internal static class TumbleWingsUiUpdatePatch { private static bool Prefix(TumbleWingsUI __instance) { if (!Plugin.DisableTumbleWingsUiEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse.Create((object)__instance).Method("Hide", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(TruckMenuAnimated), "Update")] internal static class TruckMenuAnimatedUpdatePatch { private static bool Prefix(TruckMenuAnimated __instance) { if (!Plugin.DisableMainMenuTruckAnimationEnabled() || (Object)(object)__instance == (Object)null) { return true; } Sound soundLoop = __instance.soundLoop; if (soundLoop != null) { soundLoop.PlayLoop(false, 2f, 2f, 1f, 1f); } ParticleSystem particleSkeletonBitsFirst = __instance.particleSkeletonBitsFirst; if (particleSkeletonBitsFirst != null) { particleSkeletonBitsFirst.Stop(true, (ParticleSystemStopBehavior)0); } ParticleSystem particleSkeletonSmokeFirst = __instance.particleSkeletonSmokeFirst; if (particleSkeletonSmokeFirst != null) { particleSkeletonSmokeFirst.Stop(true, (ParticleSystemStopBehavior)0); } ParticleSystem particleSkeletonBitsLast = __instance.particleSkeletonBitsLast; if (particleSkeletonBitsLast != null) { particleSkeletonBitsLast.Stop(true, (ParticleSystemStopBehavior)0); } ParticleSystem particleSkeletonSmokeLast = __instance.particleSkeletonSmokeLast; if (particleSkeletonSmokeLast != null) { particleSkeletonSmokeLast.Stop(true, (ParticleSystemStopBehavior)0); } return false; } } [HarmonyPatch(typeof(TutorialDirector), "ActivateTip")] internal static class TutorialDirectorActivateTipPatch { private static bool Prefix() { return !Plugin.DisableTutorialTipsEnabled(); } } [HarmonyPatch(typeof(TutorialDirector), "ScheduleTip")] internal static class TutorialDirectorScheduleTipPatch { private static bool Prefix() { return !Plugin.DisableTutorialTipsEnabled(); } } [HarmonyPatch(typeof(ArenaMessageUI), "ArenaText")] internal static class ArenaMessageUiArenaTextPatch { private static bool Prefix(ArenaMessageUI __instance) { if (!Plugin.DisableArenaMessagesEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse.Create((object)__instance).Method("Hide", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(ArenaMessageWinUI), "ArenaText")] internal static class ArenaMessageWinUiArenaTextPatch { private static bool Prefix(ArenaMessageWinUI __instance) { if (!Plugin.DisableArenaMessagesEnabled() || (Object)(object)__instance == (Object)null) { return true; } if ((Object)(object)__instance.kingObject != (Object)null) { __instance.kingObject.SetActive(false); } if ((Object)(object)__instance.loserObject != (Object)null) { __instance.loserObject.SetActive(false); } if ((Object)(object)__instance.backgroundObject != (Object)null) { __instance.backgroundObject.SetActive(false); } Traverse.Create((object)__instance).Method("Hide", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(ArenaLight), "TurnOnArenaWarningLight")] internal static class ArenaLightTurnOnArenaWarningLightPatch { private static bool Prefix(ArenaLight __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableArenaWarningLightsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse obj = Traverse.Create((object)__instance); Light value = obj.Field("arenaLight").GetValue(); MeshRenderer value2 = obj.Field("meshRenderer").GetValue(); if ((Object)(object)value != (Object)null) { ((Behaviour)value).enabled = false; value.intensity = 0f; } if ((Object)(object)value2 != (Object)null) { ((Renderer)value2).material.SetColor("_EmissionColor", Color.black); } return false; } } [HarmonyPatch(typeof(ArenaLight), "PulsateLight")] internal static class ArenaLightPulsateLightPatch { private static bool Prefix(ArenaLight __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.DisableArenaWarningLightsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse obj = Traverse.Create((object)__instance); Light value = obj.Field("arenaLight").GetValue(); MeshRenderer value2 = obj.Field("meshRenderer").GetValue(); if ((Object)(object)value != (Object)null) { ((Behaviour)value).enabled = false; value.intensity = 0f; } if ((Object)(object)value2 != (Object)null) { ((Renderer)value2).material.SetColor("_EmissionColor", Color.black); } return false; } } [HarmonyPatch(typeof(ArenaLight), "Update")] internal static class ArenaLightUpdatePatch { private static void Postfix(ArenaLight __instance) { if (Plugin.DisableArenaWarningLightsEnabled() && !((Object)(object)__instance == (Object)null)) { DisableArenaLightVisuals(__instance); } } private static void DisableArenaLightVisuals(ArenaLight instance) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) Traverse obj = Traverse.Create((object)instance); Light value = obj.Field("arenaLight").GetValue(); MeshRenderer value2 = obj.Field("meshRenderer").GetValue(); if ((Object)(object)value != (Object)null) { ((Behaviour)value).enabled = false; value.intensity = 0f; } if ((Object)(object)value2 != (Object)null) { ((Renderer)value2).material.SetColor("_EmissionColor", Color.black); } } } [HarmonyPatch(typeof(ArenaRaceTimerUI), "Update")] internal static class ArenaRaceTimerUiUpdatePatch { private static void Postfix(ArenaRaceTimerUI __instance) { if (Plugin.DisableArenaRaceTimerAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { ResetArenaRaceTimerAnimationState(__instance); } } private static void ResetArenaRaceTimerAnimationState(ArenaRaceTimerUI instance) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) Traverse val = Traverse.Create((object)instance); val.Field("countdownScaleSpringTime").SetValue((object)val.Field("countdownScaleSpringDuration").GetValue()); val.Field("clearedScaleSpringTime").SetValue((object)val.Field("clearedScaleSpringDuration").GetValue()); val.Field("progressScaleSpringTime").SetValue((object)val.Field("progressScaleSpringDuration").GetValue()); val.Field("placeScaleSpringTime").SetValue((object)val.Field("placeScaleSpringDuration").GetValue()); val.Field("trackPieceScaleSpringTime").SetValue((object)val.Field("trackPieceScaleSpringDuration").GetValue()); val.Field("placeFlashTimer").SetValue((object)0f); float[] value = val.Field("segmentFlashTimers").GetValue(); if (value != null) { Array.Clear(value, 0, value.Length); } Vector3 value2 = val.Field("countdownBaseScale").GetValue(); Vector3 value3 = val.Field("clearedBaseScale").GetValue(); Vector3 value4 = val.Field("progressBaseScale").GetValue(); Vector3 value5 = val.Field("placeBaseScale").GetValue(); Vector3 value6 = val.Field("trackPieceBaseScale").GetValue(); if ((Object)(object)instance.secondsText != (Object)null) { ((TMP_Text)instance.secondsText).transform.localScale = value2; ((Graphic)instance.secondsText).color = Color.white; } if ((Object)(object)instance.hundredthsText != (Object)null) { ((TMP_Text)instance.hundredthsText).transform.localScale = value2; ((Graphic)instance.hundredthsText).color = Color.white; } if ((Object)(object)instance.clearedText != (Object)null) { ((TMP_Text)instance.clearedText).transform.localScale = value3; } if ((Object)(object)instance.progressText != (Object)null) { ((TMP_Text)instance.progressText).transform.localScale = value4; } if ((Object)(object)instance.placeText != (Object)null) { ((TMP_Text)instance.placeText).transform.localScale = value5; } if ((Object)(object)instance.trackPieceText != (Object)null) { ((TMP_Text)instance.trackPieceText).transform.localScale = value6; } } } [HarmonyPatch(typeof(EnemyShadowScreenVeinEffect), "Active")] internal static class EnemyShadowScreenVeinEffectActivePatch { private static bool Prefix(EnemyShadowScreenVeinEffect __instance) { if (!Plugin.DisableEnemyShadowVeinScreenEffectEnabled() || (Object)(object)__instance == (Object)null) { return true; } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(EnemyShadowScreenVeinEffect), "Update")] internal static class EnemyShadowScreenVeinEffectUpdatePatch { private static bool Prefix(EnemyShadowScreenVeinEffect __instance) { if (!Plugin.DisableEnemyShadowVeinScreenEffectEnabled() || (Object)(object)__instance == (Object)null) { return true; } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(TruckScreenText), "Update")] internal static class TruckScreenTextUpdatePatch { private static void Postfix(TruckScreenText __instance) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } Traverse val = Traverse.Create((object)__instance); Transform value = val.Field("chatMessageLoadingBar").GetValue(); float value2 = val.Field("chatMessageTimer").GetValue(); float value3 = val.Field("chatMessageTimerMax").GetValue(); if (Plugin.DisableTruckScreenLoadingBarAnimationEnabled() && (Object)(object)value != (Object)null && value3 > 0f) { float num = Mathf.Clamp01(value2 / value3); value.localScale = new Vector3(num, value.localScale.y, value.localScale.z); } if (!Plugin.DisableTruckScreenChatAnimationsEnabled()) { return; } if ((Object)(object)__instance.chatMessage != (Object)null) { string value4 = val.Field("chatMessageIdleString1").GetValue(); if (!string.IsNullOrEmpty(value4)) { val.Field("chatMessageIdleStringCurrent").SetValue((object)value4); } } val.Field("chatMessageIdleStringTimer").SetValue((object)0f); val.Field("chatActiveTimer").SetValue((object)0f); if ((Object)(object)value != (Object)null && value3 > 0f) { float num2 = Mathf.Clamp01(value2 / value3); value.localScale = new Vector3(num2, value.localScale.y, value.localScale.z); } Transform value5 = val.Field("chatMessageResultBar").GetValue(); Light value6 = val.Field("chatMessageResultBarLight").GetValue(); if ((Object)(object)value5 != (Object)null) { ((Component)value5).gameObject.SetActive(false); } if ((Object)(object)value6 != (Object)null) { ((Behaviour)value6).enabled = false; } val.Field("chatMessageResultBarTimer").SetValue((object)(-123f)); } } [HarmonyPatch(typeof(BatteryBarEffect), "Update")] internal static class BatteryBarEffectUpdatePatch { private static bool Prefix(BatteryBarEffect __instance) { if (!Plugin.DisableBatteryBarEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(ValueScreen), "UpdateValue")] internal static class ValueScreenUpdateValuePatch { private static bool Prefix(ValueScreen __instance, int newValue) { if (!Plugin.DisableValueScreenEffectsEnabled() || (Object)(object)__instance == (Object)null) { return true; } Traverse.Create((object)__instance).Field("valuePrevious").SetValue((object)newValue); Traverse.Create((object)__instance).Field("valueCurrent").SetValue((object)newValue); Traverse.Create((object)__instance).Field("updateEffectTimer").SetValue((object)0f); Traverse.Create((object)__instance).Field("resetText").SetValue((object)false); Traverse.Create((object)__instance).Method("SetValueText", Array.Empty()).GetValue(); return false; } } [HarmonyPatch(typeof(TutorialUI), "Update")] internal static class TutorialUiUpdatePatch { private static void Postfix(TutorialUI __instance) { //IL_0025: 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) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (Plugin.DisableTutorialUiAnimationsEnabled() && !((Object)(object)__instance == (Object)null)) { if ((Object)(object)__instance.videoTransform != (Object)null) { __instance.videoTransform.localScale = Vector3.one; } if ((Object)(object)__instance.videoImage != (Object)null) { Color color = ((Graphic)__instance.videoImage).color; ((Graphic)__instance.videoImage).color = new Color(color.r, color.g, color.b, 1f); } if ((Object)(object)__instance.progressBar != (Object)null) { float value = Traverse.Create((object)__instance).Field("progressBarTarget").GetValue(); __instance.progressBar.localScale = new Vector3(value, 1f, 1f); } Traverse.Create((object)__instance).Field("dummyTextAnimationEval").SetValue((object)1f); Traverse.Create((object)__instance).Field("animationCurveEval").SetValue((object)1f); ((Component)__instance).transform.localScale = new Vector3(1f, 1f, 1f); } } } [HarmonyPatch(typeof(ItemUpgrade), "PlayerUpgrade")] internal static class ItemUpgradePlayerUpgradePatch { private static void Prefix(ItemUpgrade __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Plugin.IsInPlayerUpgradeSequence = true; if (!Plugin.DisableUpgradePotionParticlesEnabled() || !((Object)(object)__instance != (Object)null)) { return; } Transform val = ((Component)__instance).transform.Find("Particle Effects"); if (!((Object)(object)val != (Object)null)) { return; } ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (ParticleSystem val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null) { EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; val2.Clear(); } } } private static void Postfix() { Plugin.IsInPlayerUpgradeSequence = false; } } internal sealed class ConfigurationManagerAttributes { public int? Order; public Action CustomDrawer; public bool? ReadOnly; public bool? Browsable; public string Category; public string DispName; public string Description; } public enum DisplayLanguage { 中文, English } internal static class REPOConfigCreateHook { public static void Postfix(object[] __args, object __result) { try { if (__args != null && __args.Length != 0 && __result != null && __args[0] is string label) { Plugin.RegisterLiveLabelIfMatched(label, __result); } } catch { } } public static void CreateModEntriesPrefix(object[] __args) { try { Plugin._currentRenderingConfigFilePath = null; if (__args == null || __args.Length < 2 || !(__args[1] is ConfigEntryBase[] array) || array.Length == 0) { return; } ConfigEntryBase val = array[0]; if (((val != null) ? val.ConfigFile : null) != null) { string a = (Plugin._currentRenderingConfigFilePath = val.ConfigFile.ConfigFilePath); if ((Object)(object)Plugin.Instance != (Object)null && string.Equals(a, ((BaseUnityPlugin)Plugin.Instance).Config.ConfigFilePath, StringComparison.OrdinalIgnoreCase)) { Plugin.ConfirmPendingSectionLabel(); } else { Plugin.ClearPendingSectionLabel(); } } } catch { } } public static void CreateModEntriesPostfix() { Plugin._currentRenderingConfigFilePath = null; } } }