Commit 2bedaf94 authored by maxiaoliang's avatar maxiaoliang

修改bug

parent a4d3a63b
...@@ -5,11 +5,13 @@ import android.util.Log ...@@ -5,11 +5,13 @@ import android.util.Log
import com.anythink.core.api.ATAdInfo import com.anythink.core.api.ATAdInfo
import com.anythink.core.api.AdError import com.anythink.core.api.AdError
import com.game.luckyfarm.UnityPlayerActivity import com.game.luckyfarm.UnityPlayerActivity
import com.ym.game.module.*
import com.ym.game.module.HomeInfoEntity import com.ym.game.module.HomeInfoEntity
import com.ym.game.module.LandListEntity import com.ym.game.module.LandListEntity
import com.ym.game.module.OrderListEntity import com.ym.game.module.OrderListEntity
import com.ym.game.module.StatusEntity import com.ym.game.module.StatusEntity
import com.ym.game.net.GameApiClient import com.ym.game.net.GameApiClient
import com.ym.game.view.MainDialog
import com.ym.game.view.SiginDropsPopupwindow import com.ym.game.view.SiginDropsPopupwindow
import com.ym.game.view.TurntableDialog import com.ym.game.view.TurntableDialog
import com.ym.library.AppliContext import com.ym.library.AppliContext
...@@ -136,10 +138,11 @@ class GameActivity : UnityPlayerActivity() { ...@@ -136,10 +138,11 @@ class GameActivity : UnityPlayerActivity() {
} }
/** /**
* 打开飞行宝箱 * 点击飞行宝箱看视频
*/ */
fun openAdFlyBox() { fun adFlyBox() {
Log.e("M", "点击宝箱看视频")
getFlyBoxReceive()
} }
/** /**
...@@ -337,5 +340,30 @@ class GameActivity : UnityPlayerActivity() { ...@@ -337,5 +340,30 @@ class GameActivity : UnityPlayerActivity() {
}) })
} }
fun getFlyBoxReceive() {
GameApiClient.gameApi.getopenBox()
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<FlyBoxEntity>() {
override fun onSuccess(result: FlyBoxEntity?) {
Log.d("wxw", "看视频领取宝箱" + Utils.obj2Str(result))
if (result != null) {
var type = result.type
if (type != null) {
MainDialog.showopenBox(
this@GameActivity, type,
"宝箱奖励",
result.awardNum ?: 0,
result
)
}
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "看视频领取宝箱 error")
}
})
}
} }
\ No newline at end of file
...@@ -28,5 +28,7 @@ interface IUnitySendMessageCallback { ...@@ -28,5 +28,7 @@ interface IUnitySendMessageCallback {
fun onIncrVideoSeedSuccess(isSuccess: Boolean, result: String) fun onIncrVideoSeedSuccess(isSuccess: Boolean, result: String)
//看视频获得加速剂 //看视频获得加速剂
fun onIncrVideoAcceleratorsSuccess(isSuccess: Boolean, result: String) fun onIncrVideoAcceleratorsSuccess(isSuccess: Boolean, result: String)
//看视频获得宝箱奖励
fun onAdFlyBoxSuccess(isSuccess: Boolean, result: String)
} }
\ No newline at end of file
package com.ym.game.module package com.ym.game.module
class FlyBoxEntity { class FlyBoxEntity {
var type:Int?=0 var type: Int? = 0
var awardNum:Int?=0 var awardNum: Int? = 0
var seedList: MutableList<SeedList> = ArrayList() var seedList: MutableList<SeedList> = ArrayList()
class SeedList{
var id:Int=0 class SeedList {
var num:Int=0 var id: Int = 0
var num: Int = 0
} }
} }
\ No newline at end of file
...@@ -22,10 +22,10 @@ class TurntableEntity { ...@@ -22,10 +22,10 @@ class TurntableEntity {
} }
class SeedListEntity { class SeedListEntity {
var seedList: MutableList<a> = ArrayList() var seedList: MutableList<SeedList> = ArrayList()
} }
class a { class SeedList {
var id: Int = 0 var id: Int = 0
var num: Int = 0 var num: Int = 0
} }
......
...@@ -80,6 +80,7 @@ interface IGameApi { ...@@ -80,6 +80,7 @@ interface IGameApi {
*/ */
@GET(NetConfig.Game.URL_GAME_WAREHOUSE_DATA) @GET(NetConfig.Game.URL_GAME_WAREHOUSE_DATA)
fun getWareHouseData(@Query("type") id: Int): Observable<Response<List<LandListEntity>>> fun getWareHouseData(@Query("type") id: Int): Observable<Response<List<LandListEntity>>>
/** /**
* 订单数据 * 订单数据
* @param * @param
...@@ -132,15 +133,14 @@ interface IGameApi { ...@@ -132,15 +133,14 @@ interface IGameApi {
* @return * @return
*/ */
@POST(NetConfig.Game.URL_GAME_INCR_ACCELERATORS) @POST(NetConfig.Game.URL_GAME_INCR_ACCELERATORS)
fun getVideoAcceleratorsReceive(): Observable<Response<StatusEntity>> fun getVideoAcceleratorsReceive(@Query("id") id: Int): Observable<Response<StatusEntity>>
/** /**
* 看视频获得加速剂 * 看视频获得宝箱奖励
* @param * @param
* @paramq * @paramq
* @return * @return
*/ */
@POST(NetConfig.Game.URL_GAME_OPEN_BOX) @POST(NetConfig.Game.URL_GAME_OPEN_BOX)
fun getopenBox(): Observable<Response<StatusEntity>> fun getopenBox(): Observable<Response<FlyBoxEntity>>
fun getVideoAcceleratorsReceive(@Query("id") id: Int): Observable<Response<StatusEntity>>
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import android.widget.FrameLayout ...@@ -9,6 +9,7 @@ import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import com.ym.game.module.FlyBoxEntity
import com.ym.game.module.TurntableEntity import com.ym.game.module.TurntableEntity
import com.ym.library.AppliContext import com.ym.library.AppliContext
import com.ym.library.utils.PhoneUtils import com.ym.library.utils.PhoneUtils
...@@ -71,33 +72,33 @@ object MainDialog { ...@@ -71,33 +72,33 @@ object MainDialog {
val tvGetDropCount = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count) val tvGetDropCount = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count)
val layoutAd = mDialogView?.findViewById<FrameLayout>(R.id.layout_get_drop_ad) val layoutAd = mDialogView?.findViewById<FrameLayout>(R.id.layout_get_drop_ad)
val llcontent2=mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_2) val llcontent2 = mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_2)
val ivGetDropBg2 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg2) val ivGetDropBg2 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg2)
val tvGetDropCount2 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count2) val tvGetDropCount2 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count2)
val llcontent3=mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_3) val llcontent3 = mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_3)
val ivGetDropBg3 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg3) val ivGetDropBg3 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg3)
val tvGetDropCount3 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count3) val tvGetDropCount3 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count3)
//3 种子 4 金币 5 加速剂 //3 种子 4 金币 5 加速剂
when (type) { when (type) {
3 -> { 3 -> {
llcontent2.visibility=View.GONE llcontent2.visibility = View.GONE
llcontent3.visibility=View.GONE llcontent3.visibility = View.GONE
if (list?.seedList?.size == 1) { if (list?.seedList?.size == 1) {
setImage(ivGetDropBg,list?.seedList[0].id) setImage(ivGetDropBg, list?.seedList[0].id)
tvGetDropCount.text = "x${list?.seedList[0].num}" tvGetDropCount.text = "x${list?.seedList[0].num}"
} else if (list?.seedList?.size == 2) { } else if (list?.seedList?.size == 2) {
llcontent2.visibility=View.VISIBLE llcontent2.visibility = View.VISIBLE
setImage(ivGetDropBg,list?.seedList[1].id) setImage(ivGetDropBg, list?.seedList[1].id)
setImage(ivGetDropBg2,list?.seedList[1].id) setImage(ivGetDropBg2, list?.seedList[1].id)
tvGetDropCount.text = "x${list?.seedList[1].num}" tvGetDropCount.text = "x${list?.seedList[1].num}"
tvGetDropCount2.text = "x${list?.seedList[1].num}" tvGetDropCount2.text = "x${list?.seedList[1].num}"
} else if (list?.seedList?.size == 3){ } else if (list?.seedList?.size == 3) {
llcontent2.visibility=View.VISIBLE llcontent2.visibility = View.VISIBLE
llcontent3.visibility=View.VISIBLE llcontent3.visibility = View.VISIBLE
setImage(ivGetDropBg,list?.seedList[2].id) setImage(ivGetDropBg, list?.seedList[2].id)
setImage(ivGetDropBg2,list?.seedList[2].id) setImage(ivGetDropBg2, list?.seedList[2].id)
setImage(ivGetDropBg3,list?.seedList[2].id) setImage(ivGetDropBg3, list?.seedList[2].id)
tvGetDropCount.text = "x${list?.seedList[2].num}" tvGetDropCount.text = "x${list?.seedList[2].num}"
tvGetDropCount2.text = "x${list?.seedList[2].num}" tvGetDropCount2.text = "x${list?.seedList[2].num}"
tvGetDropCount3.text = "x${list?.seedList[2].num}" tvGetDropCount3.text = "x${list?.seedList[2].num}"
...@@ -127,38 +128,40 @@ object MainDialog { ...@@ -127,38 +128,40 @@ object MainDialog {
mDialog.setCancelable(false) mDialog.setCancelable(false)
mDialog.show() mDialog.show()
} }
fun setImage(img:ImageView,id:Int){
when (id){ fun setImage(img: ImageView, id: Int) {
1->{ when (id) {
1 -> {
img.setImageResource(R.mipmap.img_cabbage) img.setImageResource(R.mipmap.img_cabbage)
} }
2->{ 2 -> {
img.setImageResource(R.mipmap.img_tomato) img.setImageResource(R.mipmap.img_tomato)
} }
3->{ 3 -> {
img.setImageResource(R.mipmap.img_pumpkin) img.setImageResource(R.mipmap.img_pumpkin)
} }
4->{ 4 -> {
img.setImageResource(R.mipmap.img_radish) img.setImageResource(R.mipmap.img_radish)
} }
5->{ 5 -> {
img.setImageResource(R.mipmap.img_corn) img.setImageResource(R.mipmap.img_corn)
} }
6->{ 6 -> {
img.setImageResource(R.mipmap.img_eggplant) img.setImageResource(R.mipmap.img_eggplant)
} }
7->{ 7 -> {
img.setImageResource(R.mipmap.img_melon) img.setImageResource(R.mipmap.img_melon)
} }
8->{ 8 -> {
img.setImageResource(R.mipmap.img_grape) img.setImageResource(R.mipmap.img_grape)
} }
9->{ 9 -> {
img.setImageResource(R.mipmap.img_strawberry) img.setImageResource(R.mipmap.img_strawberry)
} }
} }
} }
/** /**
* 转盘得到红包奖励 * 转盘得到红包奖励
* type: 奖励类型 * type: 奖励类型
...@@ -197,7 +200,11 @@ object MainDialog { ...@@ -197,7 +200,11 @@ object MainDialog {
} }
fun showopenBox( fun showopenBox(
context: Context? context: Context?,
type: Int,
adType: String,
rewardCount: Int,
result: FlyBoxEntity
) { ) {
if (context == null) { if (context == null) {
return return
...@@ -205,18 +212,69 @@ object MainDialog { ...@@ -205,18 +212,69 @@ object MainDialog {
val mDialog = Dialog(context, R.style.UpdateVersionCompatDialogTheme) val mDialog = Dialog(context, R.style.UpdateVersionCompatDialogTheme)
val mDialogView = val mDialogView =
showBottomDialog( showBottomDialog(
R.layout.dialog_layout_get_red_package, R.layout.dialog_get_water_drop,
context, context,
mDialog, mDialog,
0, 0,
Gravity.CENTER Gravity.CENTER
) )
val tvmoneycount = mDialogView?.findViewById<TextView>(R.id.id_tv_moeny_count) val ivGetDropBg = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg)
mDialogView.findViewById<TextView>(R.id.id_tv_get).setOnClickListener { val tvGetDropCount = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count)
val layoutAd = mDialogView?.findViewById<FrameLayout>(R.id.layout_get_drop_ad)
val llcontent2 = mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_2)
val ivGetDropBg2 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg2)
val tvGetDropCount2 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count2)
val llcontent3 = mDialogView?.findViewById<LinearLayout>(R.id.id_ll_content_3)
val ivGetDropBg3 = mDialogView?.findViewById<ImageView>(R.id.iv_get_drop_bg3)
val tvGetDropCount3 = mDialogView?.findViewById<TextView>(R.id.tv_get_drop_count3)
//3 种子 4 金币 5 加速剂
when (type) {
1 -> {
llcontent2.visibility = View.GONE
llcontent3.visibility = View.GONE
if (result.seedList?.size == 1) {
setImage(ivGetDropBg, result.seedList[0].id)
tvGetDropCount.text = "x${result.seedList[0].num}"
} else if (result.seedList?.size == 2) {
llcontent2.visibility = View.VISIBLE
setImage(ivGetDropBg, result.seedList[1].id)
setImage(ivGetDropBg2, result.seedList[1].id)
tvGetDropCount.text = "x${result.seedList[1].num}"
tvGetDropCount2.text = "x${result.seedList[1].num}"
} else if (result.seedList?.size == 3) {
llcontent2.visibility = View.VISIBLE
llcontent3.visibility = View.VISIBLE
setImage(ivGetDropBg, result.seedList[2].id)
setImage(ivGetDropBg2, result.seedList[2].id)
setImage(ivGetDropBg3, result.seedList[2].id)
tvGetDropCount.text = "x${result.seedList[2].num}"
tvGetDropCount2.text = "x${result.seedList[2].num}"
tvGetDropCount3.text = "x${result.seedList[2].num}"
}
}
2 -> {
ivGetDropBg.setImageResource(R.mipmap.icon_coin)
tvGetDropCount.text = "+${rewardCount}"
}
3 -> {
ivGetDropBg.setImageResource(R.mipmap.icon_speed_water)
tvGetDropCount.text = "+${rewardCount}"
}
}
//shwoAd(adType, context, layoutAd)
mDialogView.findViewById<TextView>(R.id.btn_get_drop_happy_accept).setOnClickListener {
mDialog.dismiss() mDialog.dismiss()
} }
mDialogView.findViewById<ImageView>(R.id.lv_get_drop_close).setOnClickListener {
mDialog.dismiss()
}
mDialog.setCanceledOnTouchOutside(false) mDialog.setCanceledOnTouchOutside(false)
mDialog.setCancelable(false) mDialog.setCancelable(false)
mDialog.show() mDialog.show()
......
...@@ -116,7 +116,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View, ...@@ -116,7 +116,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
// WateringTaskPopupwindow().init(mContext) // WateringTaskPopupwindow().init(mContext)
} }
3 -> dismiss() 3 -> dismiss()
// 4 -> { 4 -> {
// //看广告 // //看广告
// ToponManager.loadReward((mContext as Activity), object : ToponRewardListener { // ToponManager.loadReward((mContext as Activity), object : ToponRewardListener {
// override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) { // override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
...@@ -165,7 +165,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View, ...@@ -165,7 +165,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
// AdID.AD_BUBBLE_POP_VIDEO // AdID.AD_BUBBLE_POP_VIDEO
// ) // )
// //
// } }
} }
} }
} }
......
...@@ -19,9 +19,6 @@ import com.ym.library.utils.EventUtils ...@@ -19,9 +19,6 @@ import com.ym.library.utils.EventUtils
import com.ym.library.utils.LogUtils import com.ym.library.utils.LogUtils
import com.ym.library.utils.Utils import com.ym.library.utils.Utils
import com.ym.xync.R import com.ym.xync.R
import com.ym.module.toponad.AdID
import com.ym.module.toponad.ToponManager
import com.ym.module.toponad.listener.ToponRewardListener
/** /**
...@@ -262,7 +259,6 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View { ...@@ -262,7 +259,6 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View {
"转盘", "转盘",
mLotteryResult?.awardNum ?: 0, mLotteryResult?.awardNum ?: 0,
mLotteryResult?.extJson mLotteryResult?.extJson
) )
} else { } else {
MainDialog.showgetRedPackage( MainDialog.showgetRedPackage(
......
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