public TsAudio GetAudioEx() { TsAudio tsAudio = this._GetAudioEx(); tsAudio.CheckAndSetNeedRefs(this); return(tsAudio); }
public static TsAudioAdapter TryToAddAdapter(GameObject go, TsAudio audioEx) { if (go == null) { return(null); } TsAudioAdapter tsAudioAdapter = go.GetComponent <TsAudioAdapter>(); if (tsAudioAdapter != null && tsAudioAdapter.AudioType != audioEx.baseData.AudioType) { UnityEngine.Object.DestroyImmediate(tsAudioAdapter); tsAudioAdapter = null; } if (tsAudioAdapter == null) { if (go.audio != null) { go.audio.playOnAwake = false; } switch (audioEx.baseData.AudioType) { case EAudioType.SFX: tsAudioAdapter = go.AddComponent <TsAudioAdapterSFX>(); break; case EAudioType.BGM: tsAudioAdapter = go.AddComponent <TsAudioAdapterBGM>(); break; case EAudioType.AMBIENT: tsAudioAdapter = go.AddComponent <TsAudioAdapterAmbient>(); break; case EAudioType.UI: tsAudioAdapter = go.AddComponent <TsAudioAdapterUI>(); break; case EAudioType.VOICE: tsAudioAdapter = go.AddComponent <TsAudioAdapterVoice>(); break; case EAudioType.SYSTEM: tsAudioAdapter = go.AddComponent <TsAudioAdapterSystem>(); break; case EAudioType.GAME_DRAMA: tsAudioAdapter = go.AddComponent <TsAudioAdapterGameDrama>(); break; case EAudioType.ENVIRONMENT: tsAudioAdapter = go.AddComponent <TsAudioAdapterEnvironment>(); break; default: TsLog.Assert(false, "Check the AudioType~!!! Invalid Type= {0}", new object[] { audioEx.baseData.AudioType }); break; } } if (tsAudioAdapter == null) { TsLog.LogError("Check the EAudioType~! is Invaild Value EAudioType = " + audioEx.baseData.AudioType, new object[0]); return(null); } if (!tsAudioAdapter._InitAudioEx(audioEx)) { UnityEngine.Object.Destroy(tsAudioAdapter); return(null); } audioEx.CheckAndSetNeedRefs(tsAudioAdapter); return(tsAudioAdapter); }