1. 增加星币参与游戏的入口(先开通并隐藏,暂不开放)后台控制还未添加
在游戏门槛处,用户可自由选择金币或星币作为游戏门槛,并可输入相应数量,星币门槛为10~1000,数量必须为10的倍数;
This commit is contained in:
parent
92e6b563e4
commit
816fd21fbc
@ -2,12 +2,16 @@ package com.yunbao.common.dialog;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getSystemService;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -21,6 +25,7 @@ import com.yunbao.common.activity.SudGameActivity;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CreateSudGameEvent;
|
||||
import com.yunbao.common.event.CurrencyTypeEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
@ -41,7 +46,7 @@ import java.util.Random;
|
||||
|
||||
public class CreateSudGamePopup extends BottomPopupView {
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private TextView createGameType;
|
||||
private TextView createGameType, selectCurrencyType;
|
||||
private EditText roomName, gameSill;
|
||||
private long interactionID = 0;
|
||||
private String id;
|
||||
@ -49,6 +54,10 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
private boolean isHome = false;
|
||||
private List<String> roomNames = new ArrayList<>();
|
||||
|
||||
private String currencyType = "1", currencyTypeName;
|
||||
private long animDuration = 500;
|
||||
private ImageView roomGameArrow;
|
||||
|
||||
public CreateSudGamePopup(@NonNull Context context, List<CustomSidebarChildModel> child, boolean isHome) {
|
||||
super(context);
|
||||
customSidebarChildModels = child;
|
||||
@ -82,6 +91,7 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
private String userName;
|
||||
|
||||
private void initDate() {
|
||||
currencyTypeName = getContext().getString(R.string.golden_bean);
|
||||
userName = IMLoginManager.get(getContext()).getUserInfo().getUserNicename();
|
||||
roomNames.add(WordUtil.isNewZh() ? "一起玩吧!" : "Let's play together!");
|
||||
roomNames.add(WordUtil.isNewZh() ? "來戰斗吧!" : "Let's fight!");
|
||||
@ -93,8 +103,10 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
|
||||
private void initView() {
|
||||
createGameType = findViewById(R.id.create_game_type);
|
||||
selectCurrencyType = findViewById(R.id.select_currency_type);
|
||||
roomName = findViewById(R.id.room_name);
|
||||
gameSill = findViewById(R.id.game_sill);
|
||||
roomGameArrow = findViewById(R.id.room_game_arrow);
|
||||
ViewClicksAntiShake.clicksAntiShake(createGameType, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@ -139,6 +151,7 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.create_room), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
|
||||
String sill = gameSill.getText().toString();
|
||||
String name = roomName.getText().toString();
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
@ -171,43 +184,83 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(sill)) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
if (TextUtils.equals(currencyType, "1")) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为10~1000");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 10 to 1000");
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (sill.length() > 6) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
int sillNumber = Integer.parseInt(sill);
|
||||
if (sillNumber < 100 || sillNumber > 50000) {
|
||||
if (TextUtils.equals(currencyType, "1")) {
|
||||
if (sill.length() > 6) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
int sillNumber = Integer.parseInt(sill);
|
||||
if (sillNumber < 100 || sillNumber > 50000) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sillNumber % 10 != 0) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("數量必須為10的倍數");
|
||||
} else {
|
||||
ToastUtil.show("The number must be a multiple of 10");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (sillNumber % 10 != 0) {
|
||||
} else {
|
||||
if (sill.length() > 4) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("金豆數量必須為10的倍數");
|
||||
ToastUtil.show("数量区间为10~1000");
|
||||
} else {
|
||||
ToastUtil.show("The number of golden beans must be a multiple of 10");
|
||||
ToastUtil.show("The quantity range is 10 to 1000");
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
int sillNumber = Integer.parseInt(sill);
|
||||
if (sillNumber < 10 || sillNumber > 1000) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为10~1000");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 10 to 1000");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sillNumber % 10 != 0) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("數量必須為10的倍數");
|
||||
} else {
|
||||
ToastUtil.show("The number must be a multiple of 10");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LiveNetManager.get(getContext())
|
||||
.createSudRoom(name, sill, id, new HttpCallback<CreateSudRoomModel>() {
|
||||
.createSudRoom(name, sill, currencyType, id, new HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (isHome) {
|
||||
@ -240,6 +293,36 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
roomName.setText(roomNames.get(randomNumber));
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.currency_type), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.currency_type));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 5, currencyTypeName)
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
closeAnimSudGameListEvent();
|
||||
}
|
||||
})
|
||||
)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void closeAnimSudGameListEvent() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(animDuration);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -255,4 +338,16 @@ public class CreateSudGamePopup extends BottomPopupView {
|
||||
id = event.getId();
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCurrencyTypeEvent(CurrencyTypeEvent event) {
|
||||
currencyTypeName = event.getCurrencyTypeName();
|
||||
currencyType = event.getCurrencyType();
|
||||
selectCurrencyType.setText(currencyTypeName);
|
||||
if (TextUtils.equals(currencyType, "1")) {
|
||||
gameSill.setHint(getContext().getString(R.string.interactive_game_create_gold_bean_quantity));
|
||||
} else {
|
||||
gameSill.setHint(WordUtil.isNewZh() ? "請選擇星幣數量" : "Please enter the number of Coins");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.SudTitleSelectAdapter;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CreateSudGameEvent;
|
||||
import com.yunbao.common.event.CurrencyTypeEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
@ -160,6 +161,33 @@ public class SudGameListSelectPopup extends AttachPopupView {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (mType == 5) {
|
||||
selectString.add(getContext().getString(R.string.golden_bean));
|
||||
selectString.add(getContext().getString(R.string.coins));
|
||||
selectSill.put(getContext().getString(R.string.golden_bean), "1");
|
||||
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))) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
|
||||
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
|
||||
topSelect.setVisibility(GONE);
|
||||
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
|
||||
@Override
|
||||
public void onSudTitleSelectCallBack(int index) {
|
||||
String roomHolderTypeName = selectString.get(index);
|
||||
String roomHolderType = selectSill.get(roomHolderTypeName);
|
||||
Bus.get().post(new CurrencyTypeEvent().setCurrencyType(roomHolderType).setCurrencyTypeName(roomHolderTypeName));
|
||||
dialog.dismiss();
|
||||
if(onDismissListener!=null){
|
||||
onDismissListener.onDismiss(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(topSelect, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class CurrencyTypeEvent extends BaseModel {
|
||||
private String currencyType;
|
||||
private String currencyTypeName;
|
||||
|
||||
public String getCurrencyType() {
|
||||
return currencyType;
|
||||
}
|
||||
|
||||
public CurrencyTypeEvent setCurrencyType(String currencyType) {
|
||||
this.currencyType = currencyType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCurrencyTypeName() {
|
||||
return currencyTypeName;
|
||||
}
|
||||
|
||||
public CurrencyTypeEvent setCurrencyTypeName(String currencyTypeName) {
|
||||
this.currencyTypeName = currencyTypeName;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -996,6 +996,7 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<CreateSudRoomModel>> createSudRoom(
|
||||
@Query("room_name") String roomName,
|
||||
@Query("golden_bean_number") String goldenBeanNumber,
|
||||
@Query("currency_type ") String currencyType ,
|
||||
@Query("game_id") String gameId);
|
||||
|
||||
/**
|
||||
|
@ -2244,9 +2244,9 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void createSudRoom(String roomName, String goldenBeanNumber, String gameId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
public void createSudRoom(String roomName, String goldenBeanNumber, String currencyType, String gameId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createSudRoom(roomName, goldenBeanNumber, gameId)
|
||||
.createSudRoom(roomName, goldenBeanNumber, currencyType, gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
|
||||
|
@ -141,10 +141,31 @@
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/currency_type"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_live_sud_list_input">
|
||||
android:background="@drawable/bg_live_sud_list_input"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/select_currency_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/golden_bean"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_game_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
|
@ -143,10 +143,31 @@
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/currency_type"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/bg_live_sud_list_input_home">
|
||||
android:background="@drawable/bg_live_sud_list_input_home"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/select_currency_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="@string/golden_bean"
|
||||
android:textColor="#E6000000"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_game_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
|
@ -86,8 +86,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/room_game_arrow"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@mipmap/icon_home_interactive_game_arrow" />
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user