Commit 03d7cfb7 authored by maxiaoliang's avatar maxiaoliang

修改adpater 添加碎片接口,修复崩溃

parent 6d92ac4a
......@@ -216,7 +216,6 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
* 兑换现金
*/
fun cashExchange() {
Log.d("wxw", "兑换现金")
MainLooper.get()?.post(Runnable {
if (Utils.isFastClick2()) {
CashExchangeDialog.showCashExchage(this, this)
......
package com.ym.game.activity
import android.app.Activity
import android.content.Intent
import android.util.Log
import android.view.View
......@@ -21,6 +22,7 @@ import com.ym.game.utils.CenterDialog
import com.ym.library.module.NewsEntity
import com.ym.library.net.*
import com.ym.library.utils.*
import com.ym.modulecommon.base.BaseActivity
class SplashActivity : BaseActivity(), SplashContract.View {
......@@ -61,6 +63,10 @@ class SplashActivity : BaseActivity(), SplashContract.View {
}
override fun className(): String {
return SplashActivity::class.java.simpleName
}
override fun jumpPage() {
if (!SettingPreference.getIsShowGuide()) {
EventUtils.onEvent("SplashActivity_loadSplash")
......@@ -162,6 +168,10 @@ class SplashActivity : BaseActivity(), SplashContract.View {
}
}
override fun activity(): Activity {
return this
}
override fun getDestroyed(): Boolean {
return false
}
......
......@@ -6,7 +6,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.ym.ddcy.R
import com.ym.game.module.PuzzleEntity
import com.ym.library.module.PuzzleEntity
import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.base.BaseRecyclerAdapter
import com.ym.task.module.listener.OnRecycleItemClickListener
......
......@@ -6,7 +6,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.ym.ddcy.R
import com.ym.game.module.PuzzleEntity
import com.ym.library.module.PuzzleEntity
import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.base.BaseRecyclerAdapter
......
package com.ym.game.contract
import com.ym.game.module.PuzzleEntity
import com.ym.library.module.PuzzleEntity
class PuzzleContract {
......
......@@ -5,7 +5,9 @@ import android.app.Activity
import android.util.Log
import android.view.View
import com.ym.game.contract.PuzzleContract
import com.ym.library.module.PuzzleEntity
import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers
......@@ -18,85 +20,88 @@ class PuzzlePresenter : PuzzleContract.Presenter {
}
// 获取卡片列表
override fun getPuzzleData() {
// AppClient.appApi.getCollectCard().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView?.PutPuzzDataResult(result)
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.getCollectCard().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView?.PutPuzzDataResult(result)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
//已有宝箱卡片拼图
override fun putPuzzleData(index:Int) {
// AppClient.appApi.getCollectCardPut(index).compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView.cardsFlyUp(result,index)
//
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.getCollectCardPut(index).compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView.cardsFlyUp(result,index)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
//看广告单个图片获取或者拼图
override fun noputPuzzleData(index: Int) {
// AppClient.appApi.getCollectCardPutorAdd(index).compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView?.PutPuzzDataResult(result)
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.getCollectCardPutorAdd(index).compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView?.PutPuzzDataResult(result)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
//看广告一键拼图
override fun onecleanPuzzle() {
// AppClient.appApi.getCollectCardAdv().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView?.PutPuzzDataResult(result)
//
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.getCollectCardAdv().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView?.PutPuzzDataResult(result)
if(result.advert==1){
//去看广告
mView?.getPuzzlelookAd(result.diffCardsNum)
}
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
//一键拼图
override fun automatic() {
// AppClient.appApi.getCollectCardAutoMatic().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView?.PutPuzzDataResult(result)
// Log.e("MXL",""+result.isWin)
// if(result.advert==1){
// //去看广告
// mView?.getPuzzlelookAd(result.diffCardsNum)
// }
//
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.getCollectCardAutoMatic().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView?.PutPuzzDataResult(result)
Log.e("MXL",""+result.isWin)
if(result.advert==1){
//去看广告
mView?.getPuzzlelookAd(result.diffCardsNum)
}
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
//开宝箱
override fun openBox() {
// AppClient.appApi.openCard().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
// override fun onSuccess(result: PuzzleEntity?) {
// if (result != null) {
// mView?.PutPuzzDataResult(result)
//
// }
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
GameApiClient.gameApi.openCard().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<PuzzleEntity?>() {
override fun onSuccess(result: PuzzleEntity?) {
if (result != null) {
mView?.PutPuzzDataResult(result)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
......
......@@ -23,9 +23,9 @@ import androidx.recyclerview.widget.RecyclerView
import com.airbnb.lottie.LottieAnimationView
import com.ym.ddcy.R
import com.ym.game.contract.PuzzleContract
import com.ym.game.module.PuzzleEntity
import com.ym.game.presenter.PuzzlePresenter
import com.ym.game.utils.CenterDialog
import com.ym.library.module.PuzzleEntity
import com.ym.library.rxbus.RxBusUtil
import com.ym.library.utils.Utils
import com.ym.modulecommon.AppliContext
......
package com.ym.game.module
package com.ym.library.module
class PuzzleEntity {
var isWin:Int=0
......
......@@ -295,5 +295,25 @@ interface IGameApi {
@POST(NetConfig.Game.URL_GAME_TASK_CASH)
fun getTaskCash(): Observable<Response<NewsEntity>>
@GET(NetConfig.Game.URL_COLLECT_CARD)
fun getCollectCard(): Observable<Response<PuzzleEntity?>>
@GET(NetConfig.Game.URL_COLLECT_CARD_PUT)
fun getCollectCardPut(@Query("index") index: Int): Observable<Response<PuzzleEntity?>>
@GET(NetConfig.Game.URL_COLLECT_CARD_ADV_PUT_OR_ADD)
fun getCollectCardPutorAdd(@Query("index") index: Int): Observable<Response<PuzzleEntity?>>
// 看广告一键拼图
@GET(NetConfig.Game.URL_COLLECT_CARD_ADV)
fun getCollectCardAdv(): Observable<Response<PuzzleEntity?>>
// 一键拼图
@GET(NetConfig.Game.URL_COLLECT_CARD_AUTOMATIC)
fun getCollectCardAutoMatic(): Observable<Response<PuzzleEntity?>>
// 开宝箱
@GET(NetConfig.Game.URL_COLLECT_CARD_OPEN)
fun openCard(): Observable<Response<PuzzleEntity?>>
}
\ No newline at end of file
......@@ -260,6 +260,11 @@ public class NetConfig {
public static final String URL_GAME_TASK_PROCESS = "app/v1/game/task_process";//福利中心钻石进度
public static final String URL_GAME_WELFARE_VIDEO_REPORT = "app/v1/game/welfare_video_report";//福利中心看视频任务
public static final String URL_GAME_TASK_CASH = "app/v1/game/task_cash";//福利中心提现
public static final String URL_COLLECT_CARD = "app/v1/collect-card/list";//宝箱卡片列表
public static final String URL_COLLECT_CARD_PUT = "app/v1/collect-card/put";//宝箱卡片拼图
public static final String URL_COLLECT_CARD_ADV = "app/v1/collect-card/adv";//看广告一键拼图
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_ADV_PUT_OR_ADD = "app/v1/collect-card/advPutOrAdd";//看广告单个图片获取或者拼图
}
}
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