update 随机PK&自由PK
This commit is contained in:
parent
285a33ff9a
commit
9eff246f06
@ -78,7 +78,7 @@ public class RandomPkManager {
|
||||
for (OnRandomPkTimer onRandomPkTimer : randomPkTimer) {
|
||||
onRandomPkTimer.onTimer(String.format(Locale.CHINA, "%02d:%02d", min, sec));
|
||||
}
|
||||
if (sec == 8) {
|
||||
if (sec == 2) {
|
||||
nextPk();
|
||||
}
|
||||
});
|
||||
@ -143,6 +143,7 @@ public class RandomPkManager {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPkEndSuccess();
|
||||
}
|
||||
status = PK_STATUS_DEFAULT;
|
||||
}
|
||||
|
||||
private int exitTimer;
|
||||
@ -168,7 +169,6 @@ public class RandomPkManager {
|
||||
end();
|
||||
callEndPkSuccess();
|
||||
cancel();
|
||||
status = PK_STATUS_DEFAULT;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -234,6 +234,9 @@ public class RandomPkManager {
|
||||
}
|
||||
|
||||
public void setPkStatus(int status) {
|
||||
if(status==PK_STATUS_DEFAULT){//默认状态下不响应随机PK接口
|
||||
return;
|
||||
}
|
||||
this.status = status;
|
||||
switch (status) {
|
||||
case PK_STATUS_START:
|
||||
|
@ -43,6 +43,8 @@ public class RandomPkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (getItemViewType(position) == ITEM) {
|
||||
((ItemViewHolder) holder).setData(mList.get(position-1));
|
||||
}else{
|
||||
((HeadViewHolder) holder).setData(mList.get(position));
|
||||
}
|
||||
}
|
||||
|
@ -588,8 +588,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mApplyNmae = u.getUserNiceName();
|
||||
if (by != 1) {
|
||||
if (mIsApplyDialogShow == false) {
|
||||
// showApplyDialog(u);
|
||||
if (u.isRandomPk()) {
|
||||
showPkDialog(u);
|
||||
} else {
|
||||
showApplyDialog(u);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isPK();
|
||||
@ -1003,7 +1006,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
refusePk(u);
|
||||
}
|
||||
mApplyUid = null;
|
||||
mApplyStream = null;
|
||||
@ -1200,13 +1203,21 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
cancelBtn.setVisibility(View.GONE);
|
||||
confirmBtn.setOnClickListener(v -> {
|
||||
refuse();
|
||||
refusePk(u);
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
void refuse() {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra", new IRCRTCResultCallback() {
|
||||
|
||||
void apply() {
|
||||
isPK();
|
||||
}
|
||||
})
|
||||
.build().show();
|
||||
}
|
||||
|
||||
private void refusePk(UserBean u) {
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(u.getId(), false, "extra_randm_pk", new IRCRTCResultCallback() {
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
@ -1217,6 +1228,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
public void onSuccess() {
|
||||
final SocketSendBean msg1 = new SocketSendBean()
|
||||
.param("_method_", SOCKET_LINK_MIC_PK)
|
||||
// .param("randomPk",u.isRandomPk()+"")
|
||||
.param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
@ -1250,13 +1262,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
LiveNetManager.get(mContext).setBanRandomPK(null);
|
||||
}
|
||||
|
||||
void apply() {
|
||||
isPK();
|
||||
}
|
||||
})
|
||||
.build().show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示申请多人PK的弹窗
|
||||
*/
|
||||
|
@ -1053,6 +1053,8 @@ public class SocketRyClient {
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
break;
|
||||
case 3://对方主播拒绝PK的回调
|
||||
if (map.containsKey("randomPk") && map.getString("randomPk").equals("true")) {
|
||||
}
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
mListener.onLinkMicPkRefuse();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user