From 60485deed57dc26a115128df0aa77c96c42f6f83 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 20 Aug 2024 15:01:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/CommonAppConfig.java | 4 +- .../common/dialog/GiftWallGiftInfoDialog.java | 9 +- .../GiftWallMainTab2ClassicInfoDialog.java | 15 +- .../common/dialog/SudGameDoubleDialog.java | 3 +- .../common/event/CheckCurrencyModel.java | 7 +- .../common/manager/RandomSudGameManager.java | 27 ++-- .../manager/game/AbsRandomGameManager.java | 6 + .../manager/game/BilliardsRandomManager.java | 40 ++++-- .../yunbao/common/views/LiveSudGamePopup.java | 3 + .../dialog_gift_wall_tab2_classic_info.xml | 34 ++++- .../item_dialog_gift_wall_gift_info2.xml | 132 +++++++++--------- .../item_dialog_gift_wall_gift_info2t.xml | 6 +- common/src/main/res/values-zh/strings.xml | 3 +- common/src/main/res/values/strings.xml | 1 + .../live/activity/SudSwGameActivity.java | 3 + 15 files changed, 189 insertions(+), 104 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index c72a2207d..999cfadfd 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -669,5 +669,7 @@ public class CommonAppConfig { public String getAnchorPkTime() { return SpUtil.getInstance().getStringValue(SpUtil.ANCHOR_PK_TIME); } - + public static boolean isTestEnv() { + return CommonAppConfig.HOST.contains("ceshi"); + } } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java index 416464f2e..03c22ea72 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java @@ -181,6 +181,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { public void onItemClick(GiftWallTab2Bean.Gift bean, int position) { new GiftWallMainTab2ClassicInfoDialog(mContext, bean, isAnchor) .setFullWindows(!isLiveRoom) + .setRank(position+1) .setGiftWallGiftInfoDialog(new GiftWallGiftInfoDialog(mContext, giftId, toUserId, isAnchor) .setFullWindows(isFullWindows) .setAnchorId(anchorId) @@ -438,7 +439,9 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { String tmp = ""; if (giftBean.getGift_info().getIlluminate_status() != 1) {//未點亮 - btn_one.setVisibility(View.VISIBLE); + if(list_type==2) { + btn_one.setVisibility(View.VISIBLE); + } btn_one.setText(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_light); tmp = String.format(Locale.getDefault(), "%s", (giftBean.getGift_info().getIlluminate_num() - Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()))); setTips(tmp); @@ -479,7 +482,9 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion_get)); btn_one_tips.setVisibility(View.GONE); } else { - btn_one.setVisibility(View.VISIBLE); + if(list_type==2) { + btn_one.setVisibility(View.VISIBLE); + } btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion)); setTips(String.valueOf(tmp)); } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java index ba83ddaaf..8191de16e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java @@ -36,6 +36,7 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.ViewUtils; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.CustomEllipsizeTextView; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -69,6 +70,7 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { String userName; boolean isAnchor; GiftWallGiftInfoDialog giftWallGiftInfoDialog; + int rank; public GiftWallMainTab2ClassicInfoDialog(@NonNull Context context, GiftWallTab2Bean.Gift gift, boolean isAnchor) { super(context); @@ -82,6 +84,11 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { return this; } + public GiftWallMainTab2ClassicInfoDialog setRank(int rank) { + this.rank = rank; + return this; + } + public GiftWallMainTab2ClassicInfoDialog setGiftWallGiftInfoDialog(GiftWallGiftInfoDialog giftWallGiftInfoDialog) { this.giftWallGiftInfoDialog = giftWallGiftInfoDialog; return this; @@ -122,7 +129,7 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { public void onSuccess(GiftWallInfoBean data) { GiftWallMainTab2ClassicInfoBean infoBean = new GiftWallMainTab2ClassicInfoBean(); infoBean.setIsMe(data.getIs_me()); - infoBean.setWallInfoGiftInfo(data.getGift_info(),gift); + infoBean.setWallInfoGiftInfo(data.getGift_info(), gift); infoBean.setWallInfoData(data.getData()); initData(infoBean); } @@ -184,6 +191,12 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { } } }); + if (giftWallGiftInfoDialog == null) { + ViewUtils.findViewById(this, R.id.tv_rank, TextView.class).setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_tips4)); + ViewUtils.findViewById(this, R.id.rank_value, TextView.class).setText(String.valueOf(rank)); + } else { + ViewUtils.findViewById(this, R.id.rank_value, TextView.class).setText(String.valueOf(rank)); + } } void setTopData(GiftWallMainTab2ClassicInfoBean.GiftData data, ImageView avatar, TextView name, TextView value) { 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 36e27896d..ed33019fd 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameDoubleDialog.java @@ -224,7 +224,7 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow { protected void onShow() { super.onShow(); //关闭倒计时 - countDownTimer = new CountDownTimer(140000, 1000) { + countDownTimer = new CountDownTimer(10000, 1000) { @Override public void onTick(long l) { @@ -251,7 +251,6 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow { private void sortByWinNum(List list) { // 按照胜利数排序 settleBeans 列表 if (isActivityGame) { - //TODO gameSettle.activityGameInfoBean为空 Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference for (SudActivityGameInfoBean infoBean : gameSettle.activityGameInfoBean) { for (SudSettleBean bean : list) { if (bean.getUid().equals(infoBean.getUid() + "")) { diff --git a/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java b/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java index 238a53aab..17198b0d0 100644 --- a/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java +++ b/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java @@ -3,6 +3,7 @@ package com.yunbao.common.event; import android.text.TextUtils; import com.google.gson.annotations.SerializedName; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; @@ -25,7 +26,11 @@ public class CheckCurrencyModel extends BaseModel { public CheckCurrencyModel() { activityList = new ArrayList<>(); - activityList.add("24");//测试服-台球 + if(CommonAppConfig.isTestEnv()) { + activityList.add("24");//测试服-台球 + }else { + activityList.add("38");//正式服-台球 + } } public List getActivityList() { diff --git a/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java b/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java index cbdef0e74..c83f2a300 100644 --- a/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java +++ b/common/src/main/java/com/yunbao/common/manager/RandomSudGameManager.java @@ -2,6 +2,7 @@ package com.yunbao.common.manager; import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.os.Handler; import android.os.Looper; import android.text.Spannable; @@ -20,6 +21,7 @@ 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.interfaces.OnItemClickListener; import com.yunbao.common.manager.game.AbsRandomGameManager; import com.yunbao.common.manager.game.BilliardsRandomManager; import com.yunbao.common.sud.QuickStartGameViewModel; @@ -79,23 +81,14 @@ 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() { - @Override - public void onSuccess(CreateSudRoomModel data) { - start(data, true, true); - } - - @Override - public void onError(String error) { - - } - }); + if(gameManager!=null){ + gameManager.randomCreateRoom(mContext, new OnItemClickListener() { + @Override + public void onItemClick(CreateSudRoomModel bean, int position) { + start(bean, true, true); + } + }); + } } public void reset() { diff --git a/common/src/main/java/com/yunbao/common/manager/game/AbsRandomGameManager.java b/common/src/main/java/com/yunbao/common/manager/game/AbsRandomGameManager.java index 5a6777457..69dbf28a8 100644 --- a/common/src/main/java/com/yunbao/common/manager/game/AbsRandomGameManager.java +++ b/common/src/main/java/com/yunbao/common/manager/game/AbsRandomGameManager.java @@ -1,9 +1,14 @@ package com.yunbao.common.manager.game; +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; + 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.interfaces.OnItemClickListener; import com.yunbao.common.sud.QuickStartGameViewModel; import com.yunbao.common.sud.state.SudMGPMGState; @@ -24,6 +29,7 @@ public abstract class AbsRandomGameManager { public abstract void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome, boolean isRandom); public abstract void reset(); + public abstract void randomCreateRoom(Context mContext, OnItemClickListener onClickListener); public abstract void onGameMGCommonGameBilliardsHitState(SudMGPMGState.MGCommonGameBilliardsHitState model); 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 e19bdb73e..312ebb4d4 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 @@ -1,5 +1,7 @@ package com.yunbao.common.manager.game; +import android.content.Context; +import android.content.DialogInterface; import android.os.Handler; import android.os.Looper; import android.view.View; @@ -8,6 +10,7 @@ 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.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.CreateSudRoomModel; @@ -55,7 +58,7 @@ public class BilliardsRandomManager extends AbsRandomGameManager { public void onStart(CheckCurrencyModel currencyModel, CreateSudRoomModel data, boolean isHome, boolean isRandom) { this.data = data; if (isInitDebug) { - isInitDebug=false; + isInitDebug = false; new Handler(Looper.getMainLooper()) .postDelayed(() -> { DebugDialog.getInstance(new DebugDialog.DebugDialogRunnable() { @@ -109,6 +112,32 @@ public class BilliardsRandomManager extends AbsRandomGameManager { onItemClickListener.onItemClick("", 0); } + @Override + public void randomCreateRoom(Context mContext, OnItemClickListener onClickListener) { + //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; + if (CommonAppConfig.isTestEnv()) { + id = "24"; + } else { + id = "38"; + } + LiveNetManager.get(mContext).createSudRoom(name, sill, currencyType, id, true, new HttpCallback() { + @Override + public void onSuccess(CreateSudRoomModel data) { + onClickListener.onItemClick(data, 0); + } + + @Override + public void onError(String error) { + + } + }); + } + @Override public void onGameState(CheckRemainingBalanceEvent event) { super.onGameState(event); @@ -118,7 +147,6 @@ public class BilliardsRandomManager extends AbsRandomGameManager { if (event.getSudMGPMGState().equals(SudMGPMGState.MG_COMMON_PLAYER_IN)) { LogUtils.e("收到的回调: AI uid = " + getAiUid() + "| kickUid = " + event.getPlayerIn().kickUID + "|" + getPlayerSize()); if (event.getPlayerIn().reason == 1 && aiInfo != null) { - ToastUtil.show("踢掉了AI"); reset(); isAddRobot = false; } else if (event.getPlayerIn().isIn && getPlayerSize() < 2) { @@ -152,7 +180,6 @@ public class BilliardsRandomManager extends AbsRandomGameManager { } autoJoinRobotHandler = new Handler(Looper.getMainLooper()); autoJoinRobotHandler.postDelayed(autoJoinRobotRunnable, 5000); - ToastUtil.show("启动定时器准备AI"); } @Override @@ -193,17 +220,14 @@ 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("一杆清"); model.achievement = WordUtil.getNewString(R.string.game_dialog_activity_achievements_0); } else if (comboNumberForMy > 0) { - //ToastUtil.show("连杆:" + comboNumberForMy); switch (comboNumberForMy) { case 1: model.achievement = WordUtil.getNewString(R.string.game_dialog_activity_achievements_1); @@ -243,7 +267,6 @@ public class BilliardsRandomManager extends AbsRandomGameManager { public void onAddAiPlayer() { if (isAddRobot && getPlayerSize() == 1) { - ToastUtil.show("加入AI机器人"); LiveNetManager.get(AppManager.getInstance().getMainActivity()) .ballClearanceTableAiAdd(data.getSudGameRoomId(), new HttpCallback<>() { @Override @@ -266,11 +289,12 @@ 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 4e4b76ea4..aa9abac80 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -366,6 +366,9 @@ public class LiveSudGamePopup extends BottomPopupView { @Override public void onConfirmClick(Dialog dialog, String content) { dialog.dismiss(); + if(sudLoadDialog.isShow()){ + sudLoadDialog.dismiss(); + } } }); } diff --git a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml index 77c2f0d31..fced48889 100644 --- a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml @@ -123,14 +123,14 @@ android:id="@+id/tv_star" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="55dp" + android:layout_marginTop="5dp" android:text="@string/dialog_gift_wall_list_info_list_header_rename_value1" android:textColor="#EEFFF8" android:textSize="14sp" android:textStyle="bold" - app:layout_constraintEnd_toEndOf="@+id/imageView6" - app:layout_constraintStart_toStartOf="@+id/imageView6" - app:layout_constraintTop_toBottomOf="@+id/imageView6" /> + app:layout_constraintEnd_toEndOf="@+id/gift_name" + app:layout_constraintStart_toStartOf="@+id/gift_name" + app:layout_constraintTop_toBottomOf="@+id/gift_name" /> + + + + diff --git a/common/src/main/res/layout/item_dialog_gift_wall_gift_info2.xml b/common/src/main/res/layout/item_dialog_gift_wall_gift_info2.xml index f09597c1e..5bc6fa305 100644 --- a/common/src/main/res/layout/item_dialog_gift_wall_gift_info2.xml +++ b/common/src/main/res/layout/item_dialog_gift_wall_gift_info2.xml @@ -10,7 +10,7 @@ android:id="@+id/tv_rank" android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="0.6" + android:layout_weight="0.4" android:gravity="start|center" android:text="@string/dialog_gift_wall_list_info_list_header_rank" android:textColor="#FFFFFF" @@ -25,9 +25,9 @@ - - - - - -