From 6d60a77622b02108cf7fca7b94de1708d55cd667 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 20 Jun 2013 16:31:12 +0800 Subject: [PATCH] issue #2129: Renaming variables. --- .../manual/jsb_pluginx_manual_callback.cpp | 20 ++--- plugin/protocols/PluginManager.cpp | 16 ++-- plugin/protocols/include/PluginManager.h | 2 +- plugin/protocols/include/PluginProtocol.h | 6 +- plugin/protocols/include/ProtocolAds.h | 2 +- plugin/protocols/include/ProtocolIAP.h | 6 +- plugin/protocols/include/ProtocolSocial.h | 2 +- .../platform/android/PluginJniHelper.cpp | 6 +- .../platform/android/PluginJniHelper.h | 2 +- .../platform/android/ProtocolAds.cpp | 12 +-- .../platform/android/ProtocolIAP.cpp | 22 +++--- .../platform/android/ProtocolSocial.cpp | 10 +-- plugin/protocols/platform/ios/ProtocolAds.mm | 12 +-- plugin/protocols/platform/ios/ProtocolIAP.mm | 22 +++--- .../protocols/platform/ios/ProtocolSocial.mm | 10 +-- .../HelloAds/Classes/HelloWorldScene.cpp | 74 +++++++++---------- .../HelloAds/Classes/HelloWorldScene.h | 16 ++-- 17 files changed, 120 insertions(+), 120 deletions(-) mode change 100755 => 100644 plugin/protocols/include/ProtocolSocial.h mode change 100755 => 100644 plugin/protocols/platform/android/ProtocolSocial.cpp mode change 100755 => 100644 plugin/protocols/platform/ios/ProtocolSocial.mm diff --git a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp index 8bd5582a88..205e9e31e2 100644 --- a/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp +++ b/plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp @@ -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) diff --git a/plugin/protocols/PluginManager.cpp b/plugin/protocols/PluginManager.cpp index 2061cb366a..fc6843dc20 100644 --- a/plugin/protocols/PluginManager.cpp +++ b/plugin/protocols/PluginManager.cpp @@ -34,15 +34,15 @@ PluginManager::PluginManager(void) PluginManager::~PluginManager() { - std::map::iterator it = m_pluginsMap.begin(); - for (;it != m_pluginsMap.end();++it) + std::map::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::iterator it = m_pluginsMap.find(name); - if (it != m_pluginsMap.end()) + std::map::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::iterator it = m_pluginsMap.find(name); - if (it != m_pluginsMap.end()) + std::map::iterator it = _pluginsMap.find(name); + if (it != _pluginsMap.end()) { if (it->second != NULL) { delete it->second; diff --git a/plugin/protocols/include/PluginManager.h b/plugin/protocols/include/PluginManager.h index 8800487f78..3e6e098816 100644 --- a/plugin/protocols/include/PluginManager.h +++ b/plugin/protocols/include/PluginManager.h @@ -46,7 +46,7 @@ public: private: PluginManager(void); - std::map m_pluginsMap; + std::map _pluginsMap; }; }} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/include/PluginProtocol.h b/plugin/protocols/include/PluginProtocol.h index 57a0d3aae0..25824f42ae 100644 --- a/plugin/protocols/include/PluginProtocol.h +++ b/plugin/protocols/include/PluginProtocol.h @@ -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 { diff --git a/plugin/protocols/include/ProtocolAds.h b/plugin/protocols/include/ProtocolAds.h index 2d2393c74f..4e38bd1b96 100644 --- a/plugin/protocols/include/ProtocolAds.h +++ b/plugin/protocols/include/ProtocolAds.h @@ -134,7 +134,7 @@ public: void onPlayerGetPoints(int points); protected: - AdsListener* m_pListener; + AdsListener* _listener; }; }} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/include/ProtocolIAP.h b/plugin/protocols/include/ProtocolIAP.h index f2d4c8df69..5532218b38 100644 --- a/plugin/protocols/include/ProtocolIAP.h +++ b/plugin/protocols/include/ProtocolIAP.h @@ -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 { diff --git a/plugin/protocols/include/ProtocolSocial.h b/plugin/protocols/include/ProtocolSocial.h old mode 100755 new mode 100644 index ab0717295b..5b5ac5e71d --- a/plugin/protocols/include/ProtocolSocial.h +++ b/plugin/protocols/include/ProtocolSocial.h @@ -85,7 +85,7 @@ public: void onShareResult(ShareResultCode ret, const char* msg); protected: - ShareResultListener* m_pListener; + ShareResultListener* _listener; }; }} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/PluginJniHelper.cpp b/plugin/protocols/platform/android/PluginJniHelper.cpp index fd3deb9ea9..7b4d4e25e1 100644 --- a/plugin/protocols/platform/android/PluginJniHelper.cpp +++ b/plugin/protocols/platform/android/PluginJniHelper.cpp @@ -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) diff --git a/plugin/protocols/platform/android/PluginJniHelper.h b/plugin/protocols/platform/android/PluginJniHelper.h index 6fb3080b0d..5700c8af7b 100644 --- a/plugin/protocols/platform/android/PluginJniHelper.h +++ b/plugin/protocols/platform/android/PluginJniHelper.h @@ -47,7 +47,7 @@ public: static std::string jstring2string(jstring str); private: - static JavaVM *m_psJavaVM; + static JavaVM *_psJavaVM; }; } diff --git a/plugin/protocols/platform/android/ProtocolAds.cpp b/plugin/protocols/platform/android/ProtocolAds.cpp index fead515b40..e5dcfb7d02 100644 --- a/plugin/protocols/platform/android/ProtocolAds.cpp +++ b/plugin/protocols/platform/android/ProtocolAds.cpp @@ -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); } } diff --git a/plugin/protocols/platform/android/ProtocolIAP.cpp b/plugin/protocols/platform/android/ProtocolIAP.cpp index 270e8ea44f..9a1e7e4332 100644 --- a/plugin/protocols/platform/android/ProtocolIAP.cpp +++ b/plugin/protocols/platform/android/ProtocolIAP.cpp @@ -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); } diff --git a/plugin/protocols/platform/android/ProtocolSocial.cpp b/plugin/protocols/platform/android/ProtocolSocial.cpp old mode 100755 new mode 100644 index 8c933d3380..44d3823040 --- a/plugin/protocols/platform/android/ProtocolSocial.cpp +++ b/plugin/protocols/platform/android/ProtocolSocial.cpp @@ -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 { diff --git a/plugin/protocols/platform/ios/ProtocolAds.mm b/plugin/protocols/platform/ios/ProtocolAds.mm index 1902f0eec0..49c2a57f34 100644 --- a/plugin/protocols/platform/ios/ProtocolAds.mm +++ b/plugin/protocols/platform/ios/ProtocolAds.mm @@ -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); } } diff --git a/plugin/protocols/platform/ios/ProtocolIAP.mm b/plugin/protocols/platform/ios/ProtocolIAP.mm index e3680b273d..02091a649c 100644 --- a/plugin/protocols/platform/ios/ProtocolIAP.mm +++ b/plugin/protocols/platform/ios/ProtocolIAP.mm @@ -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); } diff --git a/plugin/protocols/platform/ios/ProtocolSocial.mm b/plugin/protocols/platform/ios/ProtocolSocial.mm old mode 100755 new mode 100644 index 0c5d559d4f..b64458caf1 --- a/plugin/protocols/platform/ios/ProtocolSocial.mm +++ b/plugin/protocols/platform/ios/ProtocolSocial.mm @@ -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 { diff --git a/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp index 7c3a4f3296..f3a8f4e261 100644 --- a/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp +++ b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp @@ -72,7 +72,7 @@ bool HelloWorld::init() return false; } - m_pAdmob = dynamic_cast(PluginManager::getInstance()->loadPlugin("AdsAdmob")); + _admob = dynamic_cast(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) diff --git a/plugin/samples/HelloAds/Classes/HelloWorldScene.h b/plugin/samples/HelloAds/Classes/HelloWorldScene.h index 84b9cbd050..416fba523f 100644 --- a/plugin/samples/HelloAds/Classes/HelloWorldScene.h +++ b/plugin/samples/HelloAds/Classes/HelloWorldScene.h @@ -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__