using 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 BudgetConfig
{
public static ConfigEntry<float> BudgetPercent;
public static ConfigEntry<float> TimeFastPhase;
public static ConfigEntry<float> TimeSlowPhase;
public static ConfigEntry<float> TimeToDisplayResult;
public static void SetRandomPercentValue()
{
int num = Random.Range(1, 11);
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
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
BudgetPercent = config.Bind<float>("Shop - Fortune 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();
TimeFastPhase = config.Bind<float>("Shop - Fortune Wheel", "TimeFastPhase", 2f, new ConfigDescription("La durée de la roue.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
TimeSlowPhase = config.Bind<float>("Shop - Fortune Wheel", "TimeSlowPhase", 2f, new ConfigDescription("La durée de ralentisement jusqu'au résultat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
TimeToDisplayResult = config.Bind<float>("Shop - Fortune Wheel", "TimeToDisplayResult", 3f, new ConfigDescription("La durée d'affichage du résultat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
}
}
public class BudgetSync : MonoBehaviourPun
{
private static BudgetSync _instance;
public static BudgetSync 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("BudgetSync");
Object.DontDestroyOnLoad((Object)(object)val);
PhotonView val2 = val.AddComponent<PhotonView>();
val2.ViewID = 999;
PhotonNetwork.RegisterPhotonView(val2);
_instance = val.AddComponent<BudgetSync>();
}
return _instance;
}
}
public void BroadcastBudgetPercent(float percent, int hostMoney)
{
if (!PhotonNetwork.IsMasterClient)
{
Plugin.Log.LogWarning((object)"Seul l'host peut broadcaster le pourcentage !");
return;
}
((MonoBehaviourPun)this).photonView.RPC("ReceiveBudgetPercent", (RpcTarget)0, new object[2] { percent, hostMoney });
}
[PunRPC]
private void ReceiveBudgetPercent(float percent, int shopCurrency)
{
Plugin.Log.LogInfo((object)$"[BudgetSync] Pourcentage reçu : {percent}% (Shop currency : {shopCurrency})");
BudgetConfig.BudgetPercent.Value = percent;
BudgetUI.Instance.ShowBudget(shopCurrency);
}
}
public class BudgetUI : MonoBehaviour
{
[CompilerGenerated]
private sealed class <FlashResult>d__15 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public int finalBudget;
public BudgetUI <>4__this;
private int <i>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FlashResult>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0108: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
SoundManagerMod.Instance.PlayReveal();
<i>5__1 = 0;
goto IL_0169;
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__1++;
goto IL_0169;
case 3:
{
<>1__state = -1;
<>4__this.Hide();
return false;
}
IL_0169:
if (<i>5__1 < 3)
{
<>4__this._currencyText.text = $"${finalBudget:N0}k";
<>4__this._percentText.text = $"{BudgetConfig.BudgetPercent.Value: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;
}
<>4__this._currencyText.text = $"${finalBudget:N0}k";
<>4__this._percentText.text = $"{BudgetConfig.BudgetPercent.Value:0}%";
((Graphic)<>4__this._currencyText).color = new Color(0.2f, 1f, 0.4f);
((Graphic)<>4__this._percentText).color = new Color(0.2f, 1f, 0.4f);
PunManager.instance.SetRunStatSet("currency", finalBudget);
<>2__current = (object)new WaitForSeconds(BudgetConfig.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 <SlotMachineAnimation>d__14 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public int totalMoney;
public int finalBudget;
public BudgetUI <>4__this;
private float <fastPhase>5__1;
private float <slowPhase>5__2;
private float <elapsed>5__3;
private float <interval>5__4;
private float <slowElapsed>5__5;
private Color <colorA>5__6;
private Color <colorB>5__7;
private float <t>5__8;
private int <fakeValue>5__9;
private int <fakePercent>5__10;
private float <t>5__11;
private int <fakeValue>5__12;
private float <fakePercent>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SlotMachineAnimation>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Expected O, but got Unknown
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<fastPhase>5__1 = BudgetConfig.TimeFastPhase.Value;
<slowPhase>5__2 = BudgetConfig.TimeSlowPhase.Value;
<elapsed>5__3 = 0f;
<interval>5__4 = 0.05f;
goto IL_01d0;
case 1:
<>1__state = -1;
<elapsed>5__3 += <interval>5__4;
goto IL_01d0;
case 2:
<>1__state = -1;
<slowElapsed>5__5 += <interval>5__4;
goto IL_030b;
case 3:
{
<>1__state = -1;
return false;
}
IL_01d0:
if (<elapsed>5__3 < <fastPhase>5__1)
{
SoundManagerMod.Instance.PlayTick();
<colorA>5__6 = new Color(1f, 0.7f, 0.2f);
<colorB>5__7 = new Color(1f, 1f, 0.4f);
<t>5__8 = Mathf.PingPong(Time.time * 5f, 1f);
((Graphic)<>4__this._currencyText).color = Color.Lerp(<colorA>5__6, <colorB>5__7, <t>5__8);
((Graphic)<>4__this._percentText).color = Color.Lerp(<colorA>5__6, <colorB>5__7, <t>5__8);
<fakeValue>5__9 = Random.Range(0, totalMoney);
<fakePercent>5__10 = Random.Range(1, 11);
<fakePercent>5__10 *= 10;
<>4__this._currencyText.text = $"${<fakeValue>5__9:N0}k";
<>4__this._percentText.text = $"{<fakePercent>5__10:0}%";
<>2__current = (object)new WaitForSeconds(<interval>5__4);
<>1__state = 1;
return true;
}
<slowElapsed>5__5 = 0f;
goto IL_030b;
IL_030b:
if (<slowElapsed>5__5 < <slowPhase>5__2)
{
SoundManagerMod.Instance.PlayTick();
<t>5__11 = <slowElapsed>5__5 / <slowPhase>5__2;
<interval>5__4 = Mathf.Lerp(0.05f, 0.25f, <t>5__11);
<fakeValue>5__12 = (int)Mathf.Lerp((float)Random.Range(0, totalMoney), (float)finalBudget, <t>5__11 * <t>5__11);
<fakePercent>5__13 = Mathf.Lerp((float)(Random.Range(1, 11) * 10), BudgetConfig.BudgetPercent.Value, <t>5__11 * <t>5__11);
<>4__this._currencyText.text = $"${<fakeValue>5__12:N0}k";
<>4__this._percentText.text = $"{<fakePercent>5__13:0}%";
<>2__current = (object)new WaitForSeconds(<interval>5__4);
<>1__state = 2;
return true;
}
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FlashResult(finalBudget));
<>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 BudgetUI _instance;
private GameObject _uiRoot;
private TMP_Text _titleText;
private TMP_Text _currencyText;
private TMP_Text _currentCurrencyText;
private TMP_Text _percentText;
private bool _isVisible = false;
private Coroutine _slotCoroutine;
public static BudgetUI Instance
{
get
{
if ((Object)(object)_instance == (Object)null || (Object)(object)((Component)_instance).gameObject == (Object)null)
{
Create();
}
return _instance;
}
}
public bool IsVisible => _isVisible;
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<BudgetUI>();
_instance.LoadFromBundle();
}
private void LoadFromBundle()
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "UIs/fortunewheelbundle");
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>("FortuneWheel_Canvas");
if ((Object)(object)val2 == (Object)null)
{
Debug.LogError((object)"Prefab 'FortuneWheel_Canvas' introuvable dans le bundle !");
val.Unload(false);
return;
}
_uiRoot = Object.Instantiate<GameObject>(val2);
Canvas component = _uiRoot.GetComponent<Canvas>();
component.renderMode = (RenderMode)0;
component.sortingOrder = 100;
Debug.Log((object)$"_uiRoot Render Mode: {component.renderMode}");
_titleText = ((Component)_uiRoot.transform.Find("Panel/textTitle")).GetComponent<TMP_Text>();
_currencyText = ((Component)_uiRoot.transform.Find("Panel/VerticalGroup/HG_Currency/textCurrencyValue")).GetComponent<TMP_Text>();
_currentCurrencyText = ((Component)_uiRoot.transform.Find("Panel/VerticalGroup/HG_Currency/textCurrentCurrencyValue")).GetComponent<TMP_Text>();
_percentText = ((Component)_uiRoot.transform.Find("Panel/VerticalGroup/HG_Percent/textPercentValue")).GetComponent<TMP_Text>();
_uiRoot.SetActive(false);
val.Unload(false);
Debug.Log((object)"UI chargée depuis l'asset bundle ✓");
}
public void ShowBudget(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();
}
float num = BudgetConfig.BudgetPercent.Value / 100f;
int num2 = Mathf.RoundToInt((float)totalMoney * num);
_titleText.text = "Fortune Wheel";
_currencyText.text = $"${num2:N0}k";
_currentCurrencyText.text = $"${totalMoney}k";
_percentText.text = $"{BudgetConfig.BudgetPercent.Value}%";
_uiRoot.SetActive(true);
_isVisible = true;
if (_slotCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(_slotCoroutine);
}
_slotCoroutine = ((MonoBehaviour)this).StartCoroutine(SlotMachineAnimation(totalMoney, num2));
}
[IteratorStateMachine(typeof(<SlotMachineAnimation>d__14))]
private IEnumerator SlotMachineAnimation(int totalMoney, int finalBudget)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SlotMachineAnimation>d__14(0)
{
<>4__this = this,
totalMoney = totalMoney,
finalBudget = finalBudget
};
}
[IteratorStateMachine(typeof(<FlashResult>d__15))]
private IEnumerator FlashResult(int finalBudget)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FlashResult>d__15(0)
{
<>4__this = this,
finalBudget = finalBudget
};
}
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;
BudgetConfig.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()
{
LogKeyInputs();
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 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;
}
private void LogKeyInputs()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
{
if (Input.GetKeyDown(value))
{
Debug.Log((object)$"[REPO Challenger] Key pressed: {(object)value}");
}
}
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);
}
}
}
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();
BudgetConfig.SetRandomPercentValue();
if (!PhotonNetwork.IsConnected || PhotonNetwork.CurrentRoom == null)
{
Plugin.Log.LogInfo((object)"Shop ouvert en solo ! Budget affiché.");
BudgetUI.Instance.ShowBudget(runStatCurrency);
return;
}
PlayerAvatar localPlayer = GetLocalPlayer();
if ((Object)(object)localPlayer == (Object)null)
{
Plugin.Log.LogWarning((object)"Joueur local introuvable !");
return;
}
PhotonView component = ((Component)localPlayer).GetComponent<PhotonView>();
if (!((Object)(object)component != (Object)null) || component.IsMine)
{
if (PhotonNetwork.IsMasterClient)
{
float value = BudgetConfig.BudgetPercent.Value;
BudgetSync.Instance.BroadcastBudgetPercent(value, runStatCurrency);
Plugin.Log.LogInfo((object)"Shop ouvert ! Budget affiché.");
}
else
{
Plugin.Log.LogInfo((object)"[Client] En attente du pourcentage de l'host...");
}
}
}
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);
}
}