创建游戏,游戏界面完成

This commit is contained in:
18401019693 2023-09-25 09:52:31 +08:00
parent eedbbb5304
commit 37217e529e
8 changed files with 112 additions and 10 deletions

View File

@ -0,0 +1,34 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class SudRoomListModel extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("room_holder_id")
private String roomHolderId;
@SerializedName("room_name")
private String roomName;
@SerializedName("room_holder_type")
private String roomHolderType;
@SerializedName("sud_game_id")
private String sudGameId;
@SerializedName("golden_bean_number")
private String goldenBeanNumber;
@SerializedName("room_status")
private String roomStatus;
@SerializedName("sud_game_room_id")
private String sudGameRoomId;
@SerializedName("room_holder_name")
private String roomHolderName;
@SerializedName("avatar")
private String avatar;
@SerializedName("sud_game_name")
private String sudGameName;
@SerializedName("player_total")
private String playerTotal;
@SerializedName("ob_total")
private String obTotal;
}

View File

@ -14,8 +14,11 @@ import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.enums.PopupPosition;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudGameListEvent; import com.yunbao.common.event.SudGameListEvent;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -31,11 +34,14 @@ public class SudGameListPopup extends BottomPopupView {
private ImageView roomGameArrow; private ImageView roomGameArrow;
private TextView gameTitle; private TextView gameTitle;
private String id = "0", mLiveUid;
private int page = 0;
public SudGameListPopup(@NonNull Context context, long interactionID, List<CustomSidebarChildModel> child) { public SudGameListPopup(@NonNull Context context, long interactionID, List<CustomSidebarChildModel> child, String liveUid) {
super(context); super(context);
this.interactionID = interactionID; this.interactionID = interactionID;
customSidebarChildModels = child; customSidebarChildModels = child;
mLiveUid = liveUid;
} }
// 返回自定义弹窗的布局 // 返回自定义弹窗的布局
@ -55,7 +61,18 @@ public class SudGameListPopup extends BottomPopupView {
} }
private void initDate() { private void initDate() {
LiveNetManager.get(getContext())
.getRoomList(id, "0,0", "0", mLiveUid, page, new HttpCallback<List<SudRoomListModel>>() {
@Override
public void onSuccess(List<SudRoomListModel> data) {
}
@Override
public void onError(String error) {
}
});
} }
private void initView() { private void initView() {
@ -64,6 +81,7 @@ public class SudGameListPopup extends BottomPopupView {
for (CustomSidebarChildModel model : customSidebarChildModels) { for (CustomSidebarChildModel model : customSidebarChildModels) {
if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) { if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) {
gameTitle.setText(model.getTitle().substring(0, 2)); gameTitle.setText(model.getTitle().substring(0, 2));
id = model.getId();
} }
} }
@ -109,6 +127,7 @@ public class SudGameListPopup extends BottomPopupView {
public void onSudGameListEvent(SudGameListEvent event) { public void onSudGameListEvent(SudGameListEvent event) {
interactionID = event.getInteractionID(); interactionID = event.getInteractionID();
gameTitle.setText(event.getTitle().substring(0, 2)); gameTitle.setText(event.getTitle().substring(0, 2));
id = event.getId();
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f); ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
animator.setDuration(500); animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator()); animator.setInterpolator(new LinearInterpolator());

View File

@ -71,6 +71,7 @@ public class SudGameListSelectPopup extends AttachPopupView {
if (mType == 0) { if (mType == 0) {
Bus.get().post(new SudGameListEvent() Bus.get().post(new SudGameListEvent()
.setInteractionID(Long.parseLong(customSidebarChildModels.get(index).getSrc())) .setInteractionID(Long.parseLong(customSidebarChildModels.get(index).getSrc()))
.setId(customSidebarChildModels.get(index).getId())
.setTitle(customSidebarChildModels.get(index).getTitle())); .setTitle(customSidebarChildModels.get(index).getTitle()));
} else { } else {
Bus.get().post(new CreateSudGameEvent() Bus.get().post(new CreateSudGameEvent()
@ -86,7 +87,7 @@ public class SudGameListSelectPopup extends AttachPopupView {
ViewClicksAntiShake.clicksAntiShake(topSelect, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(topSelect, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
Bus.get().post(new SudGameListEvent().setInteractionID(0L).setTitle(getContext().getString(R.string.interactive_game_room_all))); Bus.get().post(new SudGameListEvent().setInteractionID(0L).setTitle(getContext().getString(R.string.interactive_game_room_all)).setId("0"));
dialog.dismiss(); dialog.dismiss();
} }
}); });

View File

@ -5,6 +5,16 @@ import com.yunbao.common.bean.BaseModel;
public class SudGameListEvent extends BaseModel { public class SudGameListEvent extends BaseModel {
private long interactionID = 0; private long interactionID = 0;
private String title; private String title;
private String id;
public String getId() {
return id;
}
public SudGameListEvent setId(String id) {
this.id = id;
return this;
}
public String getTitle() { public String getTitle() {
return title; return title;

View File

@ -54,6 +54,7 @@ import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.SlideInBannerModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean; import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.UserAvatarSelectBean;
@ -990,5 +991,19 @@ public interface PDLiveApi {
@Query("golden_bean_number") String goldenBeanNumber, @Query("golden_bean_number") String goldenBeanNumber,
@Query("game_id") String gameId); @Query("game_id") String gameId);
/**
* 获取游戏房列表
*
* @return
*/
@GET("/api/public/?service=Sudgameserver.getRoomList")
Observable<ResponseModel<List<SudRoomListModel>>> getRoomList(
@Query("sud_game_id") String sudGameId,
@Query("threshold") String threshold,
@Query("room_holder_type") String roomHolderType,
@Query("liveuid") String liveUid,
@Query("page") int page
);
} }

View File

@ -50,6 +50,7 @@ import com.yunbao.common.bean.RedPacketInfoModel;
import com.yunbao.common.bean.RedPacketListBean; import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.SudgameCodeModel; import com.yunbao.common.bean.SudgameCodeModel;
import com.yunbao.common.bean.UserAreaBean; import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean; import com.yunbao.common.bean.UserAvatarSelectBean;
@ -2239,6 +2240,27 @@ public class LiveNetManager {
}).isDisposed(); }).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)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<SudRoomListModel>>>() {
@Override
public void accept(ResponseModel<List<SudRoomListModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.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();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求

View File

@ -102,27 +102,28 @@
android:textColor="#fff" android:textColor="#fff"
android:textSize="14sp" /> android:textSize="14sp" />
<LinearLayout <FrameLayout
android:layout_width="74dp" android:layout_width="74dp"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:background="@drawable/bg_live_sud_list_btn" android:background="@drawable/bg_live_sud_list_btn">
android:gravity="center_vertical">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="6dp" android:layout_marginStart="6dp"
android:text="@string/interactive_game_room_game_all" android:text="2k-5k"
android:textColor="#fff" android:textColor="#fff"
android:textSize="14sp" /> android:textSize="14sp" />
<ImageView <ImageView
android:layout_width="8dp" android:layout_width="8dp"
android:layout_height="14dp" android:layout_height="14dp"
android:layout_marginStart="8dp" android:layout_gravity="center_vertical|end"
android:layout_marginEnd="8dp"
android:src="@mipmap/icon_interactive_game_arrow" /> android:src="@mipmap/icon_interactive_game_arrow" />
</LinearLayout> </FrameLayout>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -990,7 +990,7 @@ public class LiveAudienceActivity extends LiveActivity {
.enableDrag(false) .enableDrag(false)
// .dismissOnTouchOutside(false) // .dismissOnTouchOutside(false)
// .dismissOnBackPressed(false) // .dismissOnBackPressed(false)
.asCustom(new SudGameListPopup(mContext, interactionID, child)) .asCustom(new SudGameListPopup(mContext, interactionID, child,mLiveUid))
.show(); .show();
} }
@ -1683,7 +1683,7 @@ public class LiveAudienceActivity extends LiveActivity {
.enableDrag(false) .enableDrag(false)
// .dismissOnTouchOutside(false) // .dismissOnTouchOutside(false)
// .dismissOnBackPressed(false) // .dismissOnBackPressed(false)
.asCustom(new SudGameListPopup(mContext, event.getInteractionID(), event.getChild())) .asCustom(new SudGameListPopup(mContext, event.getInteractionID(), event.getChild(),mLiveUid))
.show(); .show();
} }