コード例 #1
0
        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);
            }

            PlaySoundParams playSoundParams = new PlaySoundParams
            {
                Priority           = drUISound.Priority,
                Loop               = false,
                VolumeInSoundGroup = drUISound.Volume,
                SpatialBlend       = 0f,
            };

            return(soundComponent.PlaySound(AssetUtility.GetUISoundAsset(drUISound.AssetName), "UISound", Constant.AssetPriority.UISoundAsset, playSoundParams, userData));
        }