mirror of https://github.com/axmolengine/axmol.git
issue #2129: Renaming variables.
This commit is contained in:
parent
c2f0bcf167
commit
6d60a77622
|
@ -30,7 +30,7 @@ public:
|
|||
dataVal[1] = std_string_to_jsval(cx, strMsgInfo);
|
||||
dataVal[2] = TProductInfo_to_jsval(cx, info);
|
||||
|
||||
JSObject* obj = m_pJSDelegate;
|
||||
JSObject* obj = _JSDelegate;
|
||||
|
||||
if (JS_HasProperty(cx, obj, "onPayResult", &hasAction) && hasAction) {
|
||||
if(!JS_GetProperty(cx, obj, "onPayResult", &temp_retval)) {
|
||||
|
@ -47,11 +47,11 @@ public:
|
|||
|
||||
void setJSDelegate(JSObject* pJSDelegate)
|
||||
{
|
||||
m_pJSDelegate = pJSDelegate;
|
||||
_JSDelegate = pJSDelegate;
|
||||
}
|
||||
|
||||
private:
|
||||
JSObject* m_pJSDelegate;
|
||||
JSObject* _JSDelegate;
|
||||
};
|
||||
|
||||
JSBool js_pluginx_ProtocolIAP_setResultListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
std::string strMsgInfo = msg;
|
||||
dataVal[1] = std_string_to_jsval(cx, strMsgInfo);
|
||||
|
||||
JSObject* obj = m_pJSDelegate;
|
||||
JSObject* obj = _JSDelegate;
|
||||
JSBool bRet = JS_HasProperty(cx, obj, "onAdsResult", &hasAction);
|
||||
if (bRet && hasAction) {
|
||||
if(!JS_GetProperty(cx, obj, "onAdsResult", &temp_retval)) {
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
dataVal[0] = arg;
|
||||
dataVal[1] = INT_TO_JSVAL(points);
|
||||
|
||||
JSObject* obj = m_pJSDelegate;
|
||||
JSObject* obj = _JSDelegate;
|
||||
JSBool bRet = JS_HasProperty(cx, obj, "onPlayerGetPoints", &hasAction);
|
||||
if (bRet && hasAction) {
|
||||
if(!JS_GetProperty(cx, obj, "onPlayerGetPoints", &temp_retval)) {
|
||||
|
@ -143,11 +143,11 @@ public:
|
|||
|
||||
void setJSDelegate(JSObject* pJSDelegate)
|
||||
{
|
||||
m_pJSDelegate = pJSDelegate;
|
||||
_JSDelegate = pJSDelegate;
|
||||
}
|
||||
|
||||
private:
|
||||
JSObject* m_pJSDelegate;
|
||||
JSObject* _JSDelegate;
|
||||
};
|
||||
|
||||
JSBool js_pluginx_ProtocolAds_setAdsListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
std::string strMsgInfo = msg;
|
||||
dataVal[1] = std_string_to_jsval(cx, strMsgInfo);
|
||||
|
||||
JSObject* obj = m_pJSDelegate;
|
||||
JSObject* obj = _JSDelegate;
|
||||
|
||||
if (JS_HasProperty(cx, obj, "onShareResult", &hasAction) && hasAction) {
|
||||
if(!JS_GetProperty(cx, obj, "onShareResult", &temp_retval)) {
|
||||
|
@ -205,11 +205,11 @@ public:
|
|||
|
||||
void setJSDelegate(JSObject* pJSDelegate)
|
||||
{
|
||||
m_pJSDelegate = pJSDelegate;
|
||||
_JSDelegate = pJSDelegate;
|
||||
}
|
||||
|
||||
private:
|
||||
JSObject* m_pJSDelegate;
|
||||
JSObject* _JSDelegate;
|
||||
};
|
||||
|
||||
JSBool js_pluginx_ProtocolSocial_setResultListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
|
|
|
@ -34,15 +34,15 @@ PluginManager::PluginManager(void)
|
|||
|
||||
PluginManager::~PluginManager()
|
||||
{
|
||||
std::map<std::string, PluginProtocol*>::iterator it = m_pluginsMap.begin();
|
||||
for (;it != m_pluginsMap.end();++it)
|
||||
std::map<std::string, PluginProtocol*>::iterator it = _pluginsMap.begin();
|
||||
for (;it != _pluginsMap.end();++it)
|
||||
{
|
||||
if (it->second != NULL) {
|
||||
delete it->second;
|
||||
it->second = NULL;
|
||||
}
|
||||
}
|
||||
m_pluginsMap.clear();
|
||||
_pluginsMap.clear();
|
||||
}
|
||||
|
||||
PluginManager* PluginManager::getInstance()
|
||||
|
@ -70,8 +70,8 @@ PluginProtocol* PluginManager::loadPlugin(const char* name)
|
|||
PluginProtocol* pRet = NULL;
|
||||
do {
|
||||
if (name == NULL || strlen(name) == 0) break;
|
||||
std::map<std::string, PluginProtocol*>::iterator it = m_pluginsMap.find(name);
|
||||
if (it != m_pluginsMap.end())
|
||||
std::map<std::string, PluginProtocol*>::iterator it = _pluginsMap.find(name);
|
||||
if (it != _pluginsMap.end())
|
||||
{
|
||||
if (it->second == NULL) {
|
||||
it->second = PluginFactory::getInstance()->createPlugin(name);
|
||||
|
@ -80,7 +80,7 @@ PluginProtocol* PluginManager::loadPlugin(const char* name)
|
|||
} else
|
||||
{
|
||||
pRet = PluginFactory::getInstance()->createPlugin(name);
|
||||
m_pluginsMap[name] = pRet;
|
||||
_pluginsMap[name] = pRet;
|
||||
}
|
||||
} while (false);
|
||||
|
||||
|
@ -91,8 +91,8 @@ void PluginManager::unloadPlugin(const char* name)
|
|||
{
|
||||
do {
|
||||
if (name == NULL || strlen(name) == 0) break;
|
||||
std::map<std::string, PluginProtocol*>::iterator it = m_pluginsMap.find(name);
|
||||
if (it != m_pluginsMap.end())
|
||||
std::map<std::string, PluginProtocol*>::iterator it = _pluginsMap.find(name);
|
||||
if (it != _pluginsMap.end())
|
||||
{
|
||||
if (it->second != NULL) {
|
||||
delete it->second;
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
private:
|
||||
PluginManager(void);
|
||||
std::map<std::string, PluginProtocol*> m_pluginsMap;
|
||||
std::map<std::string, PluginProtocol*> _pluginsMap;
|
||||
};
|
||||
|
||||
}} //namespace cocos2d { namespace plugin {
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
/**
|
||||
@brief plug-in info methods(name, version, SDK version)
|
||||
*/
|
||||
inline const char* getPluginName() { return m_pPluginName.c_str(); }
|
||||
inline const char* getPluginName() { return _pluginName.c_str(); }
|
||||
const char* getPluginVersion();
|
||||
const char* getSDKVersion();
|
||||
|
||||
|
@ -74,9 +74,9 @@ protected:
|
|||
private:
|
||||
friend class PluginFactory;
|
||||
inline void setPluginName(const char* name) {
|
||||
m_pPluginName = name;
|
||||
_pluginName = name;
|
||||
}
|
||||
std::string m_pPluginName;
|
||||
std::string _pluginName;
|
||||
};
|
||||
|
||||
}} //namespace cocos2d { namespace plugin {
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
void onPlayerGetPoints(int points);
|
||||
|
||||
protected:
|
||||
AdsListener* m_pListener;
|
||||
AdsListener* _listener;
|
||||
};
|
||||
|
||||
}} // namespace cocos2d { namespace plugin {
|
||||
|
|
|
@ -86,10 +86,10 @@ public:
|
|||
void onPayResult(PayResultCode ret, const char* msg);
|
||||
|
||||
protected:
|
||||
static bool m_bPaying;
|
||||
static bool _paying;
|
||||
|
||||
TProductInfo m_curInfo;
|
||||
PayResultListener* m_pListener;
|
||||
TProductInfo _curInfo;
|
||||
PayResultListener* _listener;
|
||||
};
|
||||
|
||||
}} // namespace cocos2d { namespace plugin {
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
void onShareResult(ShareResultCode ret, const char* msg);
|
||||
|
||||
protected:
|
||||
ShareResultListener* m_pListener;
|
||||
ShareResultListener* _listener;
|
||||
};
|
||||
|
||||
}} // namespace cocos2d { namespace plugin {
|
||||
|
|
|
@ -189,16 +189,16 @@ extern "C"
|
|||
|
||||
namespace cocos2d {
|
||||
|
||||
JavaVM* PluginJniHelper::m_psJavaVM = NULL;
|
||||
JavaVM* PluginJniHelper::_psJavaVM = NULL;
|
||||
|
||||
JavaVM* PluginJniHelper::getJavaVM()
|
||||
{
|
||||
return m_psJavaVM;
|
||||
return _psJavaVM;
|
||||
}
|
||||
|
||||
void PluginJniHelper::setJavaVM(JavaVM *javaVM)
|
||||
{
|
||||
m_psJavaVM = javaVM;
|
||||
_psJavaVM = javaVM;
|
||||
}
|
||||
|
||||
jclass PluginJniHelper::getClassID(const char *className, JNIEnv *env)
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
static std::string jstring2string(jstring str);
|
||||
|
||||
private:
|
||||
static JavaVM *m_psJavaVM;
|
||||
static JavaVM *_psJavaVM;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
ProtocolAds::ProtocolAds()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -131,24 +131,24 @@ void ProtocolAds::spendPoints(int points)
|
|||
|
||||
void ProtocolAds::setAdsListener(AdsListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg)
|
||||
{
|
||||
PluginUtils::outputLog("ProtocolAds", "ProtocolAds::adsResult invoked!");
|
||||
if (m_pListener != NULL)
|
||||
if (_listener != NULL)
|
||||
{
|
||||
m_pListener->onAdsResult(code, msg);
|
||||
_listener->onAdsResult(code, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void ProtocolAds::onPlayerGetPoints(int points)
|
||||
{
|
||||
PluginUtils::outputLog("ProtocolAds", "ProtocolAds::onPlayerGetPoints invoked!");
|
||||
if (m_pListener != NULL)
|
||||
if (_listener != NULL)
|
||||
{
|
||||
m_pListener->onPlayerGetPoints(this, points);
|
||||
_listener->onPlayerGetPoints(this, points);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
bool ProtocolIAP::m_bPaying = false;
|
||||
bool ProtocolIAP::_paying = false;
|
||||
|
||||
ProtocolIAP::ProtocolIAP()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo)
|
|||
|
||||
void ProtocolIAP::payForProduct(TProductInfo info)
|
||||
{
|
||||
if (m_bPaying)
|
||||
if (_paying)
|
||||
{
|
||||
PluginUtils::outputLog("ProtocolIAP", "Now is paying");
|
||||
return;
|
||||
|
@ -96,7 +96,7 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
|
||||
if (info.empty())
|
||||
{
|
||||
if (NULL != m_pListener)
|
||||
if (NULL != _listener)
|
||||
{
|
||||
onPayResult(kPayFail, "Product info error");
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_bPaying = true;
|
||||
m_curInfo = info;
|
||||
_paying = true;
|
||||
_curInfo = info;
|
||||
|
||||
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
|
||||
PluginJniMethodInfo t;
|
||||
|
@ -128,21 +128,21 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
|
||||
void ProtocolIAP::setResultListener(PayResultListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg)
|
||||
{
|
||||
m_bPaying = false;
|
||||
if (m_pListener)
|
||||
_paying = false;
|
||||
if (_listener)
|
||||
{
|
||||
m_pListener->onPayResult(ret, msg, m_curInfo);
|
||||
_listener->onPayResult(ret, msg, _curInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginUtils::outputLog("ProtocolIAP", "Result listener is null!");
|
||||
}
|
||||
m_curInfo.clear();
|
||||
_curInfo.clear();
|
||||
PluginUtils::outputLog("ProtocolIAP", "Pay result is : %d(%s)", (int) ret, msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
ProtocolSocial::ProtocolSocial()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void ProtocolSocial::share(TShareInfo info)
|
|||
{
|
||||
if (info.empty())
|
||||
{
|
||||
if (NULL != m_pListener)
|
||||
if (NULL != _listener)
|
||||
{
|
||||
onShareResult(kShareFail, "Share info error");
|
||||
}
|
||||
|
@ -117,14 +117,14 @@ void ProtocolSocial::share(TShareInfo info)
|
|||
|
||||
void ProtocolSocial::setResultListener(ShareResultListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolSocial::onShareResult(ShareResultCode ret, const char* msg)
|
||||
{
|
||||
if (m_pListener)
|
||||
if (_listener)
|
||||
{
|
||||
m_pListener->onShareResult(ret, msg);
|
||||
_listener->onShareResult(ret, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace cocos2d { namespace plugin {
|
||||
|
||||
ProtocolAds::ProtocolAds()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -97,22 +97,22 @@ void ProtocolAds::spendPoints(int points)
|
|||
// For the callbak methods
|
||||
void ProtocolAds::setAdsListener(AdsListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg)
|
||||
{
|
||||
if (m_pListener != NULL)
|
||||
if (_listener != NULL)
|
||||
{
|
||||
m_pListener->onAdsResult(code, msg);
|
||||
_listener->onAdsResult(code, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void ProtocolAds::onPlayerGetPoints(int points)
|
||||
{
|
||||
if (m_pListener != NULL)
|
||||
if (_listener != NULL)
|
||||
{
|
||||
m_pListener->onPlayerGetPoints(this, points);
|
||||
_listener->onPlayerGetPoints(this, points);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
namespace cocos2d { namespace plugin {
|
||||
|
||||
bool ProtocolIAP::m_bPaying = false;
|
||||
bool ProtocolIAP::_paying = false;
|
||||
|
||||
ProtocolIAP::ProtocolIAP()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo)
|
|||
|
||||
void ProtocolIAP::payForProduct(TProductInfo info)
|
||||
{
|
||||
if (m_bPaying)
|
||||
if (_paying)
|
||||
{
|
||||
PluginUtilsIOS::outputLog("Now is paying");
|
||||
return;
|
||||
|
@ -70,7 +70,7 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
|
||||
if (info.empty())
|
||||
{
|
||||
if (NULL != m_pListener)
|
||||
if (NULL != _listener)
|
||||
{
|
||||
onPayResult(kPayFail, "Product info error");
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_bPaying = true;
|
||||
m_curInfo = info;
|
||||
_paying = true;
|
||||
_curInfo = info;
|
||||
|
||||
PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this);
|
||||
assert(pData != NULL);
|
||||
|
@ -96,22 +96,22 @@ void ProtocolIAP::payForProduct(TProductInfo info)
|
|||
|
||||
void ProtocolIAP::setResultListener(PayResultListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg)
|
||||
{
|
||||
m_bPaying = false;
|
||||
if (m_pListener)
|
||||
_paying = false;
|
||||
if (_listener)
|
||||
{
|
||||
m_pListener->onPayResult(ret, msg, m_curInfo);
|
||||
_listener->onPayResult(ret, msg, _curInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginUtilsIOS::outputLog("Pay result listener of %s is null!", this->getPluginName());
|
||||
}
|
||||
|
||||
m_curInfo.clear();
|
||||
_curInfo.clear();
|
||||
PluginUtilsIOS::outputLog("Pay result of %s is : %d(%s)", this->getPluginName(), (int) ret, msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ THE SOFTWARE.
|
|||
namespace cocos2d { namespace plugin {
|
||||
|
||||
ProtocolSocial::ProtocolSocial()
|
||||
: m_pListener(NULL)
|
||||
: _listener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void ProtocolSocial::share(TShareInfo info)
|
|||
{
|
||||
if (info.empty())
|
||||
{
|
||||
if (NULL != m_pListener)
|
||||
if (NULL != _listener)
|
||||
{
|
||||
onShareResult(kShareFail, "Share info error");
|
||||
}
|
||||
|
@ -84,14 +84,14 @@ void ProtocolSocial::share(TShareInfo info)
|
|||
|
||||
void ProtocolSocial::setResultListener(ShareResultListener* pListener)
|
||||
{
|
||||
m_pListener = pListener;
|
||||
_listener = pListener;
|
||||
}
|
||||
|
||||
void ProtocolSocial::onShareResult(ShareResultCode ret, const char* msg)
|
||||
{
|
||||
if (m_pListener)
|
||||
if (_listener)
|
||||
{
|
||||
m_pListener->onShareResult(ret, msg);
|
||||
_listener->onShareResult(ret, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ bool HelloWorld::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_pAdmob = dynamic_cast<ProtocolAds*>(PluginManager::getInstance()->loadPlugin("AdsAdmob"));
|
||||
_admob = dynamic_cast<ProtocolAds*>(PluginManager::getInstance()->loadPlugin("AdsAdmob"));
|
||||
TAdsDeveloperInfo devInfo;
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
|
@ -81,10 +81,10 @@ bool HelloWorld::init()
|
|||
devInfo["AdmobID"] = "a1516fb6b16b12f";
|
||||
#endif
|
||||
|
||||
m_pAdmob->configDeveloperInfo(devInfo);
|
||||
m_pListener = new MyAdsListener();
|
||||
m_pAdmob->setAdsListener(m_pListener);
|
||||
m_pAdmob->setDebugMode(true);
|
||||
_admob->configDeveloperInfo(devInfo);
|
||||
_listener = new MyAdsListener();
|
||||
_admob->setAdsListener(_listener);
|
||||
_admob->setDebugMode(true);
|
||||
|
||||
Size visibleSize = Director::sharedDirector()->getVisibleSize();
|
||||
Point origin = Director::sharedDirector()->getVisibleOrigin();
|
||||
|
@ -121,45 +121,45 @@ bool HelloWorld::init()
|
|||
|
||||
// create optional menu
|
||||
// cases item
|
||||
m_pCaseItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::caseChanged, this),
|
||||
_caseItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::caseChanged, this),
|
||||
MenuItemFont::create( s_aTestCases[0].c_str() ),
|
||||
NULL );
|
||||
int caseLen = sizeof(s_aTestCases) / sizeof(std::string);
|
||||
for (int i = 1; i < caseLen; ++i)
|
||||
{
|
||||
m_pCaseItem->getSubItems()->addObject( MenuItemFont::create( s_aTestCases[i].c_str() ) );
|
||||
_caseItem->getSubItems()->addObject( MenuItemFont::create( s_aTestCases[i].c_str() ) );
|
||||
}
|
||||
m_pCaseItem->setPosition(ccpAdd(posMid, ccp(-200, 120)));
|
||||
pMenu->addChild(m_pCaseItem);
|
||||
_caseItem->setPosition(ccpAdd(posMid, ccp(-200, 120)));
|
||||
pMenu->addChild(_caseItem);
|
||||
|
||||
// type item
|
||||
m_pTypeItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::typeChanged, this),
|
||||
_typeItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::typeChanged, this),
|
||||
MenuItemFont::create( s_aTestTypes[0].c_str() ),
|
||||
NULL );
|
||||
int typeLen = sizeof(s_aTestTypes) / sizeof(std::string);
|
||||
for (int i = 1; i < typeLen; ++i)
|
||||
{
|
||||
m_pTypeItem->getSubItems()->addObject( MenuItemFont::create( s_aTestTypes[i].c_str() ) );
|
||||
_typeItem->getSubItems()->addObject( MenuItemFont::create( s_aTestTypes[i].c_str() ) );
|
||||
}
|
||||
m_pTypeItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
|
||||
pMenu->addChild(m_pTypeItem);
|
||||
_typeItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
|
||||
pMenu->addChild(_typeItem);
|
||||
|
||||
// poses item
|
||||
m_pPosItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::posChanged, this),
|
||||
_posItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(HelloWorld::posChanged, this),
|
||||
MenuItemFont::create( s_aTestPoses[0].c_str() ),
|
||||
NULL );
|
||||
int posLen = sizeof(s_aTestPoses) / sizeof(std::string);
|
||||
for (int i = 1; i < posLen; ++i)
|
||||
{
|
||||
m_pPosItem->getSubItems()->addObject( MenuItemFont::create( s_aTestPoses[i].c_str() ) );
|
||||
_posItem->getSubItems()->addObject( MenuItemFont::create( s_aTestPoses[i].c_str() ) );
|
||||
}
|
||||
m_pPosItem->setPosition(ccpAdd(posMid, ccp(200, 120)));
|
||||
pMenu->addChild(m_pPosItem);
|
||||
_posItem->setPosition(ccpAdd(posMid, ccp(200, 120)));
|
||||
pMenu->addChild(_posItem);
|
||||
|
||||
// init options
|
||||
m_pAds = m_pAdmob;
|
||||
m_ePos = ProtocolAds::kPosCenter;
|
||||
m_eType = ProtocolAds::kBannerAd;
|
||||
_ads = _admob;
|
||||
_pos = ProtocolAds::kPosCenter;
|
||||
_type = ProtocolAds::kBannerAd;
|
||||
|
||||
this->addChild(pMenu, 1);
|
||||
|
||||
|
@ -169,36 +169,36 @@ bool HelloWorld::init()
|
|||
void HelloWorld::testShow(Object* pSender)
|
||||
{
|
||||
int nSize = 0;
|
||||
if (m_pAds == m_pAdmob)
|
||||
if (_ads == _admob)
|
||||
{
|
||||
nSize = 0;
|
||||
}
|
||||
|
||||
if (m_pAds)
|
||||
if (_ads)
|
||||
{
|
||||
m_pAds->showAds(m_eType, nSize, m_ePos);
|
||||
_ads->showAds(_type, nSize, _pos);
|
||||
}
|
||||
}
|
||||
|
||||
void HelloWorld::testHide(Object* pSender)
|
||||
{
|
||||
m_pAds->hideAds(m_eType);
|
||||
_ads->hideAds(_type);
|
||||
}
|
||||
|
||||
void HelloWorld::menuCloseCallback(Object* pSender)
|
||||
{
|
||||
Director::sharedDirector()->end();
|
||||
|
||||
if (m_pAdmob != NULL)
|
||||
if (_admob != NULL)
|
||||
{
|
||||
PluginManager::getInstance()->unloadPlugin("AdsAdmob");
|
||||
m_pAdmob = NULL;
|
||||
_admob = NULL;
|
||||
}
|
||||
|
||||
if (NULL != m_pListener)
|
||||
if (NULL != _listener)
|
||||
{
|
||||
delete m_pListener;
|
||||
m_pListener = NULL;
|
||||
delete _listener;
|
||||
_listener = NULL;
|
||||
}
|
||||
|
||||
PluginManager::end();
|
||||
|
@ -210,10 +210,10 @@ void HelloWorld::menuCloseCallback(Object* pSender)
|
|||
void HelloWorld::caseChanged(Object* pSender)
|
||||
{
|
||||
std::string strLog = "";
|
||||
switch (m_pCaseItem->getSelectedIndex())
|
||||
switch (_caseItem->getSelectedIndex())
|
||||
{
|
||||
case 0:
|
||||
m_pAds = m_pAdmob;
|
||||
_ads = _admob;
|
||||
strLog = "Admob";
|
||||
break;
|
||||
default:
|
||||
|
@ -224,16 +224,16 @@ void HelloWorld::caseChanged(Object* pSender)
|
|||
|
||||
void HelloWorld::typeChanged(Object* pSender)
|
||||
{
|
||||
int selectIndex = m_pTypeItem->getSelectedIndex();
|
||||
m_eType = (ProtocolAds::AdsType) selectIndex;
|
||||
CCLog("type selected change to : %d", m_eType);
|
||||
int selectIndex = _typeItem->getSelectedIndex();
|
||||
_type = (ProtocolAds::AdsType) selectIndex;
|
||||
CCLog("type selected change to : %d", _type);
|
||||
}
|
||||
|
||||
void HelloWorld::posChanged(Object* pSender)
|
||||
{
|
||||
int selectIndex = m_pPosItem->getSelectedIndex();
|
||||
m_ePos = (ProtocolAds::AdsPos) selectIndex;
|
||||
CCLog("pos selected change to : %d", m_ePos);
|
||||
int selectIndex = _posItem->getSelectedIndex();
|
||||
_pos = (ProtocolAds::AdsPos) selectIndex;
|
||||
CCLog("pos selected change to : %d", _pos);
|
||||
}
|
||||
|
||||
void MyAdsListener::onAdsResult(AdsResultCode code, const char* msg)
|
||||
|
|
|
@ -57,16 +57,16 @@ public:
|
|||
CREATE_FUNC(HelloWorld);
|
||||
|
||||
private:
|
||||
cocos2d::plugin::ProtocolAds* m_pAdmob;
|
||||
MyAdsListener* m_pListener;
|
||||
cocos2d::plugin::ProtocolAds* _admob;
|
||||
MyAdsListener* _listener;
|
||||
|
||||
cocos2d::MenuItemToggle* m_pCaseItem;
|
||||
cocos2d::MenuItemToggle* m_pTypeItem;
|
||||
cocos2d::MenuItemToggle* m_pPosItem;
|
||||
cocos2d::MenuItemToggle* _caseItem;
|
||||
cocos2d::MenuItemToggle* _typeItem;
|
||||
cocos2d::MenuItemToggle* _posItem;
|
||||
|
||||
cocos2d::plugin::ProtocolAds* m_pAds;
|
||||
cocos2d::plugin::ProtocolAds::AdsPos m_ePos;
|
||||
cocos2d::plugin::ProtocolAds::AdsType m_eType;
|
||||
cocos2d::plugin::ProtocolAds* _ads;
|
||||
cocos2d::plugin::ProtocolAds::AdsPos _pos;
|
||||
cocos2d::plugin::ProtocolAds::AdsType _type;
|
||||
};
|
||||
|
||||
#endif // __HELLOWORLD_SCENE_H__
|
||||
|
|
Loading…
Reference in New Issue