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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPO_BoomBox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("REPO_BoomBox")]
[assembly: AssemblyCopyright("Copyright © 微软中国 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d8e9ce1-f685-430e-a7cf-19c498264c25")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace REPO_BoomBox;
[BepInPlugin("com.XiaohaiMod.REPO.BoomBox", "Xiaohai_HealBoomBox", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Item item;
public ConfigEntry<bool> healPlayer;
public ConfigEntry<int> healAmount;
public ConfigEntry<int> healSecond;
public ConfigEntry<float> batteryDrain;
public ConfigEntry<bool> spawnMust;
public ConfigEntry<int> valueMin;
public ConfigEntry<int> valueMax;
public ConfigEntry<int> probability;
public ConfigEntry<int> language;
public static ManualLogSource logger;
public static Plugin instance;
public static AudioMixerGroup[] groups;
public void Awake()
{
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
instance = this;
logger = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Xiaohai_HealBoomBox插件加载成功!");
healPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("BoomBox", "healPlayer", true, "是否恢复玩家生命值 / Enable health regeneration for the player");
healSecond = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "healCooldownSecond", 1, "每次单位时间(秒)恢复一次体力(比如:1为每秒,5为每5秒) / Time interval between each heal (in seconds)");
healAmount = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "healAmount", 1, "每次单位时间秒的恢复生命值量 / Health points restored per healing interval");
batteryDrain = ((BaseUnityPlugin)this).Config.Bind<float>("BoomBox", "batteryDrainRate", 0.2f, "每秒电量消耗量 / Battery consumption per second");
spawnMust = ((BaseUnityPlugin)this).Config.Bind<bool>("BoomBox", "spawnMust", true, "是否设置成一定在商店出现?false为随缘 / Force item to always appear in shop (false = random chance)");
probability = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "percentageProbability", 33, "如果为随缘出现,在商店出现的百分比概率(0-100,大于100或者小于0都取33) / Spawn probability percentage when not guaranteed (0-100)");
valueMin = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "valueMin", 3000, "商品最低价格(最高和最低中取随机价格) / Minimum item price (randomized between min/max)");
valueMax = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "valueMax", 6000, "商品最高价格(最高和最低中取随机价格) / Maximum item price (randomized between min/max)");
language = ((BaseUnityPlugin)this).Config.Bind<int>("BoomBox", "language", 0, "0=简体中文,other number=English");
if (probability.Value > 100 || probability.Value < 0)
{
probability.Value = 33;
}
string location = Assembly.GetExecutingAssembly().Location;
string directoryName = Path.GetDirectoryName(location);
string text = Path.Combine(directoryName, "boombox");
AssetBundle val = AssetBundle.LoadFromFile(text);
item = val.LoadAsset<Item>("item Boombox");
AudioMixer val2 = val.LoadAsset<AudioMixer>("Sound");
if ((Object)(object)val2 != (Object)null)
{
logger.LogInfo((object)"资源加载成!");
groups = val2.FindMatchingGroups("Sound");
AudioMixerGroup[] array = groups;
foreach (AudioMixerGroup val3 in array)
{
logger.LogInfo((object)("找到音效:" + ((Object)val3).name + "!"));
}
}
if ((Object)(object)item != (Object)null)
{
if (language.Value == 0)
{
item.itemName = "音响";
}
else
{
item.itemName = "BoomBox";
}
Items.RegisterItem(item);
((BaseUnityPlugin)this).Logger.LogInfo((object)("加载预制体成功!" + item.itemName));
item.prefab.AddComponent<ItemDroneBoombox>();
item.value.valueMin = valueMin.Value;
item.value.valueMax = valueMax.Value;
new Harmony("com.XiaohaiMod.REPO.BoomBox").PatchAll();
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"加载预制体失败!");
}
}
}
public static class Patch
{
[HarmonyPatch(typeof(StatsManager))]
public static class StatsManagerPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void AwakePatch(StatsManager __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
if ((Object)(object)Object.FindObjectOfType<AudioLoader>() == (Object)null)
{
Plugin.logger.LogInfo((object)"创建新游戏对象并附加自定义组件");
GameObject val = new GameObject("MyCustomObject");
Object.DontDestroyOnLoad((Object)(object)val);
val.SetActive(true);
val.AddComponent<AudioLoader>();
}
}
}
[HarmonyPatch(typeof(PunManager))]
public static class PunManagerPatch
{
private static bool spawned;
private static bool needSpawn;
[HarmonyPatch("SpawnShopItem")]
[HarmonyPostfix]
public static void SpawnShopItemPatch(PunManager __instance, ref List<Item> itemList)
{
if (GameManager.instance.gameMode == 1 && !PhotonNetwork.IsMasterClient)
{
return;
}
if (itemList.Contains(Plugin.item))
{
spawned = true;
}
else
{
if (spawned)
{
return;
}
if (Plugin.instance.spawnMust.Value)
{
needSpawn = true;
return;
}
int value = Plugin.instance.probability.Value;
int num = Random.Range(0, 100);
if (num < value)
{
needSpawn = true;
}
}
}
[HarmonyPatch("SpawnShopItem")]
[HarmonyPrefix]
public static void SpawnShopItemPatch_Pre(PunManager __instance, ref List<Item> itemList)
{
if (needSpawn && !spawned)
{
itemList.Add(Plugin.item);
needSpawn = true;
spawned = false;
}
}
}
}
public class ItemDroneBoombox : MonoBehaviourPun
{
public AudioClip[] boomBoxClips;
public Sound boomboxSound;
public bool healPlayer = true;
public int healAmount = 1;
public float batteryDrain = 0.1f;
private ItemDrone itemDrone;
private PhysGrabObject myPhysGrabObject;
private ItemEquippable itemEquippable;
private ItemBattery itemBattery;
private bool isPlayingMusic = false;
private int currentClipIndex = 0;
private float healTimer = 0f;
public GUIStyle style;
private void Start()
{
//IL_0115: 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_0125: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: 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_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Expected O, but got Unknown
Plugin.logger.LogInfo((object)$"healPlayer:{healPlayer},healAmount:{healAmount},batteryDrain:{batteryDrain}");
itemDrone = ((Component)this).GetComponent<ItemDrone>();
myPhysGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
itemBattery = ((Component)this).GetComponent<ItemBattery>();
GameObject gameObject = ((Component)this).gameObject;
AudioSource val = gameObject.AddComponent<AudioSource>();
val.volume = 1f;
val.minDistance = 1f;
val.maxDistance = 20f;
val.spatialBlend = 1f;
val.reverbZoneMix = 1f;
val.rolloffMode = (AudioRolloffMode)1;
AudioMixerGroup val2 = null;
AudioMixerGroup[] groups = Plugin.groups;
foreach (AudioMixerGroup val3 in groups)
{
if (((Object)val3).name == "Sound Effects")
{
val2 = val3;
break;
}
}
Plugin.logger.LogInfo((object)$"targetGroup为{val.outputAudioMixerGroup}");
boomboxSound = new Sound
{
Volume = 0.1f,
VolumeRandom = 0f,
Pitch = 1f,
PitchRandom = 0f,
SpatialBlend = 1f,
Doppler = 1f,
ReverbMix = 1f,
FalloffMultiplier = 1f,
OffscreenVolume = 0.8f,
OffscreenFalloff = 1f,
Type = (AudioType)0,
Source = val,
Sounds = boomBoxClips
};
if (AudioLoader.instance.loadedClips.Count != 0)
{
boomBoxClips = AudioLoader.instance.loadedClips.ToArray();
boomboxSound.Sounds = boomBoxClips;
}
Plugin.logger.LogInfo((object)"音频组件初始化成功!Boombox Script loaded successfully");
if (GameManager.instance.gameMode == 0 || PhotonNetwork.IsMasterClient)
{
healPlayer = Plugin.instance.healPlayer.Value;
healAmount = Plugin.instance.healAmount.Value;
batteryDrain = Plugin.instance.batteryDrain.Value;
StopMusic();
if (SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient)
{
((MonoBehaviourPun)this).photonView.RPC("RPC_SyncConfig", (RpcTarget)4, new object[3] { healPlayer, healAmount, batteryDrain });
}
}
}
private void OnGUI()
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
if (itemDrone.itemActivated && itemDrone.magnetActive && (Object)(object)itemDrone.playerAvatarTarget != (Object)null && itemDrone.targetIsLocalPlayer)
{
style = GUI.skin.GetStyle("label");
style.fontSize = 15;
style.normal.textColor = Color.blue;
style.richText = true;
if (Plugin.instance.language.Value == 0)
{
GUI.Label(new Rect(10f, 10f, 520f, 100f), $"当前播放:{((Object)boomBoxClips[currentClipIndex]).name} \n 按[ ]来上/下一首,按=和-来加/减音量,当前音量(0-100): {boomboxSound.Volume * 100f} 傀鹏&小海联合出品.", style);
}
else
{
GUI.Label(new Rect(10f, 10f, 520f, 100f), $"Playing:{((Object)boomBoxClips[currentClipIndex]).name} \nPress [ ] to play the previous/next song, press = and - to increase/decrease the volume. Current volume (0-100): {boomboxSound.Volume * 100f} By Xiaohai&KP.", style);
}
}
}
private void Update()
{
if (itemDrone.itemActivated && itemDrone.magnetActive && (Object)(object)itemDrone.playerAvatarTarget != (Object)null && itemDrone.targetIsLocalPlayer)
{
if (Input.GetKeyDown((KeyCode)91))
{
PlayPrevious();
}
else if (Input.GetKeyDown((KeyCode)93))
{
PlayNext();
}
if (Input.GetKeyDown((KeyCode)61))
{
boomboxSound.Volume = Mathf.Clamp01(boomboxSound.Volume + 0.02f);
((MonoBehaviourPun)this).photonView.RPC("RPC_SyncVolume", (RpcTarget)0, new object[1] { boomboxSound.Volume });
}
else if (Input.GetKeyDown((KeyCode)45))
{
boomboxSound.Volume = Mathf.Clamp01(boomboxSound.Volume - 0.02f);
((MonoBehaviourPun)this).photonView.RPC("RPC_SyncVolume", (RpcTarget)0, new object[1] { boomboxSound.Volume });
}
}
}
private void PlayNext()
{
if (boomBoxClips != null && boomBoxClips.Length != 0)
{
int index = (currentClipIndex + 1) % boomBoxClips.Length;
PlayMusic(index);
}
}
private void PlayPrevious()
{
if (boomBoxClips != null && boomBoxClips.Length != 0)
{
int index = (currentClipIndex - 1 + boomBoxClips.Length) % boomBoxClips.Length;
PlayMusic(index);
}
}
private void PlayMusic(int index)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (isPlayingMusic)
{
StopMusic();
}
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("RPC_PlayMusic", (RpcTarget)0, new object[1] { index });
return;
}
currentClipIndex = index;
boomboxSound.Sounds = (AudioClip[])(object)new AudioClip[1] { boomBoxClips[index] };
boomboxSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
Plugin.logger.LogInfo((object)("播放音乐: " + ((Object)boomBoxClips[index]).name));
isPlayingMusic = true;
}
private void StopMusic()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("RPC_StopMusic", (RpcTarget)0, Array.Empty<object>());
}
else
{
RPC_StopMusic();
}
}
private void FixedUpdate()
{
if (itemEquippable.isEquipped)
{
return;
}
if (GameManager.instance.gameMode == 1 && !PhotonNetwork.IsMasterClient)
{
UpdateMusicPlayback();
}
else if (itemDrone.itemActivated)
{
myPhysGrabObject.OverrideZeroGravity(0.1f);
myPhysGrabObject.OverrideDrag(1f, 0.1f);
myPhysGrabObject.OverrideAngularDrag(10f, 0.1f);
if (itemDrone.itemActivated && boomBoxClips != null && !isPlayingMusic)
{
PlayMusic((currentClipIndex >= 0) ? currentClipIndex : 0);
}
BatteryDrain(batteryDrain);
if (healPlayer && itemDrone.itemActivated && itemDrone.magnetActive && (Object)(object)itemDrone.playerAvatarTarget != (Object)null)
{
healTimer += Time.fixedDeltaTime;
PlayerHealth playerHealth = itemDrone.playerAvatarTarget.playerHealth;
if (healTimer >= (float)Plugin.instance.healSecond.Value)
{
if (playerHealth.health < playerHealth.maxHealth)
{
playerHealth.HealOther(healAmount, false);
}
healTimer = 0f;
}
}
else
{
healTimer = 0f;
}
}
else if (isPlayingMusic)
{
StopMusic();
}
}
private void UpdateMusicPlayback()
{
if (currentClipIndex != -1 && !boomboxSound.Source.isPlaying)
{
PlayMusic(currentClipIndex);
}
}
[PunRPC]
private void RPC_PlayMusic(int clipIndex)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
if (boomBoxClips == null || clipIndex < 0 || clipIndex >= boomBoxClips.Length)
{
Debug.LogError((object)$"无效的音乐索引: {clipIndex}");
return;
}
currentClipIndex = clipIndex;
boomboxSound.Sounds = (AudioClip[])(object)new AudioClip[1] { boomBoxClips[clipIndex] };
boomboxSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
Plugin.logger.LogInfo((object)("播放音乐: " + ((Object)boomBoxClips[clipIndex]).name));
isPlayingMusic = true;
}
[PunRPC]
private void RPC_StopMusic()
{
boomboxSound.Stop();
isPlayingMusic = false;
currentClipIndex = -1;
}
[PunRPC]
private void RPC_SyncConfig(bool syncHealPlayer, int syncHealAmount, float syncBatteryDrain)
{
healPlayer = syncHealPlayer;
healAmount = syncHealAmount;
batteryDrain = syncBatteryDrain;
}
[PunRPC]
private void RPC_SyncVolume(float syncVolume)
{
boomboxSound.Volume = syncVolume;
boomboxSound.Source.volume = boomboxSound.Volume;
Plugin.logger.LogInfo((object)$"音量已修改至 Volume Change : {boomboxSound.Volume:F2}");
}
private void BatteryDrain(float amount)
{
ItemBattery obj = itemBattery;
obj.batteryLife -= amount * Time.fixedDeltaTime;
}
}
public class AudioLoader : MonoBehaviour
{
[CompilerGenerated]
private sealed class <LoadAudioClip>d__6 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public string filePath;
public AudioLoader <>4__this;
private AudioType <audioType>5__1;
private string <extension>5__2;
private string <uri>5__3;
private string <>s__4;
private UnityWebRequest <www>5__5;
private AudioClip <clip>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudioClip>d__6(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();
}
}
<extension>5__2 = null;
<uri>5__3 = null;
<>s__4 = null;
<www>5__5 = null;
<clip>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002a: 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)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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_0133: Invalid comparison between Unknown and I4
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
try
{
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<audioType>5__1 = (AudioType)0;
<extension>5__2 = Path.GetExtension(filePath).ToLower();
string text = <extension>5__2;
<>s__4 = text;
switch (<>s__4)
{
case ".mp3":
<audioType>5__1 = (AudioType)13;
break;
case ".wav":
<audioType>5__1 = (AudioType)20;
break;
case ".ogg":
<audioType>5__1 = (AudioType)14;
break;
default:
Plugin.logger.LogWarning((object)("目录不存在 Directory does not exist: " + <extension>5__2));
return false;
}
<>s__4 = null;
<uri>5__3 = "file://" + filePath;
<www>5__5 = UnityWebRequestMultimedia.GetAudioClip(<uri>5__3, <audioType>5__1);
<>1__state = -3;
<>2__current = <www>5__5.SendWebRequest();
<>1__state = 1;
return true;
}
case 1:
<>1__state = -3;
if ((int)<www>5__5.result == 2)
{
Plugin.logger.LogError((object)("目录不存在 Directory does not exist: " + <www>5__5.error));
}
else
{
<clip>5__6 = DownloadHandlerAudioClip.GetContent(<www>5__5);
if ((Object)(object)<clip>5__6 != (Object)null)
{
((Object)<clip>5__6).name = Path.GetFileNameWithoutExtension(filePath);
<>4__this.loadedClips.Add(<clip>5__6);
Plugin.logger.LogInfo((object)("Loaded: " + ((Object)<clip>5__6).name));
}
<clip>5__6 = null;
}
<>m__Finally1();
<www>5__5 = 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 (<www>5__5 != null)
{
((IDisposable)<www>5__5).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadAudioFilesFromDirectory>d__5 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public AudioLoader <>4__this;
private string[] <allowedExtensions>5__1;
private List<string> <audioFiles>5__2;
private string[] <>s__3;
private int <>s__4;
private string <file>5__5;
private string <extension>5__6;
private List<string>.Enumerator <>s__7;
private string <filePath>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudioFilesFromDirectory>d__5(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();
}
}
<allowedExtensions>5__1 = null;
<audioFiles>5__2 = null;
<>s__3 = null;
<file>5__5 = null;
<extension>5__6 = null;
<>s__7 = default(List<string>.Enumerator);
<filePath>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!Directory.Exists(<>4__this.directoryPath))
{
Plugin.logger.LogError((object)("目录不存在 Directory does not exist: " + <>4__this.directoryPath));
return false;
}
<allowedExtensions>5__1 = new string[3] { ".mp3", ".wav", ".ogg" };
<audioFiles>5__2 = new List<string>();
<>s__3 = Directory.GetFiles(<>4__this.directoryPath);
for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
{
<file>5__5 = <>s__3[<>s__4];
<extension>5__6 = Path.GetExtension(<file>5__5).ToLower();
if (<allowedExtensions>5__1.Contains(<extension>5__6))
{
<audioFiles>5__2.Add(<file>5__5);
}
<extension>5__6 = null;
<file>5__5 = null;
}
<>s__3 = null;
<>s__7 = <audioFiles>5__2.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<filePath>5__8 = null;
break;
}
if (<>s__7.MoveNext())
{
<filePath>5__8 = <>s__7.Current;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadAudioClip(<filePath>5__8));
<>1__state = 1;
return true;
}
<>m__Finally1();
<>s__7 = default(List<string>.Enumerator);
if (<>4__this.loadedClips.Count > 0)
{
<>4__this.loadFinished = true;
Plugin.logger.LogInfo((object)"音乐加载完成 Music loaded");
}
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;
((IDisposable)<>s__7).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public string directoryPath;
public List<AudioClip> loadedClips = new List<AudioClip>();
public static AudioLoader instance;
public bool loadFinished = false;
private void Start()
{
Plugin.logger.LogInfo((object)"音乐加载开始..");
instance = this;
string location = Assembly.GetExecutingAssembly().Location;
string directoryName = Path.GetDirectoryName(location);
directoryPath = directoryName + "/Music";
if (loadedClips.Count <= 0)
{
Plugin.logger.LogInfo((object)("音乐目录 Music directory: " + directoryPath + "开始加载.."));
((MonoBehaviour)this).StartCoroutine(LoadAudioFilesFromDirectory());
}
}
[IteratorStateMachine(typeof(<LoadAudioFilesFromDirectory>d__5))]
private IEnumerator LoadAudioFilesFromDirectory()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudioFilesFromDirectory>d__5(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<LoadAudioClip>d__6))]
private IEnumerator LoadAudioClip(string filePath)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudioClip>d__6(0)
{
<>4__this = this,
filePath = filePath
};
}
}