全屏游戏
This commit is contained in:
parent
79fa6be313
commit
6d98afa319
@ -10,12 +10,21 @@ import androidx.lifecycle.Observer;
|
||||
import com.google.gson.Gson;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class SudGameActivity extends AbsActivity {
|
||||
private FrameLayout gameContainer;
|
||||
private long mInteractionID;
|
||||
@ -33,10 +42,17 @@ public class SudGameActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Bus.getOn(this);
|
||||
super.main();
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
String createSudRoomJson = getIntent().getStringExtra("CreateSudRoom");
|
||||
mCreateSudRoomModel = new Gson().fromJson(createSudRoomJson, CreateSudRoomModel.class);
|
||||
@ -76,7 +92,41 @@ public class SudGameActivity extends AbsActivity {
|
||||
GameConfigModel gameConfigModel = gameViewModel.getGameConfigModel();
|
||||
gameConfigModel.ui.ping.hide = true; // 配置不隐藏ping值
|
||||
gameConfigModel.ui.level.hide = true; // 配置不隐藏ping值
|
||||
|
||||
gameConfigModel.ui.lobby_players.custom = true;
|
||||
gameConfigModel.ui.join_btn.custom = true;
|
||||
|
||||
// SudMGP平台64bit游戏ID
|
||||
gameViewModel.switchGame((Activity) mContext, mLiveUid, mInteractionID);
|
||||
// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, -1, true, 1);
|
||||
// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfCaptain(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
// ViewClicksAntiShake.clicksAntiShake(gameTitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
// @Override
|
||||
// public void onViewClicks() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
|
||||
LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
|
||||
@Override
|
||||
public void onSuccess(CheckRemainingBalance data) {
|
||||
if (data.getGoldenBeanRemainingBalance() == 1) {
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1);
|
||||
} else {
|
||||
ToastUtil.show("钱不够,细狗");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show("钱不够,细狗");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CheckRemainingBalance extends BaseModel{
|
||||
|
||||
@SerializedName("golden_bean_remaining_balance")
|
||||
private int goldenBeanRemainingBalance;
|
||||
|
||||
public int getGoldenBeanRemainingBalance() {
|
||||
return goldenBeanRemainingBalance;
|
||||
}
|
||||
|
||||
public void setGoldenBeanRemainingBalance(int goldenBeanRemainingBalance) {
|
||||
this.goldenBeanRemainingBalance = goldenBeanRemainingBalance;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
public int seatIndex;
|
||||
|
||||
public int getSeatIndex() {
|
||||
return seatIndex;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setSeatIndex(int seatIndex) {
|
||||
this.seatIndex = seatIndex;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
@ -1004,9 +1005,9 @@ public interface PDLiveApi {
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("page") int page
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取游戏房列表 - 搜索
|
||||
*
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.getRoomList")
|
||||
Observable<ResponseModel<List<SudRoomListModel>>> searchRoomList(
|
||||
@ -1018,5 +1019,10 @@ public interface PDLiveApi {
|
||||
@Query("page") int page
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.checkRemainingBalance")
|
||||
Observable<ResponseModel<CheckRemainingBalance>> checkRemainingBalance(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
@ -2261,9 +2262,10 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void searchRoomList(String sudGameId, String threshold, String roomHolderType, String search, int page, HttpCallback<List<SudRoomListModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.searchRoomList(sudGameId,threshold,roomHolderType,"0",search,page)
|
||||
.searchRoomList(sudGameId, threshold, roomHolderType, "0", search, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudRoomListModel>>>() {
|
||||
@ -2284,6 +2286,29 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkRemainingBalance(String roomId, HttpCallback<CheckRemainingBalance> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkRemainingBalance(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CheckRemainingBalance>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CheckRemainingBalance> checkRemainingBalanceResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.common.sud;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
@ -243,6 +244,7 @@ public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
@Override
|
||||
public void onGameMGCommonGameState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameState model) {
|
||||
super.onGameMGCommonGameState(handle, model);
|
||||
Log.e("QuickStartGameViewModel",model.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,11 @@
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ISudFSMStateHandleUtils;
|
||||
import com.yunbao.common.utils.SudJsonUtils;
|
||||
|
||||
@ -172,11 +176,13 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态
|
||||
SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class);
|
||||
if (listener == null) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
} else {
|
||||
listener.onGameMGCommonSelfClickJoinBtn(handle, mgCommonSelfClickJoinBtn);
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex));
|
||||
// if (listener == null) {
|
||||
// ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
// } else {
|
||||
// listener.onGameMGCommonSelfClickJoinBtn(handle, mgCommonSelfClickJoinBtn);
|
||||
// }
|
||||
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_SELF_CLICK_CANCEL_JOIN_BTN: // 5. 取消加入(退出)游戏按钮点击状态
|
||||
SudMGPMGState.MGCommonSelfClickCancelJoinBtn selfClickCancelJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickCancelJoinBtn.class);
|
||||
@ -808,6 +814,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
if (listener != null && listener.onPlayerStateChange(handle, userId, state, dataJson)) {
|
||||
return;
|
||||
}
|
||||
Log.e("SudFSMMGDecorator", "userId:" + userId + " state:" + state + " dataJson:" + dataJson);
|
||||
switch (state) {
|
||||
case SudMGPMGState.MG_COMMON_PLAYER_IN: // 1.加入状态(已修改)
|
||||
SudMGPMGState.MGCommonPlayerIn mgCommonPlayerIn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerIn.class);
|
||||
@ -819,6 +826,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
}
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_PLAYER_READY: // 2.准备状态(已修改)
|
||||
|
||||
SudMGPMGState.MGCommonPlayerReady mgCommonPlayerReady = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerReady.class);
|
||||
sudFSMMGCache.onPlayerMGCommonPlayerReady(userId, mgCommonPlayerReady);
|
||||
if (listener == null) {
|
||||
|
@ -12,12 +12,16 @@ import androidx.lifecycle.Observer;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.event.LiveNewWishListEvent;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -115,7 +119,21 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveNewWishListEvent(LiveNewWishListEvent event) {
|
||||
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
|
||||
LiveNetManager.get(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
|
||||
@Override
|
||||
public void onSuccess(CheckRemainingBalance data) {
|
||||
if (data.getGoldenBeanRemainingBalance() == 1) {
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1);
|
||||
} else {
|
||||
ToastUtil.show("钱不够,细狗");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show("钱不够,细狗");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
BIN
main/src/main/res/mipmap-b+en+us/icon_main_live_type_1.png
Normal file
BIN
main/src/main/res/mipmap-b+en+us/icon_main_live_type_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
main/src/main/res/mipmap-b+en+us/icon_user_home_living.gif
Normal file
BIN
main/src/main/res/mipmap-b+en+us/icon_user_home_living.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 4.9 KiB |
Loading…
Reference in New Issue
Block a user