From b7842d5ac980b7a291a9b92f1fcd55c2ed61fccc Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 11 Nov 2023 15:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BA=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E7=9A=84=E6=97=B6=E5=80=99=E6=98=9F=E5=B8=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dialog/CreateSudGamePopup.java | 17 ++++++++++++-- .../common/dialog/SudGameListSelectPopup.java | 17 ++++++++++++-- .../common/event/CheckCurrencyModel.java | 19 +++++++++++++++ .../com/yunbao/common/http/PDLiveApi.java | 5 ++++ .../common/http/live/LiveNetManager.java | 23 +++++++++++++++++++ 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java 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 b6d59a596..2c4cbfc7b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -24,6 +24,7 @@ import com.yunbao.common.R; import com.yunbao.common.activity.SudGameActivity; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.event.CheckCurrencyModel; import com.yunbao.common.event.CreateSudGameEvent; import com.yunbao.common.event.CurrencyTypeEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; @@ -89,6 +90,7 @@ public class CreateSudGamePopup extends BottomPopupView { } private String userName; + private boolean isYuanbao; private void initDate() { currencyTypeName = getContext().getString(R.string.golden_bean); @@ -98,6 +100,17 @@ public class CreateSudGamePopup extends BottomPopupView { roomNames.add(WordUtil.isNewZh() ? "決戰到天亮 " : "Fight until dawn"); roomNames.add(WordUtil.isNewZh() ? "在線等遊戲夥伴~" : "Waiting for game partners~"); roomNames.add(WordUtil.isNewZh() ? userName + "的房间 " : userName + "‘s room"); + LiveNetManager.get(getContext()).checkCurrency(new HttpCallback() { + @Override + public void onSuccess(CheckCurrencyModel data) { + isYuanbao = TextUtils.equals(data.getIsYuanbao(), "1") || TextUtils.equals(data.getIsYuanbao(), "true"); + } + + @Override + public void onError(String error) { + + } + }); } private void initView() { @@ -155,7 +168,7 @@ public class CreateSudGamePopup extends BottomPopupView { String name = roomName.getText().toString(); if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (name.length() > 15) { - ToastUtil.show("房間名长度为[1-10]"); + ToastUtil.show("房間名长度为[1-15]"); return; } @@ -304,7 +317,7 @@ public class CreateSudGamePopup extends BottomPopupView { .isDestroyOnDismiss(true) .isLightStatusBar(false) .popupPosition(PopupPosition.Bottom) - .asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName) + .asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName,isYuanbao) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java index 928e1a469..40b01008b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java @@ -40,6 +40,7 @@ public class SudGameListSelectPopup extends AttachPopupView { private long interactionID = 0; private DialogInterface.OnDismissListener onDismissListener; private String mSill; + private boolean isYuanbao; public SudGameListSelectPopup(@NonNull Context context, int type, List child, long interactionID) { super(context); @@ -59,6 +60,13 @@ public class SudGameListSelectPopup extends AttachPopupView { mSill = sill; } + public SudGameListSelectPopup(@NonNull Context context, int mType, String sill, boolean isYuanbao) { + super(context); + this.mType = mType; + mSill = sill; + this.isYuanbao = isYuanbao; + } + public SudGameListSelectPopup(@NonNull Context context, String sill, List child) { super(context); this.mType = 8; @@ -174,9 +182,14 @@ public class SudGameListSelectPopup extends AttachPopupView { }); } else if (mType == 5) { selectString.add(getContext().getString(R.string.golden_bean)); - selectString.add(getContext().getString(R.string.coins)); + if (isYuanbao) { + selectString.add(getContext().getString(R.string.coins)); + } selectSill.put(getContext().getString(R.string.golden_bean), "3"); - selectSill.put(getContext().getString(R.string.coins), "2"); + if (isYuanbao) { + selectSill.put(getContext().getString(R.string.coins), "2"); + } + index = 0; for (int i = 0; i < selectString.size(); i++) { if (TextUtils.equals(mSill, selectString.get(i))) { diff --git a/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java b/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java new file mode 100644 index 000000000..846001b91 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CheckCurrencyModel.java @@ -0,0 +1,19 @@ +package com.yunbao.common.event; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.bean.BaseModel; + +public class CheckCurrencyModel extends BaseModel { + + @SerializedName("is_yuanbao") + private String isYuanbao; + + public String getIsYuanbao() { + return isYuanbao; + } + + public CheckCurrencyModel setIsYuanbao(String isYuanbao) { + this.isYuanbao = isYuanbao; + 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 1698ecffd..b8298861e 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -63,6 +63,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.WishListGiftConfModel; import com.yunbao.common.bean.WishListModel; +import com.yunbao.common.event.CheckCurrencyModel; import java.util.List; import java.util.Map; @@ -1061,4 +1062,8 @@ public interface PDLiveApi { Observable> deductMoney( @Query("room_id") String roomId ); + @GET("/api/public/?service=Sudgameserver.checkCurrency") + Observable> checkCurrency( + + ); } 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 f7e838952..7627a1f77 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 @@ -59,6 +59,7 @@ import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.VipModel; import com.yunbao.common.bean.WishListGiftConfModel; import com.yunbao.common.bean.WishListModel; +import com.yunbao.common.event.CheckCurrencyModel; import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.CheckLiveCallBack; @@ -2333,6 +2334,28 @@ public class LiveNetManager { }).isDisposed(); } + public void checkCurrency(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .checkCurrency() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(objectResponseModel.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 gameStartCheckRemainingBalance(String mgId, String roomId, HttpCallback callback) { API.get().pdLiveApi(mContext) .gameStartCheckRemainingBalance(mgId, roomId)