遊戲bug修復

This commit is contained in:
18401019693 2023-10-28 17:13:25 +08:00
parent 86d730cdf1
commit df93b9495a
10 changed files with 118 additions and 58 deletions

View File

@ -47,11 +47,15 @@ public class CreateSudRoomModel extends BaseModel {
} }
public long getLongSudGameId() { public long getLongSudGameId() {
try {
if (TextUtils.isEmpty(sudGameId)) { if (TextUtils.isEmpty(sudGameId)) {
return 0; return 0;
} else { } else {
return Long.parseLong(sudGameId); return Long.parseLong(sudGameId);
} }
} catch (NumberFormatException e) {
return 0;
}
} }
public CreateSudRoomModel setSudGameId(String sudGameId) { public CreateSudRoomModel setSudGameId(String sudGameId) {

View File

@ -21,6 +21,7 @@ import com.yunbao.common.activity.SudGameActivity;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CreateSudGameEvent; import com.yunbao.common.event.CreateSudGameEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
@ -205,12 +206,8 @@ public class CreateSudGamePopup extends BottomPopupView {
intent.putExtra("CreateSudRoom", new Gson().toJson(data)); intent.putExtra("CreateSudRoom", new Gson().toJson(data));
getContext().startActivity(intent); getContext().startActivity(intent);
} else { } else {
new XPopup.Builder(getContext()) Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(getContext(), data))
.show();
dialog.dismiss(); dialog.dismiss();
Bus.get().post(new SudGameListDissMissEvent()); Bus.get().post(new SudGameListDissMissEvent());
} }

View File

@ -22,6 +22,7 @@ import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.RoomHolderTypeEvent; import com.yunbao.common.event.RoomHolderTypeEvent;
import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudGameListEvent; import com.yunbao.common.event.SudGameListEvent;
@ -161,12 +162,8 @@ public class SudGameListPopup extends BottomPopupView {
@Override @Override
public void onSuccess(CreateSudRoomModel data) { public void onSuccess(CreateSudRoomModel data) {
if (data != null) { if (data != null) {
new XPopup.Builder(getContext())
.enableDrag(false) Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(getContext(), data))
.show();
dialog.dismiss(); dialog.dismiss();
}else { }else {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {

View File

@ -22,9 +22,11 @@ import com.yunbao.common.R;
import com.yunbao.common.adapter.SudHomeGameListAdapter; import com.yunbao.common.adapter.SudHomeGameListAdapter;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SudRoomListModelEvent; import com.yunbao.common.event.SudRoomListModelEvent;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.views.FlowLayout; import com.yunbao.common.views.FlowLayout;
@ -234,12 +236,8 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
createSudRoomModel.setAvatar(event.getModel().getAvatar()); createSudRoomModel.setAvatar(event.getModel().getAvatar());
createSudRoomModel.setRoomName(event.getModel().getRoomName()); createSudRoomModel.setRoomName(event.getModel().getRoomName());
createSudRoomModel.setSudGameName(event.getModel().getSudGameName()); createSudRoomModel.setSudGameName(event.getModel().getSudGameName());
new XPopup.Builder(getContext())
.enableDrag(false) Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(getContext(), createSudRoomModel))
.show();
dialog.dismiss(); dialog.dismiss();
} }
} }

View File

@ -0,0 +1,26 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.CreateSudRoomModel;
public class LiveSudGamePopupShowOrHideEvent {
private int type = 0;//0展示1hide隱藏2dismiss關閉
private CreateSudRoomModel createSudRoomModel;
public CreateSudRoomModel getCreateSudRoomModel() {
return createSudRoomModel;
}
public LiveSudGamePopupShowOrHideEvent setCreateSudRoomModel(CreateSudRoomModel createSudRoomModel) {
this.createSudRoomModel = createSudRoomModel;
return this;
}
public int getType() {
return type;
}
public LiveSudGamePopupShowOrHideEvent setType(int type) {
this.type = type;
return this;
}
}

View File

@ -17,6 +17,7 @@ import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.event.CheckRemainingBalanceEvent; import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
@ -92,14 +93,14 @@ public class LiveSudGamePopup extends BottomPopupView {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
gameViewModel.onDestroy(); gameViewModel.onDestroy();
dialog.dismiss(); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2));
} }
}); });
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
if (IMLoginManager.get(getContext()).getSudGameMin()) { if (IMLoginManager.get(getContext()).getSudGameMin()) {
dialog.hide(); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(1));
Bus.get().post(new ShowHideEvent()); Bus.get().post(new ShowHideEvent());
} else { } else {
IMLoginManager.get(getContext()).setSudGameMin(); IMLoginManager.get(getContext()).setSudGameMin();
@ -112,8 +113,7 @@ public class LiveSudGamePopup extends BottomPopupView {
.setCallBack(new HintCustomPopup.HintCustomCallBack() { .setCallBack(new HintCustomPopup.HintCustomCallBack() {
@Override @Override
public void onSure() { public void onSure() {
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(1));
dialog.hide();
Bus.get().post(new ShowHideEvent()); Bus.get().post(new ShowHideEvent());
} }
@ -162,15 +162,16 @@ public class LiveSudGamePopup extends BottomPopupView {
super.onDismiss(); super.onDismiss();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onHideShow(HideShowEvent event) { public void onHideShow(HideShowEvent event) {
if (event.isClose()) { if (event.isClose()) {
dialog.dismiss(); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2));
} else { } else {
if (event.isHide()) { if (event.isHide()) {
findViewById(R.id.min_game).setVisibility(GONE); findViewById(R.id.min_game).setVisibility(GONE);
} }
dialog.show();
} }
} }

View File

@ -20,6 +20,7 @@ import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.event.LiveOpenSudRoomEvent; import com.yunbao.common.event.LiveOpenSudRoomEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudGameListRefreshEvent; import com.yunbao.common.event.SudGameListRefreshEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -160,13 +161,8 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder {
} }
} else { } else {
new XPopup.Builder(itemView.getContext())
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(itemView.getContext(), createSudRoomModel))
.show();
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
Bus.get().post(new SudGameListDissMissEvent()); Bus.get().post(new SudGameListDissMissEvent());
} }
} }

