issue #2336, Add a sample project with all plugins.

This commit is contained in:
zhangbin 2013-06-28 11:46:39 +08:00
parent 6f34a59075
commit 530afbb9d9
53 changed files with 3726 additions and 4 deletions

View File

@ -75,4 +75,49 @@
location = "group:scripting/lua/proj.ios/luabindings.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "plugin-x">
<Group
location = "container:"
name = "plugins">
<Group
location = "container:"
name = "Share">
<FileRef
location = "group:plugin/plugins/twitter/proj.ios/PluginTwitter.xcodeproj">
</FileRef>
<FileRef
location = "group:plugin/plugins/weibo/proj.ios/PluginWeibo.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "Ads">
<FileRef
location = "group:plugin/plugins/admob/proj.ios/PluginAdmob.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "Analytics">
<FileRef
location = "group:plugin/plugins/flurry/proj.ios/PluginFlurry.xcodeproj">
</FileRef>
<FileRef
location = "group:plugin/plugins/umeng/proj.ios/PluginUmeng.xcodeproj">
</FileRef>
</Group>
<FileRef
location = "group:plugin/protocols/proj.ios/PluginProtocol.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "samples">
<FileRef
location = "group:plugin/samples/HelloPlugins/proj.ios/HelloPlugins.xcodeproj">
</FileRef>
</Group>
</Group>
</Workspace>

View File

@ -102,7 +102,7 @@
FA09A369168AFD41008C1C7B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = zhangbin;
};
buildConfigurationList = FA09A36C168AFD41008C1C7B /* Build configuration list for PBXProject "PluginFlurry" */;
@ -141,6 +141,9 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -167,6 +170,9 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;

View File

@ -179,7 +179,7 @@
FACAD87F1762C1B500D75ADE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = zhangbin;
};
buildConfigurationList = FACAD8821762C1B500D75ADE /* Build configuration list for PBXProject "PluginTwitter" */;
@ -226,6 +226,9 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -251,6 +254,9 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;

View File

@ -100,7 +100,7 @@
FA09A2F8168ADAEC008C1C7B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = zhangbin;
};
buildConfigurationList = FA09A2FB168ADAEC008C1C7B /* Build configuration list for PBXProject "PluginUmeng" */;
@ -139,6 +139,9 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -165,6 +168,9 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;

View File

@ -142,7 +142,7 @@
FAE27527175D9D2900F5DA8E /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = zhangbin;
};
buildConfigurationList = FAE2752A175D9D2900F5DA8E /* Build configuration list for PBXProject "PluginWeibo" */;
@ -184,6 +184,9 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -209,6 +212,9 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;

View File

@ -0,0 +1,36 @@
/****************************************************************************
Copyright (c) 2012+2013 cocos2d+x.org
http://www.cocos2d+x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
@protocol InterfaceUser <NSObject>
- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo;
- (void) login;
- (void) logout;
- (BOOL) isLogined;
- (NSString*) getSessionID;
- (void) setDebugMode: (BOOL) debug;
- (NSString*) getSDKVersion;
- (NSString*) getPluginVersion;
@end

View File

@ -0,0 +1,80 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ProtocolUser.h"
#include "PluginUtilsIOS.h"
#import "InterfaceUser.h"
namespace cocos2d { namespace plugin {
ProtocolUser::ProtocolUser()
: _listener(NULL)
{
}
ProtocolUser::~ProtocolUser()
{
}
void ProtocolUser::configDeveloperInfo(TUserDeveloperInfo devInfo)
{
if (devInfo.empty())
{
PluginUtilsIOS::outputLog("The developer info is empty for %s!", this->getPluginName());
return;
}
else
{
PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this);
assert(pData != NULL);
id ocObj = pData->obj;
if ([ocObj conformsToProtocol:@protocol(InterfaceUser)]) {
NSObject<InterfaceUser>* curObj = ocObj;
NSMutableDictionary* pDict = PluginUtilsIOS::createDictFromMap(&devInfo);
[curObj configDeveloperInfo:pDict];
}
}
}
void ProtocolUser::login()
{
PluginUtilsIOS::callOCFunctionWithName(this, "login");
}
void ProtocolUser::logout()
{
PluginUtilsIOS::callOCFunctionWithName(this, "logout");
}
bool ProtocolUser::isLogined()
{
return PluginUtilsIOS::callOCBoolFunctionWithName(this, "isLogined");
}
std::string ProtocolUser::getSessionID()
{
return PluginUtilsIOS::callOCStringFunctionWithName(this, "getSessionID");
}
}} // namespace cocos2d { namespace plugin {

View File

@ -0,0 +1,40 @@
/****************************************************************************
Copyright (c) 2012+2013 cocos2d+x.org
http://www.cocos2d+x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <Foundation/Foundation.h>
typedef enum {
kLoginSucceed = 0,
kLoginFailed,
kLogoutSucceed,
} UserActionResult;
@interface UserWrapper : NSObject
{
}
+ (void) onActionResult:(id) obj withRet:(UserActionResult) ret withMsg:(NSString*) msg;
@end

View File

@ -0,0 +1,53 @@
/****************************************************************************
Copyright (c) 2012+2013 cocos2d+x.org
http://www.cocos2d+x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "UserWrapper.h"
#include "PluginUtilsIOS.h"
#include "ProtocolUser.h"
using namespace cocos2d::plugin;
@implementation UserWrapper
+ (void) onActionResult:(id) obj withRet:(UserActionResult) ret withMsg:(NSString*) msg
{
PluginProtocol* pPlugin = PluginUtilsIOS::getPluginPtr(obj);
ProtocolUser* pUser = dynamic_cast<ProtocolUser*>(pPlugin);
if (pUser) {
UserActionListener* listener = pUser->getActionListener();
if (NULL != listener)
{
const char* chMsg = [msg UTF8String];
listener->onActionResult(pUser, (UserActionResultCode) ret, chMsg);
}
else
{
PluginUtilsIOS::outputLog("Listener of plugin %s not set correctly", pPlugin->getPluginName());
}
} else {
PluginUtilsIOS::outputLog("Can't find the C++ object of the User plugin");
}
}
@end

View File

@ -19,6 +19,8 @@
FAB6DF9A1755D93600C90D89 /* PluginProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DF991755D93600C90D89 /* PluginProtocol.mm */; };
FAC2A7F91777F8C200035D22 /* ProtocolShare.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAC2A7F61777F8C200035D22 /* ProtocolShare.mm */; };
FAC2A7FA1777F8C200035D22 /* ShareWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAC2A7F81777F8C200035D22 /* ShareWrapper.mm */; };
FAD55520177D1FA900968F54 /* ProtocolUser.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAD5551D177D1FA900968F54 /* ProtocolUser.mm */; };
FAD55521177D1FA900968F54 /* UserWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAD5551F177D1FA900968F54 /* UserWrapper.mm */; };
FADC44CA176EABCF00B2D5ED /* AdsWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FADC44C9176EABCF00B2D5ED /* AdsWrapper.mm */; };
/* End PBXBuildFile section */
@ -63,6 +65,11 @@
FAC2A7F61777F8C200035D22 /* ProtocolShare.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolShare.mm; sourceTree = "<group>"; };
FAC2A7F71777F8C200035D22 /* ShareWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareWrapper.h; sourceTree = "<group>"; };
FAC2A7F81777F8C200035D22 /* ShareWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShareWrapper.mm; sourceTree = "<group>"; };
FAD5551C177D1FA900968F54 /* InterfaceUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceUser.h; sourceTree = "<group>"; };
FAD5551D177D1FA900968F54 /* ProtocolUser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolUser.mm; sourceTree = "<group>"; };
FAD5551E177D1FA900968F54 /* UserWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserWrapper.h; sourceTree = "<group>"; };
FAD5551F177D1FA900968F54 /* UserWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserWrapper.mm; sourceTree = "<group>"; };
FAD55522177D213F00968F54 /* ProtocolUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolUser.h; sourceTree = "<group>"; };
FADC44C8176EABCF00B2D5ED /* AdsWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdsWrapper.h; sourceTree = "<group>"; };
FADC44C9176EABCF00B2D5ED /* AdsWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AdsWrapper.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -112,6 +119,7 @@
FA09A336168ADC05008C1C7B /* include */ = {
isa = PBXGroup;
children = (
FAD55522177D213F00968F54 /* ProtocolUser.h */,
FAC2A7F41777F88700035D22 /* ProtocolShare.h */,
FAB6DF931755D7D100C90D89 /* PluginFactory.h */,
FAB6DF941755D7D100C90D89 /* PluginParam.h */,
@ -128,6 +136,10 @@
FA0CB8B5168D3CC200E36B11 /* ios */ = {
isa = PBXGroup;
children = (
FAD5551C177D1FA900968F54 /* InterfaceUser.h */,
FAD5551D177D1FA900968F54 /* ProtocolUser.mm */,
FAD5551E177D1FA900968F54 /* UserWrapper.h */,
FAD5551F177D1FA900968F54 /* UserWrapper.mm */,
FAC2A7F51777F8C200035D22 /* InterfaceShare.h */,
FAC2A7F61777F8C200035D22 /* ProtocolShare.mm */,
FAC2A7F71777F8C200035D22 /* ShareWrapper.h */,
@ -212,6 +224,8 @@
FADC44CA176EABCF00B2D5ED /* AdsWrapper.mm in Sources */,
FAC2A7F91777F8C200035D22 /* ProtocolShare.mm in Sources */,
FAC2A7FA1777F8C200035D22 /* ShareWrapper.mm in Sources */,
FAD55520177D1FA900968F54 /* ProtocolUser.mm in Sources */,
FAD55521177D1FA900968F54 /* UserWrapper.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,52 @@
#include "AppDelegate.h"
#include "HelloWorldScene.h"
USING_NS_CC;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
Director* pDirector = Director::sharedDirector();
EGLView* pEGLView = EGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(960.0f, 640.0f, kResolutionNoBorder);
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
Scene *pScene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
Director::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}

View File

@ -0,0 +1,38 @@
#ifndef _APP_DELEGATE_H_
#define _APP_DELEGATE_H_
#include "cocos2d.h"
/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by Director.
*/
class AppDelegate : private cocos2d::Application
{
public:
AppDelegate();
virtual ~AppDelegate();
/**
@brief Implement Director and Scene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching();
/**
@brief The function be called when the application enter background
@param the pointer of the application
*/
virtual void applicationDidEnterBackground();
/**
@brief The function be called when the application enter foreground
@param the pointer of the application
*/
virtual void applicationWillEnterForeground();
};
#endif // _APP_DELEGATE_H_

View File

@ -0,0 +1,115 @@
#include "HelloWorldScene.h"
#include "TestAdsScene.h"
#include "TestAnalyticsScene.h"
#include "TestShareScene.h"
#include "TestIAPScene.h"
#include "TestUserScene.h"
USING_NS_CC;
std::string g_testCases[] = {
"Test Ads",
"Test Analytics",
"Test Share",
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
"Test IAP",
"Test User",
#endif
};
Scene* HelloWorld::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::sharedDirector()->getVisibleSize();
Point origin = Director::sharedDirector()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
MenuItemImage *pCloseItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pCloseItem, NULL);
pMenu->setPosition(PointZero);
this->addChild(pMenu, 1);
Point beginPos = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - 50);
float step = 60.0f;
int nCaseCount = sizeof(g_testCases) / sizeof(std::string);
for (int i = 0; i < nCaseCount; ++i) {
std::string caseName = g_testCases[i];
MenuItemFont *pItem = MenuItemFont::create(caseName.c_str(), CC_CALLBACK_1(HelloWorld::menuCallback, this));
pItem->setTag(i);
pItem->setPosition(ccp(beginPos.x, beginPos.y - i * step));
pMenu->addChild(pItem);
}
return true;
}
void HelloWorld::menuCallback(Object* pSender)
{
MenuItemFont *pItem = (MenuItemFont*) pSender;
Scene* newScene = NULL;
switch (pItem->getTag()) {
case 0:
newScene = TestAds::scene();
break;
case 1:
newScene = TestAnalytics::scene();
break;
case 2:
newScene = TestShare::scene();
break;
case 3:
newScene = TestIAP::scene();
break;
case 4:
newScene = TestUser::scene();
break;
default:
break;
}
if (newScene) {
Director::sharedDirector()->replaceScene(newScene);
}
}
void HelloWorld::menuCloseCallback(Object* pSender)
{
Director::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}

View File

@ -0,0 +1,23 @@
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class HelloWorld : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* scene();
// a selector callback
void menuCloseCallback(Object* pSender);
void menuCallback(Object* pSender);
// implement the "static node()" method manually
CREATE_FUNC(HelloWorld);
};
#endif // __HELLOWORLD_SCENE_H__

