Commit 44f3e646 authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :幸福农场
[实现方案] :农场游戏
parent 4ac40395
......@@ -6,11 +6,8 @@ import com.ym.game.module.HomeInfoEntity
import com.ym.game.module.LandListEntity
import com.ym.game.module.StatusEntity
import com.ym.game.net.GameApiClient
import com.ym.library.Constant
import com.ym.library.net.ApiClient
import com.ym.library.net.BaseObserver
import com.ym.library.net.RxSchedulers
import com.ym.library.utils.JumpUtils
import com.ym.library.utils.Utils
/**
......@@ -96,11 +93,11 @@ class GameActivity : UnityPlayerActivity() {
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "云朵加速 error")
callback?.onCloudSpeedSuccess(false, errorMsg + "")
}
})
}
//解锁地块
fun getUnlockLand(callback: IUnitySendMessageCallback?, id: Int, type: Int) {
GameApiClient.gameApi.getUnlockLand(id, type).compose(RxSchedulers.observableIO2Main())
......@@ -111,6 +108,7 @@ class GameActivity : UnityPlayerActivity() {
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "解锁地块 error")
callback?.onCloudSpeedSuccess(false, errorMsg + "")
}
})
......@@ -126,10 +124,29 @@ class GameActivity : UnityPlayerActivity() {
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "加速剂 error")
callback?.onCloudSpeedSuccess(false, errorMsg + "")
}
})
}
//仓库
fun getWareHouseData(callback: IUnitySendMessageCallback?, id: Int){
GameApiClient.gameApi.getWareHouseData(id).compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<List<LandListEntity>>() {
override fun onSuccess(result: List<LandListEntity>?) {
Log.d("wxw", "仓库" + "{\"landList\":" + Utils.obj2Str(result) + "}")
callback?.onHomeWareListSuccess(
true,
"{\"landList\":" + Utils.obj2Str(result) + "}"
)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "仓库 error")
callback?.onHomeWareListSuccess(false, errorMsg + "")
}
})
}
}
\ No newline at end of file
......@@ -13,4 +13,6 @@ interface IUnitySendMessageCallback {
fun onFarmLandListSuccess(isSuccess: Boolean, result: String)
fun onHomeWareListSuccess(isSuccess: Boolean, result: String)
}
\ No newline at end of file
......@@ -30,6 +30,16 @@ public class LandListEntity {
private int status;
private int seedNum;
private int ownNum;
public int getOwnNum() {
return ownNum;
}
public void setOwnNum(int ownNum) {
this.ownNum = ownNum;
}
public int getId() {
return id;
}
......
......@@ -6,10 +6,29 @@ package com.ym.game.module;
* @detail :
*/
public class StatusEntity {
private int id;
private int ownNum;
private int status;
private int num;
private int cloudSecond;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getOwnNum() {
return ownNum;
}
public void setOwnNum(int ownNum) {
this.ownNum = ownNum;
}
public int getStatus() {
return status;
}
......
......@@ -5,8 +5,6 @@ import com.ym.game.module.LandListEntity
import com.ym.game.module.StatusEntity
import com.ym.library.net.NetConfig
import com.ym.library.net.Response
import com.ym.task.module.bean.GuessSongTaskBean
import com.ym.task.module.net.SondTaskNetCongfig
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.POST
......@@ -64,6 +62,14 @@ interface IGameApi {
@POST(NetConfig.Game.URL_GAME_USE_ACCELERATORS)
fun getUseAccelerators(@Query("id") id: Int): Observable<Response<StatusEntity>>
/**
* 仓库
* @param id 仓库列表id
* @param
* @return
*/
@GET(NetConfig.Game.URL_GAME_WAREHOUSE_DATA)
fun getWareHouseData(@Query("type") id: Int): Observable<Response<List<LandListEntity>>>
......
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