update 隨機/自由PK
This commit is contained in:
parent
ea69f4bcb7
commit
49167f332d
@ -50,6 +50,10 @@ public class RandomPkManager {
|
|||||||
return manager;
|
return manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加监听器
|
* 添加监听器
|
||||||
*/
|
*/
|
||||||
@ -152,6 +156,13 @@ public class RandomPkManager {
|
|||||||
return rankPkInfoBean != null && rankPkInfoBean.isRankPKTime();
|
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状态
|
* 设置PK状态
|
||||||
*/
|
*/
|
||||||
public void setPkStatus(int status) {
|
public void setPkStatus(int status) {
|
||||||
|
if (!isRandomModel()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.live.presenter;
|
package com.yunbao.live.presenter;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
|
||||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
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_LINK_MIC_PK;
|
||||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||||
@ -602,7 +603,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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();
|
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
|
||||||
int mScreenWdith = util.getScreenWdith();
|
int mScreenWdith = util.getScreenWdith();
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
|
||||||
@ -771,7 +772,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
|
||||||
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
|
||||||
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||||
|
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() {
|
IMRTCManager.getInstance().responseJoinOtherRoom(mApplyUid, true, msg1.toString(), new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -968,7 +973,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
mHandler.removeMessages(WHAT_PK_WAIT_RECEIVE);
|
||||||
}
|
}
|
||||||
if (mAcceptPk) {
|
if (mAcceptPk) {
|
||||||
isPK();
|
isPK(u);
|
||||||
} else {
|
} else {
|
||||||
if (mPkWaitCount < 0) {
|
if (mPkWaitCount < 0) {
|
||||||
rtcRoom.getLocalUser().responseJoinOtherRoom(u.getId(), u.getId(), false, false, "extra", new IRCRTCResultCallback() {
|
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;
|
mApplyUid = null;
|
||||||
mApplyStream = null;
|
mApplyStream = null;
|
||||||
@ -1184,6 +1187,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
public void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
task.cancel();
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,7 +1222,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
|
|||||||
|
|
||||||
|
|
||||||
void apply() {
|
void apply() {
|
||||||
isPK();
|
isPK(u);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build().show();
|
.build().show();
|
||||||
|
@ -1079,6 +1079,9 @@ public class SocketRyClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
mListener.onLinkMicPkClose(1);
|
mListener.onLinkMicPkClose(1);
|
||||||
|
if (RandomPkManager.getInstance().isRandomModel()) {
|
||||||
|
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_DEFAULT);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 7://对方主播正在忙的回调
|
case 7://对方主播正在忙的回调
|
||||||
mListener.onLinkMicPkBusy();
|
mListener.onLinkMicPkBusy();
|
||||||
|
@ -37,6 +37,7 @@ import com.yunbao.common.http.HttpCallback;
|
|||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMRTCManager;
|
import com.yunbao.common.manager.IMRTCManager;
|
||||||
|
import com.yunbao.common.manager.RandomPkManager;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
@ -310,9 +311,9 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
userBean1.setUserNiceName("null");
|
userBean1.setUserNiceName("null");
|
||||||
userBean1.setAvatar("null");
|
userBean1.setAvatar("null");
|
||||||
}
|
}
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
|
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
|
|
||||||
//单人PK,减掉次数
|
//单人PK,减掉次数
|
||||||
|
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||||
|
ToastUtil.show("单人PK,扣次数 = " + RandomPkManager.getInstance().getStatus());
|
||||||
LiveNetManager.get(mContext).setFreePkNum(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
LiveNetManager.get(mContext).setFreePkNum(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(HttpCallbackModel data) {
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
@ -324,6 +325,11 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
ToastUtil.show("随机PK,不扣次数");
|
||||||
|
}
|
||||||
|
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
|
||||||
|
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -379,6 +385,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
|||||||
@Override
|
@Override
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
//断开连麦
|
//断开连麦
|
||||||
|
|
||||||
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
|
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
|
||||||
.execute(new HttpCallback() {
|
.execute(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -642,9 +642,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
//关注
|
//关注
|
||||||
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
||||||
} else if (i == R.id.img_trophy) {
|
} else if (i == R.id.img_trophy) {
|
||||||
// MainListActivity.forward(mContext, 0);
|
MainListActivity.forward(mContext, 0);
|
||||||
RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
//RandomPkDialogFragment fragment = new RandomPkDialogFragment();
|
||||||
fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment");
|
//fragment.show(this.getSupportFragmentManager(), "RandomPkDialogFragment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user