Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
 public SoundGroupData(DRSoundGroup dRSoundGroup)
 {
     this.dRSoundGroup = dRSoundGroup;
 }