小游戏提测版本
This commit is contained in:
parent
fe28d3508b
commit
dc7b987eda
@ -0,0 +1,39 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class BallClearanceTableJoinRoomBean extends BaseModel{
|
||||
@SerializedName("room_id")
|
||||
private String room_id;
|
||||
@SerializedName("room_name")
|
||||
private String roomName;
|
||||
@SerializedName("sud_game_id")
|
||||
private String gameId;
|
||||
|
||||
public BallClearanceTableJoinRoomBean() {
|
||||
}
|
||||
|
||||
public String getRoom_id() {
|
||||
return room_id;
|
||||
}
|
||||
|
||||
public void setRoom_id(String room_id) {
|
||||
this.room_id = room_id;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public void setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameAiInfo extends BaseModel{
|
||||
@SerializedName("uids")
|
||||
private List<String> uids;
|
||||
|
||||
public SudGameAiInfo() {
|
||||
}
|
||||
|
||||
public List<String> getUids() {
|
||||
if(uids==null)
|
||||
uids=new ArrayList<>();
|
||||
return uids;
|
||||
}
|
||||
|
||||
public void setUids(List<String> uids) {
|
||||
this.uids = uids;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameRoomInfoBean extends BaseModel{
|
||||
public static final String STATUS_WAITING = "WATING";
|
||||
public static final String STATUS_PLAYING = "PLAYING";
|
||||
@SerializedName("status")
|
||||
private String status="";
|
||||
|
||||
@SerializedName("captain_uid")
|
||||
private String captainUid;
|
||||
|
||||
@SerializedName("player")
|
||||
private List<Player> players;
|
||||
|
||||
// 注意:这里没有getter和setter方法
|
||||
// 可以添加一个构造方法或其他方法来初始化对象(如果需要)
|
||||
|
||||
public SudGameRoomInfoBean() {
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCaptainUid() {
|
||||
return captainUid;
|
||||
}
|
||||
|
||||
public void setCaptainUid(String captainUid) {
|
||||
this.captainUid = captainUid;
|
||||
}
|
||||
|
||||
public List<Player> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public void setPlayers(List<Player> players) {
|
||||
this.players = players;
|
||||
}
|
||||
|
||||
// 嵌套类来表示游戏位玩家
|
||||
public static class Player {
|
||||
public static final String PLAYER_STATUS_READY = "READY";
|
||||
public static final String PLAYER_STATUS_IDLE = "IDLE";
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
|
||||
@SerializedName("seat_index")
|
||||
private int seatIndex;
|
||||
|
||||
@SerializedName("status")
|
||||
private String status="";
|
||||
|
||||
@SerializedName("is_ai")
|
||||
private int isAi;
|
||||
|
||||
@SerializedName("ai_level")
|
||||
private int aiLevel;
|
||||
|
||||
// 同样,这里没有getter和setter方法
|
||||
|
||||
// 可以根据需要添加构造方法或其他方法
|
||||
|
||||
public Player() {
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getSeatIndex() {
|
||||
return seatIndex;
|
||||
}
|
||||
|
||||
public void setSeatIndex(int seatIndex) {
|
||||
this.seatIndex = seatIndex;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getIsAi() {
|
||||
return isAi;
|
||||
}
|
||||
|
||||
public void setIsAi(int isAi) {
|
||||
this.isAi = isAi;
|
||||
}
|
||||
|
||||
public int getAiLevel() {
|
||||
return aiLevel;
|
||||
}
|
||||
|
||||
public void setAiLevel(int aiLevel) {
|
||||
this.aiLevel = aiLevel;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果需要,可以添加其他方法来操作这些数据
|
||||
}
|
@ -255,7 +255,7 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if(!TextUtils.equals(currencyType, "4")){
|
||||
} else if (!TextUtils.equals(currencyType, "4")) {
|
||||
if (sill.length() > 4) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("貨幣數量区间为[10 - 1000]");
|
||||
@ -292,10 +292,10 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
.createSudRoom(name, sill, currencyType, id, TextUtils.equals(currencyType, "4"), new HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if(TextUtils.equals(currencyType, "4")){
|
||||
RandomSudGameManager.getManager().start(data,isHome);
|
||||
if (TextUtils.equals(currencyType, "4")) {
|
||||
RandomSudGameManager.getManager().start(data, isHome, false);
|
||||
dialog.dismiss();
|
||||
if(!isHome){
|
||||
if (!isHome) {
|
||||
Bus.get().post(new SudGameListDissMissEvent());
|
||||
}
|
||||
return;
|
||||
@ -303,7 +303,7 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
if (isHome) {
|
||||
dialog.dismiss();
|
||||
if (CommonAppConfig.getInstance().getConfig().isSw()) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(data), false, isHome);
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(data), false, false, isHome);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(data), true, isHome);
|
||||
}
|
||||
@ -396,7 +396,6 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void closeAnimSudGameListEvent() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(animDuration);
|
||||
@ -429,10 +428,10 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
} else {
|
||||
gameSill.setHint(WordUtil.isNewZh() ? "請輸入貨幣數量" : "Please enter the amount of currency");
|
||||
}
|
||||
if(TextUtils.equals(currencyType,"4")){
|
||||
if (TextUtils.equals(currencyType, "4")) {
|
||||
gameSill.setText("1");
|
||||
gameSill.setEnabled(false);
|
||||
}else {
|
||||
} else {
|
||||
gameSill.setEnabled(true);
|
||||
gameSill.setText("");
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow {
|
||||
|
||||
sub_leave.setOnClickListener(v -> destroyDialog());
|
||||
sub_again.setOnClickListener(v -> {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
destroyDialog();
|
||||
});
|
||||
|
||||
@ -118,10 +118,10 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow {
|
||||
LogUtils.e("isFirstMe:" + isFirstMe);
|
||||
if (containMe) {
|
||||
// 当前用户在游戏中
|
||||
// SudSettleBean winBean = isFirstMe ? sudSettleBean1 : sudSettleBean2;
|
||||
// SudSettleBean lossBean = isFirstMe ? sudSettleBean2 : sudSettleBean1;
|
||||
SudSettleBean winBean= sudSettleBean1;
|
||||
SudSettleBean lossBean= sudSettleBean2;
|
||||
// SudSettleBean winBean = isFirstMe ? sudSettleBean1 : sudSettleBean2;
|
||||
// SudSettleBean lossBean = isFirstMe ? sudSettleBean2 : sudSettleBean1;
|
||||
SudSettleBean winBean = sudSettleBean1;
|
||||
SudSettleBean lossBean = sudSettleBean2;
|
||||
|
||||
|
||||
if (isActivityGame) {
|
||||
@ -160,10 +160,16 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow {
|
||||
ImgLoader.display(mContext, sudSettleBean2.getAvatar_url(), sub_loss_head);
|
||||
sub_win_name.setText(sudSettleBean1.getNick_name());
|
||||
sub_loss_name.setText(sudSettleBean2.getNick_name());
|
||||
|
||||
sub_win_score.setText(sudSettleBean1.getWin_num() > 0 ? "+" + sudSettleBean1.getWin_num() : String.valueOf(sudSettleBean1.getWin_num()));
|
||||
sub_loss_score.setText(String.valueOf(sudSettleBean2.getWin_num()));
|
||||
|
||||
if (isActivityGame) {
|
||||
Map<String, Integer> map = showActivityGameScore();
|
||||
if (!map.isEmpty()) {
|
||||
isDraw = map.get("win").intValue() == map.get("loss").intValue();
|
||||
}
|
||||
findViewById(R.id.tips).setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
sub_win_score.setText(sudSettleBean1.getWin_num() > 0 ? "+" + sudSettleBean1.getWin_num() : String.valueOf(sudSettleBean1.getWin_num()));
|
||||
sub_loss_score.setText(String.valueOf(sudSettleBean2.getWin_num()));
|
||||
}
|
||||
if (isDraw) {
|
||||
// 平局
|
||||
sub_title.setImageResource(isZh ? R.mipmap.sub_draw_zh : R.mipmap.sub_draw_en);
|
||||
@ -242,6 +248,16 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow {
|
||||
|
||||
private void sortByWinNum(List<SudSettleBean> list) {
|
||||
// 按照胜利数排序 settleBeans 列表
|
||||
if (isActivityGame) {
|
||||
for (SudActivityGameInfoBean infoBean : gameSettle.activityGameInfoBean) {
|
||||
for (SudSettleBean bean : list) {
|
||||
if (bean.getUid().equals(infoBean.getUid() + "")) {
|
||||
bean.setWin_num(infoBean.getScore());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(list, (bean1, bean2) -> {
|
||||
return Integer.compare(bean2.getWin_num(), bean1.getWin_num()); // 从大到小排序
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ public class SudGameMultipleDialog extends AbsDialogCenterPopupWindow{
|
||||
|
||||
sub_leave.setOnClickListener(v-> destroyDialog());
|
||||
sub_again.setOnClickListener(v-> {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
destroyDialog();
|
||||
});
|
||||
|
||||
|
@ -1,24 +1,28 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
public class SudLoadDialog extends AbsDialogCenterPopupWindow{
|
||||
public class SudLoadDialog extends AbsDialogCenterPopupWindow {
|
||||
public SudLoadDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private LinearLayoutCompat sud_load_bg;
|
||||
private AppCompatImageView sud_load,sud_load_skip,sud_load_again;
|
||||
private ProgressBar sud_load_bar_double,sud_load_bar_multiple;
|
||||
private AppCompatImageView sud_load, sud_load_skip, sud_load_again;
|
||||
private ProgressBar sud_load_bar_double, sud_load_bar_multiple;
|
||||
private int isDouble = 0;//游戏模式 1:双人对战 2:多人游戏
|
||||
private int clickStatus = 0;//0:什么都不点击 1:点击跳过 2:点击再来一局
|
||||
|
||||
@ -50,36 +54,39 @@ public class SudLoadDialog extends AbsDialogCenterPopupWindow{
|
||||
sud_load_bar_double = findViewById(R.id.sud_load_bar_double);
|
||||
sud_load_bar_multiple = findViewById(R.id.sud_load_bar_multiple);
|
||||
|
||||
if (WordUtil.isNewZh()){
|
||||
if (WordUtil.isNewZh()) {
|
||||
sud_load.setImageResource(R.mipmap.sud_load_zh);
|
||||
sud_load_skip.setImageResource(R.mipmap.sud_load_skip_zh);
|
||||
sud_load_again.setImageResource(R.mipmap.sub_again_zh);
|
||||
}else {
|
||||
} else {
|
||||
sud_load.setImageResource(R.mipmap.sud_load_en);
|
||||
sud_load_skip.setImageResource(R.mipmap.sud_load_skip_en);
|
||||
sud_load_again.setImageResource(R.mipmap.sub_again_en);
|
||||
}
|
||||
|
||||
sud_load_skip.setOnClickListener(v->{
|
||||
sud_load_skip.setOnClickListener(v -> {
|
||||
clickStatus = 1;
|
||||
dismiss();
|
||||
});
|
||||
|
||||
sud_load_again.setOnClickListener(v->{
|
||||
sud_load_again.setOnClickListener(v -> {
|
||||
clickStatus = 2;
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
Handler activityGameTipsHandler = null;
|
||||
Runnable activityGameTipsRunnable = () -> {
|
||||
findViewById(R.id.sud_activity_tips_text).setVisibility(View.VISIBLE);
|
||||
};
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
if (isDouble == 1){
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext,R.mipmap.sud_load_bg_double));
|
||||
if (isDouble == 1) {
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext, R.mipmap.sud_load_bg_double));
|
||||
sud_load_bar_double.setVisibility(View.VISIBLE);
|
||||
sud_load_bar_multiple.setVisibility(View.GONE);
|
||||
}else {
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext,R.mipmap.sud_load_bg_multiple));
|
||||
} else {
|
||||
sud_load_bg.setBackground(ContextCompat.getDrawable(mContext, R.mipmap.sud_load_bg_multiple));
|
||||
sud_load_bar_double.setVisibility(View.GONE);
|
||||
sud_load_bar_multiple.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -88,9 +95,25 @@ public class SudLoadDialog extends AbsDialogCenterPopupWindow{
|
||||
// dismiss();
|
||||
// }
|
||||
// },10000);
|
||||
activityGameTipsHandler=new Handler(Looper.getMainLooper());
|
||||
activityGameTipsHandler.postDelayed(activityGameTipsRunnable,5000);
|
||||
}
|
||||
|
||||
public void setDouble(int isDouble){
|
||||
public void setDouble(int isDouble) {
|
||||
this.isDouble = isDouble;
|
||||
}
|
||||
|
||||
private boolean isActivityGame = false;
|
||||
|
||||
public void setActivityGame() {
|
||||
isActivityGame = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
if(activityGameTipsHandler!=null){
|
||||
activityGameTipsHandler.removeCallbacks(activityGameTipsRunnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
private boolean subReady = false;//是否直接自动准备
|
||||
private SudMGPMGState.MGCommonGameSettle mgCommonGameSettle;//结算数据
|
||||
private boolean isActivityGame;
|
||||
private SudMGPMGState.MGCommonPlayerIn playerIn;
|
||||
private String uid;
|
||||
private Object object;
|
||||
|
||||
public boolean isSubReady() {
|
||||
return subReady;
|
||||
@ -21,6 +24,30 @@ public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
return isActivityGame;
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public void setObject(Object object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
public com.yunbao.common.sud.state.SudMGPMGState.MGCommonPlayerIn getPlayerIn() {
|
||||
return playerIn;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setPlayerIn(com.yunbao.common.sud.state.SudMGPMGState.MGCommonPlayerIn playerIn) {
|
||||
this.playerIn = playerIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setActivityGame(boolean activityGame) {
|
||||
isActivityGame = activityGame;
|
||||
@ -67,4 +94,15 @@ public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
public boolean getSubReady() {
|
||||
return subReady;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CheckRemainingBalanceEvent{" +
|
||||
"seatIndex=" + seatIndex +
|
||||
", SudMGPMGState='" + SudMGPMGState + '\'' +
|
||||
", subReady=" + subReady +
|
||||
", mgCommonGameSettle=" + mgCommonGameSettle +
|
||||
", isActivityGame=" + isActivityGame +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BallClearanceTableJoinRoomBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@ -75,7 +76,9 @@ import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudActivityGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameAiInfo;
|
||||
import com.yunbao.common.bean.SudGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameRoomInfoBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
import com.yunbao.common.bean.SudGameUserModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
@ -1354,4 +1357,15 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<SudActivityGameInfoBean>>> ballClearanceTableGetResultScore(
|
||||
@Query("room_id")String roomId
|
||||
);
|
||||
@GET("/api/public/?service=Sudgameserver.ballClearanceTableAiAdd")
|
||||
Observable<ResponseModel<SudGameAiInfo>> ballClearanceTableAiAdd(
|
||||
@Query("room_id")String roomId
|
||||
);
|
||||
@GET("/api/public/?service=Sudgameserver.ballClearanceTableGetRoomInfo")
|
||||
Observable<ResponseModel<SudGameRoomInfoBean>> ballClearanceTableGetRoomInfo(
|
||||
@Query("room_id")String roomId
|
||||
);
|
||||
@GET("/api/public/?service=Sudgameserver.ballClearanceTableJoinRoom")
|
||||
Observable<ResponseModel<BallClearanceTableJoinRoomBean>> ballClearanceTableJoinRoom (
|
||||
);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AvatarBean;
|
||||
import com.yunbao.common.bean.BallClearanceTableJoinRoomBean;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BattlePassPoints;
|
||||
import com.yunbao.common.bean.BattlePassTask;
|
||||
@ -73,7 +74,9 @@ import com.yunbao.common.bean.SendMoneyLongModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudActivityGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameAiInfo;
|
||||
import com.yunbao.common.bean.SudGameInfoBean;
|
||||
import com.yunbao.common.bean.SudGameRoomInfoBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
import com.yunbao.common.bean.SudGameUserModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
@ -3651,7 +3654,63 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void ballClearanceTableAiAdd( String roomId, HttpCallback<SudGameAiInfo> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.ballClearanceTableAiAdd(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.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();
|
||||
}
|
||||
public void ballClearanceTableGetRoomInfo( String roomId, HttpCallback<SudGameRoomInfoBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.ballClearanceTableGetRoomInfo(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.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();
|
||||
}
|
||||
public void ballClearanceTableJoinRoom( HttpCallback<BallClearanceTableJoinRoomBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.ballClearanceTableJoinRoom()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.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();
|
||||
}
|
||||
private MultipartBody.Part createUploadFile(File file) {
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||
|
@ -2,27 +2,40 @@ package com.yunbao.common.manager;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.view.View;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.BallClearanceTableJoinRoomBean;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.SudGameRoomInfoBean;
|
||||
import com.yunbao.common.event.CheckCurrencyModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.game.AbsRandomGameManager;
|
||||
import com.yunbao.common.manager.game.BilliardsRandomManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class RandomSudGameManager {
|
||||
private static RandomSudGameManager manager;
|
||||
private AbsRandomGameManager gameManager;
|
||||
private CreateSudRoomModel sudRoomModel;
|
||||
private QuickStartGameViewModel gameViewModel;
|
||||
private boolean isRandom=false;
|
||||
|
||||
public static RandomSudGameManager getManager() {
|
||||
if (manager == null) {
|
||||
@ -35,20 +48,24 @@ public class RandomSudGameManager {
|
||||
|
||||
}
|
||||
|
||||
public void start(CreateSudRoomModel data, boolean isHome) {
|
||||
public void start(CreateSudRoomModel data, boolean isHome, boolean isRandom) {
|
||||
//TODO 等待五秒调用接口获取可以匹配的玩家
|
||||
//TODO 五秒内没有玩家就自己创建
|
||||
createRoom(data, isHome);
|
||||
sudRoomModel = data;
|
||||
this.isRandom = isRandom;
|
||||
createRoom(data, isHome, isRandom);
|
||||
}
|
||||
|
||||
private void createRoom(CreateSudRoomModel data, boolean isHome) {
|
||||
|
||||
private void createRoom(CreateSudRoomModel data, boolean isHome, boolean isRandom) {
|
||||
//TODO 创建房间五秒内没有其他玩家就上AI
|
||||
LiveNetManager.get(AppManager.getInstance().getMainActivity())
|
||||
.checkCurrency(new HttpCallback<CheckCurrencyModel>() {
|
||||
@Override
|
||||
public void onSuccess(CheckCurrencyModel currencyModel) {
|
||||
gameManager = new BilliardsRandomManager();
|
||||
gameManager.onStart(currencyModel, data, isHome);
|
||||
gameManager.setRandom(isRandom);
|
||||
gameManager.onStart(currencyModel, data, isHome, isRandom);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,12 +75,40 @@ public class RandomSudGameManager {
|
||||
});
|
||||
}
|
||||
|
||||
private void createRoom(Context mContext) {
|
||||
//name = 三大风扇史蒂夫史蒂夫的房间 sill = 1 currencyType = 4 id = 24 isTicket = true
|
||||
String userName = IMLoginManager.get(mContext).getUserInfo().getUserNicename();
|
||||
String name = WordUtil.isNewZh() ? userName + "的房间 " : userName + "‘s room";
|
||||
String sill = "1";
|
||||
String currencyType = "4";
|
||||
String id = "24";
|
||||
LiveNetManager.get(mContext).createSudRoom(name, sill, currencyType, id, true, new HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
start(data, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
if (gameManager != null) {
|
||||
gameManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (gameManager != null) {
|
||||
gameManager.destroy();
|
||||
gameManager = null;
|
||||
}
|
||||
sudRoomModel = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏结算
|
||||
*
|
||||
@ -133,10 +178,69 @@ public class RandomSudGameManager {
|
||||
public void onInitGame(CreateSudRoomModel mCreateSudRoomModel) {
|
||||
if (gameManager == null) {
|
||||
gameManager = new BilliardsRandomManager();
|
||||
gameManager.onStart(null, mCreateSudRoomModel, false);
|
||||
gameManager.setRandom(isRandom);
|
||||
gameManager.onStart(null, mCreateSudRoomModel, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onGameState(CheckRemainingBalanceEvent event) {
|
||||
if (gameManager != null) {
|
||||
gameManager.onGameState(event);
|
||||
}
|
||||
}
|
||||
|
||||
public void random(Context mContext) {
|
||||
LiveNetManager.get(mContext)
|
||||
.ballClearanceTableJoinRoom(new HttpCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(BallClearanceTableJoinRoomBean data) {
|
||||
if (data != null) {
|
||||
if ("0".equals(data.getRoom_id()) || StringUtil.isEmpty(data.getRoom_id())) {
|
||||
createRoom(mContext);
|
||||
return;
|
||||
}
|
||||
check(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
|
||||
private void check(BallClearanceTableJoinRoomBean data) {
|
||||
LiveNetManager.get(mContext).checkRoomStatus(data.getRoom_id(), new HttpCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel model) {
|
||||
if (TextUtils.equals(model.getRoomStatus(), "0")) {
|
||||
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("房间不存在");
|
||||
} else {
|
||||
ToastUtil.show("The room does not exist");
|
||||
}
|
||||
} else {
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
createSudRoomModel.setSudGameId(data.getGameId());
|
||||
createSudRoomModel.setSudGameRoomId(data.getRoom_id());
|
||||
createSudRoomModel.setRoomName(data.getRoomName());
|
||||
start(createSudRoomModel, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setGameViewModel(QuickStartGameViewModel gameViewModel) {
|
||||
this.gameManager = gameManager;
|
||||
if (gameManager != null) {
|
||||
gameManager.setGameViewModel(gameViewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,44 @@
|
||||
package com.yunbao.common.manager.game;
|
||||
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.SudGameRoomInfoBean;
|
||||
import com.yunbao.common.event.CheckCurrencyModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
|
||||
public abstract class AbsRandomGameManager {
|
||||
protected CreateSudRoomModel data;
|
||||
public abstract void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome);
|
||||
protected QuickStartGameViewModel gameViewModel;
|
||||
protected boolean isRandom;
|
||||
protected boolean isCaptain = false;
|
||||
|
||||
public void setRandom(boolean random) {
|
||||
isRandom = random;
|
||||
}
|
||||
|
||||
public void setGameViewModel(QuickStartGameViewModel gameViewModel) {
|
||||
this.gameViewModel = gameViewModel;
|
||||
}
|
||||
|
||||
public abstract void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome, boolean isRandom);
|
||||
|
||||
public abstract void reset();
|
||||
|
||||
public abstract void onGameMGCommonGameBilliardsHitState(SudMGPMGState.MGCommonGameBilliardsHitState model);
|
||||
public abstract boolean onGameMGCommonGameSettle(SudMGPMGState.MGCommonGameSettle model) ;
|
||||
|
||||
public abstract boolean onGameMGCommonGameSettle(SudMGPMGState.MGCommonGameSettle model);
|
||||
|
||||
public void onGameState(CheckRemainingBalanceEvent event) {
|
||||
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_COMMON_PLAYER_CAPTAIN)) {
|
||||
isCaptain = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getPlayerSize() {
|
||||
if (gameViewModel == null) return 0;
|
||||
return gameViewModel.getSudFSMMGCache().getPlayerInSet().size();
|
||||
}
|
||||
|
||||
public abstract void destroy();
|
||||
}
|
||||
|
@ -1,15 +1,28 @@
|
||||
package com.yunbao.common.manager.game;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.SudGameAiInfo;
|
||||
import com.yunbao.common.bean.SudGameRoomInfoBean;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.CheckCurrencyModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.RandomSudGameManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
@ -22,16 +35,58 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
||||
int isOneOverForOther = -1;//对方是否一杆清台
|
||||
int comboNumberForMy = 0;//自己连杆数
|
||||
int comboNumberForOther = 0;//对方连杆数
|
||||
private SudGameAiInfo aiInfo;
|
||||
private boolean isAddRobot = true;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
|
||||
|
||||
Handler autoJoinRobotHandler = null;
|
||||
Runnable autoJoinRobotRunnable = () -> {
|
||||
if (gameViewModel != null && gameViewModel.getSudFSMMGCache().getPlayerInSet().size() <= 2) {
|
||||
if (isCaptain) {
|
||||
onAddAiPlayer();
|
||||
}
|
||||
}
|
||||
};
|
||||
private boolean isInitDebug = true;
|
||||
|
||||
@Override
|
||||
public void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome) {
|
||||
public void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome, boolean isRandom) {
|
||||
this.data = data;
|
||||
if (currencyModel == null) return;
|
||||
if (isHome) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(data), true, true);
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(data), true, isRandom, true);
|
||||
} else {
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data).setActivityGame(true));
|
||||
}
|
||||
if (isInitDebug) {
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(() -> {
|
||||
DebugDialog.getInstance(new DebugDialog.DebugDialogRunnable() {
|
||||
@Override
|
||||
public void run(DebugDialog dialog) {
|
||||
dialog.setShowPattern(ShowPattern.ALL_TIME);
|
||||
onItemClickListener = (bean, position) -> {
|
||||
dialog.setParams("AI状态", isAddRobot + "");
|
||||
dialog.setParams("清杆状态", isOneOverForMy + "");
|
||||
dialog.setParams("连击", comboNumberForMy + "");
|
||||
|
||||
if (position == -1) {
|
||||
dialog.setParams("参数", bean);
|
||||
}
|
||||
dialog.setView("关闭", new Button(AppManager.getInstance().getMainActivity()), new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,13 +95,68 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
||||
isOneOverForOther = -1;
|
||||
comboNumberForMy = 0;
|
||||
comboNumberForOther = 0;
|
||||
if (autoJoinRobotHandler != null) {
|
||||
autoJoinRobotHandler.removeCallbacks(autoJoinRobotRunnable);
|
||||
autoJoinRobotHandler = null;
|
||||
}
|
||||
aiInfo = null;
|
||||
if (onItemClickListener != null)
|
||||
onItemClickListener.onItemClick("", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGameState(CheckRemainingBalanceEvent event) {
|
||||
super.onGameState(event);
|
||||
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_GAME_LOAD_OVER)) {
|
||||
joinAiRobot();
|
||||
}
|
||||
if (event.getSudMGPMGState().equals(SudMGPMGState.MG_COMMON_PLAYER_IN)) {
|
||||
LogUtils.e("收到的回调: AI uid = " + getAiUid() + "| kickUid = " + event.getPlayerIn().kickUID);
|
||||
if (event.getPlayerIn().reason == 1 && aiInfo != null) {
|
||||
ToastUtil.show("踢掉了AI");
|
||||
reset();
|
||||
isAddRobot = false;
|
||||
} else if (event.getPlayerIn().isIn && getPlayerSize() < 2) {
|
||||
reset();
|
||||
joinAiRobot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getAiUid() {
|
||||
if (aiInfo == null) {
|
||||
return "";
|
||||
}
|
||||
if (aiInfo.getUids().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return aiInfo.getUids().get(0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void joinAiRobot() {
|
||||
if (!isAddRobot) return;
|
||||
if (!isRandom) return;
|
||||
if(!isCaptain)return;
|
||||
if (getPlayerSize() == 2) return;
|
||||
if (autoJoinRobotHandler != null) {
|
||||
autoJoinRobotHandler.removeCallbacks(autoJoinRobotRunnable);
|
||||
}
|
||||
autoJoinRobotHandler = new Handler(Looper.getMainLooper());
|
||||
autoJoinRobotHandler.postDelayed(autoJoinRobotRunnable, 5000);
|
||||
ToastUtil.show("启动定时器准备AI");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGameMGCommonGameBilliardsHitState(SudMGPMGState.MGCommonGameBilliardsHitState model) {
|
||||
ToastUtil.show("台球状态:" + model.state);
|
||||
if (Integer.parseInt(model.uid) == IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId()) {
|
||||
isOneOverForOther = 0;
|
||||
if (isOneOverForOther == 1) {
|
||||
isOneOverForOther = 0;
|
||||
}
|
||||
if (isOneOverForMy == -1) {
|
||||
isOneOverForMy = 1;
|
||||
}
|
||||
@ -57,11 +167,17 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
||||
comboNumberForMy = model.state;
|
||||
}
|
||||
}
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(model.state + "", -1);
|
||||
}
|
||||
} else {
|
||||
if (isOneOverForMy == 1) {
|
||||
isOneOverForMy = 0;
|
||||
}
|
||||
if (isOneOverForMy == 0) {
|
||||
isOneOverForMy = 2;
|
||||
onSendNotOneOver();
|
||||
}
|
||||
isOneOverForMy = 0;
|
||||
if (isOneOverForOther == -1) {
|
||||
isOneOverForOther = 1;
|
||||
}
|
||||
@ -73,15 +189,17 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
ToastUtil.show("台球状态:" + model.state + "| uid = " + model.uid + " | " + isOneOverForMy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onGameMGCommonGameSettle(SudMGPMGState.MGCommonGameSettle model) {
|
||||
System.out.println("游戏结束 :" + isOneOverForMy + "|" + comboNumberForMy);
|
||||
if (isOneOverForMy == 1 && comboNumberForMy > 1) {
|
||||
ToastUtil.show("一杆清");
|
||||
//ToastUtil.show("一杆清");
|
||||
model.achievement = WordUtil.getNewString(R.string.game_dialog_activity_achievements_0);
|
||||
} else if (comboNumberForMy > 0) {
|
||||
ToastUtil.show("连杆:" + comboNumberForMy);
|
||||
//ToastUtil.show("连杆:" + comboNumberForMy);
|
||||
switch (comboNumberForMy) {
|
||||
case 1:
|
||||
model.achievement = WordUtil.getNewString(R.string.game_dialog_activity_achievements_1);
|
||||
@ -106,13 +224,39 @@ public class BilliardsRandomManager extends AbsRandomGameManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent()
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null)
|
||||
.setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE)
|
||||
.setActivityGame(true)
|
||||
.setMgCommonGameSettle(model));
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
isAddRobot = true;
|
||||
reset();
|
||||
}
|
||||
|
||||
public void onAddAiPlayer() {
|
||||
if (isAddRobot && getPlayerSize() == 1) {
|
||||
ToastUtil.show("加入AI机器人");
|
||||
LiveNetManager.get(AppManager.getInstance().getMainActivity())
|
||||
.ballClearanceTableAiAdd(data.getSudGameRoomId(), new HttpCallback<>() {
|
||||
@Override
|
||||
public void onSuccess(SudGameAiInfo data) {
|
||||
if (data != null) {
|
||||
aiInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void onSendNotOneOver() {
|
||||
LiveNetManager.get(AppManager.getInstance().getMainActivity())
|
||||
.ballClearanceTableStatus(data.getSudGameRoomId(), new HttpCallback<BaseModel>() {
|
||||
|
@ -496,7 +496,7 @@ public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
public void onGameMGCommonGameSettle(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSettle model) {
|
||||
LogUtils.e("yqw=====>"+model);
|
||||
if(RandomSudGameManager.getManager().onGameMGCommonGameSettle(model)){
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE).setMgCommonGameSettle(model));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE).setMgCommonGameSettle(model));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,9 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
if (listener != null) {
|
||||
listener.onGameStarted();
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null)
|
||||
.setSudMGPMGState(SudMGPMGState.MG_GAME_LOAD_OVER)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,7 +186,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态
|
||||
SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class);
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN).setSubReady(false));
|
||||
// if (listener == null) {
|
||||
// ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
// } else {
|
||||
@ -223,7 +226,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
RandomSudGameManager.getManager().reset();
|
||||
}
|
||||
});
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN));
|
||||
// if (listener == null) {
|
||||
// ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
// } else {
|
||||
@ -243,7 +246,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class);
|
||||
sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState);
|
||||
if (mgCommonGameState.gameState == 2) {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_STATE));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_STATE));
|
||||
}
|
||||
if (listener == null) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
@ -266,7 +269,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
// } else {
|
||||
// listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn);
|
||||
// }
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强)
|
||||
SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class);
|
||||
@ -979,6 +982,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
} else {
|
||||
listener.onPlayerMGCommonPlayerIn(handle, userId, mgCommonPlayerIn);
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(userId).setSudMGPMGState(SudMGPMGState.MG_COMMON_PLAYER_IN).setPlayerIn(mgCommonPlayerIn));
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_PLAYER_READY: // 2.准备状态(已修改)
|
||||
|
||||
@ -998,6 +1002,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
|
||||
} else {
|
||||
listener.onPlayerMGCommonPlayerCaptain(handle, userId, mgCommonPlayerCaptain);
|
||||
}
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(userId).setSudMGPMGState(SudMGPMGState.MG_COMMON_PLAYER_CAPTAIN));
|
||||
break;
|
||||
case SudMGPMGState.MG_COMMON_PLAYER_PLAYING: // 4.游戏状态(已修改)
|
||||
SudMGPMGState.MGCommonPlayerPlaying mgCommonPlayerPlaying = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerPlaying.class);
|
||||
|
@ -17,7 +17,10 @@ import java.util.List;
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/MGFSM/
|
||||
*/
|
||||
public class SudMGPMGState implements Serializable {
|
||||
|
||||
/**
|
||||
* 自定义的,游戏加载完毕的通知
|
||||
*/
|
||||
public static final String MG_GAME_LOAD_OVER="game_load_over";
|
||||
// region MG状态机-通用状态-游戏
|
||||
// 参考文档:https://docs.sud.tech/zh-CN/app/Client/MGFSM/CommonStateGame.html
|
||||
/**
|
||||
@ -1012,6 +1015,16 @@ public class SudMGPMGState implements Serializable {
|
||||
|
||||
// 当reason==1时有效;kickUID为踢人的用户uid;判断被踢的人是本人条件(onPlayerStateChange(userId==kickedUID == selfUID);(kickUID默认"",无意义便于处理)
|
||||
public String kickUID;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MGCommonPlayerIn{" +
|
||||
"isIn=" + isIn +
|
||||
", teamId=" + teamId +
|
||||
", reason=" + reason +
|
||||
", kickUID='" + kickUID + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,10 +70,11 @@ public class RouteUtil {
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardSwSudGameActivity(String CreateSudRoom, boolean isActivityGame, boolean isHome) {
|
||||
public static void forwardSwSudGameActivity(String CreateSudRoom, boolean isActivityGame,boolean isRandomRankUser, boolean isHome) {
|
||||
ARouter.getInstance().build(PATH_SudSwGameActivity)
|
||||
.withString("CreateSudRoom", CreateSudRoom)
|
||||
.withBoolean("isRandom", isActivityGame)
|
||||
.withBoolean("isActivity", isActivityGame)
|
||||
.withBoolean("isRandomRankUser", isRandomRankUser)
|
||||
.withBoolean("CreateIsHome", isHome)
|
||||
.navigation();
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class LiveSudGamePopup extends BottomPopupView {
|
||||
//加载弹窗监听
|
||||
sudLoadDialog.setOnDismissListener(() -> {
|
||||
if (sudLoadDialog.getClickStatus() == 2){
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.event.CheckCurrencyModel;
|
||||
import com.yunbao.common.event.LiveOpenSudRoomEvent;
|
||||
@ -127,34 +128,34 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
Bus.get().post(new SudGameListRefreshEvent());
|
||||
} else {
|
||||
if (TextUtils.equals(model.getIsActivity(), "1")) {
|
||||
LiveNetManager.get(itemView.getContext())
|
||||
.checkCurrency(new com.yunbao.common.http.base.HttpCallback<CheckCurrencyModel>() {
|
||||
@Override
|
||||
public void onSuccess(CheckCurrencyModel currencyModel) {
|
||||
if (currencyModel.getZqTicketNumberInt() < 1) {
|
||||
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
toGame(model, isHome, currencyModel,true);
|
||||
}
|
||||
LiveNetManager.get(mAvatar.getContext())
|
||||
.getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback<SudGameScoreBean>() {
|
||||
@Override
|
||||
public void onSuccess(SudGameScoreBean data) {
|
||||
if(data.getGolden_bean_remaining_balance()!=1){
|
||||
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
toGame(model, isHome, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
toGame(model, isHome, currencyModel,true);
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
toGame(model, isHome, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
toGame(model, isHome, null,false);
|
||||
toGame(model, isHome, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -170,7 +171,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
private void toGame(SudRoomListModel model, boolean isHome, CheckCurrencyModel currencyModel,boolean isActivity) {
|
||||
private void toGame(SudRoomListModel model, boolean isHome,boolean isActivity) {
|
||||
|
||||
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
@ -182,7 +183,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
if (isHome) {
|
||||
if (TextUtils.equals(model.getLiveUid(), "0")) {
|
||||
if (CommonAppConfig.getInstance().getConfig().isSw()) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), isActivity, isHome);
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), isActivity,false, isHome);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
|
||||
}
|
||||
@ -234,7 +235,7 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
if (CommonAppConfig.getInstance().getConfig().isSw()) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true,false, isHome);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
|
||||
}
|
||||
|
@ -222,6 +222,7 @@
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
|
@ -1,31 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/sud_load_bg"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sud_load"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/sud_load_zh"
|
||||
android:layout_marginTop="16dp"/>
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@mipmap/sud_load_zh" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_marginTop="19dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp">
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="19dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/sud_load_bar_double"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:visibility="gone"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading_double"
|
||||
android:indeterminateDuration="500"/>
|
||||
android:indeterminateDuration="500"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/sud_load_bar_multiple"
|
||||
@ -33,32 +34,44 @@
|
||||
android:layout_height="100dp"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading_multiple"
|
||||
android:indeterminateDuration="500"/>
|
||||
android:indeterminateDuration="500" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sud_activity_tips_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:text="@string/game_dialog_loading_tips_text" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sud_load_skip"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:src="@mipmap/sud_load_skip_zh"/>
|
||||
android:src="@mipmap/sud_load_skip_zh" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/sud_load_again"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/sub_again_zh"/>
|
||||
android:src="@mipmap/sub_again_zh" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
@ -1547,6 +1547,7 @@
|
||||
<string name="live_end_view_ban_timer">處罰時間:</string>
|
||||
<string name="game_create_coid_ticket">門票</string>
|
||||
<string name="game_list_activity_title">挑戰一桿清台,瓜分高額獎金</string>
|
||||
<string name="game_dialog_loading_tips_text">結算超時,請前往活動頁面查看本局結果</string>
|
||||
<string name="game_dialog_activity_achievements_title">恭喜您本局完成</string>
|
||||
<string name="game_dialog_activity_achievements_0">一桿清台</string>
|
||||
<string name="game_dialog_activity_achievements_1">1連桿</string>
|
||||
|
@ -1556,6 +1556,7 @@
|
||||
<string name="live_end_view_ban_timer">Penalty time:</string>
|
||||
<string name="game_create_coid_ticket">Ticket</string>
|
||||
<string name="game_list_activity_title">Challenge One-shot clearance Share high bonuses</string>
|
||||
<string name="game_dialog_loading_tips_text"> Settlement timed out. Please check the result on the event page</string>
|
||||
<string name="game_dialog_activity_achievements_title">Your office has completed </string>
|
||||
<string name="game_dialog_activity_achievements_0">One-shotclearance</string>
|
||||
<string name="game_dialog_activity_achievements_1">1 Combo</string>
|
||||
|
@ -487,7 +487,7 @@ public class SudRyGameActivity extends AbsActivity implements GameRyMicManager.M
|
||||
//加载弹窗监听
|
||||
sudLoadDialog.setOnDismissListener(() -> {
|
||||
if (sudLoadDialog.getClickStatus() == 2){
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -265,16 +265,20 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
}
|
||||
|
||||
private boolean isActivityGame;
|
||||
private boolean isRandomRankUser;
|
||||
|
||||
private void initView() {
|
||||
isActivityGame = getIntent().getBooleanExtra("isRandom", false);
|
||||
isActivityGame = getIntent().getBooleanExtra("isActivity", false);
|
||||
isRandomRankUser = getIntent().getBooleanExtra("isRandomRankUser", false);
|
||||
String createSudRoomJson = getIntent().getStringExtra("CreateSudRoom");
|
||||
mCreateSudRoomModel = new Gson().fromJson(createSudRoomJson, CreateSudRoomModel.class);
|
||||
mInteractionID = mCreateSudRoomModel.getLongSudGameId();
|
||||
mLiveUid = mCreateSudRoomModel.getSudGameRoomId();
|
||||
//第二次进入时,viewmodel数据丢失,所以初始化时直接获取
|
||||
gameViewModel.getScore(mCreateSudRoomModel.getSudGameRoomId(), mContext);
|
||||
|
||||
if(isActivityGame){
|
||||
RandomSudGameManager.getManager().setGameViewModel(gameViewModel);
|
||||
}
|
||||
gameContainer = findViewById(R.id.game_container);
|
||||
roomName = findViewById(R.id.room_name);
|
||||
roomNumber = findViewById(R.id.room_number);
|
||||
@ -525,6 +529,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
sudLoadDialog = new SudLoadDialog(this);//加载弹窗
|
||||
if (isActivityGame) {
|
||||
sudGameDoubleDialog.setActivityGame();
|
||||
sudLoadDialog.setActivityGame();
|
||||
}
|
||||
//游戏结算结束
|
||||
gameViewModel.listMutableLiveData.observe(this, sudSettleBeans -> {
|
||||
@ -546,7 +551,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
//加载弹窗消失监听,自动消失和点击跳过在这个监听中都不做处理
|
||||
sudLoadDialog.setOnDismissListener(() -> {
|
||||
if (sudLoadDialog.getClickStatus() == 2) {
|
||||
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false));
|
||||
}
|
||||
});
|
||||
//通知活动游戏
|
||||
@ -557,6 +562,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
|
||||
LogUtils.e("收到的回调:"+event.getSudMGPMGState()+"|"+event.getPlayerIn());
|
||||
if (isActivityGame) {
|
||||
RandomSudGameManager.getManager().onGameState(event);
|
||||
}
|
||||
@ -605,10 +611,10 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
@Override
|
||||
public void onSuccess(List<SudGameInfoBean> infoBean) {
|
||||
if (!infoBean.isEmpty()) {
|
||||
System.out.println("结算,是否为游戏活动:"+isActivityGame);
|
||||
if(isActivityGame) {
|
||||
System.out.println("结算,是否为游戏活动:" + isActivityGame);
|
||||
if (isActivityGame) {
|
||||
loadScore(infoBean, 3);
|
||||
}else{
|
||||
} else {
|
||||
gameViewModel.setSudGameInfoBeanList(infoBean);
|
||||
gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏
|
||||
}
|
||||
@ -617,8 +623,8 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
}
|
||||
}
|
||||
|
||||
private void loadScore(List<SudGameInfoBean> infoBean,int index) {
|
||||
if(index==0){
|
||||
private void loadScore(List<SudGameInfoBean> infoBean, int index) {
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
LiveNetManager.get(mContext)
|
||||
@ -627,7 +633,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
public void onSuccess(List<SudActivityGameInfoBean> data) {
|
||||
if (data.isEmpty()) {
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
loadScore(infoBean,index-1);
|
||||
loadScore(infoBean, index - 1);
|
||||
}, 300);
|
||||
return;
|
||||
}
|
||||
@ -670,9 +676,16 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
|
||||
case SudMGPMGState.MG_COMMON_GAME_STATE:
|
||||
LiveNetManager.get(mContext).deductMoney(mCreateSudRoomModel.getSudGameRoomId());
|
||||
break;
|
||||
case SudMGPMGState.MG_GAME_LOAD_OVER:
|
||||
if(isActivityGame&&isRandomRankUser) {
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, -1, true, 1);
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfReady(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onJoinRoomSuccess(RCRTCRoom rcrtcRoom) {
|
||||
LiveNetManager.get(mContext).getRoomMicData(mLiveUid, new HttpCallback<List<SudGameUserModel>>() {
|
||||
|
@ -15,6 +15,7 @@ import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.dialog.GiftWallDialog;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.RandomSudGameManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
@ -71,7 +72,8 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
|
||||
/* new GiftWallDialog(mContext, IMLoginManager.get(mContext).getUserInfo().getId() + "",
|
||||
IMLoginManager.get(mContext).getUserInfo().getUserNicename(), null
|
||||
, false).setFullWindows(true).setTab2(true).showDialog();*/
|
||||
RouteUtil.forwardBattlePass();
|
||||
// RouteUtil.forwardBattlePass();
|
||||
RandomSudGameManager.getManager().random(mContext);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user