View File

@ -0,0 +1,251 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "TestAdsScene.h"
#include "PluginManager.h"
#include "HelloWorldScene.h"
USING_NS_CC;
using namespace cocos2d::plugin;
const std::string s_aTestCases[] = {
"Admob",
};
const std::string s_aTestTypes[] = {
"Banner",
"Full Screen",
"More App",
};
const std::string s_aTestPoses[] = {
"Pos: Center",
"Pos: Top",
"Pos: TopLeft",
"Pos: TopRight",
"Pos: Bottom",
"Pos: BottomLeft",
"Pos: BottomRight",
};
Scene* TestAds::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
TestAds *layer = TestAds::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool TestAds::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
_admob = dynamic_cast<ProtocolAds*>(PluginManager::getInstance()->loadPlugin("AdsAdmob"));
TAdsDeveloperInfo devInfo;
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
devInfo["AdmobID"] = "a1517500cc8f794";
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
devInfo["AdmobID"] = "a1516fb6b16b12f";
#endif
_admob->configDeveloperInfo(devInfo);
_listener = new MyAdsListener();
_admob->setAdsListener(_listener);
_admob->setDebugMode(true);
Size visibleSize = Director::sharedDirector()->getVisibleSize();
Point origin = Director::sharedDirector()->getVisibleOrigin();
Point posMid = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
Point posBR = ccp(origin.x + visibleSize.width, origin.y);
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// 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)));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pBackItem, NULL);
pMenu->setPosition( PointZero );
LabelTTF* label1 = LabelTTF::create("ShowAds", "Arial", 24);
MenuItemLabel* pItemShow = MenuItemLabel::create(label1, CC_CALLBACK_1(TestAds::testShow, this));
pItemShow->setAnchorPoint(ccp(0.5f, 0));
pMenu->addChild(pItemShow, 0);
pItemShow->setPosition(ccpAdd(posMid, ccp(-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));
pMenu->addChild(pItemHide, 0);
pItemHide->setPosition(ccpAdd(posMid, ccp(100, -120)));
// create optional menu
// cases item
_caseItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(TestAds::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)
{
_caseItem->getSubItems()->addObject( MenuItemFont::create( s_aTestCases[i].c_str() ) );
}
_caseItem->setPosition(ccpAdd(posMid, ccp(-200, 120)));
pMenu->addChild(_caseItem);
// type item
_typeItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(TestAds::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)
{
_typeItem->getSubItems()->addObject( MenuItemFont::create( s_aTestTypes[i].c_str() ) );
}
_typeItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
pMenu->addChild(_typeItem);
// poses item
_posItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(TestAds::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)
{
_posItem->getSubItems()->addObject( MenuItemFont::create( s_aTestPoses[i].c_str() ) );
}
_posItem->setPosition(ccpAdd(posMid, ccp(200, 120)));
pMenu->addChild(_posItem);
// init options
_ads = _admob;
_pos = ProtocolAds::kPosCenter;
_type = ProtocolAds::kBannerAd;
this->addChild(pMenu, 1);
return true;
}
void TestAds::testShow(Object* pSender)
{
int nSize = 0;
if (_ads == _admob)
{
nSize = 0;
}
if (_ads)
{
_ads->showAds(_type, nSize, _pos);
}
}
void TestAds::testHide(Object* pSender)
{
_ads->hideAds(_type);
}
void TestAds::menuBackCallback(Object* pSender)
{
if (_admob != NULL)
{
_admob->hideAds(ProtocolAds::kBannerAd);
_admob->hideAds(ProtocolAds::kFullScreenAd);
_admob->hideAds(ProtocolAds::kMoreApp);
PluginManager::getInstance()->unloadPlugin("AdsAdmob");
_admob = NULL;
}
if (NULL != _listener)
{
delete _listener;
_listener = NULL;
}
Scene* newScene = HelloWorld::scene();
Director::sharedDirector()->replaceScene(newScene);
}
void TestAds::caseChanged(Object* pSender)
{
std::string strLog = "";
switch (_caseItem->getSelectedIndex())
{
case 0:
_ads = _admob;
strLog = "Admob";
break;
default:
break;
}
CCLog("case selected change to : %s", strLog.c_str());
}
void TestAds::typeChanged(Object* pSender)
{
int selectIndex = _typeItem->getSelectedIndex();
_type = (ProtocolAds::AdsType) selectIndex;
CCLog("type selected change to : %d", _type);
}
void TestAds::posChanged(Object* pSender)
{
int selectIndex = _posItem->getSelectedIndex();
_pos = (ProtocolAds::AdsPos) selectIndex;
CCLog("pos selected change to : %d", _pos);
}
void MyAdsListener::onAdsResult(AdsResultCode code, const char* msg)
{
CCLog("OnAdsResult, code : %d, msg : %s", code, msg);
}
void MyAdsListener::onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points)
{
CCLog("Player get points : %d", points);
// @warning should add code to give game-money to player here
// spend the points of player
if (pAdsPlugin != NULL) {
pAdsPlugin->spendPoints(points);
}
}

View File

@ -0,0 +1,72 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __TEST_ADS_SCENE_H__
#define __TEST_ADS_SCENE_H__
#include "cocos2d.h"
#include "ProtocolAds.h"
class MyAdsListener : public cocos2d::plugin::AdsListener
{
public:
virtual void onAdsResult(cocos2d::plugin::AdsResultCode code, const char* msg);
virtual void onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points);
};
class TestAds : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* scene();
// a selector callback
void menuBackCallback(Object* pSender);
void testShow(Object* pSender);
void testHide(Object* pSender);
// option changed callback
void caseChanged(Object* pSender);
void posChanged(Object* pSender);
void typeChanged(Object* pSender);
// implement the "static node()" method manually
CREATE_FUNC(TestAds);
private:
cocos2d::plugin::ProtocolAds* _admob;
MyAdsListener* _listener;
cocos2d::MenuItemToggle* _caseItem;
cocos2d::MenuItemToggle* _typeItem;
cocos2d::MenuItemToggle* _posItem;
cocos2d::plugin::ProtocolAds* _ads;
cocos2d::plugin::ProtocolAds::AdsPos _pos;
cocos2d::plugin::ProtocolAds::AdsType _type;
};
#endif // __TEST_ADS_SCENE_H__

View File

