*新增长按随机PK【开始匹配】按钮可输入指定UIDPk的测试模式

This commit is contained in:
zlzw 2022-12-09 09:50:47 +08:00
parent b56368412c
commit 1bbc78fb32
4 changed files with 22 additions and 11 deletions

View File

@ -600,12 +600,7 @@ public class LiveNetManager {
@Override @Override
public void accept(ResponseModel<String> responseModel) throws Exception { public void accept(ResponseModel<String> responseModel) throws Exception {
if (callback != null) { if (callback != null) {
if(CommonAppConfig.getInstance().getUid().equals("98196")) { callback.onSuccess(responseModel.getData().getInfo());
callback.onSuccess("98274");
}else{
callback.onSuccess("98196");
}
// callback.onSuccess(responseModel.getData().getInfo());
} }
} }
}, new Consumer<Throwable>() { }, new Consumer<Throwable>() {

View File

@ -34,6 +34,7 @@ public class RandomPkManager {
private TimerTask task; private TimerTask task;
private final List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();//监听器集合 private final List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();//监听器集合
private String pkUid;//对方房间ID private String pkUid;//对方房间ID
public static String debugUid;
private RankPkInfoBean rankPkInfoBean;//排位赛信息 private RankPkInfoBean rankPkInfoBean;//排位赛信息
Handler handler = new Handler(Looper.getMainLooper()); Handler handler = new Handler(Looper.getMainLooper());
@ -123,6 +124,9 @@ public class RandomPkManager {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
pkUid = data; pkUid = data;
if (debugUid != null) {
pkUid = data = debugUid;
}
for (OnRandomPkTimer pkTimer : randomPkTimer) { for (OnRandomPkTimer pkTimer : randomPkTimer) {
pkTimer.onStartPK(data); pkTimer.onStartPK(data);
} }
@ -163,6 +167,7 @@ public class RandomPkManager {
timer.schedule(task, 0, 1000); timer.schedule(task, 0, 1000);
return true; return true;
} }
private void getRankInfo() { private void getRankInfo() {
LiveNetManager.get(CommonAppContext.getTopActivity()) LiveNetManager.get(CommonAppContext.getTopActivity())
.getRankPkInfoBean(new HttpCallback<RankPkInfoBean>() { .getRankPkInfoBean(new HttpCallback<RankPkInfoBean>() {
@ -358,6 +363,7 @@ public class RandomPkManager {
/** /**
* 匹配到对方 * 匹配到对方
*
* @param pkUid 对方uid * @param pkUid 对方uid
*/ */
public void onStartPK(String pkUid) { public void onStartPK(String pkUid) {

View File

@ -5,8 +5,6 @@ import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE; import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK_RANDOM; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK_RANDOM;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk;
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk_view; import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_start_dr_pk_view;
@ -394,8 +392,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
break; break;
case Constants.LIVE_FUNC_LINK_MIC://连麦 case Constants.LIVE_FUNC_LINK_MIC://连麦
if (isDRPK != 1) { if (isDRPK != 1) {
//openLinkMicAnchorWindow(false); openLinkMicAnchorWindow(false);
openFreePkWindow(); //openFreePkWindow();
} else { } else {
ToastUtil.show("您已在PK中"); ToastUtil.show("您已在PK中");
} }

View File

@ -117,6 +117,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
initView(); initView();
initData(); initData();
RandomPkManager.debugUid = null;
} }
private void initView() { private void initView() {
@ -127,6 +128,17 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
mRandomPkSwitch.setTag(true); mRandomPkSwitch.setTag(true);
mRandomPkSwitch.setOnClickListener(this); mRandomPkSwitch.setOnClickListener(this);
mPkBtn.setOnClickListener(this); mPkBtn.setOnClickListener(this);
mPkBtn.setOnLongClickListener(v -> {
DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
RandomPkManager.debugUid = content;
ToastUtil.show("随机PK指定id = " + content);
dialog.dismiss();
}
});
return false;
});
} }
private void initData() { private void initData() {