protected override void _Load() { m_dicData.Clear(); for (int i = 0; i < m_csv.GetRows(); i++) { SoundCsvData data = new SoundCsvData(); data.csvId = m_csv.GetIntData(i, (int)eSoundCsv.csvId); data.type = m_csv.GetIntData(i, (int)eSoundCsv.type); data.ResourceID = m_csv.GetIntData(i, (int)eSoundCsv.ResourceID); data.Loop = m_csv.GetBoolData(i, (int)eSoundCsv.Loop); data.describe = m_csv.GetData(i, (int)eSoundCsv.describe); if (m_dicData.ContainsKey(data.csvId)) { Debug.LogError("重复ID:" + data.csvId); continue; } m_dicData.Add(data.csvId, data); } }
public int Play(int resId, Vector3 pos, SoundCsvData data, Action <Entity> initEnd = null, Action playEnd = null) { if (resId == 0) { return(0); } EntityBaseInfo bInfo = new EntityBaseInfo(); bInfo.m_resID = resId; bInfo.m_soundMute = m_dicTypeMute[(int)data.type]; bInfo.m_soundType = (int)data.type; bInfo.m_soundLoop = data.Loop; bInfo.m_vPos = pos; bInfo.m_ilayer = (int)LusuoLayer.eEL_Sound; int handle = EntityManager.Inst.CreateEntity(eEntityType.eSoundEntity, bInfo, initEnd); SoundEntity entity = (SoundEntity)EntityManager.Inst.GetEnity(handle); m_dicSoundEntity.Add(entity.m_hid, entity); entity.m_playEnd = playEnd; return(handle); }
public int PlaySound(int soundCsvId, Vector3 pos, Action <Entity> initEnd = null, Action playEnd = null) { if (soundCsvId == 0) { return(0); } SoundCsv sound = CsvManager.Inst.GetCsv <SoundCsv>((int)eAllCSV.eAC_Sound); if (sound == null) { return(0); } SoundCsvData data = sound.GetData(soundCsvId); if (data != null) { return(SoundManager.Inst.Play(data.ResourceID, pos, data, initEnd, playEnd)); } else { //Debug.Log("音效表无此音乐:" + soundCsvId); } return(0); }