@ -0,0 +1,303 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "TestAnalyticsScene.h"
#include "PluginManager.h"
#include "HelloWorldScene.h"
using namespace cocos2d;
using namespace cocos2d::plugin;
// The app key of flurry
#define FLURRY_KEY_IOS "KMGG7CD9WPK2TW4X9VR8"
#define FLURRY_KEY_ANDROID "SPKFH8KMPGHMMBWRBT5W"
#define UMENG_KEY_IOS "50d2b18c5270152187000097"
#define UMENG_KEY_ANDROID "" // umeng key for android is setted in AndroidManifest.xml
enum {
TAG_LOG_EVENT_ID = 0,
TAG_LOG_EVENT_ID_KV,
TAG_LOG_ONLINE_CONFIG,
TAG_LOG_EVENT_ID_DURATION,
TAG_LOG_EVENT_BEGIN,
TAG_LOG_EVENT_END,
TAG_MAKE_ME_CRASH
};
typedef struct tagEventMenuItem {
std::string id;
int tag;
}EventMenuItem;
static EventMenuItem s_EventMenuItem[] = {
{"OnlineConfig", TAG_LOG_ONLINE_CONFIG},
{"LogEvent-eventId" , TAG_LOG_EVENT_ID},
{"LogEvent-eventId-kv", TAG_LOG_EVENT_ID_KV},
{"LogEvent-eventId-Duration", TAG_LOG_EVENT_ID_DURATION},
{"LogEvent-Begin", TAG_LOG_EVENT_BEGIN},
{"LogEvent-End", TAG_LOG_EVENT_END},
{"MakeMeCrash", TAG_MAKE_ME_CRASH}
};
Scene* TestAnalytics::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
TestAnalytics *layer = TestAnalytics::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool TestAnalytics::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
_pluginAnalytics = NULL;
loadPlugins();
Size visibleSize = Director::sharedDirector()->getVisibleSize();
Point origin = Director::sharedDirector()->getVisibleOrigin();
Point posBR = ccp(origin.x + visibleSize.width, origin.y);
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// 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)));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pBackItem, NULL);
pMenu->setPosition( PointZero );
this->addChild(pMenu, 1);
float yPos = 0;
for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
LabelTTF* label = LabelTTF::create(s_EventMenuItem[i].id.c_str(), "Arial", 24);
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));
}
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));
addChild(pLabel);
return true;
}
void TestAnalytics::onExit()
{
unloadPlugins();
}
void TestAnalytics::eventMenuCallback(Object* pSender)
{
MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
switch (pMenuItem->getTag())
{
case TAG_LOG_EVENT_ID:
{
_pluginAnalytics->logEvent("click");
_pluginAnalytics->logEvent("music");
}
break;
case TAG_LOG_EVENT_ID_KV:
{
LogEventParamMap paramMap;
paramMap.insert(LogEventParamPair("type", "popular"));
paramMap.insert(LogEventParamPair("artist", "JJLin"));
_pluginAnalytics->logEvent("music", &paramMap);
}
break;
case TAG_LOG_ONLINE_CONFIG:
{
PluginParam param("abc");
CCLog("Online config = %s", _pluginAnalytics->callStringFuncWithParam("getConfigParams", &param, NULL).c_str());
}
break;
case TAG_LOG_EVENT_ID_DURATION:
{
PluginParam event1("book");
PluginParam dura1(12000);
_pluginAnalytics->callFuncWithParam("logEventWithDuration", &event1, &dura1, NULL);
PluginParam event2("book");
PluginParam dura2(12000);
PluginParam label("chapter1");
_pluginAnalytics->callFuncWithParam("logEventWithDurationLabel", &event2, &dura2, &label, NULL);
PluginParam event3("music");
PluginParam dura3(2330000);
LogEventParamMap paramMap;
paramMap.insert(LogEventParamPair("type", "popular"));
paramMap.insert(LogEventParamPair("artist", "JJLin"));
PluginParam mapValue(paramMap);
_pluginAnalytics->callFuncWithParam("logEventWithDurationParams", &event3, &dura3, &mapValue, NULL);
}
break;
case TAG_LOG_EVENT_BEGIN:
{
_pluginAnalytics->logTimedEventBegin("music");
PluginParam event1("music");
PluginParam label1("one");
_pluginAnalytics->callFuncWithParam("logTimedEventWithLabelBegin", &event1, &label1, NULL);
PluginParam event2("music");
PluginParam label2("flag0");
LogEventParamMap paramMap;
paramMap.insert(LogEventParamPair("type", "popular"));
paramMap.insert(LogEventParamPair("artist", "JJLin"));
PluginParam mapValue(paramMap);
_pluginAnalytics->callFuncWithParam("logTimedKVEventBegin", &event2, &label2, &mapValue, NULL);
PluginParam event3("music-kv");
_pluginAnalytics->callFuncWithParam("logTimedEventBeginWithParams", &event3, &mapValue, NULL);
}
break;
case TAG_LOG_EVENT_END:
{
_pluginAnalytics->logTimedEventEnd("music");
PluginParam event1("music");
PluginParam label1("one");
_pluginAnalytics->callFuncWithParam("logTimedEventWithLabelEnd", &event1, &label1, NULL);
PluginParam event2("music");
PluginParam label2("flag0");
_pluginAnalytics->callFuncWithParam("logTimedKVEventEnd", &event2, &label2, NULL);
PluginParam event3("music-kv");
_pluginAnalytics->callFuncWithParam("logTimedEventEnd", &event3, NULL);
}
break;
case TAG_MAKE_ME_CRASH:
{
char* pNull = NULL;
*pNull = 0;
}
break;
default:
break;
}
}
void TestAnalytics::loadPlugins()
{
ccLanguageType langType = Application::sharedApplication()->getCurrentLanguage();
std::string umengKey = "";
std::string flurryKey = "";
std::string pluginName = "";
std::string strAppKey = "";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
umengKey = UMENG_KEY_IOS;
flurryKey = FLURRY_KEY_IOS;
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
umengKey = UMENG_KEY_ANDROID;
flurryKey = FLURRY_KEY_ANDROID;
#endif
if (kLanguageChinese == langType)
{
pluginName = "AnalyticsUmeng";
strAppKey = umengKey;
}
else
{
pluginName = "AnalyticsFlurry";
strAppKey = flurryKey;
}
_pluginAnalytics = dynamic_cast<ProtocolAnalytics*> (PluginManager::getInstance()->loadPlugin(pluginName.c_str()));
_pluginAnalytics->setDebugMode(true);
_pluginAnalytics->startSession(strAppKey.c_str());
_pluginAnalytics->setCaptureUncaughtException(true);
_pluginAnalytics->setSessionContinueMillis(10000);
const char* sdkVer = _pluginAnalytics->getSDKVersion().c_str();
CCLog("SDK version : %s", sdkVer);
_pluginAnalytics->callFuncWithParam("updateOnlineConfig", NULL);
PluginParam pParam1(true);
_pluginAnalytics->callFuncWithParam("setReportLocation", &pParam1, NULL);
_pluginAnalytics->callFuncWithParam("logPageView", NULL);
PluginParam pParam2("1.1");
_pluginAnalytics->callFuncWithParam("setVersionName", &pParam2, NULL);
PluginParam pParam3(20);
_pluginAnalytics->callFuncWithParam("setAge", &pParam3, NULL);
PluginParam pParam4(1);
_pluginAnalytics->callFuncWithParam("setGender", &pParam4, NULL);
PluginParam pParam5("123456");
_pluginAnalytics->callFuncWithParam("setUserId", &pParam5, NULL);
PluginParam pParam6(false);
_pluginAnalytics->callFuncWithParam("setUseHttps", &pParam6, NULL);
}
void TestAnalytics::unloadPlugins()
{
if (NULL != _pluginAnalytics) {
_pluginAnalytics->stopSession();
std::string pluginName = _pluginAnalytics->getPluginName();
PluginManager::getInstance()->unloadPlugin(pluginName.c_str());
_pluginAnalytics = NULL;
}
}
void TestAnalytics::menuBackCallback(Object* pSender)
{
Scene* newScene = HelloWorld::scene();
Director::sharedDirector()->replaceScene(newScene);
}

View File

@ -0,0 +1,54 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __TEST_ANALYTICS_SCENE_H__
#define __TEST_ANALYTICS_SCENE_H__
#include "cocos2d.h"
#include "ProtocolAnalytics.h"
class TestAnalytics : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
virtual void onExit();
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::Scene* scene();
// a selector callback
void menuBackCallback(Object* pSender);
void eventMenuCallback(Object* pSender);
void loadPlugins();
void unloadPlugins();
// implement the "static node()" method manually
CREATE_FUNC(TestAnalytics);
private:
cocos2d::plugin::ProtocolAnalytics* _pluginAnalytics;
};
#endif // __TEST_ANALYTICS_SCENE_H__

View File

