Commit 2bedaf94 authored by maxiaoliang's avatar maxiaoliang

修改bug

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