From c94f549531732471d91f24abc69754c270a92018 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 27 Sep 2023 16:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9A=8F=E6=9C=BA=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=B8=B8=E6=88=8F=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E5=BA=A7=E5=92=8C=E7=BB=93=E6=9D=9F=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=AD=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/activity/SudGameActivity.java | 32 ++++++----- .../common/dialog/CreateSudGamePopup.java | 8 +-- .../common/dialog/SudGameListPopup.java | 49 ++++++++++------- .../event/CheckRemainingBalanceEvent.java | 14 +++++ .../com/yunbao/common/http/PDLiveApi.java | 4 ++ .../common/http/live/LiveNetManager.java | 22 ++++++++ .../yunbao/common/manager/IMLoginManager.java | 9 ++++ .../sud/decorator/SudFSMMGDecorator.java | 1 + .../yunbao/common/views/LiveSudGamePopup.java | 31 ++++++----- .../common/views/SudGameListViewHolder.java | 39 ++++++++++++-- .../layout/dialog_home_create_sud_game.xml | 25 ++++++--- common/src/main/res/values-en-rUS/string.xml | 27 ++++++++++ common/src/main/res/values-zh-rHK/strings.xml | 27 ++++++++++ common/src/main/res/values-zh-rTW/strings.xml | 26 +++++++++ common/src/main/res/values-zh/strings.xml | 27 ++++++++++ common/src/main/res/values/strings.xml | 54 +++++++++---------- .../dialog/LiveNewFunctionDialogFragment.java | 34 +++++++++++- .../live/views/PortraitLiveManager.java | 21 ++++++-- .../main/views/MainHomeGameViewHolder.java | 41 ++++++++------ 19 files changed, 386 insertions(+), 105 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java b/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java index 55aae7fc7..3f18a1990 100644 --- a/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/SudGameActivity.java @@ -18,6 +18,7 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.sud.QuickStartGameViewModel; 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.ToastUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -25,6 +26,8 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.util.List; + public class SudGameActivity extends AbsActivity { private FrameLayout gameContainer; private long mInteractionID; @@ -112,21 +115,26 @@ public class SudGameActivity extends AbsActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { - LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { - @Override - public void onSuccess(CheckRemainingBalance data) { - if (data.getGoldenBeanRemainingBalance() == 1) { - gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); - } else { + if (event.getResults().size() > 0) { + gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1); + } else { + LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { + @Override + public void onSuccess(CheckRemainingBalance data) { + if (data.getGoldenBeanRemainingBalance() == 1) { + gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); + } else { + ToastUtil.show("钱不够,细狗"); + } + } + + @Override + public void onError(String error) { ToastUtil.show("钱不够,细狗"); } - } + }); + } - @Override - public void onError(String error) { - ToastUtil.show("钱不够,细狗"); - } - }); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java index 5013fdc27..da13bd644 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -101,7 +101,7 @@ public class CreateSudGamePopup extends BottomPopupView { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("房间名不能为空"); } else { - ToastUtil.show("房间名不能为空"); + ToastUtil.show("The room name cannot be empty"); } return; } @@ -109,7 +109,7 @@ public class CreateSudGamePopup extends BottomPopupView { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("还未选择游戏"); } else { - ToastUtil.show("还未选择游戏"); + ToastUtil.show("No game has been selected"); } return; } @@ -117,7 +117,7 @@ public class CreateSudGamePopup extends BottomPopupView { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("数量区间为100--5W"); } else { - ToastUtil.show("数量区间为100--5W"); + ToastUtil.show("The quantity range is 100 to 5 W"); } return; } @@ -126,7 +126,7 @@ public class CreateSudGamePopup extends BottomPopupView { if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("数量区间为100--5W"); } else { - ToastUtil.show("数量区间为100--5W"); + ToastUtil.show("The quantity range is 100 to 5 W"); } return; } diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java index a54d67bc8..37cf42b76 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java @@ -28,8 +28,8 @@ import com.yunbao.common.event.SudGameListEvent; import com.yunbao.common.event.SudGameListSillEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; -import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.views.LiveSudGamePopup; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -152,25 +152,38 @@ public class SudGameListPopup extends BottomPopupView { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { + LiveNetManager.get(getContext()) + .randomRoom(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CreateSudRoomModel data) { + if (data != null) { + new XPopup.Builder(getContext()) + .enableDrag(false) + .dismissOnTouchOutside(false) + .dismissOnBackPressed(false) + .asCustom(new LiveSudGamePopup(getContext(), data)) + .show(); + dialog.dismiss(); + } + } - List sudRoomListModels = sudGameListAdapter.getList(); - if (sudRoomListModels.size() > 1) { - int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); - CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); - createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); - createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId()); - createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar()); - createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName()); - createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName()); - new XPopup.Builder(getContext()) - .enableDrag(false) - .dismissOnTouchOutside(false) - .dismissOnBackPressed(false) - .asCustom(new LiveSudGamePopup(getContext(), createSudRoomModel)) - .show(); - dialog.dismiss(); - } + @Override + public void onError(String error) { + } + }); +// List sudRoomListModels = sudGameListAdapter.getList(); +// if (sudRoomListModels.size() > 1) { +// int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); +// CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); +// createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); +// createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId()); +// createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar()); +// createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName()); +// createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName()); + +// } +// } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() { 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 71da13c47..94667df04 100644 --- a/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java @@ -1,9 +1,23 @@ package com.yunbao.common.event; 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 int seatIndex; + public List results = new ArrayList<>(); + + public List getResults() { + return results; + } + + public CheckRemainingBalanceEvent setResults(List results) { + this.results = results; + return this; + } public int getSeatIndex() { return seatIndex; 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 c0ca1661d..328ef607c 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1024,5 +1024,9 @@ public interface PDLiveApi { @Query("room_id") String roomId ); + @GET("/api/public/?service=Sudgameserver.randomRoom") + Observable> randomRoom( + ); + } 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 4b939934e..3f9b66e84 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 @@ -2241,6 +2241,28 @@ public class LiveNetManager { }).isDisposed(); } + public void randomRoom(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .randomRoom() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel createSudRoomModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback> callback) { API.get().pdLiveApi(mContext) .getRoomList(sudGameId, threshold, roomHolderType, liveUid, page) diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 8b8fb66d0..405ee28e2 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -51,6 +51,15 @@ public class IMLoginManager extends BaseCacheManager { private final String LIVE_NOTIFY_SETTINGS = "liveNotifySettings";//开播通知 private final String KEY_LANGUAGE = "language"; + private final String KEY_GAME = "key_game"; + + public void setSudGame(String sudGameJson) { + put(KEY_GAME, sudGameJson); + } + + public String getSudGame() { + return getString(KEY_GAME); + } public void setLanguage(boolean isEnglish) { put(KEY_LANGUAGE, isEnglish); diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java index 9cbcccf80..c6b7d4883 100644 --- a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java @@ -173,6 +173,7 @@ public class SudFSMMGDecorator implements ISudFSMMG { } else { listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle); } + Bus.get().post(new CheckRemainingBalanceEvent().setResults(mgCommonGameSettle.results)); break; case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态 SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class); 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 23bf22a1b..0f2d70691 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -18,6 +18,7 @@ import com.yunbao.common.event.CheckRemainingBalanceEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.sud.QuickStartGameViewModel; import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.utils.Bus; @@ -51,6 +52,7 @@ public class LiveSudGamePopup extends BottomPopupView { mCreateSudRoomModel = createSudRoomModel; mInteractionID = mCreateSudRoomModel.getLongSudGameId(); mLiveUid = mCreateSudRoomModel.getSudGameRoomId(); + IMLoginManager.get(context).setSudGame(""); } // 返回自定义弹窗的布局 @@ -120,20 +122,25 @@ public class LiveSudGamePopup extends BottomPopupView { @Subscribe(threadMode = ThreadMode.MAIN) public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { - LiveNetManager.get(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { - @Override - public void onSuccess(CheckRemainingBalance data) { - if (data.getGoldenBeanRemainingBalance() == 1) { - gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); - } else { + if (event.getResults().size() > 0) { + gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1); + } else { + LiveNetManager.get(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { + @Override + public void onSuccess(CheckRemainingBalance data) { + if (data.getGoldenBeanRemainingBalance() == 1) { + gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); + } else { + ToastUtil.show("钱不够,细狗"); + } + } + + @Override + public void onError(String error) { ToastUtil.show("钱不够,细狗"); } - } + }); + } - @Override - public void onError(String error) { - ToastUtil.show("钱不够,细狗"); - } - }); } } 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 b87f7e0f7..0e8a9d5b2 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -9,17 +9,24 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.fastjson.JSON; import com.google.gson.Gson; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; import com.yunbao.common.activity.SudGameActivity; import com.yunbao.common.bean.CreateSudRoomModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.playerObject; import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.util.List; @@ -101,9 +108,35 @@ public class SudGameListViewHolder extends RecyclerView.ViewHolder { createSudRoomModel.setRoomName(model.getRoomName()); createSudRoomModel.setSudGameName(model.getSudGameName()); if (isHome) { - Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); - intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); - itemView.getContext().startActivity(intent); + if (TextUtils.equals(model.getLiveUid(), "0")) { + Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); + intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); + itemView.getContext().startActivity(intent); + } else { + LiveHttpUtil.getLiveInfo(model.getLiveUid() + "", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + IMLoginManager.get(itemView.getContext()).setSudGame(new Gson().toJson(createSudRoomModel)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { + RouteUtil.forwardUserHome(itemView.getContext(), model.getLiveUid(), 0); + } + } + }); + } + } else { new XPopup.Builder(itemView.getContext()) .enableDrag(false) diff --git a/common/src/main/res/layout/dialog_home_create_sud_game.xml b/common/src/main/res/layout/dialog_home_create_sud_game.xml index 0142ad6d5..aef26d827 100644 --- a/common/src/main/res/layout/dialog_home_create_sud_game.xml +++ b/common/src/main/res/layout/dialog_home_create_sud_game.xml @@ -5,6 +5,15 @@ android:background="@mipmap/bg_main_home_sub_game" android:orientation="vertical"> + + @@ -74,12 +83,12 @@ android:id="@+id/create_game_type" android:layout_width="175dp" android:layout_height="32dp" - android:background="@drawable/bg_live_sud_list_input" + android:background="@drawable/bg_live_sud_list_input_home" android:paddingStart="12dp" android:paddingTop="9dp" android:paddingBottom="9dp" android:text="@string/interactive_game_create_game_select" - android:textColor="@color/white" + android:textColor="#E6000000" android:textSize="10sp" /> @@ -101,14 +110,14 @@ android:id="@+id/game_sill" android:layout_width="175dp" android:layout_height="32dp" - android:background="@drawable/bg_live_sud_list_input" + android:background="@drawable/bg_live_sud_list_input_home" android:hint="@string/interactive_game_create_gold_bean_quantity" android:inputType="numberDecimal" android:paddingStart="12dp" android:paddingTop="9dp" android:paddingBottom="9dp" - android:textColor="@color/white" - android:textColorHint="#FFFFFF" + android:textColor="#E6000000" + android:textColorHint="#E6000000" android:textSize="10sp" /> diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index f1ed036e2..529bdda6d 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1318,5 +1318,32 @@ Limited ride And limited avatar frame Whether to use trial coupons Use diamonds Join a fans club + Interactive Games + Room list + Game: + All + Threshold: + owner: + Random start + Game All + Create a room + "Room Name: " + Room ID: + Please enter a room name + Game type: + Game threshold: + Please select a game + Please enter the number of golden beans + unlimited + 0K-1KGolden Bean + 1K-2KGolden Bean + 2K-5KGolden Bean + 5 K or more gold beans + player + In a team of %s people, let\'s play together~ + %s people online + Search for room + Search History + Search for room: Please enter the owner\'s name, owner ID, or room name you want to search for. diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index e1348b3b2..a556cdac7 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1314,4 +1314,31 @@ 是否使用試用劵 使用鑽石 加入粉絲團 + 互動遊戲 + 房間列表 + 游戲: + 所有 + 門檻: + 房主: + 隨機開始 + 所有遊戲 + 創建房間 + 房間名稱: + 房間號: + 請輸入房間名 + 游戲類型: + 游戲門檻: + 請選擇游戲 + 請選擇金豆數量 + 不限 + 0K-1K金豆 + 1K-2K金豆 + 2K-5K金豆 + 5K以上金豆 + 玩家 + %s人組隊中,一起來玩吧 + %s人在綫 + 搜索房間 + 搜索历史 + 請輸入您要搜索的房主昵稱、房主ID或房間名 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 6fab24f5e..7b17db012 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1313,5 +1313,31 @@ 主播: 是否使用試用劵 使用鑽石 + 互動遊戲 + 房間列表 + 游戲: + 所有 + 門檻: + 房主: + 隨機開始 + 所有遊戲 + 創建房間 + 房間名稱: + 房間號: + 請輸入房間名 + 游戲類型: + 游戲門檻: + 請選擇游戲 + 請選擇金豆數量 + 不限 + 0K-1K金豆 + 1K-2K金豆 + 2K-5K金豆 + 5K以上金豆 + 玩家 + %s人組隊中,一起來玩吧 + %s人在綫 搜索房間 + 搜索历史 + 請輸入您要搜索的房主昵稱、房主ID或房間名 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 4fc1ae04f..ef742ca22 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1314,5 +1314,32 @@ 主播: 加入粉絲團 + 互動遊戲 + 房間列表 + 游戲: + 所有 + 門檻: + 房主: + 隨機開始 + 所有遊戲 + 創建房間 + 房間名稱: + 房間號: + 請輸入房間名 + 游戲類型: + 游戲門檻: + 請選擇游戲 + 請選擇金豆數量 + 不限 + 0K-1K金豆 + 1K-2K金豆 + 2K-5K金豆 + 5K以上金豆 + 玩家 + %s人組隊中,一起來玩吧 + %s人在綫 + 搜索房間 + 搜索历史 + 請輸入您要搜索的房主昵稱、房主ID或房間名 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 11fa8cf6c..684b42cd0 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1320,31 +1320,31 @@ Limited ride And limited avatar frame Anchor: Join a fans club - 互動遊戲 - 房間列表 - 游戲: - 所有 - 門檻: - 房主: - 隨機開始 - 所有遊戲 - 創建房間 - 房間名稱: - 房間號: - 請輸入房間名 - 游戲類型: - 游戲門檻: - 請選擇游戲 - 請選擇金豆數量 - 不限 - 0K-1K金豆 - 1K-2K金豆 - 2K-5K金豆 - 5K以上金豆 - 玩家 - %s人組隊中,一起來玩吧 - %s人在綫 - 搜索房間 - 搜索历史 - 請輸入您要搜索的房主昵稱、房主ID或房間名 + Interactive Games + Room list + Game: + All + Threshold: + owner: + Random start + Game All + Create a room + "Room Name: " + Room ID: + Please enter a room name + Game type: + Game threshold: + Please select a game + Please enter the number of golden beans + unlimited + 0K-1KGolden Bean + 1K-2KGolden Bean + 2K-5KGolden Bean + 5 K or more gold beans + player + In a team of %s people, let\'s play together~ + %s people online + Search for room + Search History + Search for room: Please enter the owner\'s name, owner ID, or room name you want to search for. diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index 00aca5d9c..12bfb2a97 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -25,9 +25,11 @@ import android.widget.TextView; import com.lxj.xpopup.XPopup; import com.yunbao.common.Constants; -import com.yunbao.common.bean.LiveAnchorSayModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.dialog.AbsDialogFragment; -import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.dialog.SudGameListPopup; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.LiveAnchorMessageCustomPopup; @@ -35,6 +37,8 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.interfaces.LiveFunctionClickListener; +import java.util.List; + /** * Created by cxf on 2018/10/9. */ @@ -121,6 +125,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements findViewById(R.id.live_tool_call_me).setOnClickListener(this); findViewById(R.id.live_tool_anchor_say).setOnClickListener(this); findViewById(R.id.live_tool_qa).setOnClickListener(this); + findViewById(R.id.live_tool_game).setOnClickListener(this); if (leave == 0) { ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); @@ -202,6 +207,31 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements -> mLiveRoomHandler.postDelayed(() -> ((LiveRyAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData(), 1000)).showDialog(); } else if (id == R.id.live_tool_qa) { new LiveAnchorCreateQADialog(mContext).setLiveUid(liveUid).showDialog(); + } else if (id == R.id.live_tool_game) { + LiveNetManager.get(mContext) + .getCustomSidebarInfo("1", new HttpCallback>() { + @Override + public void onSuccess(List data) { + for (CustomSidebarInfoModel datum : data) { + if (datum.getType().equals("6")) { + new XPopup.Builder(mContext) + .enableDrag(false) +// .dismissOnTouchOutside(false) +// .dismissOnBackPressed(false) + .asCustom(new SudGameListPopup(mContext, 0, datum.getChild(), liveUid)) + + .show(); + return; + } + } + } + + @Override + public void onError(String error) { + + } + }); + dismiss(); } } 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 0df33d47d..c887ba4e3 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -26,6 +26,8 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.google.gson.Gson; +import com.lxj.xpopup.XPopup; import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.utils.LifecycleUtils; @@ -35,6 +37,7 @@ import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveRoomActivityModel; @@ -51,12 +54,15 @@ import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.LiveFloatEvent; import com.yunbao.common.event.LiveGiftDialogEvent; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.LiveHttpConsts; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.AppManager; @@ -68,6 +74,7 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.formatBigNum; +import com.yunbao.common.views.LiveSudGamePopup; import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; @@ -86,9 +93,6 @@ import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.common.event.LiveRoomChangeEvent; -import com.yunbao.common.http.LiveHttpConsts; -import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; @@ -1113,7 +1117,16 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }, 3000); } - + String jsonCreateSudRoom = IMLoginManager.get(mContext).getSudGame(); + if (!TextUtils.isEmpty(jsonCreateSudRoom)) { + CreateSudRoomModel createSudRoomModel = new Gson().fromJson(jsonCreateSudRoom, CreateSudRoomModel.class); + new XPopup.Builder(mContext) + .enableDrag(false) + .dismissOnTouchOutside(false) + .dismissOnBackPressed(false) + .asCustom(new LiveSudGamePopup(mContext, createSudRoomModel)) + .show(); + } } else { enterRoomLeaveHandler.postDelayed(enterRoomLeaveRunnable, 200); } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java index 039506cf7..e12b6cf07 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeGameViewHolder.java @@ -36,7 +36,6 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; -import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; @@ -144,19 +143,32 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { + LiveNetManager.get(mContext) + .randomRoom(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CreateSudRoomModel data) { + if (data != null) { + Intent intent = new Intent(context, SudGameActivity.class); + intent.putExtra("CreateSudRoom", new Gson().toJson(data)); + context.startActivity(intent); + } + } + + @Override + public void onError(String error) { + + } + }); +// List sudRoomListModels = sudGameListAdapter.getList(); +// if (sudRoomListModels.size() > 1) { +// int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); +// CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); +// createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); +// createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId()); +// createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar()); +// createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName()); +// createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName()); - List sudRoomListModels = sudGameListAdapter.getList(); - if (sudRoomListModels.size() > 1) { - int random = RandomUtil.nextInt(sudRoomListModels.size() - 1); - CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); - createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId()); - createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId()); - createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar()); - createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName()); - createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName()); - Intent intent = new Intent(context, SudGameActivity.class); - intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); - context.startActivity(intent); // new XPopup.Builder(mContext) // .enableDrag(false) // .dismissOnTouchOutside(false) @@ -164,7 +176,6 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement // .asCustom(new LiveSudGamePopup(mContext, createSudRoomModel)) // .show(); - } } }); @@ -239,7 +250,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement public void onViewClicks() { new XPopup.Builder(mContext) .enableDrag(false) - .asCustom(new CreateSudGamePopup(mContext, customSidebarChildModels,true).setHomeView(true)) + .asCustom(new CreateSudGamePopup(mContext, customSidebarChildModels, true).setHomeView(true)) .show(); }