@ -0,0 +1,151 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "MyPurchase.h"
#include "PluginManager.h"
#include "cocos2d.h"
using namespace cocos2d::plugin;
using namespace cocos2d;
MyPurchase* MyPurchase::s_pPurchase = NULL;
MyPurchase::MyPurchase()
: s_pAlipay(NULL)
, s_pRetListener(NULL)
, s_pNd91(NULL)
{
}
MyPurchase::~MyPurchase()
{
unloadIAPPlugin();
if (s_pRetListener)
{
delete s_pRetListener;
s_pRetListener = NULL;
}
}
MyPurchase* MyPurchase::sharedPurchase()
{
if (s_pPurchase == NULL) {
s_pPurchase = new MyPurchase();
}
return s_pPurchase;
}
void MyPurchase::purgePurchase()
{
if (s_pPurchase)
{
delete s_pPurchase;
s_pPurchase = NULL;
}
PluginManager::end();
}
void MyPurchase::loadIAPPlugin()
{
if (s_pRetListener == NULL)
{
s_pRetListener = new MyPurchaseResult();
}
{
// init alipay plugin
s_pAlipay = dynamic_cast<ProtocolIAP*>(PluginManager::getInstance()->loadPlugin("IAPAlipay"));
TIAPDeveloperInfo pAlipayInfo;
if (pAlipayInfo.empty())
{
char msg[256] = { 0 };
sprintf(msg, "Developer info is empty. PLZ fill your alipay info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Alipay Warning");
}
s_pAlipay->setDebugMode(true);
s_pAlipay->configDeveloperInfo(pAlipayInfo);
s_pAlipay->setResultListener(s_pRetListener);
}
{
TIAPDeveloperInfo pNdInfo;
pNdInfo["Nd91AppId"] = "100010";
pNdInfo["Nd91AppKey"] = "C28454605B9312157C2F76F27A9BCA2349434E546A6E9C75";
pNdInfo["Nd91Orientation"] = "landscape";
if (pNdInfo.empty()) {
char msg[256] = { 0 };
sprintf(msg, "Developer info is empty. PLZ fill your Nd91 info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Nd91 Warning");
}
s_pNd91 = dynamic_cast<ProtocolIAP*>(PluginManager::getInstance()->loadPlugin("IAPNd91"));
s_pNd91->setDebugMode(true);
s_pNd91->configDeveloperInfo(pNdInfo);
s_pNd91->setResultListener(s_pRetListener);
}
}
void MyPurchase::unloadIAPPlugin()
{
if (s_pAlipay)
{
PluginManager::getInstance()->unloadPlugin("IAPAlipay");
s_pAlipay = NULL;
}
if (s_pNd91)
{
PluginManager::getInstance()->unloadPlugin("IAPNd91");
s_pNd91 = NULL;
}
}
void MyPurchase::payByMode(TProductInfo info, MyPayMode mode)
{
ProtocolIAP* pIAP = NULL;
switch(mode)
{
case eAlipay:
pIAP = s_pAlipay;
break;
case eND91:
pIAP = s_pNd91;
break;
default:
break;
}
if (pIAP) {
pIAP->payForProduct(info);
}
}
void MyPurchaseResult::onPayResult(PayResultCode ret, const char* msg, TProductInfo info)
{
char goodInfo[1024] = { 0 };
sprintf(goodInfo, "商品名称:%s\n商品价格:%s\n商品描述:%s",
info.find("productName")->second.c_str(),
info.find("productPrice")->second.c_str(),
info.find("productDesc")->second.c_str());
MessageBox(goodInfo , msg);
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __MY_PURCHASE_H__
#define __MY_PURCHASE_H__
#include "ProtocolIAP.h"
class MyPurchaseResult : public cocos2d::plugin::PayResultListener
{
public:
virtual void onPayResult(cocos2d::plugin::PayResultCode ret, const char* msg, cocos2d::plugin::TProductInfo info);
};
class MyPurchase
{
public:
static MyPurchase* sharedPurchase();
static void purgePurchase();
typedef enum {
eNoneMode = 0,
eAlipay,
eND91,
} MyPayMode;
void unloadIAPPlugin();
void loadIAPPlugin();
void payByMode(cocos2d::plugin::TProductInfo info, MyPayMode mode);
private:
MyPurchase();
virtual ~MyPurchase();
static MyPurchase* s_pPurchase;
cocos2d::plugin::ProtocolIAP* s_pAlipay;
cocos2d::plugin::ProtocolIAP* s_pNd91;
MyPurchaseResult* s_pRetListener;
};
#endif // __MY_PURCHASE_H__

View File

@ -0,0 +1,135 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "TestIAPScene.h"
#include "PluginManager.h"
#include "AppDelegate.h"
#include "MyPurchase.h"
#include "HelloWorldScene.h"
using namespace cocos2d;
using namespace cocos2d::plugin;
enum {
TAG_PAY_BY_ALIPAY = 100,
TAG_PAY_BY_ND91,
};
typedef struct tagEventMenuItem {
std::string id;
int tag;
}EventMenuItem;
static EventMenuItem s_EventMenuItem[] = {
{"BtnAlipay.png", TAG_PAY_BY_ALIPAY},
{"BtnND91.png", TAG_PAY_BY_ND91},
};
Scene* TestIAP::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
TestIAP *layer = TestIAP::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool TestIAP::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
MyPurchase::sharedPurchase()->loadIAPPlugin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
EGLView* pEGLView = EGLView::sharedOpenGLView();
Point posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y);
Point posTL = ccp(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)));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pBackItem, NULL);
pMenu->setPosition( PointZero );
this->addChild(pMenu, 1);
Point posStep = ccp(220, -150);
Point beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f));
int line = 0;
int row = 0;
for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
MenuItemImage* pMenuItem = MenuItemImage::create(s_EventMenuItem[i].id.c_str(), s_EventMenuItem[i].id.c_str(),
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));
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));
}
row += 1;
pMenuItem->setPosition(pos);
}
return true;
}
void TestIAP::eventMenuCallback(Object* pSender)
{
MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
TProductInfo pInfo;
MyPurchase::MyPayMode mode = (MyPurchase::MyPayMode) (pMenuItem->getTag() - TAG_PAY_BY_ALIPAY + 1);
pInfo["productName"] = "100金币";
pInfo["productPrice"] = "0.01";
pInfo["productDesc"] = "100个金灿灿的游戏币哦";
pInfo["Nd91ProductId"] = "685994";
MyPurchase::sharedPurchase()->payByMode(pInfo, mode);
}
void TestIAP::menuBackCallback(Object* pSender)
{
MyPurchase::purgePurchase();
Scene* newScene = HelloWorld::scene();
Director::sharedDirector()->replaceScene(newScene);
}

View File

@ -0,0 +1,46 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __TEST_IAP_SCENE_H__
#define __TEST_IAP_SCENE_H__
#include "cocos2d.h"
class TestIAP : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::Scene* scene();
// a selector callback
void menuBackCallback(Object* pSender);
void eventMenuCallback(Object* pSender);
// implement the "static node()" method manually
CREATE_FUNC(TestIAP);
};
#endif // __TEST_IAP_SCENE_H__

View File

@ -0,0 +1,162 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "MyShareManager.h"
#include "PluginManager.h"
#include "cocos2d.h"
using namespace cocos2d::plugin;
using namespace cocos2d;
MyShareManager* MyShareManager::s_pManager = NULL;
MyShareManager::MyShareManager()
: s_pRetListener(NULL)
, s_pTwitter(NULL)
, s_pWeibo(NULL)
{
}
MyShareManager::~MyShareManager()
{
unloadSharePlugin();
if (s_pRetListener)
{
delete s_pRetListener;
s_pRetListener = NULL;
}
}
MyShareManager* MyShareManager::sharedManager()
{
if (s_pManager == NULL) {
s_pManager = new MyShareManager();
}
return s_pManager;
}
void MyShareManager::purgeManager()
{
if (s_pManager)
{
delete s_pManager;
s_pManager = NULL;
}
PluginManager::end();
}
void MyShareManager::loadSharePlugin()
{
if (s_pRetListener == NULL)
{
s_pRetListener = new MyShareResult();
}
{
// init twitter plugin
s_pTwitter = dynamic_cast<ProtocolShare*>(PluginManager::getInstance()->loadPlugin("ShareTwitter"));
if (NULL != s_pTwitter)
{
TShareDeveloperInfo pTwitterInfo;
/* Warning: must set your twiiter dev info here */
// pTwitterInfo["TwitterKey"] = "your consumerkey";
// pTwitterInfo["TwitterSecret"] = "your consumersecret";
if (pTwitterInfo.empty())
{
char msg[256] = { 0 };
sprintf(msg, "Developer info is empty. PLZ fill your twitter info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Twitter Warning");
}
s_pTwitter->setDebugMode(true);
s_pTwitter->configDeveloperInfo(pTwitterInfo);
s_pTwitter->setResultListener(s_pRetListener);
}
}
{
s_pWeibo = dynamic_cast<ProtocolShare*>(PluginManager::getInstance()->loadPlugin("ShareWeibo"));
if (NULL != s_pWeibo)
{
TShareDeveloperInfo pWeiboInfo;
// pWeiboInfo["WeiboAppKey"] = "your app key";
// pWeiboInfo["WeiboAppSecret"] = "your app secret";
// pWeiboInfo["WeiboRedirectUrl"] = "your redirect url";
if (pWeiboInfo.empty())
{
char msg[256] = { 0 };
sprintf(msg, "Developer info is empty. PLZ fill your weibo info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Weibo Warning");
}
s_pWeibo->setDebugMode(true);
s_pWeibo->configDeveloperInfo(pWeiboInfo);
s_pWeibo->setResultListener(s_pRetListener);
}
}
}
void MyShareManager::unloadSharePlugin()
{
if (s_pTwitter)
{
PluginManager::getInstance()->unloadPlugin("ShareTwitter");
s_pTwitter = NULL;
}
if (s_pWeibo)
{
PluginManager::getInstance()->unloadPlugin("ShareWeibo");
s_pWeibo = NULL;
}
}
void MyShareManager::shareByMode(TShareInfo info, MyShareMode mode)
{
ProtocolShare* pShare = NULL;
switch(mode)
{
case eTwitter:
pShare = s_pTwitter;
break;
case eWeibo:
pShare = s_pWeibo;
break;
default:
break;
}
if (pShare) {
pShare->share(info);
}
}
void MyShareResult::onShareResult(ShareResultCode ret, const char* msg)
{
char shareStatus[1024] = { 0 };
sprintf(shareStatus, "Share %s", (ret == kShareSuccess)? "Successed" : "Failed");
MessageBox(msg, shareStatus);
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __MY_Share_MANAGER_H__
#define __MY_Share_MANAGER_H__
#include "ProtocolShare.h"
class MyShareResult : public cocos2d::plugin::ShareResultListener
{
public:
virtual void onShareResult(cocos2d::plugin::ShareResultCode ret, const char* msg);
};
class MyShareManager
{
public:
static MyShareManager* sharedManager();
static void purgeManager();
typedef enum {
eNoneMode = 0,
eTwitter,
eWeibo,
} MyShareMode;
void unloadSharePlugin();
void loadSharePlugin();
void shareByMode(cocos2d::plugin::TShareInfo info, MyShareMode mode);
private:
MyShareManager();
virtual ~MyShareManager();
static MyShareManager* s_pManager;
cocos2d::plugin::ProtocolShare* s_pTwitter;
cocos2d::plugin::ProtocolShare* s_pWeibo;
MyShareResult* s_pRetListener;
};
#endif // __MY_Share_MANAGER_H__

View File

@ -0,0 +1,131 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "TestShareScene.h"
#include "PluginManager.h"
#include "AppDelegate.h"
#include "MyShareManager.h"
#include "HelloWorldScene.h"
using namespace cocos2d;
using namespace cocos2d::plugin;
enum {
TAG_SHARE_BY_TWWITER = 100,
TAG_SHARE_BY_WEIBO = 101,
};
typedef struct tagEventMenuItem {
std::string id;
int tag;
}EventMenuItem;
static EventMenuItem s_EventMenuItem[] = {
{"twitter.jpeg", TAG_SHARE_BY_TWWITER},
{"weibo.png", TAG_SHARE_BY_WEIBO}
};
Scene* TestShare::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
TestShare *layer = TestShare::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool TestShare::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
MyShareManager::sharedManager()->loadSharePlugin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
EGLView* pEGLView = EGLView::sharedOpenGLView();
Point posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y);
Point posTL = ccp(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(TestShare::menuBackCallback, this));
Size backSize = pBackItem->getContentSize();
pBackItem->setPosition(ccpAdd(posBR, ccp(- backSize.width / 2, backSize.height / 2)));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pBackItem, NULL);
pMenu->setPosition( PointZero );
this->addChild(pMenu, 1);
Point posStep = ccp(150, -150);
Point beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f));
int line = 0;
int row = 0;
for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) {
MenuItemImage* pMenuItem = MenuItemImage::create(s_EventMenuItem[i].id.c_str(), s_EventMenuItem[i].id.c_str(), CC_CALLBACK_1(TestShare::eventMenuCallback, this));
pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag);
Point pos = ccpAdd(beginPos, ccp(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));
}
row += 1;
pMenuItem->setPosition(pos);
}
return true;
}
void TestShare::eventMenuCallback(Object* pSender)
{
MenuItemLabel* pMenuItem = (MenuItemLabel*)pSender;
TShareInfo pInfo;
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);
}
void TestShare::menuBackCallback(Object* pSender)
{
MyShareManager::purgeManager();
Scene* newScene = HelloWorld::scene();
Director::sharedDirector()->replaceScene(newScene);
}

