● 游戏结束后,会出现两个选择:【再来一局】或【退出】,不论点击哪个按钮,都将回到游戏初始界面,用户都需手动再次上位、准备,修改为点击【退出】的逻辑不变,点击【再来一局】时,将会先判断用户的金豆数量是否足够参与下局游戏,若金豆数量不足,则弹出不足的提示,并回到游戏初始界面,若金豆数量足够,则直接回到座位,并自动准备本局游戏;

● 在点击加入游戏和开始游戏时,进行双重的金豆余额判断,如果余额不够进行游戏,则无法开始,并提示‘金豆不足’,如果两次判断余额充足,则正常开始游戏;
● 随机游戏房间名:1.一起玩吧! 2.來戰斗吧! 3.你的籌碼我收下了! 4.在線等遊戲夥伴~ 5.決戰到天亮 6.‘用户名’的房间(例:范德萨的房间
This commit is contained in:
18401019693 2023-11-07 14:46:45 +08:00
parent d7bc2615d6
commit 92e6b563e4
14 changed files with 371 additions and 168 deletions

View File

@ -27,7 +27,6 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import java.util.Locale; import java.util.Locale;
public class SudGameActivity extends AbsActivity { public class SudGameActivity extends AbsActivity {
@ -97,10 +96,12 @@ public class SudGameActivity extends AbsActivity {
GameConfigModel gameConfigModel = gameViewModel.getGameConfigModel(); GameConfigModel gameConfigModel = gameViewModel.getGameConfigModel();
gameConfigModel.ui.ping.hide = true; // 配置不隐藏ping值 gameConfigModel.ui.ping.hide = true; // 配置不隐藏ping值
gameConfigModel.ui.level.hide = true; // 配置不隐藏ping值 gameConfigModel.ui.level.hide = true; // 配置不隐藏ping值
gameConfigModel.ui.lobby_game_setting.hide = true; // 配置不隐藏ping值
gameConfigModel.ui.lobby_players.custom = true; gameConfigModel.ui.lobby_players.custom = true;
gameConfigModel.ui.join_btn.custom = true; gameConfigModel.ui.join_btn.custom = true;
gameConfigModel.ui.lobby_game_setting.hide = true; // 配置不隐藏ping值 gameConfigModel.ui.game_settle_again_btn.custom = true;
gameConfigModel.ui.start_btn.custom = true;
// SudMGP平台64bit游戏ID // SudMGP平台64bit游戏ID
gameViewModel.switchGame((Activity) mContext, mLiveUid, mInteractionID); gameViewModel.switchGame((Activity) mContext, mLiveUid, mInteractionID);
@ -118,32 +119,57 @@ public class SudGameActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
if (event.getResults().size() > 0) { switch (event.getSudMGPMGState()) {
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1); case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN:
} else { case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN:
LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() { LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
@Override @Override
public void onSuccess(CheckRemainingBalance data) { public void onSuccess(CheckRemainingBalance data) {
if (data.getGoldenBeanRemainingBalance() == 1) { if (data.getGoldenBeanRemainingBalance() == 1) {
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1);
} else { } else {
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("金豆不够 ");
} else {
ToastUtil.show("Insufficient money ");
}
}
}
@Override
public void onError(String error) {
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("金豆不够 "); ToastUtil.show("金豆不够 ");
}else { } else {
ToastUtil.show("Insufficient money "); ToastUtil.show("Insufficient money ");
} }
} }
} });
break;
case SudMGPMGState.MG_COMMON_GAME_SETTLE:
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1);
break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN:
LiveNetManager.get(mContext).gameStartCheckRemainingBalance(mCreateSudRoomModel.getSudGameId(),
mCreateSudRoomModel.getSudGameRoomId(), new
HttpCallback<CheckRemainingBalance>() {
@Override
public void onSuccess(CheckRemainingBalance data) {
if (data.getStatus()==1){
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfPlaying(true);
}else {
@Override }
public void onError(String error) {
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { }
ToastUtil.show("金豆不够 ");
}else { @Override
ToastUtil.show("Insufficient money "); public void onError(String error) {
} ToastUtil.show(error);
} }
}); });
break;
} }
} }

View File

