完成小游戏直播间半屏内容

This commit is contained in:
zlzw 2024-04-26 18:04:16 +08:00
parent 651fe12edd
commit 150bdba795
8 changed files with 92 additions and 3 deletions

View File

@ -67,13 +67,14 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
public void updateData(List<CustomSidebarChildModel> mChild) { public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear(); child.clear();
if (mChild.size() > 8) { /* if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
child.add(mChild.get(i)); child.add(mChild.get(i));
} }
} else { } else {
child.addAll(mChild); child.addAll(mChild);
} }*/
child.addAll(mChild);
notifyDataSetChanged(); notifyDataSetChanged();
} }

View File

@ -21,6 +21,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.List; import java.util.List;
//游戏弹窗
public class LiveNewRolePopup extends BottomPopupView { public class LiveNewRolePopup extends BottomPopupView {
private boolean showRed = false; private boolean showRed = false;

View File

@ -0,0 +1,44 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.HttpCallbackModel;
public class SubGameEvent {
int type;
HttpCallbackModel model;
String dataJson;
public SubGameEvent(int type, HttpCallbackModel model, String dataJson) {
this.type = type;
this.model = model;
this.dataJson = dataJson;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public HttpCallbackModel getModel() {
return model;
}
public void setModel(HttpCallbackModel model) {
this.model = model;
}
public String getDataJson() {
return dataJson;
}
@Override
public String toString() {
return "SubGameEvent{" +
"type=" + type +
", model=" + model +
", dataJson='" + dataJson + '\'' +
'}';
}
}

View File

@ -362,6 +362,7 @@ public class SudFSMMGDecorator implements ISudFSMMG {
mgCommonGameCreateOrder.gameId = gameId; mgCommonGameCreateOrder.gameId = gameId;
mgCommonGameCreateOrder.gameRoomId = gameRoomId; mgCommonGameCreateOrder.gameRoomId = gameRoomId;
mgCommonGameCreateOrder.userId = userId; mgCommonGameCreateOrder.userId = userId;
mgCommonGameCreateOrder.dataJson = dataJson;
} }
Log.i(TAG, "onGameStateChange: " + dataJson); Log.i(TAG, "onGameStateChange: " + dataJson);

View File

@ -1,10 +1,13 @@
package com.yunbao.common.sud.decorator.game; package com.yunbao.common.sud.decorator.game;
import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.event.SubGameEvent;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.sud.state.SudMGPMGState; import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil;
public class JumpEvent { public class JumpEvent {
private static long clickTimer = 0; private static long clickTimer = 0;
@ -35,7 +38,10 @@ public class JumpEvent {
new HttpCallback<HttpCallbackModel>() { new HttpCallback<HttpCallbackModel>() {
@Override @Override
public void onSuccess(HttpCallbackModel data) { public void onSuccess(HttpCallbackModel data) {
if (data.getCode() != 0) {
ToastUtil.show(data.getMsg());
Bus.get().post(new SubGameEvent(0, data,order.dataJson));
}
} }
@Override @Override

View File

@ -500,6 +500,7 @@ public class SudMGPMGState implements Serializable {
public long gameId; public long gameId;
public String gameRoomId; public String gameRoomId;
public String userId; public String userId;
public String dataJson;
} }
/** /**

View File

@ -2,6 +2,7 @@ package com.yunbao.common.views;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
@ -9,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import com.alibaba.fastjson.JSONObject;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView; import com.lxj.xpopup.core.BottomPopupView;
import com.makeramen.roundedimageview.RoundedImageView; import com.makeramen.roundedimageview.RoundedImageView;
@ -17,16 +19,19 @@ import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.event.CheckRemainingBalanceEvent; import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.event.SubGameEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.sud.QuickStartGameViewModel; import com.yunbao.common.sud.QuickStartGameViewModel;
import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.sud.model.GameConfigModel;
import com.yunbao.common.sud.state.SudMGPAPPState;
import com.yunbao.common.sud.state.SudMGPMGState; import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
@ -276,4 +281,17 @@ public class LiveSudGamePopup extends BottomPopupView {
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameStatus(SubGameEvent event) {
if (event.getType() == 0) {
DebugDialog.getInstance().setParams("游戏回调", event.getModel().getCode() + "");
Log.i("游戏回调", "onGameStateChange: event :" + event.toString());
if (event.getModel().getCode() == 1001 || event.getModel().getCode() == 1002) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("result", 0);
gameViewModel.sudFSTAPPDecorator.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_CREATE_ORDER_RESULT, jsonObject.toString());
}
}
}
} }

View File

@ -5,6 +5,7 @@ import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@ -15,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -32,6 +34,7 @@ import com.yunbao.common.bean.SudGameChatImModel;
import com.yunbao.common.bean.SudGameUserModel; import com.yunbao.common.bean.SudGameUserModel;
import com.yunbao.common.dialog.SudGameInputPopupWindow; import com.yunbao.common.dialog.SudGameInputPopupWindow;
import com.yunbao.common.event.CheckRemainingBalanceEvent; import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.event.SubGameEvent;
import com.yunbao.common.event.SudGameSocketImEvent; import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
@ -39,8 +42,10 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.GameMicManager; import com.yunbao.common.manager.imrongcloud.GameMicManager;
import com.yunbao.common.sud.QuickStartGameViewModel; import com.yunbao.common.sud.QuickStartGameViewModel;
import com.yunbao.common.sud.decorator.SudFSMMGDecorator;
import com.yunbao.common.sud.model.GameConfigModel; import com.yunbao.common.sud.model.GameConfigModel;
import com.yunbao.common.sud.model.GameViewInfoModel; import com.yunbao.common.sud.model.GameViewInfoModel;
import com.yunbao.common.sud.state.SudMGPAPPState;
import com.yunbao.common.sud.state.SudMGPMGState; import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
@ -679,4 +684,16 @@ public class SudGameActivity extends AbsActivity implements GameMicManager.Meeti
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSudGameStatus(SubGameEvent event) {
if (event.getType() == 0) {
Log.i("游戏回调", "onGameStateChange: event :" + event.toString());
if (event.getModel().getCode() == 1001 || event.getModel().getCode() == 1002) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("result", 0);
gameViewModel.sudFSTAPPDecorator.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_CREATE_ORDER_RESULT, jsonObject.toString());
}
}
}
} }