Exemple #1
0
 public SoundData(DRSound dRSound, DRAssetsPath dRAssetsPath, SoundGroupData soundGroup, SoundPlayParamData soundPlayParam)
 {
     this.dRSound        = dRSound;
     this.dRAssetsPath   = dRAssetsPath;
     this.SoundGroupData = soundGroup;
     this.SoundPlayParam = soundPlayParam;
 }
Exemple #2
0
        protected override void OnLoad()
        {
            dtSound = GameEntry.DataTable.GetDataTable <DRSound>();
            if (dtSound == null)
            {
                throw new System.Exception("Can not get data table Sound");
            }

            dtSoundGroup = GameEntry.DataTable.GetDataTable <DRSoundGroup>();
            if (dtSoundGroup == null)
            {
                throw new System.Exception("Can not get data table SoundGroup");
            }

            dtSoundPlayParam = GameEntry.DataTable.GetDataTable <DRSoundPlayParam>();
            if (dtSoundPlayParam == null)
            {
                throw new System.Exception("Can not get data table SoundPlayParam");
            }

            dicSoundData          = new Dictionary <int, SoundData>();
            dicSoundGroupData     = new Dictionary <int, SoundGroupData>();
            dicSoundPlayParamData = new Dictionary <int, SoundPlayParamData>();

            DRSound[] dRSounds = dtSound.GetAllDataRows();
            foreach (var dRSound in dRSounds)
            {
                SoundGroupData soundGroupData = null;
                if (!dicSoundGroupData.TryGetValue(dRSound.SoundGroupId, out soundGroupData))
                {
                    DRSoundGroup dRSoundGroup = dtSoundGroup.GetDataRow(dRSound.SoundGroupId);
                    if (dRSoundGroup == null)
                    {
                        throw new System.Exception("Can not find SoundGroup id :" + dRSound.SoundGroupId);
                    }
                    soundGroupData = new SoundGroupData(dRSoundGroup);
                    dicSoundGroupData.Add(dRSound.SoundGroupId, soundGroupData);
                }

                SoundPlayParamData soundPlayParamData = null;
                if (!dicSoundPlayParamData.TryGetValue(dRSound.SoundPlayParamId, out soundPlayParamData))
                {
                    DRSoundPlayParam dRSoundPlayParam = dtSoundPlayParam.GetDataRow(dRSound.SoundPlayParamId);
                    if (dRSoundPlayParam == null)
                    {
                        throw new System.Exception("Can not find SoundPlayParam id :" + dRSound.SoundPlayParamId);
                    }
                    soundPlayParamData = new SoundPlayParamData(dRSoundPlayParam);
                    dicSoundPlayParamData.Add(dRSound.SoundPlayParamId, soundPlayParamData);
                }

                DRAssetsPath dRAssetsPath = GameEntry.Data.GetData <DataAssetsPath>().GetDRAssetsPathByAssetsId(dRSound.AssetId);

                SoundData soundData = new SoundData(dRSound, dRAssetsPath, soundGroupData, soundPlayParamData);
                dicSoundData.Add(dRSound.Id, soundData);
            }
        }
Exemple #3
0
        public SoundGroupData[] GetAllSoundGroupData()
        {
            int index = 0;

            SoundGroupData[] results = new SoundGroupData[dicSoundGroupData.Count];
            foreach (var soundGroupData in dicSoundGroupData.Values)
            {
                results[index++] = soundGroupData;
            }

            return(results);
        }