@ -2,16 +2,27 @@ package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class CheckRemainingBalance extends BaseModel{ public class CheckRemainingBalance extends BaseModel {
@SerializedName("golden_bean_remaining_balance") @SerializedName("golden_bean_remaining_balance")
private int goldenBeanRemainingBalance; private int goldenBeanRemainingBalance;
@SerializedName("status")
private int status;
public int getGoldenBeanRemainingBalance() { public int getStatus() {
return goldenBeanRemainingBalance; return status;
} }
public void setGoldenBeanRemainingBalance(int goldenBeanRemainingBalance) { public CheckRemainingBalance setStatus(int status) {
this.goldenBeanRemainingBalance = goldenBeanRemainingBalance; this.status = status;
} return this;
}
public int getGoldenBeanRemainingBalance() {
return goldenBeanRemainingBalance;
}
public void setGoldenBeanRemainingBalance(int goldenBeanRemainingBalance) {
this.goldenBeanRemainingBalance = goldenBeanRemainingBalance;
}
} }

View File

@ -28,7 +28,7 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveSudGamePopup; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -37,6 +37,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Random;
public class CreateSudGamePopup extends BottomPopupView { public class CreateSudGamePopup extends BottomPopupView {
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>(); private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
@ -46,6 +47,7 @@ public class CreateSudGamePopup extends BottomPopupView {
private String id; private String id;
private boolean isHomeView; private boolean isHomeView;
private boolean isHome = false; private boolean isHome = false;
private List<String> roomNames = new ArrayList<>();
public CreateSudGamePopup(@NonNull Context context, List<CustomSidebarChildModel> child, boolean isHome) { public CreateSudGamePopup(@NonNull Context context, List<CustomSidebarChildModel> child, boolean isHome) {
super(context); super(context);
@ -72,13 +74,21 @@ public class CreateSudGamePopup extends BottomPopupView {
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
Bus.getOn(this); Bus.getOn(this);
initView();
initDate(); initDate();
initView();
} }
private void initDate() { private String userName;
private void initDate() {
userName = IMLoginManager.get(getContext()).getUserInfo().getUserNicename();
roomNames.add(WordUtil.isNewZh() ? "一起玩吧!" : "Let's play together!");
roomNames.add(WordUtil.isNewZh() ? "來戰斗吧!" : "Let's fight!");
roomNames.add(WordUtil.isNewZh() ? "你的籌碼我收下了!" : ".I have taken your chips!");
roomNames.add(WordUtil.isNewZh() ? "在線等遊戲夥伴~" : "Waiting for game partners online~ ");
roomNames.add(WordUtil.isNewZh() ? "決戰到天亮 " : "Fight until dawn");
roomNames.add(WordUtil.isNewZh() ? userName + "的房间 " : userName + "s room");
} }
private void initView() { private void initView() {
@ -169,14 +179,14 @@ public class CreateSudGamePopup extends BottomPopupView {
} }
return; return;
} }
if (sill.length() > 6 ){ if (sill.length() > 6) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("数量区间为100--5W"); ToastUtil.show("数量区间为100--5W");
} else { } else {
ToastUtil.show("The quantity range is 100 to 5 W"); ToastUtil.show("The quantity range is 100 to 5 W");
} }
return; return;
}else { } else {
int sillNumber = Integer.parseInt(sill); int sillNumber = Integer.parseInt(sill);
if (sillNumber < 100 || sillNumber > 50000) { if (sillNumber < 100 || sillNumber > 50000) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
@ -186,7 +196,7 @@ public class CreateSudGamePopup extends BottomPopupView {
} }
return; return;
} }
if (sillNumber%10!=0){ if (sillNumber % 10 != 0) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("金豆數量必須為10的倍數"); ToastUtil.show("金豆數量必須為10的倍數");
} else { } else {
@ -221,6 +231,15 @@ public class CreateSudGamePopup extends BottomPopupView {
}); });
} }
}); });
roomName.setText(WordUtil.isNewZh() ? userName + "的房间 " : userName + "s room");
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.create_game_random), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Random random = new Random();
int randomNumber = random.nextInt(roomNames.size());
roomName.setText(roomNames.get(randomNumber));
}
});
} }
@Override @Override

View File

