迁移数据表到 Luban,移除 JsonNet、EnumUtility
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using GameFramework;
|
||||
using SepCore.DataTable;
|
||||
using GameFramework;
|
||||
using SepCore.Definition;
|
||||
using SepCore.Entity;
|
||||
using GameFramework.DataTable;
|
||||
using GameFramework.Sound;
|
||||
using UnityGameFramework.Runtime;
|
||||
using SepCore.CustomUtility;
|
||||
@@ -18,13 +16,7 @@ namespace SepCore.Sound
|
||||
{
|
||||
soundComponent.StopMusic();
|
||||
|
||||
IDataTable<DRMusic> dtMusic = GameEntry.DataTable.GetDataTable<DRMusic>();
|
||||
DRMusic drMusic = dtMusic.GetDataRow(musicId);
|
||||
if (drMusic == null)
|
||||
{
|
||||
Log.Warning("Can not load music '{0}' from data table.", musicId.ToString());
|
||||
return null;
|
||||
}
|
||||
MusicConfig musicConfig = GameEntry.Luban.Get<MusicConfig>(musicId);
|
||||
|
||||
PlaySoundParams playSoundParams = PlaySoundParams.Create();
|
||||
playSoundParams.Priority = 64;
|
||||
@@ -32,7 +24,7 @@ namespace SepCore.Sound
|
||||
playSoundParams.VolumeInSoundGroup = 1f;
|
||||
playSoundParams.FadeInSeconds = FadeVolumeDuration;
|
||||
playSoundParams.SpatialBlend = 0f;
|
||||
s_MusicSerialId = soundComponent.PlaySound(AssetUtility.GetMusicAsset(drMusic.AssetName), "Music", Constant.AssetPriority.MusicAsset, playSoundParams, null, userData);
|
||||
s_MusicSerialId = soundComponent.PlaySound(AssetUtility.GetMusicAsset(musicConfig.AssetName), "Music", Constant.AssetPriority.MusicAsset, playSoundParams, null, userData);
|
||||
return s_MusicSerialId;
|
||||
}
|
||||
|
||||
@@ -49,38 +41,26 @@ namespace SepCore.Sound
|
||||
|
||||
public static int? PlaySound(this SoundComponent soundComponent, int soundId, EntityBase bindingEntity = null, object userData = null)
|
||||
{
|
||||
IDataTable<DRSound> dtSound = GameEntry.DataTable.GetDataTable<DRSound>();
|
||||
DRSound drSound = dtSound.GetDataRow(soundId);
|
||||
if (drSound == null)
|
||||
{
|
||||
Log.Warning("Can not load sound '{0}' from data table.", soundId.ToString());
|
||||
return null;
|
||||
}
|
||||
SoundConfig soundConfig = GameEntry.Luban.Get<SoundConfig>(soundId);
|
||||
|
||||
PlaySoundParams playSoundParams = PlaySoundParams.Create();
|
||||
playSoundParams.Priority = drSound.Priority;
|
||||
playSoundParams.Loop = drSound.Loop;
|
||||
playSoundParams.VolumeInSoundGroup = drSound.Volume;
|
||||
playSoundParams.SpatialBlend = drSound.SpatialBlend;
|
||||
return soundComponent.PlaySound(AssetUtility.GetSoundAsset(drSound.AssetName), "Sound", Constant.AssetPriority.SoundAsset, playSoundParams, bindingEntity != null ? bindingEntity.Entity : null, userData);
|
||||
playSoundParams.Priority = soundConfig.Priority;
|
||||
playSoundParams.Loop = soundConfig.Loop;
|
||||
playSoundParams.VolumeInSoundGroup = soundConfig.Volume;
|
||||
playSoundParams.SpatialBlend = soundConfig.SpatialBlend;
|
||||
return soundComponent.PlaySound(AssetUtility.GetSoundAsset(soundConfig.AssetName), "Sound", Constant.AssetPriority.SoundAsset, playSoundParams, bindingEntity != null ? bindingEntity.Entity : null, userData);
|
||||
}
|
||||
|
||||
public static int? PlayUISound(this SoundComponent soundComponent, int uiSoundId, object userData = null)
|
||||
{
|
||||
IDataTable<DRUISound> dtUISound = GameEntry.DataTable.GetDataTable<DRUISound>();
|
||||
DRUISound drUISound = dtUISound.GetDataRow(uiSoundId);
|
||||
if (drUISound == null)
|
||||
{
|
||||
Log.Warning("Can not load UI sound '{0}' from data table.", uiSoundId.ToString());
|
||||
return null;
|
||||
}
|
||||
UISoundConfig uiSoundConfig = GameEntry.Luban.Get<UISoundConfig>(uiSoundId);
|
||||
|
||||
PlaySoundParams playSoundParams = PlaySoundParams.Create();
|
||||
playSoundParams.Priority = drUISound.Priority;
|
||||
playSoundParams.Priority = uiSoundConfig.Priority;
|
||||
playSoundParams.Loop = false;
|
||||
playSoundParams.VolumeInSoundGroup = drUISound.Volume;
|
||||
playSoundParams.VolumeInSoundGroup = uiSoundConfig.Volume;
|
||||
playSoundParams.SpatialBlend = 0f;
|
||||
return soundComponent.PlaySound(AssetUtility.GetUISoundAsset(drUISound.AssetName), "UISound", Constant.AssetPriority.UISoundAsset, playSoundParams, userData);
|
||||
return soundComponent.PlaySound(AssetUtility.GetUISoundAsset(uiSoundConfig.AssetName), "UISound", Constant.AssetPriority.UISoundAsset, playSoundParams, userData);
|
||||
}
|
||||
|
||||
public static bool IsMuted(this SoundComponent soundComponent, string soundGroupName)
|
||||
|
||||
Reference in New Issue
Block a user