修改随机开始,修改游戏的上座和结束的逻辑,添加中英文

This commit is contained in:
18401019693 2023-09-27 16:28:43 +08:00
parent 6d98afa319
commit c94f549531
19 changed files with 386 additions and 105 deletions

View File

@ -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<CheckRemainingBalance>() {
@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<CheckRemainingBalance>() {
@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("钱不够,细狗");
}
});
}
}

View File

@ -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;
}

View File

@ -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<CreateSudRoomModel>() {
@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<SudRoomListModel> 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<SudRoomListModel> 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() {

View File

@ -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<SudMGPMGState.MGCommonGameSettle.PlayerResult> results = new ArrayList<>();
public List<SudMGPMGState.MGCommonGameSettle.PlayerResult> getResults() {
return results;
}
public CheckRemainingBalanceEvent setResults(List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results) {
this.results = results;
return this;
}
public int getSeatIndex() {
return seatIndex;

View File

@ -1024,5 +1024,9 @@ public interface PDLiveApi {
@Query("room_id") String roomId
);
@GET("/api/public/?service=Sudgameserver.randomRoom")
Observable<ResponseModel<CreateSudRoomModel>> randomRoom(
);
}

View File

@ -2241,6 +2241,28 @@ public class LiveNetManager {
}).isDisposed();
}
public void randomRoom(HttpCallback<CreateSudRoomModel> callback) {
API.get().pdLiveApi(mContext)
.randomRoom()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
@Override
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(createSudRoomModelResponseModel.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 getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback<List<SudRoomListModel>> callback) {
API.get().pdLiveApi(mContext)
.getRoomList(sudGameId, threshold, roomHolderType, liveUid, page)

View File

@ -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);

View File

@ -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);

View File

@ -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<CheckRemainingBalance>() {
@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<CheckRemainingBalance>() {
@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("钱不够,细狗");
}
});
}
}

View File

@ -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)

View File

@ -5,6 +5,15 @@
android:background="@mipmap/bg_main_home_sub_game"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="@string/interactive_game"
android:textColor="#000"
android:textSize="18sp" />
<FrameLayout
android:layout_width="match_parent"
@ -46,13 +55,13 @@
android:id="@+id/room_name"
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_room_name_input"
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" />
</LinearLayout>
@ -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" />
</LinearLayout>
@ -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" />
</LinearLayout>

View File

@ -1318,5 +1318,32 @@ Limited ride And limited avatar frame</string>
<string name="trial_coupon">Whether to use trial coupons</string>
<string name="use_diamonds">Use diamonds</string>
<string name="live_send_red_packge_fans_group">Join a fans club</string>
<string name="interactive_game">Interactive Games</string>
<string name="interactive_game_room_list">Room list</string>
<string name="interactive_game_room_game">Game</string>
<string name="interactive_game_room_game_all">All</string>
<string name="interactive_game_room_sill">Threshold:</string>
<string name="interactive_game_room_house_owner">owner:</string>
<string name="interactive_game_room_random_start">Random start</string>
<string name="interactive_game_room_all">Game All</string>
<string name="interactive_game_create_room">Create a room</string>
<string name="interactive_game_create_room_name">"Room Name: "</string>
<string name="interactive_game_create_room_number">Room ID:</string>
<string name="interactive_game_create_room_name_input">Please enter a room name</string>
<string name="interactive_game_create_game_type">Game type:</string>
<string name="interactive_game_create_game_sill">Game threshold:</string>
<string name="interactive_game_create_game_select">Please select a game</string>
<string name="interactive_game_create_gold_bean_quantity">Please enter the number of golden beans</string>
<string name="interactive_game_create_unlimited">unlimited</string>
<string name="interactive_game_create_0_1">0K-1KGolden Bean</string>
<string name="interactive_game_create_1_2">1K-2KGolden Bean</string>
<string name="interactive_game_create_2_5">2K-5KGolden Bean</string>
<string name="interactive_game_create_5">5 K or more gold beans</string>
<string name="interactive_game_player">player</string>
<string name="interactive_game_player_we_are">In a team of %s people, let\'s play together~</string>
<string name="interactive_game_player_we_are_2">%s people online</string>
<string name="interactive_game_search_room">Search for room</string>
<string name="interactive_game_search_history">Search History</string>
<string name="interactive_game_search_room_name_input">Search for room: Please enter the owner\'s name, owner ID, or room name you want to search for.</string>
</resources>

View File