View File

@ -0,0 +1,46 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __TEST_SHARE_SCENE_H__
#define __TEST_SHARE_SCENE_H__
#include "cocos2d.h"
class TestShare : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::Scene* scene();
// a selector callback
void menuBackCallback(Object* pSender);
void eventMenuCallback(Object* pSender);
// implement the "static node()" method manually
CREATE_FUNC(TestShare);
};
#endif // __TEST_SHARE_SCENE_H__

View File

@ -0,0 +1,184 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "MyUserManager.h"
#include "PluginManager.h"
#include "cocos2d.h"
using namespace cocos2d::plugin;
using namespace cocos2d;
MyUserManager* MyUserManager::s_pManager = NULL;
MyUserManager::MyUserManager()
: _retListener(NULL)
, _qh360(NULL)
, _nd91(NULL)
{
}
MyUserManager::~MyUserManager()
{
unloadPlugin();
if (_retListener)
{
delete _retListener;
_retListener = NULL;
}
}
MyUserManager* MyUserManager::sharedManager()
{
if (s_pManager == NULL) {
s_pManager = new MyUserManager();
}
return s_pManager;
}
void MyUserManager::purgeManager()
{
if (s_pManager)
{
delete s_pManager;
s_pManager = NULL;
}
PluginManager::end();
}
void MyUserManager::loadPlugin()
{
if (_retListener == NULL)
{
_retListener = new MyUserActionResult();
}
{
// init qh360 plugin
_qh360 = dynamic_cast<ProtocolUser*>(PluginManager::getInstance()->loadPlugin("UserQH360"));
if (NULL != _qh360)
{
_qh360->setDebugMode(true);
_qh360->setActionListener(_retListener);
}
}
{
_nd91 = dynamic_cast<ProtocolUser*>(PluginManager::getInstance()->loadPlugin("UserNd91"));
if (NULL != _nd91)
{
TUserDeveloperInfo pNdInfo;
pNdInfo["Nd91AppId"] = "100010";
pNdInfo["Nd91AppKey"] = "C28454605B9312157C2F76F27A9BCA2349434E546A6E9C75";
pNdInfo["Nd91Orientation"] = "landscape";
if (pNdInfo.empty()) {
char msg[256] = { 0 };
sprintf(msg, "Developer info is empty. PLZ fill your Nd91 info in %s(nearby line %d)", __FILE__, __LINE__);
MessageBox(msg, "Nd91 Warning");
}
_nd91->configDeveloperInfo(pNdInfo);
_nd91->setDebugMode(true);
_nd91->setActionListener(_retListener);
}
}
}
void MyUserManager::unloadPlugin()
{
if (_qh360)
{
PluginManager::getInstance()->unloadPlugin("UserQH360");
_qh360 = NULL;
}
if (_nd91)
{
PluginManager::getInstance()->unloadPlugin("UserNd91");
_nd91 = NULL;
}
}
void MyUserManager::loginByMode(MyUserMode mode)
{
ProtocolUser* pUser = NULL;
switch(mode)
{
case kQH360:
pUser = _qh360;
break;
case kND91:
pUser = _nd91;
break;
default:
break;
}
if (pUser) {
pUser->login();
}
}
void MyUserManager::logoutByMode(MyUserMode mode)
{
ProtocolUser* pUser = NULL;
switch(mode)
{
case kQH360:
pUser = _qh360;
break;
case kND91:
pUser = _nd91;
break;
default:
break;
}
if (pUser) {
pUser->logout();
}
}
void MyUserActionResult::onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg)
{
char userStatus[1024] = { 0 };
switch (code)
{
case kLoginSucceed:
case kLoginFailed:
sprintf(userStatus, "User of \"%s\" login %s", pPlugin->getPluginName(), (code == kLoginSucceed)? "Successed" : "Failed");
break;
case kLogoutSucceed:
sprintf(userStatus, "User of \"%s\" logout", pPlugin->getPluginName());
break;
default:
break;
}
MessageBox(msg, userStatus);
// get session ID
std::string sessionID = pPlugin->getSessionID();
CCLog("User Session ID of plugin %s is : %s", pPlugin->getPluginName(), sessionID.c_str());
std::string strStatus = pPlugin->isLogined() ? "online" : "offline";
CCLog("User status of plugin %s is : %s", pPlugin->getPluginName(), strStatus.c_str());
}

View File

@ -0,0 +1,63 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __MY_USER_MANAGER_H__
#define __MY_USER_MANAGER_H__
#include "ProtocolUser.h"
class MyUserActionResult : public cocos2d::plugin::UserActionListener
{
public:
virtual void onActionResult(cocos2d::plugin::ProtocolUser* pPlugin, cocos2d::plugin::UserActionResultCode code, const char* msg);
};
class MyUserManager
{
public:
static MyUserManager* sharedManager();
static void purgeManager();
typedef enum {
kNoneMode = 0,
kQH360,
kND91,
} MyUserMode;
void unloadPlugin();
void loadPlugin();
void loginByMode(MyUserMode mode);
void logoutByMode(MyUserMode mode);
private:
MyUserManager();
virtual ~MyUserManager();
static MyUserManager* s_pManager;
cocos2d::plugin::ProtocolUser* _qh360;
cocos2d::plugin::ProtocolUser* _nd91;
MyUserActionResult* _retListener;
};
#endif // __MY_USER_MANAGER_H__

View File

@ -0,0 +1,108 @@
#include "TestUserScene.h"
#include "MyUserManager.h"
#include "HelloWorldScene.h"
USING_NS_CC;
const std::string s_aTestCases[] = {
"QH360",
"ND91",
};
Scene* TestUser::scene()
{
// 'scene' is an autorelease object
Scene *scene = Scene::create();
// 'layer' is an autorelease object
TestUser *layer = TestUser::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool TestUser::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
MyUserManager::sharedManager()->loadPlugin();
Size visibleSize = Director::sharedDirector()->getVisibleSize();
Point origin = Director::sharedDirector()->getVisibleOrigin();
Point posMid = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
Point posBR = ccp(origin.x + visibleSize.width, origin.y);
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
MenuItemFont *pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(TestUser::menuBackCallback, this));
Size backSize = pBackItem->getContentSize();
pBackItem->setPosition(ccpAdd(posBR, ccp(- backSize.width / 2, backSize.height / 2)));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pBackItem, NULL);
pMenu->setPosition(PointZero);
LabelTTF* label1 = LabelTTF::create("Login", "Arial", 32);
MenuItemLabel* pItemLogin = MenuItemLabel::create(label1, CC_CALLBACK_1(TestUser::testLogin, this));
pItemLogin->setAnchorPoint(ccp(0.5f, 0));
pMenu->addChild(pItemLogin, 0);
pItemLogin->setPosition(ccpAdd(posMid, ccp(-100, -120)));
LabelTTF* label2 = LabelTTF::create("Logout", "Arial", 32);
MenuItemLabel* pItemLogout = MenuItemLabel::create(label2, CC_CALLBACK_1(TestUser::testLogout, this));
pItemLogout->setAnchorPoint(ccp(0.5f, 0));
pMenu->addChild(pItemLogout, 0);
pItemLogout->setPosition(ccpAdd(posMid, ccp(100, -120)));
// create optional menu
// cases item
_caseItem = MenuItemToggle::createWithCallback(CC_CALLBACK_1(TestUser::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)
{
_caseItem->getSubItems()->addObject( MenuItemFont::create( s_aTestCases[i].c_str() ) );
}
_caseItem->setPosition(ccpAdd(posMid, ccp(0, 120)));
pMenu->addChild(_caseItem);
_selectedCase = 0;
this->addChild(pMenu, 1);
return true;
}
void TestUser::caseChanged(Object* pSender)
{
_selectedCase = _caseItem->getSelectedIndex();
}
void TestUser::testLogin(Object* pSender)
{
MyUserManager::sharedManager()->loginByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
}
void TestUser::testLogout(Object* pSender)
{
MyUserManager::sharedManager()->logoutByMode((MyUserManager::MyUserMode) (_selectedCase + 1));
}
void TestUser::menuBackCallback(Object* pSender)
{
MyUserManager::purgeManager();
Scene* newScene = HelloWorld::scene();
Director::sharedDirector()->replaceScene(newScene);
}

View File

