C# Class QFramework.QSoundMgr

Inheritance: QMgrBehaviour
Datei anzeigen Open project: liangxiegame/QFramework

Public Properties

Property Type Description
clips AudioClip[]
musicClips AudioClip>.Dictionary
playersForClipId List[]
soundState int

Public Methods

Method Description
CanPlayBackSound ( ) : bool

是否播放背景音乐,默认是1:播放

CanPlaySoundEffect ( ) : bool

是否播放音效,默认是1:播放

Init ( ) : IEnumerator
LoadAudioClip ( string path ) : AudioClip

载入一个音频

LoadSoundSync ( string path, int id ) : void
Off ( ) : void
On ( ) : void
Play ( AudioClip clip, Vector3 position ) : void

播放音频剪辑

PlayBacksound ( string name, bool canPlay ) : void

播放背景音乐

PlayClipAsync ( int id, bool loop = false ) : void
PlayClipSync ( int id ) : void
PlayMusic ( string name, bool loop = true ) : void
PreloadClip ( string bundleName, string soundName, int id ) : void

异步加载太慢了

PreloadMusic ( string bundleName, string musicName ) : void
ProcessMsg ( QMsg msg ) : void

覆盖掉上一级的消息转发

StopClip ( int id ) : void
StopMusic ( ) : void
StopSound ( int id ) : void

停止所有音效

UnloadAudioClip ( string path ) : void

Protected Methods

Method Description
QSoundMgr ( ) : UnityEngine
SetupMgrId ( ) : void

Private Methods

Method Description
Add ( string key, AudioClip value ) : void

添加一个声音

Awake ( ) : void

创建音效播放器和音乐播放器

Get ( string key ) : AudioClip

获取一个声音

OnDestroy ( ) : void
Start ( ) : void

Method Details

CanPlayBackSound() public method

是否播放背景音乐,默认是1:播放
public CanPlayBackSound ( ) : bool
return bool

CanPlaySoundEffect() public method

是否播放音效,默认是1:播放
public CanPlaySoundEffect ( ) : bool
return bool

Init() public method

public Init ( ) : IEnumerator
return IEnumerator

LoadAudioClip() public method

载入一个音频
public LoadAudioClip ( string path ) : AudioClip
path string
return AudioClip

LoadSoundSync() public method

public LoadSoundSync ( string path, int id ) : void
path string
id int
return void

Off() public method

public Off ( ) : void
return void

On() public method

public On ( ) : void
return void

Play() public method

播放音频剪辑
public Play ( AudioClip clip, Vector3 position ) : void
clip AudioClip
position Vector3
return void

PlayBacksound() public method

播放背景音乐
public PlayBacksound ( string name, bool canPlay ) : void
name string
canPlay bool
return void

PlayClipAsync() public method

public PlayClipAsync ( int id, bool loop = false ) : void
id int
loop bool
return void

PlayClipSync() public method

public PlayClipSync ( int id ) : void
id int
return void

PlayMusic() public method

public PlayMusic ( string name, bool loop = true ) : void
name string
loop bool
return void

PreloadClip() public method

异步加载太慢了
public PreloadClip ( string bundleName, string soundName, int id ) : void
bundleName string
soundName string
id int Identifier.
return void

PreloadMusic() public method

public PreloadMusic ( string bundleName, string musicName ) : void
bundleName string
musicName string
return void

ProcessMsg() public method

覆盖掉上一级的消息转发
public ProcessMsg ( QMsg msg ) : void
msg QMsg
return void

QSoundMgr() protected method

protected QSoundMgr ( ) : UnityEngine
return UnityEngine

SetupMgrId() protected method

protected SetupMgrId ( ) : void
return void

StopClip() public method

public StopClip ( int id ) : void
id int
return void

StopMusic() public method

public StopMusic ( ) : void
return void

StopSound() public method

停止所有音效
public StopSound ( int id ) : void
id int
return void

UnloadAudioClip() public method

public UnloadAudioClip ( string path ) : void
path string
return void

Property Details

clips public_oe property

public AudioClip[] clips
return AudioClip[]

musicClips public_oe property

public Dictionary musicClips
return AudioClip>.Dictionary

playersForClipId public_oe property

public List[] playersForClipId
return List[]

soundState public_oe property

public int soundState
return int