View File

@ -69,6 +69,7 @@ import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.event.LiveErrorEvent; import com.yunbao.common.event.LiveErrorEvent;
import com.yunbao.common.event.LiveOpenSudRoomEvent; import com.yunbao.common.event.LiveOpenSudRoomEvent;
import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -98,6 +99,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.CustomDrawerPopupView; import com.yunbao.common.views.CustomDrawerPopupView;
import com.yunbao.common.views.HintCustomPopup; import com.yunbao.common.views.HintCustomPopup;
import com.yunbao.common.views.LiveSudGamePopup;
import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -1710,6 +1712,46 @@ public class LiveAudienceActivity extends LiveActivity {
verticalViewPager.setEnableScroll(true); verticalViewPager.setEnableScroll(true);
} }
private LiveSudGamePopup liveSudGamePopupXPopup = null;
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveSudGamePopupShowOrHideEvent(LiveSudGamePopupShowOrHideEvent event) {
switch (event.getType()) {
case 0:
if (liveSudGamePopupXPopup == null) {
liveSudGamePopupXPopup = new LiveSudGamePopup(mContext, event.getCreateSudRoomModel());
new XPopup.Builder(mContext)
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(liveSudGamePopupXPopup).show();
}else {
if (liveSudGamePopupXPopup != null) {
liveSudGamePopupXPopup.dialog.show();
}
}
break;
case 1:
if (liveSudGamePopupXPopup != null) {
liveSudGamePopupXPopup.dialog.hide();
}
break;
case 2:
if (liveSudGamePopupXPopup != null) {
liveSudGamePopupXPopup.dialog.dismiss();
liveSudGamePopupXPopup = null;
}
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveOpenSudRoomEvent(LiveOpenSudRoomEvent liveOpenSudRoomEvent) { public void onLiveOpenSudRoomEvent(LiveOpenSudRoomEvent liveOpenSudRoomEvent) {
if (manager != null) { if (manager != null) {

View File

@ -101,6 +101,7 @@ import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
@ -669,14 +670,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
createSudRoomModel.setAvatar(sudGameDateModel.getAvatar()); createSudRoomModel.setAvatar(sudGameDateModel.getAvatar());
createSudRoomModel.setRoomName(sudGameDateModel.getRoomName()); createSudRoomModel.setRoomName(sudGameDateModel.getRoomName());
createSudRoomModel.setSudGameName(sudGameDateModel.getSudGameName()); createSudRoomModel.setSudGameName(sudGameDateModel.getSudGameName());
new XPopup.Builder(mContext)
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(mContext, createSudRoomModel))
.show();
}
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
}
sud_layout_name.setVisibility(View.GONE);
} }
}); });
sudNameHandler.removeCallbacks(sudNameRunnable); sudNameHandler.removeCallbacks(sudNameRunnable);
@ -691,17 +688,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private View sudGameMin; private View sudGameMin;
public void onShowHideEvent() { public void onShowHideEvent() {
if (sudGameMin == null) {
sudGameMin = findViewById(R.id.sud_game_min); sudGameMin = findViewById(R.id.sud_game_min);
sudGameMin.setVisibility(View.VISIBLE);
ViewClicksAntiShake.clicksAntiShake(sudGameMin, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(sudGameMin, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
Bus.get().post(new HideShowEvent().setClose(false)); Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0));
sudGameMin.setVisibility(View.GONE); sudGameMin.setVisibility(View.GONE);
} }
}); });
} }
sudGameMin.setVisibility(View.VISIBLE);
}
/** /**
* 获取下一秒钟的时间 * 获取下一秒钟的时间
*/ */

View File

@ -26,7 +26,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.lxj.xpopup.XPopup;
import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.permission.PermissionUtils;
import com.lzf.easyfloat.utils.LifecycleUtils; import com.lzf.easyfloat.utils.LifecycleUtils;
@ -56,6 +55,7 @@ import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.LiveFloatEvent;
import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
@ -77,7 +77,6 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.LiveSudGamePopup;
import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
@ -722,11 +721,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} else { } else {
mLiveRoomViewHolder.hindeRedPacket(); mLiveRoomViewHolder.hindeRedPacket();
} }
if (createSudRoomModel == null) {
if (TextUtils.equals(data.getSudGameRoomStatus(), "1")) { if (TextUtils.equals(data.getSudGameRoomStatus(), "1")) {
mLiveRoomViewHolder.setSudName(WordUtil.isNewZh() ? data.getSudGameDateModel().getSudGameName() : data.getSudGameDateModel().getSud_game_name_en(), data.getSudGameDateModel()); mLiveRoomViewHolder.setSudName(WordUtil.isNewZh() ? data.getSudGameDateModel().getSudGameName() : data.getSudGameDateModel().getSud_game_name_en(), data.getSudGameDateModel());
} }
} }
}
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
@ -1137,12 +1139,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}, 3000); }, 3000);
} }
if (createSudRoomModel != null) { if (createSudRoomModel != null) {
new XPopup.Builder(mContext)
.enableDrag(false) Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(mContext, createSudRoomModel))
.show();
createSudRoomModel = null; createSudRoomModel = null;
} }
// String jsonCreateSudRoom = IMLoginManager.get(mContext).getSudGame(); // String jsonCreateSudRoom = IMLoginManager.get(mContext).getSudGame();