@ -0,0 +1,30 @@
#ifndef __TEST_USER_SCENE_H__
#define __TEST_USER_SCENE_H__
#include "cocos2d.h"
class TestUser : public cocos2d::Layer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* scene();
// a selector callback
void menuBackCallback(Object* pSender);
void testLogin(Object* pSender);
void testLogout(Object* pSender);
void caseChanged(Object* pSender);
// implement the "static node()" method manually
CREATE_FUNC(TestUser);
private:
cocos2d::MenuItemToggle* _caseItem;
int _selectedCase;
};
#endif // __TEST_USER_SCENE_H__

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="lib" path="plugin-x/protocols/android/libPluginProtocol.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/flurry/android/FlurryAgent.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/flurry/android/libPluginFlurry.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/umeng/android/libPluginUmeng.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/umeng/android/umeng_sdk.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/alipay/android/alipay_plugin.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/alipay/android/libPluginAlipay.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/nd91/android/libPluginNd91.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/nd91/android/NdComPlatform.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/admob/android/GoogleAdMobAdsSdk.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/admob/android/libPluginAdmob.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/twitter/android/libPluginSocialTwitter.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/twitter/android/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/twitter/android/signpost-core-1.2.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/twitter/android/signpost-jetty6-1.2.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/twitter/android/twitter4j-core-android-3.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/weibo/android/libPluginSocialWeibo.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/weibo/android/weibosdk.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/qh360/android/360SDK.jar"/>
<classpathentry exported="true" kind="lib" path="plugin-x/plugins/qh360/android/libPluginQH360.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -0,0 +1,45 @@
<?xml version='1.0' encoding='UTF-8'?>
<projectDescription>
<name>HelloPlugins</name>
<comment />
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>Classes</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/Classes</locationURI>
</link>
<link>
<name>plugin-x</name>
<type>2</type>
<locationURI>PARENT-3-PROJECT_LOC/publish</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.cocos2dx.HelloPlugins" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />
<uses-feature android:glEsVersion="0x00020000" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation" android:label="@string/app_name" android:name=".HelloPlugins" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:configChanges="orientation|keyboardHidden|navigation" android:launchMode="singleTask" android:name="com.nd.commplatform.activity.SNSControlCenterActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowBackground="@null" android:windowSoftInputMode="adjustPan" />
<activity android:configChanges="orientation|keyboardHidden|navigation" android:launchMode="singleTask" android:name="com.nd.commplatform.activity.SNSLoginActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowBackground="@null" android:windowSoftInputMode="adjustPan" />
<activity android:configChanges="orientation|keyboardHidden|navigation" android:name="com.nd.commplatform.activity.SNSAppPromotionActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowBackground="@null" android:windowSoftInputMode="adjustPan" />
<service android:enabled="true" android:exported="false" android:name="com.nd.commplatform.service.NdDownloadService" android:process=":com.nd.commplatform.download" />
<receiver android:exported="false" android:name="com.nd.commplatform.versionupdate.ND2VersionUpdateNotify" android:process="android.intent.nd.sns.commplatform.versionupdate" />
<service android:exported="false" android:name="com.nd.commplatform.versionupdate.ND2VersionUpdateService" android:process="android.intent.nd.sns.commplatform.versionupdate" />
<service android:enabled="true" android:exported="false" android:name="com.nd.commplatform.service.NdNewMessageNotification" />
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity" />
<activity android:configChanges="orientation|keyboardHidden|navigation" android:name="com.qihoopay.insdk.activity.ContainerActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<activity android:configChanges="orientation|keyboardHidden|navigation|screenSize" android:name="com.qihoopay.insdk.activity.RemoteContainerActivity" android:process=":remote" android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<meta-data android:name="QHOPENSDK_APPID" android:value="Your app_id" />
<meta-data android:name="QHOPENSDK_APPKEY" android:value="Your app_key" />
<meta-data android:name="QHOPENSDK_PRIVATEKEY" android:value="Your app_private_key" />
<meta-data android:name="QHOPENSDK_CHANNEL" android:value="Your channel or delete this line" />
</application>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>

View File

