Exemplo n.º 1
0
 public SoundData(DRSound dRSound, DRAssetsPath dRAssetsPath, SoundGroupData soundGroup, SoundPlayParamData soundPlayParam)
 {
     this.dRSound        = dRSound;
     this.dRAssetsPath   = dRAssetsPath;
     this.SoundGroupData = soundGroup;
     this.SoundPlayParam = soundPlayParam;
 }
Exemplo n.º 2
0
    public void ParseDataRow(string dataRowText)
    {
        DRSound model = GameUtility.DeserializeObject <DRSound>(dataRowText);

        Id    = model.Id;
        Name  = model.Name;
        Asset = model.Asset;
    }
Exemplo n.º 3
0
    /// <summary>
    /// 场景物体音效
    /// </summary>
    /// <param name="soundComponent"></param>
    /// <param name="soundId"></param>
    /// <param name="bindingEntity"></param>
    /// <param name="userData"></param>
    /// <returns></returns>
    public static int?PlaySound(this SoundComponent soundComponent, int soundId, StarForce.Entity 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);
        }

        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));
    }