Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of REPOChallenger v1.2.2
BpeInEx/plugins/REPOChallengerMod/REPOChallenger.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPOChallenger")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPOChallenger")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d2844401-0171-4b10-9d0c-70ebdae69925")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public static class ChallengerConfig { public static ConfigEntry<float> BudgetPercent; public static ConfigEntry<float> SpinWheelDuration; public static ConfigEntry<float> TimeToDisplayResult; public static void SetRandomPercentValue() { int num = Random.Range(0, 10); int num2 = num * 10; BudgetPercent.Value = num2; } public static void Init(ConfigFile config) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown BudgetPercent = config.Bind<float>("Shop - Tax Wheel", "BudgetPercent", 80f, new ConfigDescription("Pourcentage de l'argent utilisable dans le shop", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1] { "HideFromREPOConfig" })); SetRandomPercentValue(); SpinWheelDuration = config.Bind<float>("Shop - Tax Wheel", "Spin Wheel Duration", 2f, new ConfigDescription("The duration of the spining wheel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); TimeToDisplayResult = config.Bind<float>("Shop - Tax Wheel", "Time To Display Result", 3f, new ConfigDescription("The duration for which the result is displayed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); } } public class PluginSyncManager : MonoBehaviourPun { private static PluginSyncManager _instance; public static PluginSyncManager Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("PluginSyncManager"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<PluginSyncManager>(); PhotonView val2 = val.AddComponent<PhotonView>(); val2.ViewID = 999; PhotonNetwork.RegisterPhotonView(val2); } return _instance; } } public void BroadcastTaxPercent(float percent, int shopCurrency) { if (!PhotonNetwork.IsMasterClient) { Plugin.Log.LogWarning((object)"Only host can broadcast the percentage !"); return; } ((MonoBehaviourPun)this).photonView.RPC("ReceiveTaxPercent", (RpcTarget)0, new object[2] { percent, shopCurrency }); } [PunRPC] private void ReceiveTaxPercent(float percent, int shopCurrency) { Plugin.Log.LogInfo((object)$"[BudgetSync] Percent : {percent}% (Shop currency : {shopCurrency})"); ChallengerConfig.BudgetPercent.Value = percent; TaxWheelUI.Instance.ShowTaxWheel(shopCurrency); } } [HarmonyPatch(typeof(SteamManager), "OnLobbyEntered")] public class OnLobbyEnteredPatch { private static void Postfix() { Plugin.Log.LogInfo((object)"[REPOChallenger - PluginSyncManager] Lobby entered, initializing PluginSyncManager..."); _ = PluginSyncManager.Instance; } } public class TaxWheelUI : MonoBehaviour { [CompilerGenerated] private sealed class <FlashResult>d__19 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TaxWheelUI <>4__this; private float <taxPercent>5__1; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlashResult>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_00c5: 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) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; SoundManagerMod.Instance.PlayReveal(); <taxPercent>5__1 = <>4__this._percent * 100f; <i>5__2 = 0; goto IL_0181; case 1: <>1__state = -1; ((Graphic)<>4__this._currencyText).color = new Color(1f, 0.85f, 0.2f); ((Graphic)<>4__this._percentText).color = new Color(1f, 0.85f, 0.2f); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; <i>5__2++; goto IL_0181; case 3: { <>1__state = -1; <>4__this.Hide(); return false; } IL_0181: if (<i>5__2 < 3) { <>4__this._currencyText.text = $"${<>4__this._newCurrency:N0}k"; <>4__this._percentText.text = $"{<taxPercent>5__1:0}%"; ((Graphic)<>4__this._currencyText).color = Color.white; ((Graphic)<>4__this._percentText).color = Color.white; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } ((Graphic)<>4__this._currencyText).color = new Color(1f, 0.3f, 0.3f); ((Graphic)<>4__this._percentText).color = new Color(1f, 0.3f, 0.3f); PunManager.instance.SetRunStatSet("currency", <>4__this._newCurrency); <>2__current = (object)new WaitForSeconds(ChallengerConfig.TimeToDisplayResult.Value); <>1__state = 3; return true; } } 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 <SpinWheel>d__18 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public TaxWheelUI <>4__this; private float <rotSpeed>5__1; private int <segmentIndex>5__2; private float <segmentAngle>5__3; private float <targetAngle>5__4; private float <currentAngle>5__5; private float <angleDiff>5__6; private float <totalRotationPhase2>5__7; private float <rotated>5__8; private float <finalAngle>5__9; private float <delta>5__10; private float <elapsed>5__11; private float <remaining>5__12; private float <t>5__13; private float <step>5__14; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpinWheel>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._isSpinning = true; <rotSpeed>5__1 = Mathf.RoundToInt(Random.Range(1350f, 1800f)); <segmentIndex>5__2 = (int)ChallengerConfig.BudgetPercent.Value / 10; <segmentAngle>5__3 = 36f; <targetAngle>5__4 = (float)<segmentIndex>5__2 * <segmentAngle>5__3 % 360f; <elapsed>5__11 = 0f; goto IL_013d; case 1: <>1__state = -1; <elapsed>5__11 += Time.deltaTime; goto IL_013d; case 2: <>1__state = -1; goto IL_02bc; case 3: { <>1__state = -1; return false; } IL_013d: if (<elapsed>5__11 < duration) { if (Time.time > <>4__this.nextTickTime) { SoundManagerMod.Instance.PlayTick(); <>4__this.nextTickTime = Time.time + <segmentAngle>5__3 / <rotSpeed>5__1; } ((Transform)<>4__this._wheelTransform).Rotate(0f, 0f, <rotSpeed>5__1 * Time.deltaTime); <>2__current = null; <>1__state = 1; return true; } <currentAngle>5__5 = ((Transform)<>4__this._wheelTransform).eulerAngles.z % 360f; <angleDiff>5__6 = (<targetAngle>5__4 - <currentAngle>5__5) % 360f; <totalRotationPhase2>5__7 = 1080f + <angleDiff>5__6; <rotated>5__8 = 0f; goto IL_02bc; IL_02bc: if (<rotated>5__8 < <totalRotationPhase2>5__7) { <remaining>5__12 = <totalRotationPhase2>5__7 - <rotated>5__8; <t>5__13 = <remaining>5__12 / <totalRotationPhase2>5__7; <rotSpeed>5__1 = Mathf.Lerp(0f, 1800f, <t>5__13); <rotSpeed>5__1 = Mathf.Max(<rotSpeed>5__1, 10f); if (Time.time > <>4__this.nextTickTime) { SoundManagerMod.Instance.PlayTick(); <>4__this.nextTickTime = Time.time + <segmentAngle>5__3 / <rotSpeed>5__1; } <step>5__14 = <rotSpeed>5__1 * Time.deltaTime; <step>5__14 = Mathf.Min(<step>5__14, <remaining>5__12); ((Transform)<>4__this._wheelTransform).Rotate(0f, 0f, <step>5__14); <rotated>5__8 += <step>5__14; <>2__current = null; <>1__state = 2; return true; } <finalAngle>5__9 = ((Transform)<>4__this._wheelTransform).eulerAngles.z; <delta>5__10 = Mathf.DeltaAngle(<finalAngle>5__9, <targetAngle>5__4); if (Mathf.Abs(<delta>5__10) < 5f) { ((Transform)<>4__this._wheelTransform).Rotate(0f, 0f, <delta>5__10); } <>4__this._isSpinning = false; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FlashResult()); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static TaxWheelUI _instance; private GameObject _uiRoot; private RectTransform _wheelTransform; private TMP_Text _currentCurrencyText; private TMP_Text _currencyText; private TMP_Text _percentText; private int _newCurrency; private float _percent; private bool _isVisible = false; private bool _isSpinning = false; private Coroutine _spinWheelCoroutine; private float nextTickTime = 0f; public static TaxWheelUI Instance { get { if ((Object)(object)_instance == (Object)null || (Object)(object)((Component)_instance).gameObject == (Object)null) { Create(); } return _instance; } } public bool IsVisible => _isVisible; public bool IsSpinning => _isSpinning; private void Update() { if (SemiFunc.RunIsShop() && _isVisible) { SemiFunc.InputDisableMovement(); SemiFunc.InputDisableAiming(); SemiFunc.CursorUnlock(0.1f); } } public static void Create() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("ShopBudgetUI"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<TaxWheelUI>(); _instance.LoadFromBundle(); } private void LoadFromBundle() { string text = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "UIs/taxwheelbundle"); if (!File.Exists(text)) { Debug.LogError((object)("Bundle d'UI introuvable à l'emplacement : " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("Échec du chargement du bundle d'UI depuis : " + text)); return; } GameObject val2 = val.LoadAsset<GameObject>("TaxWheelCanvas"); if ((Object)(object)val2 == (Object)null) { Debug.LogError((object)"Prefab 'TaxWheelCanvas' introuvable dans le bundle !"); val.Unload(false); return; } _uiRoot = Object.Instantiate<GameObject>(val2); Canvas component = _uiRoot.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = 1; _currencyText = ((Component)_uiRoot.transform.Find("Panel/ResultGroup/HorizontalGroupResult/textCurrencyValue")).GetComponent<TMP_Text>(); _currentCurrencyText = ((Component)_uiRoot.transform.Find("Panel/ResultGroup/HorizontalGroupResult/textCurrentCurrencyValue")).GetComponent<TMP_Text>(); _percentText = ((Component)_uiRoot.transform.Find("Panel/ResultGroup/HorizontalGroupResult/textPercentValue")).GetComponent<TMP_Text>(); _wheelTransform = ((Component)_uiRoot.transform.Find("Panel/WheelContainer/WheelBase")).GetComponent<RectTransform>(); _uiRoot.SetActive(false); val.Unload(false); Debug.Log((object)"UI chargée depuis l'asset bundle ✓"); } public void ShowTaxWheel(int totalMoney) { if ((Object)(object)_uiRoot == (Object)null || (Object)(object)_currencyText == (Object)null || (Object)(object)_percentText == (Object)null) { Plugin.Log.LogWarning((object)"UI perdue entre les scènes, rechargement..."); LoadFromBundle(); } _percent = ChallengerConfig.BudgetPercent.Value / 100f; _newCurrency = Mathf.RoundToInt((float)totalMoney * (1f - _percent)); _currentCurrencyText.text = $"${totalMoney}k"; _currencyText.text = "$...k"; _percentText.text = "...%"; _uiRoot.SetActive(true); _isVisible = true; if (_spinWheelCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_spinWheelCoroutine); } float value = ChallengerConfig.SpinWheelDuration.Value; _spinWheelCoroutine = ((MonoBehaviour)this).StartCoroutine(SpinWheel(value)); } [IteratorStateMachine(typeof(<SpinWheel>d__18))] private IEnumerator SpinWheel(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpinWheel>d__18(0) { <>4__this = this, duration = duration }; } [IteratorStateMachine(typeof(<FlashResult>d__19))] private IEnumerator FlashResult() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlashResult>d__19(0) { <>4__this = this }; } public void Hide() { _uiRoot.SetActive(false); _isVisible = false; SemiFunc.CursorUnlock(0f); } } [BepInPlugin("com.nolex.repochallenger", "REPO Challenger", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Log; public static Plugin Instance; private Harmony _harmony; private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ChallengerConfig.Init(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[REPO Challenger] mod is initializing..."); Harmony val = new Harmony("com.nolex.repochallenger"); val.PatchAll(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)("[REPO Challenger] Scene loaded: " + ((Scene)(ref scene)).name)); if ((Object)(object)GameObject.Find("REPOChallengerModHandler") == (Object)null) { GameObject val = new GameObject("REPOChallengerModHandler"); val.AddComponent<REPOChallengerModHandler>(); Object.DontDestroyOnLoad((Object)(object)val); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[REPO Challenger] Mod handler created and set to not destroy on load."); } } } public class REPOChallengerModHandler : MonoBehaviour { private bool levelInitialized = false; private object levelGeneratorInstance = null; private Type levelGeneratorType = null; private void Update() { if (!levelInitialized && TryGetLevelGeneratorInstance(out levelGeneratorInstance, out levelGeneratorType)) { FieldInfo field = levelGeneratorInstance.GetField("Generated", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && (bool)field.GetValue(levelGeneratorInstance)) { levelInitialized = true; Debug.Log((object)"[REPO Challenger] Level generator detected and level is generated."); } } } private void KeyInputsHandler() { if (Input.GetKeyDown((KeyCode)273) || Input.GetKeyDown((KeyCode)274)) { int runStatCurrency = StatsManager.instance.GetRunStatCurrency(); int num = (Input.GetKeyDown((KeyCode)273) ? (runStatCurrency + 10) : (runStatCurrency - 10)); SemiFunc.StatSetRunCurrency(num); } if (Input.GetKeyDown((KeyCode)112)) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)5); } } private bool TryGetLevelGeneratorInstance(out object levelGeneratorInstance, out Type levelGeneratorType) { levelGeneratorInstance = null; levelGeneratorType = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly[] array = assemblies; foreach (Assembly assembly in array) { Type[] types = assembly.GetTypes(); Type[] array2 = types; foreach (Type type in array2) { if (type.Name == "LevelGenerator") { levelGeneratorType = type; levelGeneratorInstance = Object.FindObjectOfType(levelGeneratorType); if (levelGeneratorInstance != null) { return true; } } } } return false; } } public static class ReflectionExtensions { public static FieldInfo GetField(this object obj, string fieldName, BindingFlags bindingFlags) { if (obj == null) { throw new ArgumentNullException("obj"); } Type type = obj.GetType(); return type.GetField(fieldName, bindingFlags); } } [HarmonyPatch(typeof(LoadingUI), "StopLoading")] public class ShopOpenPatch { private static void Postfix(ShopManager __instance) { if (!SemiFunc.RunIsShop()) { return; } int runStatCurrency = StatsManager.instance.GetRunStatCurrency(); ChallengerConfig.SetRandomPercentValue(); if (!PhotonNetwork.IsConnected || PhotonNetwork.CurrentRoom == null) { Plugin.Log.LogInfo((object)"Shop open in solo ! Tax wheel displayed."); TaxWheelUI.Instance.ShowTaxWheel(runStatCurrency); return; } PlayerAvatar localPlayer = GetLocalPlayer(); if ((Object)(object)localPlayer == (Object)null) { Plugin.Log.LogWarning((object)"Local player not found !"); return; } PhotonView component = ((Component)localPlayer).GetComponent<PhotonView>(); if (!((Object)(object)component != (Object)null) || component.IsMine) { if (PhotonNetwork.IsMasterClient) { float value = ChallengerConfig.BudgetPercent.Value; PluginSyncManager.Instance.BroadcastTaxPercent(value, runStatCurrency); Plugin.Log.LogInfo((object)"Shop open ! Tax Wheel displayed."); } else { Plugin.Log.LogInfo((object)"[Client] Waiting host's percentage..."); } } } private static PlayerAvatar GetLocalPlayer() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { PhotonView component = ((Component)val).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.IsMine) { return val; } } return null; } } public class SoundManagerMod : MonoBehaviour { [CompilerGenerated] private sealed class <LoadClip>d__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string fileName; public Action<AudioClip> onLoaded; public SoundManagerMod <>4__this; private string <fullPath>5__1; private AudioType <type>5__2; private UnityWebRequest <request>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadClip>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <fullPath>5__1 = null; <request>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <fullPath>5__1 = Path.Combine(<>4__this._soundsPath, fileName); if (!File.Exists(<fullPath>5__1)) { Debug.LogWarning((object)("Son introuvable : " + <fullPath>5__1)); return false; } <type>5__2 = (AudioType)(fileName.EndsWith(".ogg") ? 14 : 20); <request>5__3 = UnityWebRequestMultimedia.GetAudioClip("file://" + <fullPath>5__1, <type>5__2); <>1__state = -3; <>2__current = <request>5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; onLoaded(DownloadHandlerAudioClip.GetContent(<request>5__3)); <>m__Finally1(); <request>5__3 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<request>5__3 != null) { ((IDisposable)<request>5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static SoundManagerMod _instance; private AudioSource _audioSource; private AudioClip _tickSound; private AudioClip _revealSound; public static SoundManagerMod Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("ShopBudgetSound"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<SoundManagerMod>(); } return _instance; } } private string _soundsPath => Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "Sounds"); private void Awake() { _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); ((MonoBehaviour)this).StartCoroutine(LoadClip("tick.wav", delegate(AudioClip clip) { _tickSound = clip; })); ((MonoBehaviour)this).StartCoroutine(LoadClip("reveal.wav", delegate(AudioClip clip) { _revealSound = clip; })); } [IteratorStateMachine(typeof(<LoadClip>d__9))] private IEnumerator LoadClip(string fileName, Action<AudioClip> onLoaded) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadClip>d__9(0) { <>4__this = this, fileName = fileName, onLoaded = onLoaded }; } public void PlayTick() { _audioSource.PlayOneShot(_tickSound); } public void PlayReveal() { _audioSource.PlayOneShot(_revealSound); } }