-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStopMenuUI.cpp
68 lines (56 loc) · 1.46 KB
/
StopMenuUI.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
//
// GameMainScene.cpp
// HelloCpp
//
// Created by shaoleibo on 15-1-31.
// Copyright (c) 2015年 Bullets in a Burning Box, Inc. All rights reserved.
//
#include "StopMenuUI.h"
#include "GameMap.h"
#if defined( PAY_WITH_UMENG )
#include "MobClickCpp.h"
#endif
USING_NS_CC;
USING_NS_CC_EXT;
using namespace gui;
bool StopMenuUI::init()
{
m_fileName = "StopMenu.ExportJson";
if( UIBase::init() )
{
// parse
m_pOkBtn = static_cast<UIButton*>(m_pWidget->getChildByName("okBtn"));
m_pCanelBtn = static_cast<UIButton*>(m_pWidget->getChildByName("canelBtn"));
// register Event
m_pOkBtn->addTouchEventListener( this,toucheventselector(StopMenuUI::okBtnCallBack));
m_pCanelBtn->addTouchEventListener( this,toucheventselector(StopMenuUI::chanlBtnCallBack));
deactivate();
return true;
}
return false;
}
void StopMenuUI::okBtnCallBack( ::cocos2d::CCObject* pSender, ::cocos2d::ui::TouchEventType type )
{
if(type == cocos2d::ui::TOUCH_EVENT_ENDED)
{
GameMap::GetInstance()->SaveLevel();
deactivate();
}
}
void StopMenuUI::chanlBtnCallBack( ::cocos2d::CCObject* pSender, ::cocos2d::ui::TouchEventType type )
{
if(type == cocos2d::ui::TOUCH_EVENT_ENDED)
{
GameMap::GetInstance()->SaveLevel();
deactivate();
#if defined( PAY_WITH_UMENG )
umeng::MobClickCpp::end();
#endif
CCDirector::sharedDirector()->end();
}
}
StopMenuUI::~StopMenuUI()
{
m_pOkBtn = NULL;
m_pCanelBtn = NULL;
}