@ -1314,4 +1314,31 @@
<string name="trial_coupon">是否使用試用劵</string>
<string name="use_diamonds">使用鑽石</string>
<string name="live_send_red_packge_fans_group">加入粉絲團</string>
<string name="interactive_game">互動遊戲</string>
<string name="interactive_game_room_list">房間列表</string>
<string name="interactive_game_room_game">游戲:</string>
<string name="interactive_game_room_game_all">所有</string>
<string name="interactive_game_room_sill">門檻:</string>
<string name="interactive_game_room_house_owner">房主:</string>
<string name="interactive_game_room_random_start">隨機開始</string>
<string name="interactive_game_room_all">所有遊戲</string>
<string name="interactive_game_create_room">創建房間</string>
<string name="interactive_game_create_room_name">房間名稱:</string>
<string name="interactive_game_create_room_number">房間號:</string>
<string name="interactive_game_create_room_name_input">請輸入房間名</string>
<string name="interactive_game_create_game_type">游戲類型:</string>
<string name="interactive_game_create_game_sill">游戲門檻:</string>
<string name="interactive_game_create_game_select">請選擇游戲</string>
<string name="interactive_game_create_gold_bean_quantity">請選擇金豆數量</string>
<string name="interactive_game_create_unlimited">不限</string>
<string name="interactive_game_create_0_1">0K-1K金豆</string>
<string name="interactive_game_create_1_2">1K-2K金豆</string>
<string name="interactive_game_create_2_5">2K-5K金豆</string>
<string name="interactive_game_create_5">5K以上金豆</string>
<string name="interactive_game_player">玩家</string>
<string name="interactive_game_player_we_are">%s人組隊中一起來玩吧</string>
<string name="interactive_game_player_we_are_2">%s人在綫</string>
<string name="interactive_game_search_room">搜索房間</string>
<string name="interactive_game_search_history">搜索历史</string>
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
</resources>

View File

@ -1313,5 +1313,31 @@
<string name="live_mic_anchor_to_user_dialog">主播:</string>
<string name="trial_coupon">是否使用試用劵</string>
<string name="use_diamonds">使用鑽石</string>
<string name="interactive_game">互動遊戲</string>
<string name="interactive_game_room_list">房間列表</string>
<string name="interactive_game_room_game">游戲:</string>
<string name="interactive_game_room_game_all">所有</string>
<string name="interactive_game_room_sill">門檻:</string>
<string name="interactive_game_room_house_owner">房主:</string>
<string name="interactive_game_room_random_start">隨機開始</string>
<string name="interactive_game_room_all">所有遊戲</string>
<string name="interactive_game_create_room">創建房間</string>
<string name="interactive_game_create_room_name">房間名稱:</string>
<string name="interactive_game_create_room_number">房間號:</string>
<string name="interactive_game_create_room_name_input">請輸入房間名</string>
<string name="interactive_game_create_game_type">游戲類型:</string>
<string name="interactive_game_create_game_sill">游戲門檻:</string>
<string name="interactive_game_create_game_select">請選擇游戲</string>
<string name="interactive_game_create_gold_bean_quantity">請選擇金豆數量</string>
<string name="interactive_game_create_unlimited">不限</string>
<string name="interactive_game_create_0_1">0K-1K金豆</string>
<string name="interactive_game_create_1_2">1K-2K金豆</string>
<string name="interactive_game_create_2_5">2K-5K金豆</string>
<string name="interactive_game_create_5">5K以上金豆</string>
<string name="interactive_game_player">玩家</string>
<string name="interactive_game_player_we_are">%s人組隊中一起來玩吧</string>
<string name="interactive_game_player_we_are_2">%s人在綫</string>
<string name="interactive_game_search_room">搜索房間</string>
<string name="interactive_game_search_history">搜索历史</string>
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
</resources>

View File

@ -1314,5 +1314,32 @@
<string name="live_mic_anchor_to_user_dialog">主播:</string>
<string name="live_send_red_packge_fans_group">加入粉絲團</string>
<string name="interactive_game">互動遊戲</string>
<string name="interactive_game_room_list">房間列表</string>
<string name="interactive_game_room_game">游戲:</string>
<string name="interactive_game_room_game_all">所有</string>
<string name="interactive_game_room_sill">門檻:</string>
<string name="interactive_game_room_house_owner">房主:</string>
<string name="interactive_game_room_random_start">隨機開始</string>
<string name="interactive_game_room_all">所有遊戲</string>
<string name="interactive_game_create_room">創建房間</string>
<string name="interactive_game_create_room_name">房間名稱:</string>
<string name="interactive_game_create_room_number">房間號:</string>
<string name="interactive_game_create_room_name_input">請輸入房間名</string>
<string name="interactive_game_create_game_type">游戲類型:</string>
<string name="interactive_game_create_game_sill">游戲門檻:</string>
<string name="interactive_game_create_game_select">請選擇游戲</string>
<string name="interactive_game_create_gold_bean_quantity">請選擇金豆數量</string>
<string name="interactive_game_create_unlimited">不限</string>
<string name="interactive_game_create_0_1">0K-1K金豆</string>
<string name="interactive_game_create_1_2">1K-2K金豆</string>
<string name="interactive_game_create_2_5">2K-5K金豆</string>
<string name="interactive_game_create_5">5K以上金豆</string>
<string name="interactive_game_player">玩家</string>
<string name="interactive_game_player_we_are">%s人組隊中一起來玩吧</string>
<string name="interactive_game_player_we_are_2">%s人在綫</string>
<string name="interactive_game_search_room">搜索房間</string>
<string name="interactive_game_search_history">搜索历史</string>
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
</resources>

View File

@ -1320,31 +1320,31 @@ Limited ride And limited avatar frame</string>
<string name="live_mic_anchor_to_user_dialog">Anchor:</string>
<string name="live_send_red_packge_fans_group">Join a fans club</string>
<string name="interactive_game">互動遊戲</string>
<string name="interactive_game_room_list">房間列表</string>
<string name="interactive_game_room_game">游戲:</string>
<string name="interactive_game_room_game_all">所有</string>
<string name="interactive_game_room_sill">門檻:</string>
<string name="interactive_game_room_house_owner">房主:</string>
<string name="interactive_game_room_random_start">隨機開始</string>
<string name="interactive_game_room_all">所有遊戲</string>
<string name="interactive_game_create_room">創建房間</string>
<string name="interactive_game_create_room_name">房間名稱:</string>
<string name="interactive_game_create_room_number">房間號:</string>
<string name="interactive_game_create_room_name_input">請輸入房間名</string>
<string name="interactive_game_create_game_type">游戲類型:</string>
<string name="interactive_game_create_game_sill">游戲門檻:</string>
<string name="interactive_game_create_game_select">請選擇游戲</string>
<string name="interactive_game_create_gold_bean_quantity">請選擇金豆數量</string>
<string name="interactive_game_create_unlimited">不限</string>
<string name="interactive_game_create_0_1">0K-1K金豆</string>
<string name="interactive_game_create_1_2">1K-2K金豆</string>
<string name="interactive_game_create_2_5">2K-5K金豆</string>
<string name="interactive_game_create_5">5K以上金豆</string>
<string name="interactive_game_player">玩家</string>
<string name="interactive_game_player_we_are">%s人組隊中一起來玩吧</string>
<string name="interactive_game_player_we_are_2">%s人在綫</string>
<string name="interactive_game_search_room">搜索房間</string>
<string name="interactive_game_search_history">搜索历史</string>
<string name="interactive_game_search_room_name_input">請輸入您要搜索的房主昵稱、房主ID或房間名</string>
<string name="interactive_game">Interactive Games</string>
<string name="interactive_game_room_list">Room list</string>
<string name="interactive_game_room_game">Game</string>
<string name="interactive_game_room_game_all">All</string>
<string name="interactive_game_room_sill">Threshold:</string>
<string name="interactive_game_room_house_owner">owner:</string>
<string name="interactive_game_room_random_start">Random start</string>
<string name="interactive_game_room_all">Game All</string>
<string name="interactive_game_create_room">Create a room</string>
<string name="interactive_game_create_room_name">"Room Name: "</string>
<string name="interactive_game_create_room_number">Room ID:</string>
<string name="interactive_game_create_room_name_input">Please enter a room name</string>
<string name="interactive_game_create_game_type">Game type:</string>
<string name="interactive_game_create_game_sill">Game threshold:</string>
<string name="interactive_game_create_game_select">Please select a game</string>
<string name="interactive_game_create_gold_bean_quantity">Please enter the number of golden beans</string>
<string name="interactive_game_create_unlimited">unlimited</string>
<string name="interactive_game_create_0_1">0K-1KGolden Bean</string>
<string name="interactive_game_create_1_2">1K-2KGolden Bean</string>
<string name="interactive_game_create_2_5">2K-5KGolden Bean</string>
<string name="interactive_game_create_5">5 K or more gold beans</string>
<string name="interactive_game_player">player</string>
<string name="interactive_game_player_we_are">In a team of %s people, let\'s play together~</string>
<string name="interactive_game_player_we_are_2">%s people online</string>
<string name="interactive_game_search_room">Search for room</string>
<string name="interactive_game_search_history">Search History</string>
<string name="interactive_game_search_room_name_input">Search for room: Please enter the owner\'s name, owner ID, or room name you want to search for.</string>
</resources>

View File

@ -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<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> 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();
}
}

View File

@ -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);
}

View File

@ -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<CreateSudRoomModel>() {
@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<SudRoomListModel> 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<SudRoomListModel> 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();
}