@ -1,21 +1,17 @@
package com.yunbao.common.event; package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.sud.state.SudMGPMGState;
import java.util.ArrayList;
import java.util.List;
public class CheckRemainingBalanceEvent extends BaseModel { public class CheckRemainingBalanceEvent extends BaseModel {
public int seatIndex; public int seatIndex=0;
public List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results = new ArrayList<>(); private String SudMGPMGState;
public List<SudMGPMGState.MGCommonGameSettle.PlayerResult> getResults() { public String getSudMGPMGState() {
return results; return SudMGPMGState;
} }
public CheckRemainingBalanceEvent setResults(List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results) { public CheckRemainingBalanceEvent setSudMGPMGState(String sudMGPMGState) {
this.results = results; SudMGPMGState = sudMGPMGState;
return this; return this;
} }

View File

@ -1048,5 +1048,9 @@ public interface PDLiveApi {
@GET("/api/public/?service=Home.activityPopup") @GET("/api/public/?service=Home.activityPopup")
Observable<ResponseModel<List<OpenAdModel>>> activityPopup(); Observable<ResponseModel<List<OpenAdModel>>> activityPopup();
@GET("/api/public/?service=Sudgameserver.gameStartCheckRemainingBalance")
Observable<ResponseModel<CheckRemainingBalance>> gameStartCheckRemainingBalance(
@Query("mg_id") String mgId,
@Query("room_id") String roomId
);
} }

View File

@ -63,6 +63,7 @@ import com.yunbao.common.http.API;
import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.http.base.CheckLiveCallBack; import com.yunbao.common.http.base.CheckLiveCallBack;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.WordUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -2314,6 +2315,34 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void gameStartCheckRemainingBalance(String mgId, String roomId, HttpCallback<CheckRemainingBalance> callback) {
API.get().pdLiveApi(mContext)
.gameStartCheckRemainingBalance(mgId, roomId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<CheckRemainingBalance>>() {
@Override
public void accept(ResponseModel<CheckRemainingBalance> createSudRoomModelResponseModel) throws Exception {
if (callback != null) {
if (createSudRoomModelResponseModel.getData().getInfo().getStatus() == 1) {
callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo());
} else {
callback.onError(createSudRoomModelResponseModel.getData().getMsg());
}
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(WordUtil.isNewZh() ? "金豆不够" : "Insufficient money ");
}
}
}).isDisposed();
}
public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback<List<SudRoomListModel>> callback) { public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback<List<SudRoomListModel>> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.getRoomList(sudGameId, threshold, roomHolderType, liveUid, page) .getRoomList(sudGameId, threshold, roomHolderType, liveUid, page)

View File

@ -173,11 +173,11 @@ public class SudFSMMGDecorator implements ISudFSMMG {
} else { } else {
listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle); listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle);
} }
Bus.get().post(new CheckRemainingBalanceEvent().setResults(mgCommonGameSettle.results)); Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_SETTLE));
break; break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态 case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态
SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class); SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class);
Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex)); Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex).setSudMGPMGState( SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN));
// if (listener == null) { // if (listener == null) {
// ISudFSMStateHandleUtils.handleSuccess(handle); // ISudFSMStateHandleUtils.handleSuccess(handle);
// } else { // } else {
@ -211,11 +211,12 @@ public class SudFSMMGDecorator implements ISudFSMMG {
break; break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN: // 8. 开始游戏按钮点击状态 case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN: // 8. 开始游戏按钮点击状态
SudMGPMGState.MGCommonSelfClickStartBtn mgCommonSelfClickStartBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickStartBtn.class); SudMGPMGState.MGCommonSelfClickStartBtn mgCommonSelfClickStartBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickStartBtn.class);
if (listener == null) { Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState( SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN));
ISudFSMStateHandleUtils.handleSuccess(handle); // if (listener == null) {
} else { // ISudFSMStateHandleUtils.handleSuccess(handle);
listener.onGameMGCommonSelfClickStartBtn(handle, mgCommonSelfClickStartBtn); // } else {
} // listener.onGameMGCommonSelfClickStartBtn(handle, mgCommonSelfClickStartBtn);
// }
break; break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_SHARE_BTN: // 9. 分享按钮点击状态 case SudMGPMGState.MG_COMMON_SELF_CLICK_SHARE_BTN: // 9. 分享按钮点击状态
SudMGPMGState.MGCommonSelfClickShareBtn mgCommonSelfClickShareBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickShareBtn.class); SudMGPMGState.MGCommonSelfClickShareBtn mgCommonSelfClickShareBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickShareBtn.class);
@ -244,11 +245,12 @@ public class SudFSMMGDecorator implements ISudFSMMG {
break; break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN: // 12. 结算界面再来一局按钮点击状态2021-12-27新增 case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN: // 12. 结算界面再来一局按钮点击状态2021-12-27新增
SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn mgCommonSelfClickGameSettleAgainBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn.class); SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn mgCommonSelfClickGameSettleAgainBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn.class);
if (listener == null) { // if (listener == null) {
ISudFSMStateHandleUtils.handleSuccess(handle); // ISudFSMStateHandleUtils.handleSuccess(handle);
} else { // } else {
listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn); // listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn);
} // }
Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN));
break; break;
case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表2021-12-30新增现在只支持碰碰我最强 case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表2021-12-30新增现在只支持碰碰我最强
SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class); SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class);

View File

@ -89,13 +89,13 @@ public class SudFSTAPPDecorator {
* @param isPlaying true 开始游戏false 结束游戏 * @param isPlaying true 开始游戏false 结束游戏
* @param reportGameInfoExtras string类型Https服务回调report_game_info参数最大长度1024字节超过则截断2022-01-21 * @param reportGameInfoExtras string类型Https服务回调report_game_info参数最大长度1024字节超过则截断2022-01-21
*/ */
public void notifyAPPCommonSelfPlaying(boolean isPlaying, String reportGameInfoExtras, String reportGameInfoKey) { public void notifyAPPCommonSelfPlaying(boolean isPlaying) {
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP; ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
if (iSudFSTAPP != null) { if (iSudFSTAPP != null) {
SudMGPAPPState.APPCommonSelfPlaying state = new SudMGPAPPState.APPCommonSelfPlaying(); SudMGPAPPState.APPCommonSelfPlaying state = new SudMGPAPPState.APPCommonSelfPlaying();
state.isPlaying = isPlaying; state.isPlaying = isPlaying;
state.reportGameInfoExtras = reportGameInfoExtras; // state.reportGameInfoExtras = reportGameInfoExtras;
state.reportGameInfoKey = reportGameInfoKey; // state.reportGameInfoKey = reportGameInfoKey;
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_PLAYING, SudJsonUtils.toJson(state), null); iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_PLAYING, SudJsonUtils.toJson(state), null);
} }
} }

View File

@ -25,6 +25,7 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.sud.QuickStartGameViewModel; import com.yunbao.common.sud.QuickStartGameViewModel;
import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.sud.model.GameConfigModel;
import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -32,6 +33,8 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
@ -47,6 +50,7 @@ public class LiveSudGamePopup extends BottomPopupView {
private TextView gameTitle, roomName, roomNumber; private TextView gameTitle, roomName, roomNumber;
private RoundedImageView mAvatar; private RoundedImageView mAvatar;
public LiveSudGamePopup(@NonNull Context context, long interactionID, String liveUid) { public LiveSudGamePopup(@NonNull Context context, long interactionID, String liveUid) {
super(context); super(context);
mInteractionID = interactionID; mInteractionID = interactionID;
@ -147,6 +151,8 @@ public class LiveSudGamePopup extends BottomPopupView {
gameConfigModel.ui.lobby_players.custom = true; gameConfigModel.ui.lobby_players.custom = true;
gameConfigModel.ui.join_btn.custom = true; gameConfigModel.ui.join_btn.custom = true;
gameConfigModel.ui.game_settle_again_btn.custom = true;
gameConfigModel.ui.start_btn.custom = true;
// SudMGP平台64bit游戏ID // SudMGP平台64bit游戏ID
gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID); gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID);
} }
@ -154,9 +160,11 @@ public class LiveSudGamePopup extends BottomPopupView {
private void initDate() { private void initDate() {
} }
public void BusGetOff(){
public void BusGetOff() {
Bus.getOff(this); Bus.getOff(this);
} }
@Override @Override
public void dismiss() { public void dismiss() {
@ -178,34 +186,59 @@ public class LiveSudGamePopup extends BottomPopupView {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
if (event.getResults().size() > 0) { switch (event.getSudMGPMGState()) {
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1); case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN:
} else { case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN:
LiveNetManager.get(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() { LiveNetManager.get(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
@Override @Override
public void onSuccess(CheckRemainingBalance data) { public void onSuccess(CheckRemainingBalance data) {
if (data.getGoldenBeanRemainingBalance() == 1) { if (data.getGoldenBeanRemainingBalance() == 1) {
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1);
} else { } else {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("金豆不够 ");
} else {
ToastUtil.show("Insufficient money ");
}
}
}
@Override
public void onError(String error) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("金豆不够 "); ToastUtil.show("金豆不够 ");
} else { } else {
ToastUtil.show("Insufficient money "); ToastUtil.show("Insufficient money ");
} }
} }
} });
break;
case SudMGPMGState.MG_COMMON_GAME_SETTLE:
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1);
break;
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN:
LiveNetManager.get(getContext()).gameStartCheckRemainingBalance(mCreateSudRoomModel.getSudGameId(),
mCreateSudRoomModel.getSudGameRoomId(), new
HttpCallback<CheckRemainingBalance>() {
@Override
public void onSuccess(CheckRemainingBalance data) {
if (data.getStatus()==1){
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfPlaying(true);
}else {
@Override }
public void onError(String error) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { }
ToastUtil.show("金豆不够 ");
} else { @Override
ToastUtil.show("Insufficient money "); public void onError(String error) {
} ToastUtil.show(error);
} }
}); });
break;
} }
} }
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="14dp" />
<solid android:color="#FFB72B" />
</shape>

View File

@ -40,45 +40,66 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="50dp" android:layout_marginTop="30dp"
android:gravity="center_vertical"> android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:gravity="end" android:gravity="start"
android:text="@string/interactive_game_create_room_name" android:text="@string/interactive_game_create_room_name"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
<EditText
android:id="@+id/room_name" <LinearLayout
android:layout_width="175dp" android:layout_width="wrap_content"
android:layout_height="32dp" android:layout_height="wrap_content"
android:background="@drawable/bg_live_sud_list_input" android:layout_marginTop="10dp"
android:hint="@string/interactive_game_create_room_name_input" android:gravity="center_vertical">
android:paddingStart="12dp"
android:paddingTop="9dp" <EditText
android:paddingBottom="9dp" android:id="@+id/room_name"
android:textColor="@color/white" android:layout_width="175dp"
android:textColorHint="#FFFFFF" android:layout_height="32dp"
android:textSize="10sp" /> android:background="@drawable/bg_live_sud_list_input"
android:hint="@string/interactive_game_create_room_name_input"
android:paddingStart="12dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:textColor="@color/white"
android:textColorHint="#FFFFFF"
android:textSize="10sp" />
<TextView
android:id="@+id/create_game_random"
android:layout_width="57dp"
android:layout_height="28dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_live_sud_random_home"
android:gravity="center"
android:text="@string/sud_in_game_random_name"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="26dp" android:layout_marginTop="26dp"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:gravity="end" android:gravity="start"
android:text="@string/interactive_game_create_game_type" android:text="@string/interactive_game_create_game_type"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
@ -87,6 +108,7 @@
android:id="@+id/create_game_type" android:id="@+id/create_game_type"
android:layout_width="175dp" android:layout_width="175dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_live_sud_list_input" android:background="@drawable/bg_live_sud_list_input"
android:paddingStart="12dp" android:paddingStart="12dp"
android:paddingTop="9dp" android:paddingTop="9dp"
@ -99,36 +121,52 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="26dp" android:layout_marginTop="26dp"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:gravity="end" android:gravity="start"
android:text="@string/interactive_game_create_game_sill" android:text="@string/interactive_game_create_game_sill"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
<EditText <LinearLayout
android:id="@+id/game_sill" android:layout_width="wrap_content"
android:layout_width="175dp" android:layout_height="wrap_content"
android:layout_height="32dp" android:layout_marginTop="10dp">
android:background="@drawable/bg_live_sud_list_input"
android:ellipsize="end" <LinearLayout
android:hint="@string/interactive_game_create_gold_bean_quantity" android:layout_width="58dp"
android:inputType="numberDecimal" android:layout_height="32dp"
android:maxEms="5" android:background="@drawable/bg_live_sud_list_input">
android:paddingStart="12dp"
android:paddingTop="9dp" </LinearLayout>
android:singleLine="true"
android:paddingBottom="9dp" <EditText
android:digits="1234567890" android:id="@+id/game_sill"
android:textColor="@color/white" android:layout_width="175dp"
android:textColorHint="#FFFFFF" android:layout_height="32dp"
android:textSize="10sp" /> android:layout_marginStart="10dp"
android:background="@drawable/bg_live_sud_list_input"
android:digits="1234567890"
android:ellipsize="end"
android:hint="@string/interactive_game_create_gold_bean_quantity"
android:inputType="numberDecimal"
android:maxEms="5"
android:paddingStart="12dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:singleLine="true"
android:textColor="@color/white"
android:textColorHint="#FFFFFF"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView

View File

@ -41,54 +41,76 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="50dp" android:layout_marginTop="30dp"
android:gravity="center_vertical"> android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:gravity="end"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:gravity="start"
android:text="@string/interactive_game_create_room_name" android:text="@string/interactive_game_create_room_name"
android:textColor="#000" android:textColor="#000"
android:layout_marginEnd="5dp"
android:textSize="14sp" /> android:textSize="14sp" />
<EditText <LinearLayout
android:id="@+id/room_name" android:layout_width="wrap_content"
android:layout_width="175dp" android:layout_height="wrap_content"
android:layout_height="32dp" android:layout_marginTop="10dp"
android:background="@drawable/bg_live_sud_list_input_home" android:gravity="center_vertical">
android:hint="@string/interactive_game_create_room_name_input"
android:paddingStart="12dp" <EditText
android:singleLine="true" android:id="@+id/room_name"
android:paddingTop="9dp" android:layout_width="175dp"
android:paddingBottom="9dp" android:layout_height="32dp"
android:textColor="#E6000000" android:background="@drawable/bg_live_sud_list_input_home"
android:textColorHint="#E6000000" android:hint="@string/interactive_game_create_room_name_input"
android:textSize="10sp" /> android:paddingStart="12dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:singleLine="true"
android:textColor="#E6000000"
android:textColorHint="#E6000000"
android:textSize="10sp" />
<TextView
android:id="@+id/create_game_random"
android:layout_width="57dp"
android:layout_height="28dp"
android:layout_marginStart="10dp"
android:background="@drawable/bg_live_sud_random_home"
android:gravity="center"
android:text="@string/sud_in_game_random_name"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="26dp" android:layout_marginTop="26dp"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:gravity="end"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:gravity="start"
android:text="@string/interactive_game_create_game_type" android:text="@string/interactive_game_create_game_type"
android:textColor="#000" android:textColor="#000"
android:layout_marginEnd="5dp"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/create_game_type" android:id="@+id/create_game_type"
android:layout_width="175dp" android:layout_width="175dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_live_sud_list_input_home" android:background="@drawable/bg_live_sud_list_input_home"
android:paddingStart="12dp" android:paddingStart="12dp"
android:paddingTop="9dp" android:paddingTop="9dp"
@ -101,36 +123,53 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginStart="72dp"
android:layout_marginTop="26dp" android:layout_marginTop="26dp"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="vertical">
<TextView <TextView
android:layout_width="120dp" android:layout_width="120dp"
android:gravity="end"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:gravity="start"
android:text="@string/interactive_game_create_game_sill" android:text="@string/interactive_game_create_game_sill"
android:textColor="#000" android:textColor="#000"
android:layout_marginEnd="5dp"
android:textSize="14sp" /> android:textSize="14sp" />
<EditText <LinearLayout
android:id="@+id/game_sill" android:layout_width="wrap_content"
android:layout_width="175dp" android:layout_height="wrap_content"
android:layout_height="32dp" android:layout_marginTop="10dp">
android:digits="1234567890"
android:background="@drawable/bg_live_sud_list_input_home" <LinearLayout
android:hint="@string/interactive_game_create_gold_bean_quantity" android:layout_width="58dp"
android:inputType="numberDecimal" android:layout_height="32dp"
android:paddingStart="12dp" android:background="@drawable/bg_live_sud_list_input_home">
android:singleLine="true"
android:ellipsize="end" </LinearLayout>
android:maxEms="5"
android:paddingTop="9dp" <EditText
android:paddingBottom="9dp" android:id="@+id/game_sill"
android:textColor="#E6000000" android:layout_width="175dp"
android:textColorHint="#E6000000" android:layout_height="32dp"
android:textSize="10sp" /> android:layout_marginStart="10dp"
android:background="@drawable/bg_live_sud_list_input_home"
android:digits="1234567890"
android:ellipsize="end"
android:hint="@string/interactive_game_create_gold_bean_quantity"
android:inputType="numberDecimal"
android:maxEms="5"
android:paddingStart="12dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:singleLine="true"
android:textColor="#E6000000"
android:textColorHint="#E6000000"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView

View File

@ -1370,4 +1370,5 @@ Limited ride And limited avatar frame</string>
<string name="the_live_room">Exiting the live room will synchronize with exiting the game room. \ n Do you want to continue</string> <string name="the_live_room">Exiting the live room will synchronize with exiting the game room. \ n Do you want to continue</string>
<string name="sud_in_game">IN GAME</string> <string name="sud_in_game">IN GAME</string>
<string name="sud_in_game_minimize">minimize</string> <string name="sud_in_game_minimize">minimize</string>
<string name="sud_in_game_random_name">随机</string>
</resources> </resources>

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : " https://ceshi.yaoulive.com", serverHost : " https://ceshi.yaoulive.com",