@ -0,0 +1,87 @@
## Prerequisites:
* Android NDK
* Android SDK **OR** Eclipse ADT Bundle
* Android AVD target installed
## Building project
There are two ways of building Android projects.
1. Eclipse
2. Command Line
### Import Project in Eclipse
#### Features:
1. Complete workflow from Eclipse, including:
* Build C++.
* Clean C++.
* Build and Run whole project.
* Logcat view.
* Debug Java code.
* Javascript editor.
* Project management.
2. True C++ editing, including:
* Code completion.
* Jump to definition.
* Refactoring tools etc.
* Quick open C++ files.
#### Setup Eclipse Environment (only once)
**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.
1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)
**OR**
Install Eclipse with Java. Add ADT and CDT plugins.
2. Only for Windows
1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).
2. Add `Cygwin\bin` directory to system PATH variable.
3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.
3. Set up Variables:
1. Path Variable `COCOS2DX`:
* Eclipse->Preferences->General->Workspace->**Linked Resources**
* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.
![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)
2. C/C++ Environment Variable `NDK_ROOT`:
* Eclipse->Preferences->C/C++->Build->**Environment**.
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
4. Import libcocos2dx library project:
1. File->New->Project->Android Project From Existing Code.
2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.
3. Click **Finish** to add project.
#### Adding and running from Eclipse
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
1. File->New->Project->Android Project From Existing Code
2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`
3. Add the project
4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
### Running project from Command Line
$ cd cocos2d-x/samples/Cpp/TestCpp/proj.android/
$ export NDK_ROOT=/path/to/ndk
$ ./build_native.sh
$ ant debug install
If the last command results in sdk.dir missing error then do:
$ android list target
$ android update project -p . -t (id from step 6)
$ android update project -p cocos2d-x/cocos2dx/platform/android/java/ -t (id from step 6)

View File

@ -0,0 +1,17 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloPlugins" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View File

@ -0,0 +1,88 @@
APPNAME="HelloPlugins"
# options
buildexternalsfromsource=
usage(){
cat << EOF
usage: $0 [options]
Build C/C++ code for $APPNAME using Android NDK
OPTIONS:
-s Build externals from source
-h this help
EOF
}
while getopts "sh" OPTION; do
case "$OPTION" in
s)
buildexternalsfromsource=1
;;
h)
usage
exit 0
;;
esac
done
# paths
if [ -z "${NDK_ROOT+aaa}" ];then
echo "please define NDK_ROOT"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory
PLUGIN_ROOT="$DIR/../../.."
COCOS2DX_ROOT="$DIR/../../../.."
APP_ROOT="$DIR/.."
APP_ANDROID_ROOT="$DIR"
echo "NDK_ROOT = $NDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
echo "APP_ROOT = $APP_ROOT"
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
# make sure assets is exist
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
rm -rf "$APP_ANDROID_ROOT"/assets
fi
mkdir "$APP_ANDROID_ROOT"/assets
# copy resources
for file in "$APP_ROOT"/Resources/*
do
if [ -d "$file" ]; then
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
fi
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
done
# copy plugin resources
if [ -d "${PLUGIN_ROOT}"/publish/plugins ]; then
for file in "${PLUGIN_ROOT}"/publish/plugins/*
do
if [ -d "${file}"/android/ForAssets/ ];then
cp -rf "$file"/android/ForAssets/* "$APP_ANDROID_ROOT"/assets
fi
done
fi
# run ndk-build
if [[ "$buildexternalsfromsource" ]]; then
echo "Building external dependencies from source"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
"NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"
else
echo "Using prebuilt externals"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
"NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"
fi

View File

@ -0,0 +1,30 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/TestAds/TestAdsScene.cpp \
../../Classes/TestAnalytics/TestAnalyticsScene.cpp \
../../Classes/TestIAP/TestIAPScene.cpp \
../../Classes/TestIAP/MyPurchase.cpp \
../../Classes/TestShare/TestShareScene.cpp \
../../Classes/TestShare/MyShareManager.cpp \
../../Classes/TestUser/TestUserScene.cpp \
../../Classes/TestUser/MyUserManager.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes $(LOCAL_PATH)/../../Classes/TestAds $(LOCAL_PATH)/../../Classes/TestAnalytics \
$(LOCAL_PATH)/../../Classes/TestIAP $(LOCAL_PATH)/../../Classes/TestShare $(LOCAL_PATH)/../../Classes/TestUser
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static \
PluginProtocolStatic
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx)
$(call import-module,protocols/android)

View File

@ -0,0 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
NDK_TOOLCHAIN_VERSION=4.7

View File

@ -0,0 +1,48 @@
#include "AppDelegate.h"
#include "cocos2d.h"
#include "CCEventType.h"
#include "platform/android/jni/JniHelper.h"
#include <jni.h>
#include <android/log.h>
#include "PluginJniHelper.h"
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
using namespace cocos2d;
extern "C"
{
jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
JniHelper::setJavaVM(vm);
PluginJniHelper::setJavaVM(vm); // for plugins
return JNI_VERSION_1_4;
}
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
{
if (!Director::sharedDirector()->getOpenGLView())
{
EGLView *view = EGLView::sharedOpenGLView();
view->setFrameSize(w, h);
AppDelegate *pAppDelegate = new AppDelegate();
Application::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
ccGLInvalidateStateCache();
ShaderCache::sharedShaderCache()->reloadDefaultShaders();
TextureCache::reloadAllTextures();
NotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
Director::sharedDirector()->setGLDefaultValues();
}
*/
}
}

View File

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-14
android.library.reference.1=../../../../cocos2dx/platform/android/java
android.library.reference.2=../../../publish/plugins/nd91/android/DependProject

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">HelloPlugins</string>
</resources>

View File

@ -0,0 +1,52 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.cocos2dx.HelloPlugins;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
import org.cocos2dx.plugin.PluginWrapper;
import android.os.Bundle;
public class HelloPlugins extends Cocos2dxActivity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
PluginWrapper.init(this); // for plugins
PluginWrapper.setGLSurfaceView(Cocos2dxGLSurfaceView.getInstance());
}
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// HelloPlugins should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
static {
System.loadLibrary("cocos2dcpp");
}
}

View File

@ -0,0 +1,11 @@
#import <UIKit/UIKit.h>
@class RootViewController;
@interface AppController : NSObject <UIApplicationDelegate> {
UIWindow *window;
RootViewController *viewController;
}
@end

View File

@ -0,0 +1,112 @@
#import "AppController.h"
#import "EAGLView.h"
#import "cocos2d.h"
#import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppController
#pragma mark -
#pragma mark Application lifecycle
// cocos2d application instance
static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
// Init the CCEAGLView
CCEAGLView *__glView = [CCEAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGB565
depthFormat: GL_DEPTH24_STENCIL8_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0];
// Use RootViewController manage CCEAGLView
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view = __glView;
// Set RootViewController to window
if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:true];
cocos2d::Application::sharedApplication()->run();
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
cocos2d::Director::sharedDirector()->pause();
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
cocos2d::Director::sharedDirector()->resume();
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::sharedApplication()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::sharedApplication()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -0,0 +1,547 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1AC3624916D4A1E8000847F2 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3624316D4A1E8000847F2 /* AppController.mm */; };
1AC3624B16D4A1E8000847F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3624516D4A1E8000847F2 /* main.m */; };
1AFAF8B716D35DE700DB1158 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */; };
1AFAF8B816D35DE700DB1158 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */; };
1AFAF8BC16D35E4900DB1158 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B916D35E4900DB1158 /* CloseNormal.png */; };
1AFAF8BD16D35E4900DB1158 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */; };
1AFCDA8216D4A25900906EA6 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFCDA8116D4A25900906EA6 /* RootViewController.mm */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
7855E0E1153FEF240059DD9A /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 7855E0DF153FEF240059DD9A /* Default.png */; };
BF171245129291EC00B8313A /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB012928DE900B8313A /* OpenGLES.framework */; };
BF1712461292920000B8313A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB212928DE900B8313A /* libxml2.dylib */; };
BF1712471292920000B8313A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB412928DE900B8313A /* libz.dylib */; };
BF1C47F01293687400B63C5D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF1C47EA1293683800B63C5D /* QuartzCore.framework */; };
D41A0AD1160F154A004552AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D41A0AD0160F154A004552AE /* Default-568h@2x.png */; };
D446FD6E16102124000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD6D16102124000ADA7B /* Default@2x.png */; };
D44C620C132DFF330009C878 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44C620B132DFF330009C878 /* OpenAL.framework */; };
D44C620E132DFF430009C878 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44C620D132DFF430009C878 /* AVFoundation.framework */; };
D44C6210132DFF4E0009C878 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44C620F132DFF4E0009C878 /* AudioToolbox.framework */; };
D4EF949A15BD2D8B00D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949915BD2D8B00D803EB /* Icon-57.png */; };
D4EF949C15BD2D8E00D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949B15BD2D8E00D803EB /* Icon-114.png */; };
D4EF949E15BD2D9600D803EB /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949D15BD2D9600D803EB /* Icon-72.png */; };
D4EF94A015BD2D9800D803EB /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949F15BD2D9800D803EB /* Icon-144.png */; };
FAD554CF177C09B200968F54 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554CE177C09B200968F54 /* libcocos2dx.a */; };
FAD554E5177C131500968F54 /* TestAdsScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD554D1177C131500968F54 /* TestAdsScene.cpp */; };
FAD554E6177C131500968F54 /* TestAnalyticsScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD554D4177C131500968F54 /* TestAnalyticsScene.cpp */; };
FAD554E9177C131500968F54 /* MyShareManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD554DC177C131500968F54 /* MyShareManager.cpp */; };
FAD554EA177C131500968F54 /* TestShareScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD554DE177C131500968F54 /* TestShareScene.cpp */; };
FAD554F3177C16A100968F54 /* libPluginAdmob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554ED177C16A100968F54 /* libPluginAdmob.a */; };
FAD554F4177C16A100968F54 /* libPluginFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554EE177C16A100968F54 /* libPluginFlurry.a */; };
FAD554F5177C16A100968F54 /* libPluginProtocol.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554EF177C16A100968F54 /* libPluginProtocol.a */; };
FAD554F6177C16A100968F54 /* libPluginTwitter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554F0177C16A100968F54 /* libPluginTwitter.a */; };
FAD554F7177C16A100968F54 /* libPluginUmeng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554F1177C16A100968F54 /* libPluginUmeng.a */; };
FAD554F8177C16A100968F54 /* libPluginWeibo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554F2177C16A100968F54 /* libPluginWeibo.a */; };
FAD554FD177C16DF00968F54 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554FC177C16DF00968F54 /* MessageUI.framework */; };
FAD554FF177C16E700968F54 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD554FE177C16E700968F54 /* MediaPlayer.framework */; };
FAD55501177C16F100968F54 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD55500177C16F100968F54 /* SystemConfiguration.framework */; };
FAD55503177C16FA00968F54 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD55502177C16FA00968F54 /* StoreKit.framework */; };
FAD55505177C170300968F54 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD55504177C170200968F54 /* AdSupport.framework */; };
FAD55518177D1EE900968F54 /* MyPurchase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD5550F177D1EE900968F54 /* MyPurchase.cpp */; };
FAD55519177D1EE900968F54 /* TestIAPScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD55511177D1EE900968F54 /* TestIAPScene.cpp */; };
FAD5551A177D1EE900968F54 /* MyUserManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD55514177D1EE900968F54 /* MyUserManager.cpp */; };
FAD5551B177D1EE900968F54 /* TestUserScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAD55516177D1EE900968F54 /* TestUserScene.cpp */; };
FAD55527177D2C2000968F54 /* BtnAlipay.png in Resources */ = {isa = PBXBuildFile; fileRef = FAD55523177D2C2000968F54 /* BtnAlipay.png */; };
FAD55528177D2C2000968F54 /* BtnND91.png in Resources */ = {isa = PBXBuildFile; fileRef = FAD55524177D2C2000968F54 /* BtnND91.png */; };
FAD55529177D2C2000968F54 /* twitter.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = FAD55525177D2C2000968F54 /* twitter.jpeg */; };
FAD5552A177D2C2000968F54 /* weibo.png in Resources */ = {isa = PBXBuildFile; fileRef = FAD55526177D2C2000968F54 /* weibo.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1AC3624216D4A1E8000847F2 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = SOURCE_ROOT; };
1AC3624316D4A1E8000847F2 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = SOURCE_ROOT; };
1AC3624516D4A1E8000847F2 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; };
1AC3624616D4A1E8000847F2 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; };
1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppDelegate.cpp; path = ../Classes/AppDelegate.cpp; sourceTree = "<group>"; };
1AFAF8B416D35DE700DB1158 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../Classes/AppDelegate.h; sourceTree = "<group>"; };
1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelloWorldScene.cpp; path = ../Classes/HelloWorldScene.cpp; sourceTree = "<group>"; };
1AFAF8B616D35DE700DB1158 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelloWorldScene.h; path = ../Classes/HelloWorldScene.h; sourceTree = "<group>"; };
1AFAF8B916D35E4900DB1158 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseNormal.png; sourceTree = "<group>"; };
1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseSelected.png; sourceTree = "<group>"; };
1AFCDA8016D4A25900906EA6 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = SOURCE_ROOT; };
1AFCDA8116D4A25900906EA6 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = SOURCE_ROOT; };
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* HelloPlugins.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloPlugins.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
7855E0DF153FEF240059DD9A /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; };
BF170DB012928DE900B8313A /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
BF170DB212928DE900B8313A /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
BF170DB412928DE900B8313A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
BF1C47EA1293683800B63C5D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
D41A0AD0160F154A004552AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = "<group>"; };
D446FD6D16102124000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = "<group>"; };
D44C620B132DFF330009C878 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
D44C620D132DFF430009C878 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
D44C620F132DFF4E0009C878 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
D4EF949915BD2D8B00D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = "<group>"; };
D4EF949B15BD2D8E00D803EB /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-114.png"; path = "../proj.ios/Icon-114.png"; sourceTree = "<group>"; };
D4EF949D15BD2D9600D803EB /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "../proj.ios/Icon-72.png"; sourceTree = "<group>"; };
D4EF949F15BD2D9800D803EB /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-144.png"; path = "../proj.ios/Icon-144.png"; sourceTree = "<group>"; };
D4F9F37B12E54555005CA6D2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
FAD554CE177C09B200968F54 /* libcocos2dx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libcocos2dx.a; path = "libcocos2dx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554D1177C131500968F54 /* TestAdsScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAdsScene.cpp; sourceTree = "<group>"; };
FAD554D2177C131500968F54 /* TestAdsScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestAdsScene.h; sourceTree = "<group>"; };
FAD554D4177C131500968F54 /* TestAnalyticsScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAnalyticsScene.cpp; sourceTree = "<group>"; };
FAD554D5177C131500968F54 /* TestAnalyticsScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestAnalyticsScene.h; sourceTree = "<group>"; };
FAD554DC177C131500968F54 /* MyShareManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyShareManager.cpp; sourceTree = "<group>"; };
FAD554DD177C131500968F54 /* MyShareManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyShareManager.h; sourceTree = "<group>"; };
FAD554DE177C131500968F54 /* TestShareScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestShareScene.cpp; sourceTree = "<group>"; };
FAD554DF177C131500968F54 /* TestShareScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestShareScene.h; sourceTree = "<group>"; };
FAD554ED177C16A100968F54 /* libPluginAdmob.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginAdmob.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554EE177C16A100968F54 /* libPluginFlurry.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginFlurry.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554EF177C16A100968F54 /* libPluginProtocol.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginProtocol.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554F0177C16A100968F54 /* libPluginTwitter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginTwitter.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554F1177C16A100968F54 /* libPluginUmeng.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginUmeng.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554F2177C16A100968F54 /* libPluginWeibo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPluginWeibo.a; sourceTree = BUILT_PRODUCTS_DIR; };
FAD554FC177C16DF00968F54 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
FAD554FE177C16E700968F54 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
FAD55500177C16F100968F54 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
FAD55502177C16FA00968F54 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
FAD55504177C170200968F54 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
FAD5550F177D1EE900968F54 /* MyPurchase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyPurchase.cpp; sourceTree = "<group>"; };
FAD55510177D1EE900968F54 /* MyPurchase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyPurchase.h; sourceTree = "<group>"; };
FAD55511177D1EE900968F54 /* TestIAPScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestIAPScene.cpp; sourceTree = "<group>"; };
FAD55512177D1EE900968F54 /* TestIAPScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestIAPScene.h; sourceTree = "<group>"; };
FAD55514177D1EE900968F54 /* MyUserManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MyUserManager.cpp; sourceTree = "<group>"; };
FAD55515177D1EE900968F54 /* MyUserManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyUserManager.h; sourceTree = "<group>"; };
FAD55516177D1EE900968F54 /* TestUserScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestUserScene.cpp; sourceTree = "<group>"; };
FAD55517177D1EE900968F54 /* TestUserScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestUserScene.h; sourceTree = "<group>"; };
FAD55523177D2C2000968F54 /* BtnAlipay.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = BtnAlipay.png; sourceTree = "<group>"; };
FAD55524177D2C2000968F54 /* BtnND91.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = BtnND91.png; sourceTree = "<group>"; };
FAD55525177D2C2000968F54 /* twitter.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = twitter.jpeg; sourceTree = "<group>"; };
FAD55526177D2C2000968F54 /* weibo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = weibo.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FAD55505177C170300968F54 /* AdSupport.framework in Frameworks */,
FAD55503177C16FA00968F54 /* StoreKit.framework in Frameworks */,
FAD55501177C16F100968F54 /* SystemConfiguration.framework in Frameworks */,
FAD554FF177C16E700968F54 /* MediaPlayer.framework in Frameworks */,
FAD554FD177C16DF00968F54 /* MessageUI.framework in Frameworks */,
FAD554F3177C16A100968F54 /* libPluginAdmob.a in Frameworks */,
FAD554F4177C16A100968F54 /* libPluginFlurry.a in Frameworks */,
FAD554F5177C16A100968F54 /* libPluginProtocol.a in Frameworks */,
FAD554F6177C16A100968F54 /* libPluginTwitter.a in Frameworks */,
FAD554F7177C16A100968F54 /* libPluginUmeng.a in Frameworks */,
FAD554F8177C16A100968F54 /* libPluginWeibo.a in Frameworks */,
FAD554CF177C09B200968F54 /* libcocos2dx.a in Frameworks */,
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */,
BF171245129291EC00B8313A /* OpenGLES.framework in Frameworks */,
BF1712461292920000B8313A /* libxml2.dylib in Frameworks */,
BF1712471292920000B8313A /* libz.dylib in Frameworks */,
BF1C47F01293687400B63C5D /* QuartzCore.framework in Frameworks */,
D44C620C132DFF330009C878 /* OpenAL.framework in Frameworks */,
D44C620E132DFF430009C878 /* AVFoundation.framework in Frameworks */,
D44C6210132DFF4E0009C878 /* AudioToolbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* ios */ = {
isa = PBXGroup;
children = (
1AC3624216D4A1E8000847F2 /* AppController.h */,
1AC3624316D4A1E8000847F2 /* AppController.mm */,
D4F9F37B12E54555005CA6D2 /* Info.plist */,
1AC3624516D4A1E8000847F2 /* main.m */,
1AC3624616D4A1E8000847F2 /* Prefix.pch */,
1AFCDA8016D4A25900906EA6 /* RootViewController.h */,
1AFCDA8116D4A25900906EA6 /* RootViewController.mm */,
);
name = ios;
path = Classes;
sourceTree = "<group>";
};
15AA9C4015B7EC450033D6C2 /* Classes */ = {
isa = PBXGroup;
children = (
FAD5550E177D1EE900968F54 /* TestIAP */,
FAD55513177D1EE900968F54 /* TestUser */,
FAD554D0177C131500968F54 /* TestAds */,
FAD554D3177C131500968F54 /* TestAnalytics */,
FAD554DB177C131500968F54 /* TestShare */,
1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */,
1AFAF8B416D35DE700DB1158 /* AppDelegate.h */,
1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */,
1AFAF8B616D35DE700DB1158 /* HelloWorldScene.h */,
);
name = Classes;
path = ../classes;
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* HelloPlugins.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
15AA9C4015B7EC450033D6C2 /* Classes */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
080E96DDFE201D6D7F000001 /* ios */,
19C28FACFE9D520D11CA2CBB /* Products */,
78C7DDAA14EBA5050085D0C2 /* Resources */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
FAD55504177C170200968F54 /* AdSupport.framework */,
FAD55502177C16FA00968F54 /* StoreKit.framework */,
FAD55500177C16F100968F54 /* SystemConfiguration.framework */,
FAD554FE177C16E700968F54 /* MediaPlayer.framework */,
FAD554FC177C16DF00968F54 /* MessageUI.framework */,
FAD554ED177C16A100968F54 /* libPluginAdmob.a */,
FAD554EE177C16A100968F54 /* libPluginFlurry.a */,
FAD554EF177C16A100968F54 /* libPluginProtocol.a */,
FAD554F0177C16A100968F54 /* libPluginTwitter.a */,
FAD554F1177C16A100968F54 /* libPluginUmeng.a */,
FAD554F2177C16A100968F54 /* libPluginWeibo.a */,
FAD554CE177C09B200968F54 /* libcocos2dx.a */,
BF170DB212928DE900B8313A /* libxml2.dylib */,
BF170DB412928DE900B8313A /* libz.dylib */,
D44C620F132DFF4E0009C878 /* AudioToolbox.framework */,
D44C620D132DFF430009C878 /* AVFoundation.framework */,
288765A40DF7441C002DB57D /* CoreGraphics.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
D44C620B132DFF330009C878 /* OpenAL.framework */,
BF170DB012928DE900B8313A /* OpenGLES.framework */,
BF1C47EA1293683800B63C5D /* QuartzCore.framework */,
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
78C7DDAA14EBA5050085D0C2 /* Resources */ = {
isa = PBXGroup;
children = (
FAD55523177D2C2000968F54 /* BtnAlipay.png */,
FAD55524177D2C2000968F54 /* BtnND91.png */,
FAD55525177D2C2000968F54 /* twitter.jpeg */,
FAD55526177D2C2000968F54 /* weibo.png */,
1AFAF8B916D35E4900DB1158 /* CloseNormal.png */,
1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */,
D41A0AD0160F154A004552AE /* Default-568h@2x.png */,
7855E0DF153FEF240059DD9A /* Default.png */,
D446FD6D16102124000ADA7B /* Default@2x.png */,
D4EF949B15BD2D8E00D803EB /* Icon-114.png */,
D4EF949F15BD2D9800D803EB /* Icon-144.png */,
D4EF949915BD2D8B00D803EB /* Icon-57.png */,
D4EF949D15BD2D9600D803EB /* Icon-72.png */,
);
name = Resources;
path = ../Resources;
sourceTree = "<group>";
};
FAD554D0177C131500968F54 /* TestAds */ = {
isa = PBXGroup;
children = (
FAD554D1177C131500968F54 /* TestAdsScene.cpp */,
FAD554D2177C131500968F54 /* TestAdsScene.h */,
);
name = TestAds;
path = ../Classes/TestAds;
sourceTree = "<group>";
};
FAD554D3177C131500968F54 /* TestAnalytics */ = {
isa = PBXGroup;
children = (
FAD554D4177C131500968F54 /* TestAnalyticsScene.cpp */,
FAD554D5177C131500968F54 /* TestAnalyticsScene.h */,
);
name = TestAnalytics;
path = ../Classes/TestAnalytics;
sourceTree = "<group>";
};
FAD554DB177C131500968F54 /* TestShare */ = {
isa = PBXGroup;
children = (
FAD554DC177C131500968F54 /* MyShareManager.cpp */,
FAD554DD177C131500968F54 /* MyShareManager.h */,
FAD554DE177C131500968F54 /* TestShareScene.cpp */,
FAD554DF177C131500968F54 /* TestShareScene.h */,
);
name = TestShare;
path = ../Classes/TestShare;
sourceTree = "<group>";
};
FAD5550E177D1EE900968F54 /* TestIAP */ = {
isa = PBXGroup;
children = (
FAD5550F177D1EE900968F54 /* MyPurchase.cpp */,
FAD55510177D1EE900968F54 /* MyPurchase.h */,
FAD55511177D1EE900968F54 /* TestIAPScene.cpp */,
FAD55512177D1EE900968F54 /* TestIAPScene.h */,
);
name = TestIAP;
path = ../Classes/TestIAP;
sourceTree = "<group>";
};
FAD55513177D1EE900968F54 /* TestUser */ = {
isa = PBXGroup;
children = (
FAD55514177D1EE900968F54 /* MyUserManager.cpp */,
FAD55515177D1EE900968F54 /* MyUserManager.h */,
FAD55516177D1EE900968F54 /* TestUserScene.cpp */,
FAD55517177D1EE900968F54 /* TestUserScene.h */,
);
name = TestUser;
path = ../Classes/TestUser;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1D6058900D05DD3D006BFB54 /* HelloPlugins */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloPlugins" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = HelloPlugins;
productName = iphone;
productReference = 1D6058910D05DD3D006BFB54 /* HelloPlugins.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloPlugins" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
targets = (
1D6058900D05DD3D006BFB54 /* HelloPlugins */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7855E0E1153FEF240059DD9A /* Default.png in Resources */,
D4EF949A15BD2D8B00D803EB /* Icon-57.png in Resources */,
D4EF949C15BD2D8E00D803EB /* Icon-114.png in Resources */,
D4EF949E15BD2D9600D803EB /* Icon-72.png in Resources */,
D4EF94A015BD2D9800D803EB /* Icon-144.png in Resources */,
D41A0AD1160F154A004552AE /* Default-568h@2x.png in Resources */,
D446FD6E16102124000ADA7B /* Default@2x.png in Resources */,
1AFAF8BC16D35E4900DB1158 /* CloseNormal.png in Resources */,
1AFAF8BD16D35E4900DB1158 /* CloseSelected.png in Resources */,
FAD55527177D2C2000968F54 /* BtnAlipay.png in Resources */,
FAD55528177D2C2000968F54 /* BtnND91.png in Resources */,
FAD55529177D2C2000968F54 /* twitter.jpeg in Resources */,
FAD5552A177D2C2000968F54 /* weibo.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1AFAF8B716D35DE700DB1158 /* AppDelegate.cpp in Sources */,
1AFAF8B816D35DE700DB1158 /* HelloWorldScene.cpp in Sources */,
1AC3624916D4A1E8000847F2 /* AppController.mm in Sources */,
1AC3624B16D4A1E8000847F2 /* main.m in Sources */,
1AFCDA8216D4A25900906EA6 /* RootViewController.mm in Sources */,
FAD554E5177C131500968F54 /* TestAdsScene.cpp in Sources */,
FAD554E6177C131500968F54 /* TestAnalyticsScene.cpp in Sources */,
FAD554E9177C131500968F54 /* MyShareManager.cpp in Sources */,
FAD554EA177C131500968F54 /* TestShareScene.cpp in Sources */,
FAD55518177D1EE900968F54 /* MyPurchase.cpp in Sources */,
FAD55519177D1EE900968F54 /* TestIAPScene.cpp in Sources */,
FAD5551A177D1EE900968F54 /* MyUserManager.cpp in Sources */,
FAD5551B177D1EE900968F54 /* TestUserScene.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
USE_FILE32API,
CC_TARGET_OS_IPHONE,
"COCOS2D_DEBUG=1",
CC_ENABLE_CHIPMUNK_INTEGRATION,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios/Simulation\"",
"\"$(SRCROOT)/../../../protocols/include\"",
);
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "";
OTHER_CFLAGS = "-O2";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = HelloPlugins;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
VALID_ARCHS = "armv6 armv7 i386";
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
USE_FILE32API,
CC_TARGET_OS_IPHONE,
CC_ENABLE_CHIPMUNK_INTEGRATION,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios/Simulation\"",
"\"$(SRCROOT)/../../../protocols/include\"",
);
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = HelloPlugins;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloPlugins" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloPlugins" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

View File

@ -0,0 +1,8 @@
//
// Prefix header for all source files of the 'iphone' target in the 'iphone' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,8 @@
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
@end

View File

@ -0,0 +1,65 @@
#import "RootViewController.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@ -0,0 +1,12 @@
#import <UIKit/UIKit.h>
// Under iOS and the Simulator, we can use an alternate Accelerometer interface
#import "AccelerometerSimulation.h"
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
[pool release];
return retVal;
}