public void Play(string _file) { this.m_FileName = _file; if (!this.m_Play) { return; } string path = UserData.Create("audio") + _file; if (!File.Exists(path)) { return; } if (Singleton <Studio.Studio> .Instance.bgmCtrl.play) { Singleton <Studio.Studio> .Instance.bgmCtrl.Stop(); } Singleton <Sound> .Instance.StopBGM(0.0f); string empty = string.Empty; AudioClip clip = ExternalAudioClip.Load(path, 0L, (uAudio.uAudio_backend.uAudio)null, ref empty); if (Object.op_Equality((Object)clip, (Object)null)) { Debug.LogWarning((object)string.Format("読めないよ : {0}", (object)_file)); } else { Singleton <Sound> .Instance.Play(Sound.Type.BGM, clip, 0.0f); } }
public void SongPlay() { if (this.State == 1) { return; } this.State = (PlayBackState)1; try { mp3AudioClip.SongDone = false; mp3AudioClip.flare_SongEnd = false; this.UAudio.targetFile = (__Null)this.targetFile; if (Object.op_Equality((Object)this.myAudioSource.get_clip(), (Object)null)) { if (this.UAudio.LoadMainOutputStream()) { long songLength = (long)this.UAudio.get_SongLength(); string szErrorMs = (string)null; this.myAudioSource.set_clip(ExternalAudioClip.Load(this.targetFile, (long)this.UAudio.get_SongLength(), this.UAudio, ref szErrorMs)); this.CurrentTime = TimeSpan.Zero; try { if (this.sendPlaybackState != null) { this.sendPlaybackState((PlayBackState)1); } } catch { Debug.LogWarning((object)"theAudioStream_sendStartLoopPump #32fw46hw465h45h"); } } else { this.myAudioSource.set_clip((AudioClip)null); } } if (Object.op_Inequality((Object)this.myAudioSource.get_clip(), (Object)null)) { if (this.myAudioSource.get_isPlaying()) { return; } this.myAudioSource.Play(); } else { this.State = (PlayBackState)0; } } catch (Exception ex) { this.State = (PlayBackState)0; Debug.LogWarning((object)"uAudioPlayer - Play #j356j536j356j56j"); Debug.LogWarning((object)ex); } }
private void Awake() { harmony = HarmonyWrapper.PatchAll(typeof(Hooks)); var ass = Assembly.GetExecutingAssembly(); var soundDir = Path.Combine(Path.GetDirectoryName(ass.Location), PluginName); foreach (var filePath in Directory.GetFiles(soundDir)) { var clip = ExternalAudioClip.Load(filePath); slaps.Add(clip); } }