mirror of https://github.com/axmolengine/axmol.git
rename variable
This commit is contained in:
parent
eec96e9e96
commit
80103487fe
|
@ -47,8 +47,8 @@ public class Cocos2dxMusic {
|
|||
private MediaPlayer mBackgroundMediaPlayer;
|
||||
private float mLeftVolume;
|
||||
private float mRightVolume;
|
||||
private boolean mPaused;
|
||||
private boolean mPausedFlag = false;
|
||||
private boolean mPaused;// whether music is paused state.
|
||||
private boolean mManualPaused = false;// whether music is paused manually before the program is switched to the background.
|
||||
private String mCurrentPath;
|
||||
|
||||
// ===========================================================
|
||||
|
@ -143,7 +143,7 @@ public class Cocos2dxMusic {
|
|||
if (this.mBackgroundMediaPlayer != null && this.mBackgroundMediaPlayer.isPlaying()) {
|
||||
this.mBackgroundMediaPlayer.pause();
|
||||
this.mPaused = true;
|
||||
this.mPausedFlag = true;
|
||||
this.mManualPaused = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ public class Cocos2dxMusic {
|
|||
if (this.mBackgroundMediaPlayer != null && this.mPaused) {
|
||||
this.mBackgroundMediaPlayer.start();
|
||||
this.mPaused = false;
|
||||
this.mPausedFlag = false;
|
||||
this.mManualPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class Cocos2dxMusic {
|
|||
}
|
||||
|
||||
public void onEnterForeground(){
|
||||
if(!this.mPausedFlag){
|
||||
if(!this.mManualPaused){
|
||||
if (this.mBackgroundMediaPlayer != null && this.mPaused) {
|
||||
this.mBackgroundMediaPlayer.start();
|
||||
this.mPaused = false;
|
||||
|
|
|
@ -129,8 +129,8 @@ public class Cocos2dxSound {
|
|||
// stop effects
|
||||
final ArrayList<Integer> streamIDs = this.mPathStreamIDsMap.get(pPath);
|
||||
if (streamIDs != null) {
|
||||
for (final Integer pStreamID : streamIDs) {
|
||||
this.mSoundPool.stop(pStreamID);
|
||||
for (final Integer steamID : streamIDs) {
|
||||
this.mSoundPool.stop(steamID);
|
||||
}
|
||||
}
|
||||
this.mPathStreamIDsMap.remove(pPath);
|
||||
|
@ -180,24 +180,24 @@ public class Cocos2dxSound {
|
|||
return streamID;
|
||||
}
|
||||
|
||||
public void stopEffect(final int pStreamID) {
|
||||
this.mSoundPool.stop(pStreamID);
|
||||
public void stopEffect(final int steamID) {
|
||||
this.mSoundPool.stop(steamID);
|
||||
|
||||
// remove record
|
||||
for (final String pPath : this.mPathStreamIDsMap.keySet()) {
|
||||
if (this.mPathStreamIDsMap.get(pPath).contains(pStreamID)) {
|
||||
this.mPathStreamIDsMap.get(pPath).remove(this.mPathStreamIDsMap.get(pPath).indexOf(pStreamID));
|
||||
if (this.mPathStreamIDsMap.get(pPath).contains(steamID)) {
|
||||
this.mPathStreamIDsMap.get(pPath).remove(this.mPathStreamIDsMap.get(pPath).indexOf(steamID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseEffect(final int pStreamID) {
|
||||
this.mSoundPool.pause(pStreamID);
|
||||
public void pauseEffect(final int steamID) {
|
||||
this.mSoundPool.pause(steamID);
|
||||
}
|
||||
|
||||
public void resumeEffect(final int pStreamID) {
|
||||
this.mSoundPool.resume(pStreamID);
|
||||
public void resumeEffect(final int steamID) {
|
||||
this.mSoundPool.resume(steamID);
|
||||
}
|
||||
|
||||
public void pauseAllEffects() {
|
||||
|
@ -205,8 +205,8 @@ public class Cocos2dxSound {
|
|||
final Iterator<Entry<String, ArrayList<Integer>>> iter = this.mPathStreamIDsMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Entry<String, ArrayList<Integer>> entry = iter.next();
|
||||
for (final int pStreamID : entry.getValue()) {
|
||||
this.mSoundPool.pause(pStreamID);
|
||||
for (final int steamID : entry.getValue()) {
|
||||
this.mSoundPool.pause(steamID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,8 +219,8 @@ public class Cocos2dxSound {
|
|||
final Iterator<Entry<String, ArrayList<Integer>>> iter = this.mPathStreamIDsMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Entry<String, ArrayList<Integer>> entry = iter.next();
|
||||
for (final int pStreamID : entry.getValue()) {
|
||||
this.mSoundPool.resume(pStreamID);
|
||||
for (final int steamID : entry.getValue()) {
|
||||
this.mSoundPool.resume(steamID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -233,8 +233,8 @@ public class Cocos2dxSound {
|
|||
final Iterator<?> iter = this.mPathStreamIDsMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Map.Entry<String, ArrayList<Integer>> entry = (Map.Entry<String, ArrayList<Integer>>) iter.next();
|
||||
for (final int pStreamID : entry.getValue()) {
|
||||
this.mSoundPool.stop(pStreamID);
|
||||
for (final int steamID : entry.getValue()) {
|
||||
this.mSoundPool.stop(steamID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,8 +263,8 @@ public class Cocos2dxSound {
|
|||
final Iterator<Entry<String, ArrayList<Integer>>> iter = this.mPathStreamIDsMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Entry<String, ArrayList<Integer>> entry = iter.next();
|
||||
for (final int pStreamID : entry.getValue()) {
|
||||
this.mSoundPool.setVolume(pStreamID, this.mLeftVolume, this.mRightVolume);
|
||||
for (final int steamID : entry.getValue()) {
|
||||
this.mSoundPool.setVolume(steamID, this.mLeftVolume, this.mRightVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue