Commit 6cfd79f2 authored by maxiaoliang's avatar maxiaoliang

添加首页角标查询

parent 2a88c3e0
...@@ -208,7 +208,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -208,7 +208,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
MainLooper.get()?.post(Runnable { MainLooper.get()?.post(Runnable {
if (Utils.isFastClick2()) { if (Utils.isFastClick2()) {
//CashExchangeDialog.showCashExchage(this, this) //CashExchangeDialog.showCashExchage(this, this)
PuzzleDialog.showPuzzleDialog(this) PuzzleDialog.showPuzzleDialog(this,this)
} }
}) })
} }
...@@ -650,12 +650,13 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -650,12 +650,13 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
//订单数据 //订单数据
fun getOrderData(callback: IUnitySendMessageCallback?) { fun getOrderData(callback: IUnitySendMessageCallback?) {
GameApiClient.gameApi.getOrderData().compose(RxSchedulers.observableIO2Main()) GameApiClient.gameApi.getHomeWList().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<OrderListEntity>() { .subscribe(object : BaseObserver<List<HomeListEntity>>() {
override fun onSuccess(result: OrderListEntity?) { override fun onSuccess(result: List<HomeListEntity>?) {
mOrderString = Utils.obj2Str(result) mOrderString = Utils.obj2Str(result)
Log.d("wxw", "订单数据" + Utils.obj2Str(result)) Log.d("wxw", "订单数据" + Utils.obj2Str(result))
callback?.onOrderListSuccess(true, Utils.obj2Str(result)) callback?.onOrderListSuccess(true,
"{\"homeList\":" + Utils.obj2Str(result) + "}")
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
...@@ -899,7 +900,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -899,7 +900,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
override fun onCloseViewSuccess(isSuccess: Boolean) { override fun onCloseViewSuccess(isSuccess: Boolean) {
//关闭view //关闭view
Log.e("MXL","CLOSE")
callUnity("TitleView", "getHomeInfo", "") callUnity("TitleView", "getHomeInfo", "")
callUnity("DailyWelfarm", "getCardList", "")
} }
fun getUserInfo() { fun getUserInfo() {
...@@ -963,5 +966,36 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -963,5 +966,36 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
} }
} }
//卡片收集
fun addCard(callback: IUnitySendMessageCallback?) {
GameApiClient.gameApi.addCard().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<AddCardEntity>() {
override fun onSuccess(result: AddCardEntity?) {
mOrderString = Utils.obj2Str(result)
Log.d("wxw", "收集卡片" + Utils.obj2Str(result))
callback?.onAddCardSuccess(true, Utils.obj2Str(result) )
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "收集卡片 error")
callback?.onAddCardSuccess(false, errorMsg + "")
}
})
}
//查询卡片角标
fun getCardList(callback: IUnitySendMessageCallback?) {
GameApiClient.gameApi.getCollectCard().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<PuzzleEntity>() {
override fun onSuccess(result: PuzzleEntity?) {
mOrderString = Utils.obj2Str(result)
Log.d("wxw", "查询卡片角标" + Utils.obj2Str(result))
callback?.onGetCardList(true, Utils.obj2Str(result) )
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "查询卡片角标 error")
callback?.onGetCardList(false, errorMsg + "")
}
})
}
} }
\ No newline at end of file
...@@ -50,4 +50,10 @@ interface IUnitySendMessageCallback { ...@@ -50,4 +50,10 @@ interface IUnitySendMessageCallback {
//判断是否云朵加速 //判断是否云朵加速
fun onGetCheckCloud(isSuccess: Boolean, result: String) fun onGetCheckCloud(isSuccess: Boolean, result: String)
//收集卡片
fun onAddCardSuccess(isSuccess: Boolean, result: String)
//查询碎片角标
fun onGetCardList(isSuccess: Boolean, result: String)
} }
\ No newline at end of file
...@@ -23,6 +23,7 @@ import androidx.recyclerview.widget.RecyclerView ...@@ -23,6 +23,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.airbnb.lottie.LottieAnimationView import com.airbnb.lottie.LottieAnimationView
import com.ym.ddcy.R import com.ym.ddcy.R
import com.ym.game.contract.PuzzleContract import com.ym.game.contract.PuzzleContract
import com.ym.game.listener.IDialogViewCloseCallback
import com.ym.game.presenter.PuzzlePresenter import com.ym.game.presenter.PuzzlePresenter
import com.ym.game.utils.CenterDialog import com.ym.game.utils.CenterDialog
import com.ym.library.module.PuzzleEntity import com.ym.library.module.PuzzleEntity
...@@ -51,7 +52,7 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti ...@@ -51,7 +52,7 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti
var anim_mask_layout: ViewGroup? = null var anim_mask_layout: ViewGroup? = null
//展示拼图窗口 //展示拼图窗口
fun showPuzzleDialog(context: Context?) { fun showPuzzleDialog(context: Context?,mListener: IDialogViewCloseCallback) {
if (context == null) { if (context == null) {
return return
} }
...@@ -85,7 +86,7 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti ...@@ -85,7 +86,7 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti
mDialogView?.findViewById<ImageView>(R.id.iv_dialog_close).setOnClickListener { mDialogView?.findViewById<ImageView>(R.id.iv_dialog_close).setOnClickListener {
mDialog?.dismiss() mDialog?.dismiss()
// mListener.onCloseViewSuccess(true); mListener.onCloseViewSuccess(true);
// RxBusUtil.getDefault().unregister(this) // RxBusUtil.getDefault().unregister(this)
} }
mDialogView?.findViewById<ImageView>(R.id.id_img_one_click_puzzle).setOnClickListener { mDialogView?.findViewById<ImageView>(R.id.id_img_one_click_puzzle).setOnClickListener {
...@@ -303,4 +304,6 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti ...@@ -303,4 +304,6 @@ object PuzzleDialog : PuzzleContract.View, OnRecycleItemClickListener<PuzzleEnti
} }
} }
\ No newline at end of file
package com.ym.library.module
class AddCardEntity {
var cardIndex:Int=0
var totalCards:Int=0
}
\ No newline at end of file
package com.ym.library.module
class HomeListEntity {
var id:Int=0
var ownNum:Int=0
var targetNum:Int=0
var name:String=""
var imgUrl:String=""
var cashStr:String=""
}
\ No newline at end of file
...@@ -316,4 +316,15 @@ interface IGameApi { ...@@ -316,4 +316,15 @@ interface IGameApi {
@GET(NetConfig.Game.URL_COLLECT_CARD_OPEN) @GET(NetConfig.Game.URL_COLLECT_CARD_OPEN)
fun openCard(): Observable<Response<PuzzleEntity?>> fun openCard(): Observable<Response<PuzzleEntity?>>
// 收金币获得卡片
@GET(NetConfig.Game.URL_COLLECT_CARD_ADD_CARD)
fun addCard(): Observable<Response<AddCardEntity?>>
/**
* 首页列表数据
* @param
* @paramq
* @return
*/
@GET(NetConfig.Game.URL_GAME_HOME_WD_LIST)
fun getHomeWList(): Observable<Response<List<HomeListEntity>>>
} }
\ No newline at end of file
...@@ -266,5 +266,7 @@ public class NetConfig { ...@@ -266,5 +266,7 @@ public class NetConfig {
public static final String URL_COLLECT_CARD_AUTOMATIC = "app/v1/collect-card/automatic";//已有的卡片自动拼接到宝箱上 public static final String URL_COLLECT_CARD_AUTOMATIC = "app/v1/collect-card/automatic";//已有的卡片自动拼接到宝箱上
public static final String URL_COLLECT_CARD_OPEN = "app/v1/collect-card/open";//开宝箱 public static final String URL_COLLECT_CARD_OPEN = "app/v1/collect-card/open";//开宝箱
public static final String URL_COLLECT_CARD_ADV_PUT_OR_ADD = "app/v1/collect-card/advPutOrAdd";//看广告单个图片获取或者拼图 public static final String URL_COLLECT_CARD_ADV_PUT_OR_ADD = "app/v1/collect-card/advPutOrAdd";//看广告单个图片获取或者拼图
public static final String URL_COLLECT_CARD_ADD_CARD = "app/v1/collect-card/addCard";//收金币获得卡片
public static final String URL_GAME_HOME_WD_LIST = "app/v1/game/ddcy/home_wd_list";//首页展示果实列表
} }
} }
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