mirror of https://github.com/axmolengine/axmol.git
Rename the singleton methods name in sample project of plugin.
Remove the deprecated methods.
This commit is contained in:
parent
a718f8ba81
commit
9944a5d186
|
@ -89,8 +89,8 @@ bool TestAds::init()
|
|||
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
Point origin = Director::getInstance()->getVisibleOrigin();
|
||||
Point posMid = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
|
||||
Point posBR = ccp(origin.x + visibleSize.width, origin.y);
|
||||
Point posMid = Point(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
|
||||
Point posBR = Point(origin.x + visibleSize.width, origin.y);
|
||||
|
||||
/////////////////////////////
|
||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||
|
@ -99,7 +99,7 @@ bool TestAds::init()
|
|||
// add a "close" icon to exit the progress. it's an autorelease object
|
||||
MenuItemFont *pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(TestAds::menuBackCallback, this));
|
||||
Size backSize = pBackItem->getContentSize();
|
||||
pBackItem->setPosition(ccpAdd(posBR, ccp(- backSize.width / 2, backSize.height / 2)));
|
||||
pBackItem->setPosition(posBR + Point(- backSize.width / 2, backSize.height / 2));
|
||||
|
||||
// create menu, it's an autorelease object
|
||||
Menu* pMenu = Menu::create(pBackItem, NULL);
|
||||
|
@ -107,15 +107,15 @@ bool TestAds::init()
|
|||
|
||||
LabelTTF* label1 = LabelTTF::create("ShowAds", "Arial", 24);
|
||||
MenuItemLabel* pItemShow = MenuItemLabel::create(label1, CC_CALLBACK_1(TestAds::testShow, this));
|
||||
pItemShow->setAnchorPoint(ccp(0.5f, 0));
|
||||
pItemShow->setAnchorPoint(Point(0.5f, 0));
|
||||
pMenu->addChild(pItemShow, 0);
|
||||
pItemShow->setPosition(ccpAdd(posMid, ccp(-100, -120)));
|
||||
pItemShow->setPosition(posMid + Point(-100, -120));
|
||||
|
||||
LabelTTF* label2 = LabelTTF::create("HideAds", "Arial", 24);
|
||||
MenuItemLabel* pItemHide = MenuItemLabel::create(label2, CC_CALLBACK_1(TestAds::testHide, this));
|
||||
pItemHide->setAnchorPoint(ccp(0.5f, 0));
|
||||
pItemHide->setAnchorPoint(Point(0.5f, 0));
|
||||
pMenu->addChild(pItemHide, 0);
|
||||
pItemHide->setPosition(ccpAdd(posMid, ccp(100, -120)));
|
||||
pItemHide->setPosition(posMid + Point(100, -120));
|
||||
|
||||
// create optional menu
|
||||
// cases item
|
||||
|
@ -127,7 +127,7 @@ bool TestAds::init()
|
|||
{
|
||||
_caseItem->getSubItems()->addObject( MenuItemFont::create( s_aTestCases[i].c_str() ) );
|
||||
}
|
||||
_caseItem->setPosition(ccpAdd(posMid, ccp(-200, 120)));
|
||||
_caseItem->setPosition(posMid + Point(-200, 120));
|
||||
pMenu->addChild(_caseItem);
|
||||
|
||||
// type item
|
||||
|
@ -139,7 +139,7 @@ bool TestAds::init()
|
|||
{
|
||||
_typeItem->getSubItems()->addObject( MenuItemFont::create( s_aTestTypes[i].c_str() ) );
|
||||
}
|
||||
_typeItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
|
||||
_typeItem->setPosition(posMid + Point(0, 120));
|
||||
pMenu->addChild(_typeItem);
|
||||
|
||||
// poses item
|
||||
|
@ -151,7 +151,7 @@ bool TestAds::init()
|
|||
{
|
||||
_posItem->getSubItems()->addObject( MenuItemFont::create( s_aTestPoses[i].c_str() ) );
|
||||
}
|
||||
_posItem->setPosition(ccpAdd(posMid, ccp(200, 120)));
|
||||
_posItem->setPosition(posMid + Point(200, 120));
|
||||
pMenu->addChild(_posItem);
|
||||
|
||||
// init options
|
||||
|
|
|
@ -89,7 +89,7 @@ bool TestAnalytics::init()
|
|||
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
Point origin = Director::getInstance()->getVisibleOrigin();
|
||||
Point posBR = ccp(origin.x + visibleSize.width, origin.y);
|
||||
Point posBR = Point(origin.x + visibleSize.width, origin.y);
|
||||
|
||||
/////////////////////////////
|
||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||
|
@ -98,7 +98,7 @@ bool TestAnalytics::init()
|
|||
// add a "close" icon to exit the progress. it's an autorelease object
|
||||
MenuItemFont *pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(TestAnalytics::menuBackCallback, this));
|
||||
Size backSize = pBackItem->getContentSize();
|
||||
pBackItem->setPosition(ccpAdd(posBR, ccp(- backSize.width / 2, backSize.height / 2)));
|
||||
pBackItem->setPosition(posBR + Point(- backSize.width / 2, backSize.height / 2));
|
||||
|
||||
// create menu, it's an autorelease object
|
||||
Menu* pMenu = Menu::create(pBackItem, NULL);
|
||||
|
@ -111,15 +111,15 @@ bool TestAnalytics::init()
|
|||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(TestAnalytics::eventMenuCallback, this));
|
||||
pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag);
|
||||
yPos = visibleSize.height - 35*i - 100;
|
||||
pMenuItem->setPosition( ccp(visibleSize.width / 2, yPos));
|
||||
pMenuItem->setPosition( Point(visibleSize.width / 2, yPos));
|
||||
}
|
||||
|
||||
std::string strName = _pluginAnalytics->getPluginName();
|
||||
std::string strVer = _pluginAnalytics->getSDKVersion();
|
||||
char ret[256] = { 0 };
|
||||
sprintf(ret, "Plugin : %s, Ver : %s", strName.c_str(), strVer.c_str());
|
||||
LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, CCSizeMake(visibleSize.width, 0), kTextAlignmentCenter);
|
||||
pLabel->setPosition(ccp(visibleSize.width / 2, yPos - 80));
|
||||
LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, Point(visibleSize.width, 0), kTextAlignmentCenter);
|
||||
pLabel->setPosition(Point(visibleSize.width / 2, yPos - 80));
|
||||
addChild(pLabel);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -48,7 +48,7 @@ MyPurchase::~MyPurchase()
|
|||
}
|
||||
}
|
||||
|
||||
MyPurchase* MyPurchase::sharedPurchase()
|
||||
MyPurchase* MyPurchase::getInstance()
|
||||
{
|
||||
if (s_pPurchase == NULL) {
|
||||
s_pPurchase = new MyPurchase();
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
class MyPurchase
|
||||
{
|
||||
public:
|
||||
static MyPurchase* sharedPurchase();
|
||||
static MyPurchase* getInstance();
|
||||
static void purgePurchase();
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -70,28 +70,28 @@ bool TestIAP::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
MyPurchase::sharedPurchase()->loadIAPPlugin();
|
||||
MyPurchase::getInstance()->loadIAPPlugin();
|
||||
|
||||
/////////////////////////////
|
||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||
// you may modify it.
|
||||
|
||||
EGLView* pEGLView = EGLView::getInstance();
|
||||
Point posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y);
|
||||
Point posTL = ccp(pEGLView->getVisibleOrigin().x, pEGLView->getVisibleOrigin().y + pEGLView->getVisibleSize().height);
|
||||
Point posBR = Point(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y);
|
||||
Point posTL = Point(pEGLView->getVisibleOrigin().x, pEGLView->getVisibleOrigin().y + pEGLView->getVisibleSize().height);
|
||||
|
||||
// add a "close" icon to exit the progress. it's an autorelease object
|
||||
MenuItemFont *pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(TestIAP::menuBackCallback, this));
|
||||
Size backSize = pBackItem->getContentSize();
|
||||
pBackItem->setPosition(ccpAdd(posBR, ccp(- backSize.width / 2, backSize.height / 2)));
|
||||
pBackItem->setPosition(posBR + Point(- backSize.width / 2, backSize.height / 2));
|
||||
|
||||
// create menu, it's an autorelease object
|
||||
Menu* pMenu = Menu::create(pBackItem, NULL);
|
||||
pMenu->setPosition( Point::ZERO );
|
||||
this->addChild(pMenu, 1);
|
||||
|
||||
Point posStep = ccp(220, -150);
|
||||
Point beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f));
|
||||
Point posStep = Point(220, -150);
|
||||
Point beginPos = posTL + (posStep * 0.5f);
|
||||
int line = 0;
|
||||
int row = 0;
|
||||
for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
|
||||
|
@ -99,13 +99,13 @@ bool TestIAP::init()
|
|||
CC_CALLBACK_1(TestIAP::eventMenuCallback, this));
|
||||
pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag);
|
||||
|
||||
Point pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line));
|
||||
Point pos = beginPos + Point(posStep.x * row, posStep.y * line);
|
||||
Size itemSize = pMenuItem->getContentSize();
|
||||
if ((pos.x + itemSize.width / 2) > posBR.x)
|
||||
{
|
||||
line += 1;
|
||||
row = 0;
|
||||
pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line));
|
||||
pos = beginPos + Point(posStep.x * row, posStep.y * line);
|
||||
}
|
||||
row += 1;
|
||||
pMenuItem->setPosition(pos);
|
||||
|
@ -123,7 +123,7 @@ void TestIAP::eventMenuCallback(Object* pSender)
|
|||
pInfo["productPrice"] = "0.01";
|
||||
pInfo["productDesc"] = "100个金灿灿的游戏币哦";
|
||||
pInfo["Nd91ProductId"] = "685994";
|
||||
MyPurchase::sharedPurchase()->payByMode(pInfo, mode);
|
||||
MyPurchase::getInstance()->payByMode(pInfo, mode);
|
||||
}
|
||||
|
||||
void TestIAP::menuBackCallback(Object* pSender)
|
||||
|
|
|
@ -49,7 +49,7 @@ MyIAPOLManager::~MyIAPOLManager()
|
|||
}
|
||||
}
|
||||
|
||||
MyIAPOLManager* MyIAPOLManager::sharedManager()
|
||||
MyIAPOLManager* MyIAPOLManager::getInstance()
|
||||
{
|
||||
if (s_pIAPOnline == NULL) {
|
||||
s_pIAPOnline = new MyIAPOLManager();
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
class MyIAPOLManager
|
||||
{
|
||||
public:
|
||||
static MyIAPOLManager* sharedManager();
|
||||
static MyIAPOLManager* getInstance();
|
||||
static void purge();
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -74,7 +74,7 @@ bool TestIAPOnline::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
MyIAPOLManager::sharedManager()->loadPlugins();
|
||||
MyIAPOLManager::getInstance()->loadPlugins();
|
||||
|
||||
/////////////////////////////
|
||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||
|
@ -153,7 +153,7 @@ void TestIAPOnline::eventMenuCallback(Object* pSender)
|
|||
// pInfo["QHAppOrderID"] = "Order ID in game"; // The order ID in game (Game defined this)
|
||||
}
|
||||
|
||||
MyIAPOLManager::sharedManager()->payByMode(pInfo, mode);
|
||||
MyIAPOLManager::getInstance()->payByMode(pInfo, mode);
|
||||
}
|
||||
|
||||
void TestIAPOnline::menuBackCallback(Object* pSender)
|
||||
|
|
|
@ -48,7 +48,7 @@ MyShareManager::~MyShareManager()
|
|||
}
|
||||
}
|
||||
|
||||
MyShareManager* MyShareManager::sharedManager()
|
||||
MyShareManager* MyShareManager::getInstance()
|
||||
{
|
||||
if (s_pManager == NULL) {
|
||||
s_pManager = new MyShareManager();
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
class MyShareManager
|
||||
{
|
||||
public:
|
||||
static MyShareManager* sharedManager();
|
||||
static MyShareManager* getInstance();
|
||||
static void purgeManager();
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -70,7 +70,7 @@ bool TestShare::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
MyShareManager::sharedManager()->loadSharePlugin();
|
||||
MyShareManager::getInstance()->loadSharePlugin();
|
||||
|
||||
/////////////////////////////
|
||||
// 2. add a menu item with "X" image, which is clicked to quit the program
|
||||
|
@ -120,7 +120,7 @@ void TestShare::eventMenuCallback(Object* pSender)
|
|||
pInfo["SharedText"] = "Share message : HelloShare!";
|
||||
// pInfo["SharedImagePath"] = "Full/path/to/image";
|
||||
MyShareManager::MyShareMode mode = (MyShareManager::MyShareMode) (pMenuItem->getTag() - TAG_SHARE_BY_TWWITER + 1);
|
||||
MyShareManager::sharedManager()->shareByMode(pInfo, mode);
|
||||
MyShareManager::getInstance()->shareByMode(pInfo, mode);
|
||||
}
|
||||
|
||||
void TestShare::menuBackCallback(Object* pSender)
|
||||
|
|
|
@ -41,7 +41,7 @@ MySocialManager::~MySocialManager()
|
|||
unloadPlugins();
|
||||
}
|
||||
|
||||
MySocialManager* MySocialManager::sharedManager()
|
||||
MySocialManager* MySocialManager::getInstance()
|
||||
{
|
||||
if (s_pManager == NULL) {
|
||||
s_pManager = new MySocialManager();
|
||||
|
|
|
@ -29,7 +29,7 @@ THE SOFTWARE.
|
|||
class MySocialManager : public cocos2d::plugin::SocialListener
|
||||
{
|
||||
public:
|
||||
static MySocialManager* sharedManager();
|
||||
static MySocialManager* getInstance();
|
||||
static void purgeManager();
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -59,7 +59,7 @@ bool TestSocial::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
MySocialManager::sharedManager()->loadPlugins();
|
||||
MySocialManager::getInstance()->loadPlugins();
|
||||
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
Point origin = Director::getInstance()->getVisibleOrigin();
|
||||
|
@ -119,7 +119,7 @@ bool TestSocial::init()
|
|||
void TestSocial::testSubmit(Object* pSender)
|
||||
{
|
||||
int nIdx = _caseItem->getSelectedIndex();
|
||||
MySocialManager::sharedManager()->submitScore((MySocialManager::MySocialMode)(nIdx + 1), "0", 30000);
|
||||
MySocialManager::getInstance()->submitScore((MySocialManager::MySocialMode)(nIdx + 1), "0", 30000);
|
||||
}
|
||||
|
||||
void TestSocial::testUnlock(Object* pSender)
|
||||
|
@ -129,19 +129,19 @@ void TestSocial::testUnlock(Object* pSender)
|
|||
info["AchievementID"] = "MyAchiID";
|
||||
info["NDDisplayText"] = "Fighter";
|
||||
info["NDScore"] = "100";
|
||||
MySocialManager::sharedManager()->unlockAchievement((MySocialManager::MySocialMode)(nIdx + 1), info);
|
||||
MySocialManager::getInstance()->unlockAchievement((MySocialManager::MySocialMode)(nIdx + 1), info);
|
||||
}
|
||||
|
||||
void TestSocial::testLeaderboard(Object* pSender)
|
||||
{
|
||||
int nIdx = _caseItem->getSelectedIndex();
|
||||
MySocialManager::sharedManager()->showLeaderboard((MySocialManager::MySocialMode)(nIdx + 1), "0");
|
||||
MySocialManager::getInstance()->showLeaderboard((MySocialManager::MySocialMode)(nIdx + 1), "0");
|
||||
}
|
||||
|
||||
void TestSocial::testAchievement(Object* pSender)
|
||||
{
|
||||
int nIdx = _caseItem->getSelectedIndex();
|
||||
MySocialManager::sharedManager()->showAchievement((MySocialManager::MySocialMode)(nIdx + 1));
|
||||
MySocialManager::getInstance()->showAchievement((MySocialManager::MySocialMode)(nIdx + 1));
|
||||
}
|
||||
|
||||
void TestSocial::menuBackCallback(Object* pSender)
|
||||
|
|
|
@ -49,7 +49,7 @@ MyUserManager::~MyUserManager()
|
|||
}
|
||||
}
|
||||
|
||||
MyUserManager* MyUserManager::sharedManager()
|
||||
MyUserManager* MyUserManager::getInstance()
|
||||
{
|
||||
if (s_pManager == NULL) {
|
||||
s_pManager = new MyUserManager();
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
class MyUserManager
|
||||
{
|
||||
public:
|
||||
static MyUserManager* sharedManager();
|
||||
static MyUserManager* getInstance();
|
||||
static void purgeManager();
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -60,7 +60,7 @@ bool TestUser::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
MyUserManager::sharedManager()->loadPlugin();
|
||||
MyUserManager::getInstance()->loadPlugin();
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
Point origin = Director::getInstance()->getVisibleOrigin();
|
||||
Point posMid = Point(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
|
||||
|
@ -117,12 +117,12 @@ void TestUser::caseChanged(Object* pSender)
|
|||
|
||||
void TestUser::testLogin(Object* pSender)
|
||||
{
|
||||
MyUserManager::sharedManager()->loginByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
|
||||
MyUserManager::getInstance()->loginByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
|
||||
}
|
||||
|
||||
void TestUser::testLogout(Object* pSender)
|
||||
{
|
||||
MyUserManager::sharedManager()->logoutByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
|
||||
MyUserManager::getInstance()->logoutByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
|
||||
}
|
||||
|
||||
void TestUser::menuBackCallback(Object* pSender)
|
||||
|
|
Loading…
Reference in New Issue