public static GameObject CreateGameObjectWithAudio(string goName, TsAudio.BaseData baseData, AudioClip clip, bool loop, bool isDontDestroyOnLoad) { if (string.IsNullOrEmpty(goName)) { goName = "_Audio: " + clip.name; } TsAudio tsAudio = TsAudioCreator.Create(baseData); if (tsAudio == null) { TsLog.LogError("CreateGameObjectWithAudio()~! Failed Create~! goName= " + goName, new object[0]); return(null); } GameObject gameObject = new GameObject(goName, new Type[] { typeof(AudioSource) }); tsAudio.RefAudioSource = gameObject.audio; tsAudio.RefAudioClip = clip; TsAudioAdapter tsAudioAdapter = TsAudioAdapter.TryToAddAdapter(gameObject, tsAudio); tsAudioAdapter.GetAudioEx().baseData.Loop = loop; tsAudioAdapter.GetAudioEx().baseData.IsDontDestroyOnLoad = isDontDestroyOnLoad; return(gameObject); }
public void Start() { for (int i = 0; i < this._audioBaseDatas.Count; i++) { TsAudio.BaseData baseData = this._audioBaseDatas[i]; if (baseData.DefaultBundleInfo._RequestDownload(new TsAudio.RequestData(i, baseData), new PostProcPerItem(this.OnEvent_Downloaded))) { baseData.RequestedIndexList.Add(i); } } }
public static TsAudio Create(TsAudio.BaseData baseData) { if (baseData == null) { TsLog.LogError("TsAudioCreator.Create() baseData == null !!!!!", new object[0]); return(null); } TsAudio tsAudio; switch (baseData.AudioType) { case EAudioType.SFX: tsAudio = new TsAudioSFX(baseData.AudioType); break; case EAudioType.BGM: tsAudio = new TsAudioBGM(baseData.AudioType); break; case EAudioType.AMBIENT: tsAudio = new TsAudioAmbient(baseData.AudioType); break; case EAudioType.UI: tsAudio = new TsAudioUI(baseData.AudioType); break; case EAudioType.VOICE: tsAudio = new TsAudioVoice(baseData.AudioType); break; case EAudioType.SYSTEM: tsAudio = new TsAudioSystem(baseData.AudioType); break; case EAudioType.GAME_DRAMA: tsAudio = new TsAudioGameDrama(baseData.AudioType); break; case EAudioType.ENVIRONMENT: tsAudio = new TsAudioEnvironment(baseData.AudioType); break; default: TsLog.Log("Check the EAudioType~! is Invalid Value~! EAudioType= " + baseData.AudioType, new object[0]); return(null); } tsAudio._InitBaseData(baseData); return(tsAudio); }
public void OnClickedAdd(AudioClip audioClip, EAudioType audioType) { if (audioClip == null) { return; } foreach (TsAudio.BaseData current in this._audioBaseDatas) { if (current.DefaultBundleInfo.AudioClipName.Equals(audioClip.name, StringComparison.CurrentCultureIgnoreCase)) { TsLog.Log("Failed~! Already Contained~!", new object[0]); return; } } TsAudio.BaseData baseData = TsAudio.BaseData.Create(audioType); baseData.DefaultBundleInfo.FillBundleInfo(audioClip); TsLog.Log("OnClickedAdd() Info= " + baseData.DefaultBundleInfo.ToString(), new object[0]); this._audioBaseDatas.Add(baseData); }
public void OnClickedRemove(string audioClipName) { if (string.IsNullOrEmpty(audioClipName)) { return; } if (this._audioBaseDatas.Count <= 0) { return; } TsAudio.BaseData item = null; foreach (TsAudio.BaseData current in this._audioBaseDatas) { if (current.DefaultBundleInfo.AudioClipName.Equals(audioClipName)) { item = current; break; } } this._audioBaseDatas.Remove(item); }
public static GameObject CreateGameObjectWithAudio(string goName, TsAudio.BaseData baseData, AudioClip clip) { return(TsAudioCreator.CreateGameObjectWithAudio(goName, baseData, clip, false, false)); }
public static GameObject CreateGameObjectWithAudio(TsAudio.BaseData baseData, AudioClip clip) { return(TsAudioCreator.CreateGameObjectWithAudio(null, baseData, clip, false, false)); }
public static TsAudio Create(EAudioType eAudioType) { TsAudio.BaseData baseData = TsAudio.BaseData.Create(eAudioType); return(TsAudioCreator.Create(baseData)); }