update 隨機/自由PK
This commit is contained in:
parent
ea69f4bcb7
commit
49167f332d
@ -50,6 +50,10 @@ public class RandomPkManager {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加监听器
|
||||
*/
|
||||
@ -152,6 +156,13 @@ public class RandomPkManager {
|
||||
return rankPkInfoBean != null && rankPkInfoBean.isRankPKTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为随机PK模式
|
||||
*/
|
||||
public boolean isRandomModel() {
|
||||
return status == PK_STATUS_START || status == PK_STATUS_REQUEST || status == PK_STATUS_EXIT_ING;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始匹配
|
||||
*/
|
||||
@ -327,6 +338,9 @@ public class RandomPkManager {
|
||||
* 设置PK状态
|
||||
*/
|
||||
public void setPkStatus(int status) {
|
||||
if (!isRandomModel()) {
|
||||
return;
|
||||
}
|
||||
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
||||
return;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
@Override
|
||||
public void onSuccess(SetAttentsModel data) {
|
||||
bean.setAttention(data.getIsattent());
|
||||
if ("1" .equals(data.getIsattent())) {
|
||||
if ("1".equals(data.getIsattent())) {
|
||||
ToastUtil.show(R.string.following);
|
||||
mOnItemClickListener.onItemClick(bean, 1);
|
||||
} else {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yunbao.live.presenter;
|
||||
|
||||
import android.app.Dialog;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
@ -602,7 +603,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isPK();
|
||||
isPK(u);
|
||||
}
|
||||
}
|
||||
|
||||
@ -755,7 +756,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
}
|
||||
|
||||
private void isPK() {
|
||||
private void isPK(UserBean bean) {
|
||||
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||
int mScreenWdith = util.getScreenWdith();
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
|
||||
@ -771,8 +772,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, true, msg1.toString(), new IRCRTCResultCallback() {
|
||||
if (bean != null && bean.isRandomPk()) {
|
||||
msg1.put("random_pk", bean.isRandomPk() ? 1 : 0);
|
||||
msg1.put("is_ladders", bean.getRankPkImgUrl());
|
||||
}
|
||||
System.out.println("PK回执 = " + msg1.toString());
|
||||
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, true, msg1.toString(), new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
|
||||
@ -968,7 +973,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||
}
|
||||
if (mAcceptPk) {
|
||||
isPK();
|
||||
isPK(u);
|
||||
} else {
|
||||
if (mPkWaitCount < 0) {
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
||||
@ -1012,8 +1017,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
refusePk(u);
|
||||
}
|
||||
mApplyUid = null;
|
||||
mApplyStream = null;
|
||||
@ -1184,6 +1187,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||
dialog.dismiss();
|
||||
task.cancel();
|
||||
apply();
|
||||
}
|
||||
|
||||
@ -1218,7 +1222,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
|
||||
void apply() {
|
||||
isPK();
|
||||
isPK(u);
|
||||
}
|
||||
})
|
||||
.build().show();
|
||||
@ -1236,7 +1240,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("randomPk",u.isRandomPk()+"")
|
||||
.param("action", 3);
|
||||
msg1.create();
|
||||
|
||||
@ -1988,7 +1992,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
||||
}
|
||||
if (mLiveLinkMicPkViewHolder != null) {
|
||||
if (!TextUtils.isEmpty(winUid)) {
|
||||
if ("0" .equals(winUid)) {
|
||||
if ("0".equals(winUid)) {
|
||||
mLiveLinkMicPkViewHolder.end(0);
|
||||
mLiveLinkMicPkViewHolder.hideTime();
|
||||
if (mHandler != null) {
|
||||
|
@ -1079,6 +1079,9 @@ public class SocketRyClient {
|
||||
});
|
||||
}
|
||||
mListener.onLinkMicPkClose(1);
|
||||
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_DEFAULT);
|
||||
}
|
||||
break;
|
||||
case 7://对方主播正在忙的回调
|
||||
mListener.onLinkMicPkBusy();
|
||||
|
@ -37,6 +37,7 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -310,20 +311,25 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
userBean1.setUserNiceName("null");
|
||||
userBean1.setAvatar("null");
|
||||
}
|
||||
//单人PK,减掉次数
|
||||
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||
ToastUtil.show("单人PK,扣次数 = " + RandomPkManager.getInstance().getStatus());
|
||||
LiveNetManager.get(mContext).setFreePkNum(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.show("随机PK,不扣次数");
|
||||
}
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
|
||||
//单人PK,减掉次数
|
||||
LiveNetManager.get(mContext).setFreePkNum(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||
@Override
|
||||
public void onSuccess(HttpCallbackModel data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -379,6 +385,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
//断开连麦
|
||||
|
||||
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
|
@ -642,9 +642,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
//关注
|
||||
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
||||
} else if (i == R.id.img_trophy) {
|
||||
// MainListActivity.forward(mContext, 0);
|
||||
RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
||||
fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment");
|
||||
MainListActivity.forward(mContext, 0);
|
||||
//RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
||||
//fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user