Skip to content

Commit

Permalink
Update the iOS projects of plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbin committed Apr 27, 2013
1 parent 59d8f55 commit 553d6a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 50 deletions.
58 changes: 13 additions & 45 deletions plugin/protocols/platform/ios/ProtocolAds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,59 @@

namespace cocos2d { namespace plugin {

AdListener* ProtocolAds::m_pListener = NULL;

ProtocolAds::ProtocolAds()
: m_pListener(NULL)
{
}

ProtocolAds::~ProtocolAds()
{
}

/**
@brief plugin initialization
*/
bool ProtocolAds::init()
{
return true;
}

/**
@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::configDeveloperInfo(TAdsDeveloperInfo devInfo)
{
}

/**
@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::showAds(AdsType type, int sizeEnum, AdsPos pos)
{
}

/**
@brief hide the banner ads view
*/
void ProtocolAds::hideBannerAd()
void ProtocolAds::hideAds(AdsType type)
{
}

/**
@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::spendPoints(int points)
{
}

// For the callbak methods
void ProtocolAds::receiveAd()
void ProtocolAds::setDebugMode(bool debug)
{
if (m_pListener != NULL)
{
m_pListener->onReceiveAd();
}
}

void ProtocolAds::presentScreen()
// For the callbak methods
void ProtocolAds::setAdsListener(AdsListener* pListener)
{
if (m_pListener != NULL)
{
m_pListener->onPresentScreen();
}
m_pListener = pListener;
}

void ProtocolAds::failedToReceiveAd(AdListener::EAdErrorCode code, const char* msg)
void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg)
{
if (m_pListener != NULL)
{
m_pListener->onFailedToReceiveAd(code, msg);
m_pListener->onAdsResult(code, msg);
}
}

void ProtocolAds::dismissScreen()
void ProtocolAds::onPlayerGetPoints(int points)
{
if (m_pListener != NULL)
{
m_pListener->onDismissScreen();
m_pListener->onPlayerGetPoints(this, points);
}
}

Expand Down
9 changes: 4 additions & 5 deletions plugin/protocols/platform/ios/ProtocolIAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace cocos2d { namespace plugin {

bool ProtocolIAP::m_bPaying = false;
PayResultListener* ProtocolIAP::m_pListener = NULL;
TProductInfo ProtocolIAP::m_curInfo;

ProtocolIAP::ProtocolIAP()
: m_pListener(NULL)
{
}

Expand All @@ -19,7 +18,7 @@ bool ProtocolIAP::init()
return true;
}

void ProtocolIAP::initDeveloperInfo(TDeveloperInfo devInfo)
void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo)
{
}

Expand All @@ -32,12 +31,12 @@ void ProtocolIAP::setResultListener(PayResultListener* pListener)
m_pListener = pListener;
}

void ProtocolIAP::payResult(EPayResult ret, const char* msg)
void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg)
{
m_bPaying = false;
if (m_pListener)
{
m_pListener->payResult(ret, msg, m_curInfo);
m_pListener->onPayResult(ret, msg, m_curInfo);
}

m_curInfo.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
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>"; };
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>"; };
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>"; };
Expand Down Expand Up @@ -86,6 +87,7 @@
FA09A336168ADC05008C1C7B /* include */ = {
isa = PBXGroup;
children = (
FA4E3033172BD02800A3E673 /* ProtocolSocial.h */,
FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */,
FA09A337168ADC05008C1C7B /* PluginManager.h */,
FA09A338168ADC05008C1C7B /* PluginProtocol.h */,
Expand Down

0 comments on commit 553d6a0

Please sign in to comment.