Merge pull request #2478 from natural-law/master

Update iOS projects of plugin.
This commit is contained in:
James Chen 2013-04-27 02:35:07 -07:00
commit 33d1ccce1f
5 changed files with 25 additions and 56 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 */,

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.cocos2dx.helloIAP" package="org.cocos2dx.helloIAPJS"
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">

View File

@ -21,7 +21,7 @@ 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
package org.cocos2dx.helloIAP; package org.cocos2dx.helloIAPJS;
import org.cocos2dx.lib.Cocos2dxActivity; import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView; import org.cocos2dx.lib.Cocos2dxGLSurfaceView;