本文整理汇总了Java中org.andengine.audio.music.Music类的典型用法代码示例。如果您正苦于以下问题:Java Music类的具体用法?Java Music怎么用?Java Music使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Music类属于org.andengine.audio.music包,在下文中一共展示了Music类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: playLevelSound
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Play the given audio file
* @param soundFile
*/
public void playLevelSound(String soundFile, MediaPlayer.OnCompletionListener callback) {
Debug.d("Playing sound: "+soundFile);
if (!this.isStarted || !this.isRunning) {
Debug.d("Game hasn't started yet, not playing any sound");
return;
}
if (this.levelSounds.containsKey(soundFile)) {
Music sound = this.levelSounds.get(soundFile);
sound.setOnCompletionListener(callback);
sound.play();
} else {
Debug.d("No levelSounds: " + soundFile + "");
}
}
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:20,代码来源:PhoeniciaGame.java
示例2: playMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
public void playMusic(Music music) {
if (this.mMusic != null) {
this.mMusic.stop();
}
this.mMusic = music;
this.mMusic.play();
}
开发者ID:tamzi,项目名称:sophia,代码行数:8,代码来源:LevelScene.java
示例3: getInstance
import org.andengine.audio.music.Music; //导入依赖的package包/类
public static MediaManager getInstance(BaseGameActivity pBaseActivity) {
if (self == null) {
self = new MediaManager();
MediaManager.mBaseActivity = pBaseActivity;
MediaManager.mMusicArray = new SparseArray<Music>();
MediaManager.mSoundArray = new SparseArray<Sound>();
}
return self;
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:10,代码来源:MediaManager.java
示例4: play
import org.andengine.audio.music.Music; //导入依赖的package包/类
public void play(MusicType pMusicType, boolean isStart) {
Music music = get(pMusicType);
// 再生中
if (music.isPlaying()) {
return;
}
stopPlayingMusic(); // 再生中のBGMは全部止めてから再生する
// 再生する(基本ループ)
music.setLooping(true);
music.play();
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:13,代码来源:MediaManager.java
示例5: pause
import org.andengine.audio.music.Music; //导入依赖的package包/类
public void pause(MusicType pMusicType) {
Music music = get(pMusicType);
// 再生中
if (music.isPlaying()) {
// 一時停止
music.pause();
}
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:9,代码来源:MediaManager.java
示例6: pausePlayingMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
public void pausePlayingMusic() {
int size = mMusicArray.size();
for (int i = 0; i < size; i++) {
MusicType musicType = MusicType.get(mMusicArray.keyAt(i));
Music music = get(musicType);
if (music.isPlaying()) {
music.pause();
mPauseMusicType = musicType;
}
}
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:12,代码来源:MediaManager.java
示例7: get
import org.andengine.audio.music.Music; //导入依赖的package包/类
private Music get(MusicType pMusicType) {
Music music = mMusicArray.get(pMusicType.getValue());
// 未生成, 解放済み
if (music == null) {
throw new RuntimeException("not create musicType = " + pMusicType);
}
if (music.isReleased()) {
throw new RuntimeException("released musicType = " + pMusicType);
}
return music;
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:12,代码来源:MediaManager.java
示例8: playMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Begins playing music.
* @param m
*/
public static void playMusic(Music m) {
if(m != null && !m.isPlaying()) {
m.setVolume(getMusicVolume());
m.play();
}
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:11,代码来源:SFXManager.java
示例9: playMusicLoop
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Play music in looping.
* @param m
*/
public static void playMusicLoop(Music m) {
if(m != null && !m.isPlaying()) {
m.setVolume(getMusicVolume());
m.setLooping(true);
m.play();
}
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:12,代码来源:SFXManager.java
示例10: stopMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Stops music and sets the tune to the begining.
* @param m
*/
public static void stopMusic(Music m) {
if(m != null && m.isPlaying()) {
m.pause();
m.seekTo(0);
}
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:11,代码来源:SFXManager.java
示例11: isPlaying
import org.andengine.audio.music.Music; //导入依赖的package包/类
public static boolean isPlaying(Music m) {
return m.isPlaying();
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:4,代码来源:SFXManager.java
示例12: pauseMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Pause music. May be resumed.
* @param m
*/
public static void pauseMusic(Music m) {
if(m != null && m.isPlaying())
m.pause();
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:9,代码来源:SFXManager.java
示例13: resumeMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
/**
* Resume Music (works with pauseMusic).
* @param m
*/
public static void resumeMusic(Music m) {
m.setVolume(getMusicVolume());
m.resume();
}
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:9,代码来源:SFXManager.java
示例14: playMusic
import org.andengine.audio.music.Music; //导入依赖的package包/类
private void playMusic(Music music) {
if (music != null && !music.isReleased()) {
music.play();
}
}
开发者ID:delight-im,项目名称:NationSoccer,代码行数:6,代码来源:GameScene.java
注:本文中的org.andengine.audio.music.Music类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论