using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using YAPYAP; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Yap_NativeSettingsUI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("YapYap Native Settings UI Library MOD")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cc8fda413f141a4967405746fec77f3e68c8b1dd")] [assembly: AssemblyProduct("Yap_NativeSettingsUI")] [assembly: AssemblyTitle("Yap_NativeSettingsUI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Yap_NativeSettingsUI { [BepInPlugin("com.yapyap.nativesettingsui", "Yap Native Settings UI", "1.0.1")] public sealed class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__8 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool isInGame; public Plugin <>4__this; private UISettings 5__1; private MenuController 5__2; private int 5__3; private GameController 5__4; private int 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; if (!isInGame) { 5__2 = null; 5__3 = 0; goto IL_009d; } 5__4 = null; 5__5 = 0; goto IL_013a; case 1: <>1__state = -1; 5__3++; goto IL_009d; case 2: { <>1__state = -1; 5__5++; goto IL_013a; } IL_009d: if (5__3 < 60) { 5__2 = Object.FindFirstObjectByType(); if (!((Object)(object)5__2 != (Object)null)) { <>2__current = null; <>1__state = 1; return true; } } if ((Object)(object)5__2 == (Object)null) { return false; } 5__1 = NativeSettingsUI.TryGetUiSettings((Component)(object)5__2); 5__2 = null; break; IL_013a: if (5__5 < 60) { 5__4 = Object.FindFirstObjectByType(); if (!((Object)(object)5__4 != (Object)null)) { <>2__current = null; <>1__state = 2; return true; } } if ((Object)(object)5__4 == (Object)null) { return false; } 5__1 = NativeSettingsUI.TryGetUiSettings((Component)(object)5__4); 5__4 = null; break; } if ((Object)(object)5__1 == (Object)null) { return false; } NativeSettingsUI.Inject(5__1, isInGame); 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(); } } internal static ManualLogSource Log; private static Plugin instance; private SystemLanguage lastLanguage; private int languagePollCountdown; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Yap Native Settings UI plugin initialized!.!"); NativeSettingsUI.InternalInitialize(this); SceneManager.sceneLoaded += OnSceneLoaded; OnSceneLoaded(SceneManager.GetActiveScene(), (LoadSceneMode)0); } private void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //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) if (languagePollCountdown > 0) { languagePollCountdown--; return; } languagePollCountdown = 10; SystemLanguage currentLanguage = NativeSettingsUI.GetCurrentLanguage(); if (currentLanguage != lastLanguage) { lastLanguage = currentLanguage; NativeSettingsUI.NotifyLanguageChanged(currentLanguage); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { ((MonoBehaviour)this).StartCoroutine(InjectWhenReady(isInGame: false)); ((MonoBehaviour)this).StartCoroutine(InjectWhenReady(isInGame: true)); } [IteratorStateMachine(typeof(d__8))] private IEnumerator InjectWhenReady(bool isInGame) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this, isInGame = isInGame }; } } public readonly struct LocalText { public readonly string Key; public readonly string Chinese; public readonly string English; public LocalText(string key, string chinese, string english) { if (key == null) { throw new ArgumentNullException("key"); } if (chinese == null) { throw new ArgumentNullException("chinese"); } if (english == null) { throw new ArgumentNullException("english"); } Key = key; Chinese = chinese; English = english; } } public sealed class UiRef where T : Object { public T Value { get; private set; } public bool IsReady => (Object)(object)Value != (Object)null; public event Action Ready; internal void SetValue(T value) { if (!((Object)(object)value == (Object)null)) { Value = value; this.Ready?.Invoke(value); } } } public sealed class SettingsTab { internal readonly string Guid; internal readonly LocalText Title; internal readonly bool ShowInGame; private readonly List controls = new List(); internal SettingsTab(string guid, LocalText title, bool showInGame) { Guid = guid; Title = title; ShowInGame = showInGame; } public UiRef