mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2930 from natural-law/develop
Optimize class ProtocolAds for more Ads plugins.
This commit is contained in:
commit
12c21172c0
|
@ -94,4 +94,5 @@ tools/toolsForPublish/environment.sh
|
|||
.settings
|
||||
plugins/china*
|
||||
plugins/punchbox*
|
||||
plugins/touchpay*
|
||||
samplesPrivate*
|
||||
|
|
|
@ -99,6 +99,9 @@ public class AdsAdmob implements InterfaceAds {
|
|||
case AdsWrapper.ADS_TYPE_FULL_SCREEN:
|
||||
LogD("Now not support full screen view in Admob");
|
||||
break;
|
||||
case AdsWrapper.ADS_TYPE_MORE_APP:
|
||||
LogD("Now not support more app ads in Admob");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -106,7 +109,7 @@ public class AdsAdmob implements InterfaceAds {
|
|||
|
||||
@Override
|
||||
public void spendPoints(int points) {
|
||||
// do nothing, Admob don't have this function
|
||||
LogD("Admob not support spend points!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -213,7 +216,7 @@ public class AdsAdmob implements InterfaceAds {
|
|||
@Override
|
||||
public void onDismissScreen(Ad arg0) {
|
||||
LogD("onDismissScreen invoked");
|
||||
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewDismissed, "Full screen ads view dismissed!");
|
||||
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_AdsDismissed, "Ads view dismissed!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -247,7 +250,7 @@ public class AdsAdmob implements InterfaceAds {
|
|||
@Override
|
||||
public void onPresentScreen(Ad arg0) {
|
||||
LogD("onPresentScreen invoked");
|
||||
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewShown, "Full screen ads view shown!");
|
||||
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_AdsShown, "Ads view shown!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,4 +264,9 @@ public class AdsAdmob implements InterfaceAds {
|
|||
public String getPluginVersion() {
|
||||
return "0.2.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPoints() {
|
||||
LogD("Admob not support query points!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ typedef enum {
|
|||
- (void) configDeveloperInfo: (NSMutableDictionary*) devInfo;
|
||||
- (void) showAds: (int) type size:(int) sizeEnum position:(int) pos;
|
||||
- (void) hideAds: (int) type;
|
||||
- (void) queryPoints;
|
||||
- (void) spendPoints: (int) points;
|
||||
- (void) setDebugMode: (BOOL) isDebugMode;
|
||||
- (NSString*) getSDKVersion;
|
||||
|
|
|
@ -62,10 +62,18 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (type == kTypeBanner) {
|
||||
switch (type) {
|
||||
case kTypeBanner:
|
||||
[self showBanner:sizeEnum atPos:pos];
|
||||
} else {
|
||||
break;
|
||||
case kTypeFullScreen:
|
||||
OUTPUT_LOG(@"Now not support full screen view in Admob");
|
||||
break;
|
||||
case kTypeMoreApp:
|
||||
OUTPUT_LOG(@"Now not support more app ads in Admob");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,9 +90,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) queryPoints
|
||||
{
|
||||
OUTPUT_LOG(@"Admob not support query points!");
|
||||
}
|
||||
|
||||
- (void) spendPoints: (int) points
|
||||
{
|
||||
|
||||
OUTPUT_LOG(@"Admob not support spend points!");
|
||||
}
|
||||
|
||||
- (void) setDebugMode: (BOOL) isDebugMode
|
||||
|
|
|
@ -36,8 +36,8 @@ typedef enum
|
|||
{
|
||||
kAdsReceived = 0, // The ad is received
|
||||
|
||||
kFullScreenViewShown, // The full screen advertisement shown
|
||||
kFullScreenViewDismissed, // The full screen advertisement dismissed
|
||||
kAdsShown, // The advertisement shown
|
||||
kAdsDismissed, // The advertisement dismissed
|
||||
|
||||
kPointsSpendSucceed, // The points spend succeed
|
||||
kPointsSpendFailed, // The points spend failed
|
||||
|
@ -72,6 +72,7 @@ public:
|
|||
typedef enum {
|
||||
kBannerAd = 0,
|
||||
kFullScreenAd,
|
||||
kMoreApp,
|
||||
} AdsType;
|
||||
|
||||
typedef enum {
|
||||
|
@ -111,6 +112,11 @@ public:
|
|||
*/
|
||||
void hideAds(AdsType type);
|
||||
|
||||
/**
|
||||
@brief Query the points of player
|
||||
*/
|
||||
void queryPoints();
|
||||
|
||||
/**
|
||||
@brief Spend the points.
|
||||
Use this method to notify server spend points.
|
||||
|
|
|
@ -119,6 +119,11 @@ void ProtocolAds::hideAds(AdsType type)
|
|||
PluginUtils::callJavaFunctionWithName_oneParam(this, "hideAds", "(I)V", type);
|
||||
}
|
||||
|
||||
void ProtocolAds::queryPoints()
|
||||
{
|
||||
PluginUtils::callJavaFunctionWithName(this, "queryPoints");
|
||||
}
|
||||
|
||||
void ProtocolAds::spendPoints(int points)
|
||||
{
|
||||
PluginUtils::callJavaFunctionWithName_oneParam(this, "spendPoints", "(I)V", points);
|
||||
|
|
|
@ -28,8 +28,8 @@ THE SOFTWARE.
|
|||
typedef enum {
|
||||
kAdsReceived = 0,
|
||||
|
||||
kFullScreenViewShown,
|
||||
kFullScreenViewDismissed,
|
||||
kAdsShown,
|
||||
kAdsDismissed,
|
||||
|
||||
kPointsSpendSucceed,
|
||||
kPointsSpendFailed,
|
||||
|
@ -41,6 +41,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
kTypeBanner = 0,
|
||||
kTypeFullScreen,
|
||||
kTypeMoreApp,
|
||||
} AdsTypeEnum;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -29,6 +29,7 @@ THE SOFTWARE.
|
|||
- (void) configDeveloperInfo: (NSMutableDictionary*) devInfo;
|
||||
- (void) showAds: (int) type size:(int) sizeEnum position:(int) pos;
|
||||
- (void) hideAds: (int) type;
|
||||
- (void) queryPoints;
|
||||
- (void) spendPoints: (int) points;
|
||||
- (void) setDebugMode: (BOOL) debug;
|
||||
- (NSString*) getSDKVersion;
|
||||
|
|
|
@ -30,8 +30,8 @@ import android.view.WindowManager;
|
|||
public class AdsWrapper {
|
||||
|
||||
public static final int RESULT_CODE_AdsReceived = 0; // The ad is received
|
||||
public static final int RESULT_CODE_FullScreenViewShown = 1; // The full screen advertisement shown
|
||||
public static final int RESULT_CODE_FullScreenViewDismissed = 2; // The full screen advertisement dismissed
|
||||
public static final int RESULT_CODE_AdsShown = 1; // The advertisement shown
|
||||
public static final int RESULT_CODE_AdsDismissed = 2; // The advertisement dismissed
|
||||
public static final int RESULT_CODE_PointsSpendSucceed = 3; // The points spend succeed
|
||||
public static final int RESULT_CODE_PointsSpendFailed = 4; // The points spend failed
|
||||
public static final int RESULT_CODE_NetworkError = 5; // Network error
|
||||
|
@ -39,6 +39,7 @@ public class AdsWrapper {
|
|||
|
||||
public static final int ADS_TYPE_BANNER = 0;
|
||||
public static final int ADS_TYPE_FULL_SCREEN = 1;
|
||||
public static final int ADS_TYPE_MORE_APP = 2;
|
||||
|
||||
public static final int POS_CENTER = 0;
|
||||
public static final int POS_TOP = 1;
|
||||
|
|
|
@ -32,6 +32,7 @@ public interface InterfaceAds {
|
|||
public void configDeveloperInfo(Hashtable<String, String> devInfo);
|
||||
public void showAds(int type, int sizeEnum, int pos);
|
||||
public void hideAds(int type);
|
||||
public void queryPoints();
|
||||
public void spendPoints(int points);
|
||||
public void setDebugMode(boolean debug);
|
||||
public String getSDKVersion();
|
||||
|
|
|
@ -34,6 +34,7 @@ const std::string s_aTestCases[] = {
|
|||
const std::string s_aTestTypes[] = {
|
||||
"Banner",
|
||||
"Full Screen",
|
||||
"More App",
|
||||
};
|
||||
|
||||
const std::string s_aTestPoses[] = {
|
||||
|
|
Loading…
Reference in New Issue