添加创建游戏的时候星币配置的接口
This commit is contained in:
parent
eb5aebda51
commit
b7842d5ac9
@ -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<CheckCurrencyModel>() {
|
||||
@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) {
|
||||
|
@ -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<CustomSidebarChildModel> 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<CustomSidebarChildModel> 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));
|
||||
if (isYuanbao) {
|
||||
selectString.add(getContext().getString(R.string.coins));
|
||||
}
|
||||
selectSill.put(getContext().getString(R.string.golden_bean), "3");
|
||||
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))) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<ResponseModel<Object>> deductMoney(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
@GET("/api/public/?service=Sudgameserver.checkCurrency")
|
||||
Observable<ResponseModel<CheckCurrencyModel>> checkCurrency(
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -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<CheckCurrencyModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkCurrency()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CheckCurrencyModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CheckCurrencyModel> objectResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(objectResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@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<CheckRemainingBalance> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.gameStartCheckRemainingBalance(mgId, roomId)
|
||||
|
Loading…
Reference in New Issue
Block a user