Created
July 29, 2014 18:33
-
-
Save darkdukey/2a16641561921b4814bb to your computer and use it in GitHub Desktop.
AnySDK Ads API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @file PluginProtocol.h | |
*/ | |
#ifndef __CCX_IPLUGIN_H__ | |
#define __CCX_IPLUGIN_H__ | |
#include "PluginParam.h" | |
#include <vector> | |
namespace anysdk { namespace framework { | |
/** | |
* @class PluginProtocol | |
* @brief The super class for all plugins. | |
*/ | |
class PluginProtocol | |
{ | |
public: | |
/** | |
*@brief set plugin name | |
*@param the name of plugin | |
*/ | |
virtual void setPluginName(const char* name) = 0 ; | |
/** | |
*@brief get plugin name | |
*@return the name of plugin | |
*/ | |
virtual const char* getPluginName() = 0 ; | |
/** | |
*@brief get the version of plugin | |
*@return the version of plugin | |
*/ | |
virtual std::string getPluginVersion() = 0 ; | |
/** | |
*@brief get the version of sdk | |
*@return the version of sdk | |
*/ | |
virtual std::string getSDKVersion() = 0 ; | |
/** | |
*@brief switch debug plug-in on/off | |
*@param the value of on/off | |
*/ | |
virtual void setDebugMode(bool bDebug) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param PluginParam* param | |
*@return void | |
*/ | |
virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param std::vector<PluginParam*> params | |
*@return void | |
*/ | |
virtual void callFuncWithParam(const char* funcName, std::vector<PluginParam*> params) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param PluginParam* param | |
*@return string | |
*/ | |
virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param std::vector<PluginParam*> params | |
*@return string | |
*/ | |
virtual std::string callStringFuncWithParam(const char* funcName, std::vector<PluginParam*> params) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param PluginParam* param | |
*@return int | |
*/ | |
virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param std::vector<PluginParam*> params | |
*@return int | |
*/ | |
virtual int callIntFuncWithParam(const char* funcName, std::vector<PluginParam*> params) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param PluginParam* param | |
*@return bool | |
*/ | |
virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param std::vector<PluginParam*> params | |
*@return bool | |
*/ | |
virtual bool callBoolFuncWithParam(const char* funcName, std::vector<PluginParam*> params) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param PluginParam* param | |
*@return float | |
*/ | |
virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...) = 0 ; | |
/** | |
*@brief methods for reflections | |
*@param function name | |
*@param std::vector<PluginParam*> params | |
*@return float | |
*/ | |
virtual float callFloatFuncWithParam(const char* funcName, std::vector<PluginParam*> params) = 0 ; | |
}; | |
}} //namespace anysdk { namespace framework { | |
#endif /* __CCX_IPLUGIN_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @file ProtocolAds.h | |
*/ | |
#ifndef __CCX_PROTOCOL_ADS_H__ | |
#define __CCX_PROTOCOL_ADS_H__ | |
#include "PluginProtocol.h" | |
#include <map> | |
#include <string> | |
namespace anysdk { namespace framework { | |
/// \typedef std::map<std::string, std::string> TAdsDeveloperInfo | |
/// typedef TAdsDeveloperInfo. | |
typedef std::map<std::string, std::string> TAdsDeveloperInfo; | |
/// \typedef std::map<std::string, std::string> TAdsInfo | |
/// typedef TAdsInfo. | |
typedef std::map<std::string, std::string> TAdsInfo; | |
/** @brief AdsResultCode enum, with inline docs */ | |
typedef enum | |
{ | |
kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ | |
kAdsShown, /**< enum the callback: the advertisement dismissed. */ | |
kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ | |
kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ | |
kPointsSpendFailed, /**< enum the callback: the points spend failed. */ | |
kNetworkError, /**< enum the callback of Network error at center. */ | |
kUnknownError, /**< enum the callback of Unknown error. */ | |
kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ | |
} AdsResultCode; | |
/** @brief AdsPos enum, with inline docs */ | |
typedef enum { | |
kPosCenter = 0,/**< enum the toolbar is at center. */ | |
kPosTop,/**< enum the toolbar is at top. */ | |
kPosTopLeft,/**< enum the toolbar is at topleft. */ | |
kPosTopRight,/**< enum the toolbar is at topright. */ | |
kPosBottom,/**< enum the toolbar is at bottom. */ | |
kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ | |
kPosBottomRight,/**< enum the toolbar is at bottomright. */ | |
} AdsPos; | |
/** @brief AdsType enum, with inline docs */ | |
typedef enum { | |
AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ | |
AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ | |
AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ | |
AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ | |
} AdsType; | |
class ProtocolAds; | |
class AdsListener | |
{ | |
public: | |
/** | |
*@brief The advertisement request result | |
*@param the id of callback | |
*@param聽the information of callback | |
*/ | |
virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; | |
/** | |
@brief Player get points from advertisement(For example: Tapjoy) | |
@param points The point number player has got. | |
@param pAdsPlugin The plugin which the player get points. Used to spend the points. | |
*/ | |
virtual void onPlayerGetPoints(ProtocolAds* pAdsPlugin, int points) {} | |
}; | |
class ProtocolAds : public PluginProtocol | |
{ | |
public: | |
/** | |
@brief show adview | |
@param the type of ads | |
*/ | |
virtual void showAds(AdsType adsType) = 0; | |
/** | |
@brief Hide the adview | |
@param the type of ads | |
*/ | |
virtual void hideAds(AdsType adsType) = 0; | |
/** | |
*@brief Query the points of player | |
*@return the point | |
*/ | |
virtual float queryPoints() = 0; | |
/** | |
*@brief Spend the points. | |
Use this method to notify server spend points. | |
*@param points Need spend number of points | |
*/ | |
virtual void spendPoints(int points) = 0; | |
/** | |
@brief set the Ads listener | |
@param pListener The callback object for Ads result | |
*/ | |
virtual void setAdsListener(AdsListener* listener) = 0; | |
/** | |
@brief get pListener The callback object for Ads result | |
@return the listener | |
*/ | |
virtual AdsListener* getAdsListener() = 0; | |
/** | |
@brief Check function the plugin support or not | |
@param the name of plugin | |
@return if the function support ,return true | |
else retur false | |
*/ | |
virtual bool isSupportFunction(std::string functionName) = 0; | |
}; | |
}} // namespace anysdk { namespace framework { | |
#endif /* __CCX_PROTOCOL_ADS_H__ */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment