diff --git a/app/build.gradle b/app/build.gradle index 12ded74d9..3378311dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -98,11 +98,12 @@ android { def processManifestTask = project.tasks.getByName("process${variantName}Manifest") processManifestTask.doLast { pm -> // String manifestPath = "build/intermediates/bundle_manifest/google_onlineRelease/bundle-manifest/AndroidManifest.xml" - String manifestPath = "build/intermediates/merged_manifests/google_onlineRelease/processGoogle_onlineReleaseManifest/AndroidManifest.xml" - def isGooglePlay = variant.name.contains("google") + String manifestPath = "build/intermediates/merged_manifests/${variant.name}/process${variantName}Manifest/AndroidManifest.xml" + def isGooglePlay = !variant.name.contains("link") + println "variant = ${variant.name}" println "谷歌版本:" + isGooglePlay println "文件存在" + file(manifestPath).exists() - println "" + (isGooglePlay == 1) + println "" + (isGooglePlay) println "" + (file(manifestPath).exists() && isGooglePlay) if (file(manifestPath).exists() && isGooglePlay) { def manifestContent = file(manifestPath).getText() diff --git a/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java b/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java index 3afcad115..3875882a5 100644 --- a/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java +++ b/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java @@ -32,6 +32,7 @@ public class CreateSudRoomModel extends BaseModel { private String mgId; @SerializedName("sud_game_icon") private String sudGameIcon; + private boolean isActivity;//活动游戏 public String getSudGameRoomId() { return sudGameRoomId; @@ -161,4 +162,12 @@ public class CreateSudRoomModel extends BaseModel { this.sudGameIcon = sudGameIcon; return this; } + + public void setActivity(boolean isActivity) { + this.isActivity=isActivity; + } + + public boolean isActivity() { + return isActivity; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/SudGameActivityInfoRoomBean.java b/common/src/main/java/com/yunbao/common/bean/SudGameActivityInfoRoomBean.java new file mode 100644 index 000000000..639253f9c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudGameActivityInfoRoomBean.java @@ -0,0 +1,116 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class SudGameActivityInfoRoomBean extends BaseModel{ + @SerializedName("id") + private long id; + @SerializedName("room_holder_id") + private long roomHolderID; + @SerializedName("room_name") + private String roomName; + @SerializedName("room_holder_type") + private long roomHolderType; + @SerializedName("sud_game_id") + private long sudGameID; + @SerializedName("currency_type") + private long currencyType; + @SerializedName("golden_bean_number") + private long goldenBeanNumber; + @SerializedName("room_status") + private long roomStatus; + @SerializedName("is_activity") + private long isActivity; + @SerializedName("create_time") + private String createTime; + @SerializedName("end_time") + private String endTime; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getRoomHolderID() { + return roomHolderID; + } + + public void setRoomHolderID(long roomHolderID) { + this.roomHolderID = roomHolderID; + } + + public String getRoomName() { + return roomName; + } + + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public long getRoomHolderType() { + return roomHolderType; + } + + public void setRoomHolderType(long roomHolderType) { + this.roomHolderType = roomHolderType; + } + + public long getSudGameID() { + return sudGameID; + } + + public void setSudGameID(long sudGameID) { + this.sudGameID = sudGameID; + } + + public long getCurrencyType() { + return currencyType; + } + + public void setCurrencyType(long currencyType) { + this.currencyType = currencyType; + } + + public long getGoldenBeanNumber() { + return goldenBeanNumber; + } + + public void setGoldenBeanNumber(long goldenBeanNumber) { + this.goldenBeanNumber = goldenBeanNumber; + } + + public long getRoomStatus() { + return roomStatus; + } + + public void setRoomStatus(long roomStatus) { + this.roomStatus = roomStatus; + } + + public long getIsActivity() { + return isActivity; + } + + public void setIsActivity(long isActivity) { + this.isActivity = isActivity; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java b/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java index ba35e7c9b..ffe5b4399 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java @@ -145,7 +145,6 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow { winBean = tmp; } } - ToastUtil.show("结算:" + isDraw + " | " + isFirstMe + "|"); } else { sub_win_score.setText(winBean.getWin_num() > 0 ? "+" + winBean.getWin_num() : String.valueOf(winBean.getWin_num())); sub_loss_score.setText(String.valueOf(lossBean.getWin_num())); @@ -157,6 +156,7 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow { sub_loss_name.setText(lossBean.getNick_name()); if (isDraw) { // 平局 + LogUtils.e("玩家平局",isActivityGame,showActivityGameScore(),gameSettle.activityGameInfoBean); sub_title.setImageResource(isZh ? R.mipmap.sub_draw_zh : R.mipmap.sub_draw_en); sub_win_hat.setVisibility(View.GONE); } else { @@ -190,6 +190,7 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow { } if (isDraw) { // 平局 + LogUtils.e("观众平局",isActivityGame,showActivityGameScore(),gameSettle.activityGameInfoBean); sub_title.setImageResource(isZh ? R.mipmap.sub_draw_zh : R.mipmap.sub_draw_en); sub_win_hat.setVisibility(View.GONE); } else { diff --git a/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java b/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java index 0bb365a89..2bb44f082 100644 --- a/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java @@ -1,8 +1,10 @@ package com.yunbao.common.event; +import com.blankj.utilcode.util.LogUtils; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.SudActivityGameInfoBean; import com.yunbao.common.sud.state.SudMGPMGState; +import com.yunbao.common.utils.DebugUtils; import java.util.List; @@ -59,6 +61,10 @@ public class CheckRemainingBalanceEvent extends BaseModel { } public SudMGPMGState.MGCommonGameSettle getMgCommonGameSettle(List data) { + if(data==null) { + LogUtils.e("数据为空"); + DebugUtils.showStackTrace(); + } mgCommonGameSettle.activityGameInfoBean = data; return mgCommonGameSettle; } diff --git a/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java b/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java index 936c57317..c84d2865c 100644 --- a/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java +++ b/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java @@ -5,8 +5,10 @@ import com.yunbao.common.bean.CreateSudRoomModel; public class LiveOpenSudRoomEvent extends BaseModel { private CreateSudRoomModel createSudRoomModel = null; + private boolean isActivity; public CreateSudRoomModel getCreateSudRoomModel() { + createSudRoomModel.setActivity(isActivity); return createSudRoomModel; } @@ -14,4 +16,9 @@ public class LiveOpenSudRoomEvent extends BaseModel { this.createSudRoomModel = createSudRoomModel; return this; } + + public LiveOpenSudRoomEvent setActivity(boolean activity) { + isActivity = activity; + return this; + } } diff --git a/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java b/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java index aa4d96ab5..96ee74166 100644 --- a/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java +++ b/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java @@ -1,5 +1,6 @@ package com.yunbao.common.event; +import com.blankj.utilcode.util.LogUtils; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.utils.DebugUtils; @@ -31,6 +32,8 @@ public class LiveSudGamePopupShowOrHideEvent { } public LiveSudGamePopupShowOrHideEvent setType(int type) { + LogUtils.e("调用游戏显示",isActivityGame); + DebugUtils.showStackTrace(); this.type = type; return this; } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 93cd6743b..cdbdb409e 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -76,6 +76,7 @@ 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.SudGameActivityInfoRoomBean; import com.yunbao.common.bean.SudGameAiInfo; import com.yunbao.common.bean.SudGameInfoBean; import com.yunbao.common.bean.SudGameRoomInfoBean; @@ -1373,4 +1374,8 @@ public interface PDLiveApi { @GET("/api/public/?service=Sudgameserver.ballClearanceTableJoinRoom") Observable> ballClearanceTableJoinRoom ( ); + @GET("/api/public/?service=Sudgameserver.getRoomInfo") + Observable> checkGameForActivity( + @Query("room_id")String roomId + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 66aa1c9f7..7631dc829 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -74,6 +74,7 @@ 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.SudGameActivityInfoRoomBean; import com.yunbao.common.bean.SudGameAiInfo; import com.yunbao.common.bean.SudGameInfoBean; import com.yunbao.common.bean.SudGameRoomInfoBean; @@ -3713,6 +3714,25 @@ public class LiveNetManager { } }).isDisposed(); } + public void checkGameForActivity(String gameRoomId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .checkGameForActivity(gameRoomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, new Consumer() { + @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); diff --git a/common/src/main/java/com/yunbao/common/manager/game/BilliardsRandomManager.java b/common/src/main/java/com/yunbao/common/manager/game/BilliardsRandomManager.java index 817958142..163c698c6 100644 --- a/common/src/main/java/com/yunbao/common/manager/game/BilliardsRandomManager.java +++ b/common/src/main/java/com/yunbao/common/manager/game/BilliardsRandomManager.java @@ -128,6 +128,7 @@ public class BilliardsRandomManager extends AbsRandomGameManager { LiveNetManager.get(mContext).createSudRoom(name, sill, currencyType, id, true, new HttpCallback() { @Override public void onSuccess(CreateSudRoomModel data) { + BilliardsRandomManager.this.data = data; onClickListener.onItemClick(data, 0); } @@ -283,12 +284,10 @@ public class BilliardsRandomManager extends AbsRandomGameManager { .ballClearanceTableStatus(data.getSudGameRoomId(), new HttpCallback() { @Override public void onSuccess(BaseModel data) { - ToastUtil.show("标记一杆清台失败"); } @Override public void onError(String error) { - ToastUtil.show("标记一杆清台失败 错误:" + error); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java index aa9abac80..af2672339 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -19,11 +19,13 @@ import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.BottomPopupView; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; +import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.SudActivityGameInfoBean; +import com.yunbao.common.bean.SudGameActivityInfoRoomBean; import com.yunbao.common.bean.SudGameInfoBean; import com.yunbao.common.bean.SudGameScoreBean; import com.yunbao.common.dialog.SudGameDoubleDialog; @@ -89,7 +91,7 @@ public class LiveSudGamePopup extends BottomPopupView { mInteractionID = mCreateSudRoomModel.getLongSudGameId(); mLiveUid = mCreateSudRoomModel.getSudGameRoomId(); //第二次进入时,viewmodel数据丢失,所以初始化时直接获取 - gameViewModel.getScore(mCreateSudRoomModel.getSudGameRoomId(),getActivity()); + gameViewModel.getScore(mCreateSudRoomModel.getSudGameRoomId(), getActivity()); IMLoginManager.get(context).setSudGame(""); if (isActivityGame) { RandomSudGameManager.getManager().setGameViewModel(gameViewModel); @@ -120,8 +122,21 @@ public class LiveSudGamePopup extends BottomPopupView { protected void onCreate() { super.onCreate(); Bus.getOn(this); - initView(); - initDate(); + LiveNetManager.get(getContext()) + .checkGameForActivity(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<>() { + @Override + public void onSuccess(SudGameActivityInfoRoomBean data) { + isActivityGame = data.getIsActivity() == 1; + initView(); + initDate(); + } + + @Override + public void onError(String error) { + initView(); + initDate(); + } + }); } @@ -221,7 +236,8 @@ public class LiveSudGamePopup extends BottomPopupView { gameConfigModel.ui.start_btn.custom = true; // SudMGP平台64bit游戏ID gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID); - if(isActivityGame){ + LogUtils.e("半窗游戏活动设置:" + isActivityGame); + if (isActivityGame) { sudGameDoubleDialog.setActivityGame(); sudLoadDialog.setActivityGame(); } @@ -243,7 +259,7 @@ public class LiveSudGamePopup extends BottomPopupView { //加载弹窗监听 sudLoadDialog.setOnDismissListener(() -> { - if (sudLoadDialog.getClickStatus() == 2){ + if (sudLoadDialog.getClickStatus() == 2) { Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false)); } }); @@ -273,6 +289,8 @@ public class LiveSudGamePopup extends BottomPopupView { } }); + + } public void BusGetOff() { @@ -281,7 +299,9 @@ public class LiveSudGamePopup extends BottomPopupView { @Override public void dismiss() { - + if(isActivityGame){ + RandomSudGameManager.getManager().destroy(); + } super.dismiss(); } @@ -344,29 +364,60 @@ public class LiveSudGamePopup extends BottomPopupView { LiveNetManager.get(getContext()).getSudGameInfo(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback>() { @Override public void onSuccess(List infoBean) { - if (!infoBean.isEmpty()) { - System.out.println("结算,是否为游戏活动:" + isActivityGame); - if (isActivityGame) { - loadScore(infoBean, 3); - } else { - gameViewModel.setSudGameInfoBeanList(infoBean); - gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + LiveNetManager.get(getContext()).checkGameForActivity(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { + @Override + public void onSuccess(SudGameActivityInfoRoomBean data) { + isActivityGame=data.getIsActivity()==1; + if(isActivityGame) { + sudLoadDialog.setActivityGame(); + sudGameDoubleDialog.setActivityGame(); + } + if (!infoBean.isEmpty()) { + System.out.println("结算,是否为游戏活动:" + isActivityGame); + if (isActivityGame) { + loadScore(infoBean, 3); + } else { + gameViewModel.setSudGameInfoBeanList(infoBean); + gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + } + } else { + if (isActivityGame) { + showDialog(); + } else { + ToastUtil.show(WordUtil.getNewString(R.string.net_error)); + } + } } - } else { - if (isActivityGame) { - showDialog(); - } else { - ToastUtil.show(WordUtil.getNewString(R.string.net_error)); + + @Override + public void onError(String error) { + if (!infoBean.isEmpty()) { + System.out.println("结算,是否为游戏活动:" + isActivityGame); + if (isActivityGame) { + loadScore(infoBean, 3); + } else { + gameViewModel.setSudGameInfoBeanList(infoBean); + gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + } + } else { + if (isActivityGame) { + showDialog(); + } else { + ToastUtil.show(WordUtil.getNewString(R.string.net_error)); + } + } } - } + }); + } + private void showDialog() { DialogUitl.showSimpleDialog(getContext(), WordUtil.isNewZh() ? "結算超時\n請前往活動頁面查看本局結果" : "Settlement timed out\nPlease check the result on the event page Confirm.", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { dialog.dismiss(); - if(sudLoadDialog.isShow()){ + if (sudLoadDialog.isShow()) { sudLoadDialog.dismiss(); } } @@ -374,7 +425,8 @@ public class LiveSudGamePopup extends BottomPopupView { } private void loadScore(List infoBean, int index) { - if (index == 0) { + LogUtils.e("活动判断", isActivityGame); + if (index == 0 && isActivityGame) { showDialog(); return; } @@ -382,7 +434,7 @@ public class LiveSudGamePopup extends BottomPopupView { .ballClearanceTableGetResultScore(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<>() { @Override public void onSuccess(List data) { - if (data.isEmpty()) { + if (data.isEmpty() && isActivityGame) { new Handler(Looper.getMainLooper()).postDelayed(() -> { loadScore(infoBean, index - 1); }, 500); @@ -398,6 +450,7 @@ public class LiveSudGamePopup extends BottomPopupView { } }); } + @Override public void onError(String error) { ToastUtil.show(error); diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java index 14f701982..26a045518 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -212,10 +212,36 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder { @Override public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw); + new Handler().postDelayed(new Runnable() { @Override public void run() { - Bus.get().post(new LiveOpenSudRoomEvent().setCreateSudRoomModel(createSudRoomModel)); + LiveNetManager.get(mAvatar.getContext()) + .getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback() { + @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() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel)); + } + }); + return; + } + Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel)); + } + + @Override + public void onError(String error) { + + } + }); } }, 1500); } diff --git a/config.gradle b/config.gradle index 8989decd7..3399b6bd2 100644 --- a/config.gradle +++ b/config.gradle @@ -4,8 +4,8 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 23, targetSdkVersion : 34, - versionCode : 693, - versionName : "6.8.1" + versionCode : 664, + versionName : "6.6.1" ] manifestPlaceholders = [ //正式、 @@ -32,6 +32,6 @@ ext { isPluginModel : false, facebook_app_id : "2011402032399020", facebook_client_token : "959584e054a33614996361f0044e5253", - channelId : "1656399535" + lineChannelId : "1656399535" ] } diff --git a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java index 1defc06b1..36da5c70f 100644 --- a/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java +++ b/lib_faceunity/src/main/java/io/agora/beautyapi/faceunity/agora/SWManager.java @@ -19,6 +19,7 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.base.BaseCacheManager; +import com.yunbao.common.utils.DebugUtils; import com.yunbao.common.utils.L; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; diff --git a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java index a24c5ed5e..34b03d4a9 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java @@ -36,6 +36,7 @@ import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.RoomMicStatusModel; import com.yunbao.common.bean.SudActivityGameInfoBean; +import com.yunbao.common.bean.SudGameActivityInfoRoomBean; import com.yunbao.common.bean.SudGameChatImModel; import com.yunbao.common.bean.SudGameInfoBean; import com.yunbao.common.bean.SudGameScoreBean; @@ -241,7 +242,9 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M @Override protected void onDestroy() { - + if(isActivityGame){ + RandomSudGameManager.getManager().destroy(); + } LiveNetManager.get(mContext).leaveMic(mLiveUid, new HttpCallback() { @Override public void onSuccess(HttpCallbackModel data) { @@ -278,9 +281,6 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M 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); @@ -529,10 +529,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M sudGameDoubleDialog = new SudGameDoubleDialog(this);//双人游戏 sudGameMultipleDialog = new SudGameMultipleDialog(this);//多人游戏 sudLoadDialog = new SudLoadDialog(this);//加载弹窗 - if (isActivityGame) { - sudGameDoubleDialog.setActivityGame(); - sudLoadDialog.setActivityGame(); - } + //游戏结算结束 gameViewModel.listMutableLiveData.observe(this, sudSettleBeans -> { //观察结算排名数据,点击跳过和再来一局不需要显示结算界面 @@ -556,10 +553,30 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M Bus.get().post(new CheckRemainingBalanceEvent(null).setSudMGPMGState(SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN).setSubReady(false)); } }); - //通知活动游戏 - if (isActivityGame) { - RandomSudGameManager.getManager().onInitGame(mCreateSudRoomModel); - } + LiveNetManager.get(mContext) + .checkGameForActivity(gameViewModel.getGameRoomId(), new HttpCallback<>() { + @Override + public void onSuccess(SudGameActivityInfoRoomBean data) { + isActivityGame = data.getIsActivity() == 1; + if (isActivityGame) { + sudGameDoubleDialog.setActivityGame(); + sudLoadDialog.setActivityGame(); + } + if (isActivityGame) { + RandomSudGameManager.getManager().setGameViewModel(gameViewModel); + } + //通知活动游戏 + if (isActivityGame) { + RandomSudGameManager.getManager().onInitGame(mCreateSudRoomModel); + } + } + + @Override + public void onError(String error) { + + } + }); + } @Subscribe(threadMode = ThreadMode.MAIN) @@ -612,21 +629,51 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M LiveNetManager.get(mContext).getSudGameInfo(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback>() { @Override public void onSuccess(List infoBean) { - if (!infoBean.isEmpty()) { - System.out.println("结算,是否为游戏活动:" + isActivityGame); - if (isActivityGame) { - loadScore(infoBean, 3); - } else { - gameViewModel.setSudGameInfoBeanList(infoBean); - gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + LiveNetManager.get(mContext).checkGameForActivity(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { + @Override + public void onSuccess(SudGameActivityInfoRoomBean data) { + isActivityGame=data.getIsActivity()==1; + if(isActivityGame) { + sudLoadDialog.setActivityGame(); + sudGameDoubleDialog.setActivityGame(); + } + if (!infoBean.isEmpty()) { + System.out.println("结算,是否为游戏活动:" + isActivityGame); + if (isActivityGame) { + loadScore(infoBean, 3); + } else { + gameViewModel.setSudGameInfoBeanList(infoBean); + gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + } + } else { + if (isActivityGame) { + showDialog(); + } else { + ToastUtil.show(getString(R.string.net_error)); + } + } } - } else { - if (isActivityGame) { - showDialog(); - } else { - ToastUtil.show(getString(R.string.net_error)); + + @Override + public void onError(String error) { + if (!infoBean.isEmpty()) { + System.out.println("结算,是否为游戏活动:" + isActivityGame); + if (isActivityGame) { + loadScore(infoBean, 3); + } else { + gameViewModel.setSudGameInfoBeanList(infoBean); + gameViewModel.sudGameRank(event.getMgCommonGameSettle(null));//结算游戏 + } + } else { + if (isActivityGame) { + showDialog(); + } else { + ToastUtil.show(getString(R.string.net_error)); + } + } } - } + }); + } private void showDialog() { @@ -643,7 +690,8 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M } private void loadScore(List infoBean, int index) { - if (index == 0) { + LogUtils.e("活动判断", isActivityGame); + if (index == 0 && isActivityGame) { showDialog(); return; } @@ -651,7 +699,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M .ballClearanceTableGetResultScore(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<>() { @Override public void onSuccess(List data) { - if (data.isEmpty()) { + if (data.isEmpty() && isActivityGame) { new Handler(Looper.getMainLooper()).postDelayed(() -> { loadScore(infoBean, index - 1); }, 500); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index dc5dd76a8..b01ac66e1 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1373,7 +1373,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } if (createSudRoomModel != null) { - Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel)); + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel).setActivityGame(createSudRoomModel.isActivity())); createSudRoomModel = null; } // String jsonCreateSudRoom = IMLoginManager.get(mContext).getSudGame();