-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMusicManager.cpp
72 lines (63 loc) · 1.06 KB
/
MusicManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "MusicManager.h"
#include "BgSound.h"
#include "SimpleAudioEngine.h"
#include "ConfigManager.h"
USING_NS_CC;
using namespace CocosDenshion;
MusicManager::MusicManager()
{
}
bool MusicManager::Stop()
{
isStopMusic = true;
m_pBgSound->stop();
return true;
}
bool MusicManager::Open()
{
isStopMusic = false;
m_pBgSound->play();
return true;
}
bool MusicManager::Play( int type )
{
if(isStopMusic) return false;
switch ( type )
{
case BG_SOUND:
{
m_pBgSound->play();
break;
}
case Click_Effect_Sound:
{
m_pClickSound->play();
break;
}
case Greate_Effect_Sound:
{
m_pGreateSound->play();
break;
}
case Prefect_Effect_Sound:
{
m_pPrefectSound->play();
break;
}
case Excellent_Effect_Sound:
{
m_pExcellentSound->play();
break;
}
}
return true;
}
MusicManager::~MusicManager()
{
m_pBgSound = NULL;
m_pGreateSound = NULL;
m_pPrefectSound = NULL;
m_pExcellentSound = NULL;
m_pClickSound = NULL;
SimpleAudioEngine::sharedEngine()->end();
}