Commit 73e29820 authored by maxiaoliang's avatar maxiaoliang

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/com/ym/game/net/IGameApi.kt
parents 3fb320ed bc2d00a9
...@@ -51,7 +51,7 @@ class GameActivity : UnityPlayerActivity() { ...@@ -51,7 +51,7 @@ class GameActivity : UnityPlayerActivity() {
) )
mLoading?.dismiss() mLoading?.dismiss()
TurntableDialog.initTurntableAnim() TurntableDialog.initTurntableAnim()
ToponManager.initRewardAd(this, AdID.mPlacementId_Reward_video_luck_farm)
} }
/** /**
...@@ -59,29 +59,6 @@ class GameActivity : UnityPlayerActivity() { ...@@ -59,29 +59,6 @@ class GameActivity : UnityPlayerActivity() {
*/ */
fun gotoWithdrawPage() { fun gotoWithdrawPage() {
Log.d("wxw", "跳转提现页") Log.d("wxw", "跳转提现页")
ToponManager.loadReward(this, object : ToponRewardListener {
override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayClicked")
}
override fun onRewardedVideoAdClosed(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdClosed")
}
override fun onRewardedVideoAdFailed(errorCode: AdError) {
Log.d("wxw", "onRewardedVideoAdFailed")
}
override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayEnd")
}
override fun onRewardedVideoAdPlayStart(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayStart")
}
}, AdID.mPlacementId_Reward_video_luck_farm)
} }
/** /**
...@@ -189,18 +166,57 @@ class GameActivity : UnityPlayerActivity() { ...@@ -189,18 +166,57 @@ class GameActivity : UnityPlayerActivity() {
* */ * */
fun getCloudSpeed(callback: IUnitySendMessageCallback?) { fun getCloudSpeed(callback: IUnitySendMessageCallback?) {
Log.d("wxw", "云朵加速") Log.d("wxw", "云朵加速")
GameApiClient.gameApi.getCloudSpeed().compose(RxSchedulers.observableIO2Main()) ToponManager.loadReward(this, object : ToponRewardListener {
.subscribe(object : BaseObserver<StatusEntity>() { override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
override fun onSuccess(result: StatusEntity?) { Log.d("wxw", "onRewardedVideoAdPlayClicked")
Log.d("wxw", "云朵加速" + Utils.obj2Str(result)) }
callback?.onCloudSpeedSuccess(true, Utils.obj2Str(result))
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onRewardedVideoAdClosed(entity: ATAdInfo) {
Log.d("wxw", "云朵加速 error") Log.d("wxw", "onRewardedVideoAdClosed")
callback?.onCloudSpeedSuccess(false, errorMsg + "") //看视频上报
} getVideoAcceleratorsReceive();
}) //
GameApiClient.gameApi.getCloudSpeed().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) {
Log.d("wxw", "云朵加速" + Utils.obj2Str(result))
callback?.onCloudSpeedSuccess(true, Utils.obj2Str(result))
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "云朵加速 error")
callback?.onCloudSpeedSuccess(false, errorMsg + "")
}
})
}
override fun onRewardedVideoAdFailed(errorCode: AdError) {
Log.d("wxw", "onRewardedVideoAdFailed")
callback?.onIncrVideoAcceleratorsSuccess(false,"广告失败")
}
override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayEnd")
}
override fun onRewardedVideoAdPlayStart(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayStart")
}
}, AdID.mPlacementId_Reward_video_luck_farm)
// GameApiClient.gameApi.getCloudSpeed().compose(RxSchedulers.observableIO2Main())
// .subscribe(object : BaseObserver<StatusEntity>() {
// override fun onSuccess(result: StatusEntity?) {
// Log.d("wxw", "云朵加速" + Utils.obj2Str(result))
// callback?.onCloudSpeedSuccess(true, Utils.obj2Str(result))
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
// Log.d("wxw", "云朵加速 error")
// callback?.onCloudSpeedSuccess(false, errorMsg + "")
// }
// })
} }
//解锁地块 //解锁地块
...@@ -308,38 +324,125 @@ class GameActivity : UnityPlayerActivity() { ...@@ -308,38 +324,125 @@ class GameActivity : UnityPlayerActivity() {
//看视频领取种子 //看视频领取种子
fun getVideoSeedReceive(callback: IUnitySendMessageCallback?, id: Int) { fun getVideoSeedReceive(callback: IUnitySendMessageCallback?, id: Int) {
GameApiClient.gameApi.getVideoSeedReceive(id).compose(RxSchedulers.observableIO2Main()) ToponManager.loadReward(this, object : ToponRewardListener {
.subscribe(object : BaseObserver<StatusEntity>() { override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
override fun onSuccess(result: StatusEntity?) { Log.d("wxw", "onRewardedVideoAdPlayClicked")
result?.id = id }
Log.d("wxw", "看视频领取种子" + Utils.obj2Str(result))
callback?.onIncrVideoSeedSuccess(true, Utils.obj2Str(result))
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onRewardedVideoAdClosed(entity: ATAdInfo) {
Log.d("wxw", "看视频领取种子 error") Log.d("wxw", "onRewardedVideoAdClosed")
callback?.onIncrVideoSeedSuccess(false, errorMsg + "") //看视频上报
} getVideoAcceleratorsReceive();
}) //
GameApiClient.gameApi.getVideoSeedReceive(id).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) {
result?.id = id
Log.d("wxw", "看视频领取种子" + Utils.obj2Str(result))
callback?.onIncrVideoSeedSuccess(true, Utils.obj2Str(result))
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "看视频领取种子 error")
callback?.onIncrVideoSeedSuccess(false, errorMsg + "")
}
})
}
override fun onRewardedVideoAdFailed(errorCode: AdError) {
Log.d("wxw", "onRewardedVideoAdFailed")
callback?.onIncrVideoAcceleratorsSuccess(false,"广告失败")
}
override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayEnd")
}
override fun onRewardedVideoAdPlayStart(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayStart")
}
}, AdID.mPlacementId_Reward_video_luck_farm)
// GameApiClient.gameApi.getVideoSeedReceive(id).compose(RxSchedulers.observableIO2Main())
// .subscribe(object : BaseObserver<StatusEntity>() {
// override fun onSuccess(result: StatusEntity?) {
// result?.id = id
// Log.d("wxw", "看视频领取种子" + Utils.obj2Str(result))
// callback?.onIncrVideoSeedSuccess(true, Utils.obj2Str(result))
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
// Log.d("wxw", "看视频领取种子 error")
// callback?.onIncrVideoSeedSuccess(false, errorMsg + "")
// }
// })
} }
//看视频领取加速剂 //看视频领取加速剂
fun getVideoAcceleratorsReceive(callback: IUnitySendMessageCallback?, id: Int) { fun getVideoAcceleratorsReceive(callback: IUnitySendMessageCallback?, id: Int) {
GameApiClient.gameApi.getVideoAcceleratorsReceive(id) ToponManager.loadReward(this, object : ToponRewardListener {
override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayClicked")
}
override fun onRewardedVideoAdClosed(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdClosed")
//看视频上报
getVideoAcceleratorsReceive();
//
GameApiClient.gameApi.getVideoAcceleratorsReceive(id)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) {
Log.d("wxw", "看视频领取加速剂" + Utils.obj2Str(result))
callback?.onIncrVideoAcceleratorsSuccess(true, Utils.obj2Str(result))
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "看视频领取加速剂 error")
callback?.onIncrVideoAcceleratorsSuccess(false, errorMsg + "")
}
})
}
override fun onRewardedVideoAdFailed(errorCode: AdError) {
Log.d("wxw", "onRewardedVideoAdFailed")
callback?.onIncrVideoAcceleratorsSuccess(false,"广告失败")
}
override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayEnd")
}
override fun onRewardedVideoAdPlayStart(entity: ATAdInfo) {
Log.d("wxw", "onRewardedVideoAdPlayStart")
}
}, AdID.mPlacementId_Reward_video_luck_farm)
}
//看视频领上报
fun getVideoAcceleratorsReceive() {
GameApiClient.gameApi.adVideoReport()
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StatusEntity>() { .subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) { override fun onSuccess(result: StatusEntity?) {
Log.d("wxw", "看视频领取加速剂" + Utils.obj2Str(result)) Log.d("wxw", "看视频上报 Success")
callback?.onIncrVideoAcceleratorsSuccess(true, Utils.obj2Str(result))
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "看视频领取加速剂 error") Log.d("wxw", "看视频上报 error")
callback?.onIncrVideoAcceleratorsSuccess(false, errorMsg + "")
} }
}) })
} }
fun getFlyBoxReceive() { fun getFlyBoxReceive() {
GameApiClient.gameApi.getopenBox() GameApiClient.gameApi.getopenBox()
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
......
...@@ -125,7 +125,6 @@ interface IGameApi { ...@@ -125,7 +125,6 @@ interface IGameApi {
*/ */
@POST(NetConfig.Game.URL_GAME_INCR_SEED) @POST(NetConfig.Game.URL_GAME_INCR_SEED)
fun getVideoSeedReceive(@Query("id") id: Int): Observable<Response<StatusEntity>> fun getVideoSeedReceive(@Query("id") id: Int): Observable<Response<StatusEntity>>
/** /**
* 看视频获得加速剂 * 看视频获得加速剂
* @param * @param
...@@ -142,7 +141,16 @@ interface IGameApi { ...@@ -142,7 +141,16 @@ interface IGameApi {
* @return * @return
*/ */
@POST(NetConfig.Game.URL_GAME_OPEN_BOX) @POST(NetConfig.Game.URL_GAME_OPEN_BOX)
fun getopenBox(): Observable<Response<FlyBoxEntity>> fun getopenBox(): Observable<Response<StatusEntity>>
/**
* 看视频上报
* @param
* @paramq
* @return
*/
@POST(NetConfig.Game.URL_GAME_AD_VIDEO_REPORT)
fun adVideoReport(): Observable<Response<StatusEntity>>
/** /**
* 任务领取奖励 * 任务领取奖励
......
...@@ -234,6 +234,7 @@ public class NetConfig { ...@@ -234,6 +234,7 @@ public class NetConfig {
public static class Game{ public static class Game{
public static final String URL_GAME_AD_VIDEO_REPORT="app/v1/game/report";//看视频上报 public static final String URL_GAME_AD_VIDEO_REPORT="app/v1/game/report";//看视频上报
public static final String URL_GAME_BUY_SEED="app/v1/game/farm/buy_seed";//金币购买种子 public static final String URL_GAME_BUY_SEED="app/v1/game/farm/buy_seed";//金币购买种子
public static final String URL_GAME_CLOUD_SPEED="app/v1/game/farm/cloud_speed";//云朵加速 public static final String URL_GAME_CLOUD_SPEED="app/v1/game/farm/cloud_speed";//云朵加速
public static final String URL_GAME_DO_WD="app/v1/game/farm/do_wd";//发起提现 public static final String URL_GAME_DO_WD="app/v1/game/farm/do_wd";//发起提现
......
...@@ -79,28 +79,6 @@ public class PermissionsActivity extends Activity { ...@@ -79,28 +79,6 @@ public class PermissionsActivity extends Activity {
isRequireCheck = true; isRequireCheck = true;
} }
private void createDialog() {
alertBuilder = new AlertDialog.Builder(this)
.setTitle(R.string.permission_help)
.setNegativeButton(R.string.permission_quit, (dialog, which) -> {
setResult(PERMISSIONS_DENIED);
isAlertDialogShow = false;
finish();
})
.setPositiveButton(R.string.permission_setting, (dialog, which) -> {
isAlertDialogShow = false;
dialog.dismiss();
startAppSettings();
})
.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
})
.setCancelable(false);
}
// 启动应用的设置 // 启动应用的设置
private void startAppSettings() { private void startAppSettings() {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
......
...@@ -213,7 +213,6 @@ object ToponManager { ...@@ -213,7 +213,6 @@ object ToponManager {
override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) { override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
listener.onRewardedVideoAdPlayEnd(entity) listener.onRewardedVideoAdPlayEnd(entity)
//移除本次并预加载 //移除本次并预加载
mRewardVideoAd?.show(activity)
AdMap.aTRewardVideoAdMap.remove(placementId) AdMap.aTRewardVideoAdMap.remove(placementId)
AdMap.aTRewardVideoAdMap[placementId] = AdMap.aTRewardVideoAdMap[placementId] =
preloadingLoadReward(activity, placementId) preloadingLoadReward(activity, placementId)
...@@ -256,6 +255,7 @@ object ToponManager { ...@@ -256,6 +255,7 @@ object ToponManager {
Toast.makeText(activity, "看完视频即可获得奖励", Toast.LENGTH_SHORT).show() Toast.makeText(activity, "看完视频即可获得奖励", Toast.LENGTH_SHORT).show()
isShowToast = false isShowToast = false
} }
mRewardVideoAd?.show(activity)
Log.i(TAG, "isAdReady = true") Log.i(TAG, "isAdReady = true")
removeCallbacksAndMessages(null) removeCallbacksAndMessages(null)
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment