Update the iOS projects of plugin.

This commit is contained in:
zhangbin 2013-04-27 17:29:20 +08:00
parent 4db988f51d
commit 1db8ecd8e4
3 changed files with 23 additions and 54 deletions

View File

@ -2,9 +2,8 @@
namespace cocos2d { namespace plugin { namespace cocos2d { namespace plugin {
AdListener* ProtocolAds::m_pListener = NULL;
ProtocolAds::ProtocolAds() ProtocolAds::ProtocolAds()
: m_pListener(NULL)
{ {
} }
@ -12,81 +11,50 @@ ProtocolAds::~ProtocolAds()
{ {
} }
/**
@brief plugin initialization
*/
bool ProtocolAds::init() bool ProtocolAds::init()
{ {
return true; return true;
} }
/** void ProtocolAds::configDeveloperInfo(TAdsDeveloperInfo devInfo)
@brief initialize the application info
@param appInfo This parameter is the info of aplication,
different plugin have different format
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
void ProtocolAds::initAppInfo(TAppInfo appInfo)
{ {
} }
/** void ProtocolAds::showAds(AdsType type, int sizeEnum, AdsPos pos)
@brief show banner ads at specified position
@param pos The position where the banner view be shown
@param sizeEnum The size of the banner view.
In different plugin, it's have different mean.
Pay attention to the subclass definition
*/
void ProtocolAds::showBannerAd(EBannerPos pos, int sizeEnum)
{ {
} }
/** void ProtocolAds::hideAds(AdsType type)
@brief hide the banner ads view {
*/ }
void ProtocolAds::hideBannerAd()
void ProtocolAds::spendPoints(int points)
{ {
} }
/**
@brief Set whether needs to output logs to console.
@param debug If true debug mode enabled, or debug mode disabled.
*/
void ProtocolAds::setDebugMode(bool debug) void ProtocolAds::setDebugMode(bool debug)
{ {
} }
// For the callbak methods // For the callbak methods
void ProtocolAds::receiveAd() void ProtocolAds::setAdsListener(AdsListener* pListener)
{
m_pListener = pListener;
}
void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg)
{ {
if (m_pListener != NULL) if (m_pListener != NULL)
{ {
m_pListener->onReceiveAd(); m_pListener->onAdsResult(code, msg);
} }
} }
void ProtocolAds::presentScreen() void ProtocolAds::onPlayerGetPoints(int points)
{ {
if (m_pListener != NULL) if (m_pListener != NULL)
{ {
m_pListener->onPresentScreen(); m_pListener->onPlayerGetPoints(this, points);
}
}
void ProtocolAds::failedToReceiveAd(AdListener::EAdErrorCode code, const char* msg)
{
if (m_pListener != NULL)
{
m_pListener->onFailedToReceiveAd(code, msg);
}
}
void ProtocolAds::dismissScreen()
{
if (m_pListener != NULL)
{
m_pListener->onDismissScreen();
} }
} }

View File

@ -3,10 +3,9 @@
namespace cocos2d { namespace plugin { namespace cocos2d { namespace plugin {
bool ProtocolIAP::m_bPaying = false; bool ProtocolIAP::m_bPaying = false;
PayResultListener* ProtocolIAP::m_pListener = NULL;
TProductInfo ProtocolIAP::m_curInfo;
ProtocolIAP::ProtocolIAP() ProtocolIAP::ProtocolIAP()
: m_pListener(NULL)
{ {
} }
@ -19,7 +18,7 @@ bool ProtocolIAP::init()
return true; return true;
} }
void ProtocolIAP::initDeveloperInfo(TDeveloperInfo devInfo) void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo)
{ {
} }
@ -32,12 +31,12 @@ void ProtocolIAP::setResultListener(PayResultListener* pListener)
m_pListener = pListener; m_pListener = pListener;
} }
void ProtocolIAP::payResult(EPayResult ret, const char* msg) void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg)
{ {
m_bPaying = false; m_bPaying = false;
if (m_pListener) if (m_pListener)
{ {
m_pListener->payResult(ret, msg, m_curInfo); m_pListener->onPayResult(ret, msg, m_curInfo);
} }
m_curInfo.clear(); m_curInfo.clear();

View File

@ -38,6 +38,7 @@
FA09A33C168ADC1F008C1C7B /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = ../PluginManager.cpp; sourceTree = "<group>"; }; FA09A33C168ADC1F008C1C7B /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = ../PluginManager.cpp; sourceTree = "<group>"; };
FA09A33D168ADC1F008C1C7B /* RegisterPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterPlugin.cpp; path = ../RegisterPlugin.cpp; sourceTree = "<group>"; }; FA09A33D168ADC1F008C1C7B /* RegisterPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterPlugin.cpp; path = ../RegisterPlugin.cpp; sourceTree = "<group>"; };
FA0CB8B6168D3CC200E36B11 /* ProtocolAnalytics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolAnalytics.cpp; sourceTree = "<group>"; }; FA0CB8B6168D3CC200E36B11 /* ProtocolAnalytics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolAnalytics.cpp; sourceTree = "<group>"; };
FA4E3033172BD02800A3E673 /* ProtocolSocial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolSocial.h; sourceTree = "<group>"; };
FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolAds.h; sourceTree = "<group>"; }; FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolAds.h; sourceTree = "<group>"; };
FA7C6C991724E51C008A0ECC /* ProtocolAds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolAds.cpp; sourceTree = "<group>"; }; FA7C6C991724E51C008A0ECC /* ProtocolAds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolAds.cpp; sourceTree = "<group>"; };
FA7C6C9A1724E51C008A0ECC /* ProtocolIAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolIAP.cpp; sourceTree = "<group>"; }; FA7C6C9A1724E51C008A0ECC /* ProtocolIAP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProtocolIAP.cpp; sourceTree = "<group>"; };
@ -86,6 +87,7 @@
FA09A336168ADC05008C1C7B /* include */ = { FA09A336168ADC05008C1C7B /* include */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FA4E3033172BD02800A3E673 /* ProtocolSocial.h */,
FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */, FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */,
FA09A337168ADC05008C1C7B /* PluginManager.h */, FA09A337168ADC05008C1C7B /* PluginManager.h */,
FA09A338168ADC05008C1C7B /* PluginProtocol.h */, FA09A338168ADC05008C1C7B /* PluginProtocol.h */,