fix[声望升级-修复BUG]

This commit is contained in:
Martin 2024-05-31 20:59:16 +08:00
parent efa698ebfa
commit c4d378daba
9 changed files with 1002 additions and 945 deletions

View File

@ -343,7 +343,7 @@ public class RandomPkManager {
@Override @Override
public void onError(String error) { public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); //ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
} }
}); });
} }

View File

@ -165,6 +165,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
private boolean mPaused; private boolean mPaused;
String mBeautySdkType; String mBeautySdkType;
public static int isDRPK = 0; public static int isDRPK = 0;
public static int DRPKing = 0; // 0 多人PK前 1 多人PK中 2多人PK后
public static boolean PKing = false; public static boolean PKing = false;
public static int pk_nub; public static int pk_nub;
public static int backIndex = 0;//0=未判断1=已判断 public static int backIndex = 0;//0=未判断1=已判断
@ -405,6 +406,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
LiveSwLinkMicPkPresenter.mApplyUid = CommonAppConfig.getInstance().getUid(); LiveSwLinkMicPkPresenter.mApplyUid = CommonAppConfig.getInstance().getUid();
btn_start_dr_pk.setVisibility(View.VISIBLE); btn_start_dr_pk.setVisibility(View.VISIBLE);
// dr_pk_view.setVisibility(View.VISIBLE); // dr_pk_view.setVisibility(View.VISIBLE);
L.eSw("ac2222222222222222222");
final SocketSendBean msg1 = new SocketSendBean() final SocketSendBean msg1 = new SocketSendBean()
.param("_method_", SOCKET_LIVE_DRPK) .param("_method_", SOCKET_LIVE_DRPK)
.param("action", 9) .param("action", 9)
@ -872,6 +874,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
MicUserManager.get().removeAllMicUserList(); MicUserManager.get().removeAllMicUserList();
PKing = false; PKing = false;
isDRPK = 0; isDRPK = 0;
DRPKing = 0;
endLive(); endLive();
RandomPkManager.getInstance().release(); RandomPkManager.getInstance().release();
} }
@ -1345,7 +1348,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
public void onError(Message message, RongIMClient.ErrorCode errorCode) { public void onError(Message message, RongIMClient.ErrorCode errorCode) {
Log.e("tx", "aaa" + errorCode.toString()); Log.e("tx", "aaa" + errorCode.toString());
ToastUtil.show(errorCode.code + ":" + errorCode.msg); //ToastUtil.show(errorCode.code + ":" + errorCode.msg);
} }
}); });
} else { } else {

View File

@ -3,6 +3,7 @@ package com.yunbao.live.presenter;
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;
import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing;
import static com.yunbao.live.activity.LiveSwAnchorActivity.PKing; import static com.yunbao.live.activity.LiveSwAnchorActivity.PKing;
import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK;
import static com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder; import static com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder;
@ -158,6 +159,8 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
private List<DrPkbean> drPkbeans = new ArrayList<>(); private List<DrPkbean> drPkbeans = new ArrayList<>();
private JSONArray pkScores; //PK分数
public LiveSwLinkMicPkPresenter setDRInitiator(boolean DRInitiator) { public LiveSwLinkMicPkPresenter setDRInitiator(boolean DRInitiator) {
this.DRInitiator = DRInitiator; this.DRInitiator = DRInitiator;
return this; return this;
@ -475,6 +478,98 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1); livePushSwViewHolder.setAnDrPkRtc(String.valueOf(drPkbeans.get(i).getId()), -1);
} }
} }
if (DRPKing == 1) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
setMyDrPkDetailsView();
for (int j = 0; j < drPkbeans.size(); j++) {
if (j == 0) {
L.eSw("j == 0" + j);
//设置多人PK数据
if (detailsView2 != null) {
livePushSwViewHolder.dr2_preview.removeView(detailsView2);
}
detailsView2 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout2 = detailsView2.findViewById(R.id.lin_pk2);
linearGrade2 = detailsView2.findViewById(R.id.linear_grade2);
textPkName2 = detailsView2.findViewById(R.id.text_pk_name2);
imageGrade2 = detailsView2.findViewById(R.id.image_grade2);
textGrade2 = detailsView2.findViewById(R.id.text_grade2);
imageGrade2.setTag(String.valueOf(drPkbeans.get(0).getId()));
textPkName2.setText(drPkbeans.get(0).getUser_nicename());
livePushSwViewHolder.dr2_preview.addView(detailsView2);
detailsLinearLayout2.setVisibility(View.GONE);
linearGrade2.setVisibility(View.GONE);
} else if (j == 1) {
L.eSw("j == 1" + j);
if (detailsView4 != null) {
livePushSwViewHolder.dr4_preview.removeView(detailsView4);
}
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
imageGrade4.setTag(String.valueOf(drPkbeans.get(1).getId()));
textPkName4.setText(drPkbeans.get(1).getUser_nicename());
livePushSwViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.GONE);
linearGrade4.setVisibility(View.GONE);
} else if (j == 2) {
L.eSw("j == 2" + j);
if (detailsView4 != null) {
livePushSwViewHolder.dr4_preview.removeView(detailsView4);
}
detailsView4 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout4 = detailsView4.findViewById(R.id.lin_pk4);
linearGrade4 = detailsView4.findViewById(R.id.linear_grade4);
textPkName4 = detailsView4.findViewById(R.id.text_pk_name4);
imageGrade4 = detailsView4.findViewById(R.id.image_grade4);
textGrade4 = detailsView4.findViewById(R.id.text_grade4);
imageGrade4.setTag(String.valueOf(drPkbeans.get(2).getId()));
textPkName4.setText(drPkbeans.get(2).getUser_nicename());
livePushSwViewHolder.dr4_preview.addView(detailsView4);
detailsLinearLayout4.setVisibility(View.GONE);
linearGrade4.setVisibility(View.GONE);
if (detailsView3 != null) {
livePushSwViewHolder.dr3_preview.removeView(detailsView3);
}
detailsView3 = LayoutInflater.from(mContext).inflate(R.layout.view_live_pk_details, null);
detailsLinearLayout3 = detailsView3.findViewById(R.id.lin_pk3);
linearGrade3 = detailsView3.findViewById(R.id.linear_grade3);
textPkName3 = detailsView3.findViewById(R.id.text_pk_name3);
imageGrade3 = detailsView3.findViewById(R.id.image_grade3);
textGrade3 = detailsView3.findViewById(R.id.text_grade3);
imageGrade3.setTag(String.valueOf(drPkbeans.get(1).getId()));
textPkName3.setText(drPkbeans.get(1).getUser_nicename());
livePushSwViewHolder.dr3_preview.addView(detailsView3);
detailsLinearLayout3.setVisibility(View.GONE);
linearGrade3.setVisibility(View.GONE);
ToastUtil.show(WordUtil.isNewZh() ? "接受成功" : "Success");
}
}
int removeUid = 0;
for (int k = 0; k < pkScores.size(); k++) {
JSONObject score = pkScores.getJSONObject(k);
String userID = score.getString("id");
if(userID.equals(uid)){
removeUid = k;
}
}
pkScores.remove(removeUid);
upDataPkScore(pkScores,"-1",0);
}
}, 1000);
}
SWManager.get().setDrPkNumClarity(drPkbeans.size()); SWManager.get().setDrPkNumClarity(drPkbeans.size());
if (drPkbeans.size() == 1) { if (drPkbeans.size() == 1) {
mLiveAnchorViewHolder.closeEndPkBt(); mLiveAnchorViewHolder.closeEndPkBt();
@ -520,7 +615,6 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
dRjoinOtherRoom(u); dRjoinOtherRoom(u);
//展示结束连麦按钮 //展示结束连麦按钮
mLiveAnchorViewHolder.showEndPkBt(); mLiveAnchorViewHolder.showEndPkBt();
mLiveAnchorViewHolder.setDrpkRoomId(CommonAppConfig.getInstance().getUid());
} }
/** /**
@ -578,6 +672,9 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
/*---------------------------------------------------------------- */ /*---------------------------------------------------------------- */
final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 2) //回复PK申请 2 final SocketSendBean msg1 = new SocketSendBean().param("_method_", SOCKET_LINK_MIC_PK).param("action", 2) //回复PK申请 2
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", bean.getId()).param("uid", CommonAppConfig.getInstance().getUid()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", bean.getId()).param("uid", CommonAppConfig.getInstance().getUid()).param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()).param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
if (bean.isRandomPk()) {
msg1.param("random_pk", "1");
}
if (RandomPkManager.getInstance().isRankModel()) { if (RandomPkManager.getInstance().isRankModel()) {
L.eSw("排位赛"); L.eSw("排位赛");
msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png"); msg1.param("is_ladders", "https://downs.yaoulive.com/rank_top_box.png");
@ -711,6 +808,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
Log.e("ry", "退出多人OKKK" + inputStreamList.size()); Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0; isDRPK = 0;
DRPKing = 1;
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1159,6 +1257,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
//多人PK接受申请画 加入副房间 //多人PK接受申请画 加入副房间
public void dRjoinOtherRoom(UserBean u) { public void dRjoinOtherRoom(UserBean u) {
L.eSw("dRjoinOtherRoom UserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBeanUserBean ");
setMyDrPkDetailsView(); setMyDrPkDetailsView();
HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() { HttpClient.getInstance().get("Live.getDRPKroom", "Live.getDRPKroom").params("uid", CommonAppConfig.getInstance().getUid()).params("roomid", mApplyUid).execute(new HttpCallback() {
@Override @Override
@ -1601,11 +1700,13 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
* 更新Pk分数 * 更新Pk分数
*/ */
public void upDataPkScore(JSONArray pkScores, String uid, int time) { public void upDataPkScore(JSONArray pkScores, String uid, int time) {
this.pkScores = pkScores;
L.eSw("更新Pk分数 upDataPkScore time:" + time + " " + pkScores); L.eSw("更新Pk分数 upDataPkScore time:" + time + " " + pkScores);
String userID1 = (String) imageGrade1.getTag(); String userID1 = (String) imageGrade1.getTag();
String userID2 = (String) imageGrade2.getTag(); String userID2 = (String) imageGrade2.getTag();
String userID4 = (String) imageGrade4.getTag(); String userID4 = (String) imageGrade4.getTag();
if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE) { if (livePushSwViewHolder.timeTitle.getVisibility() == View.GONE &&!"-1".equals(uid)) {
mHandler.removeMessages(WHAT_PK_TIME2); mHandler.removeMessages(WHAT_PK_TIME2);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushSwViewHolder.timeTitle.getLayoutParams(); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) livePushSwViewHolder.timeTitle.getLayoutParams();
layoutParams.topMargin = DpUtil.dp2px(123); layoutParams.topMargin = DpUtil.dp2px(123);
@ -1699,7 +1800,7 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
} }
} }
} }
} else { } else if(pkScoreSize == 4){
String userID3 = (String) imageGrade3.getTag(); String userID3 = (String) imageGrade3.getTag();
detailsLinearLayout1.setVisibility(View.VISIBLE); detailsLinearLayout1.setVisibility(View.VISIBLE);
@ -1803,6 +1904,61 @@ public class LiveSwLinkMicPkPresenter implements View.OnClickListener {
} }
} }
}else{
detailsLinearLayout1.setVisibility(View.VISIBLE);
detailsLinearLayout2.setVisibility(View.VISIBLE);
linearGrade1.setVisibility(View.VISIBLE);
linearGrade2.setVisibility(View.VISIBLE);
//拿到原始数据
for (int i = 0; i < pkScores.size(); i++) {
JSONObject score = pkScores.getJSONObject(i);
String userID = score.getString("id");
long userScore = score.getLong("score");
if (TextUtils.equals(userID, userID1)) {
textGrade1.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade1);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade1);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade1);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade1);
break;
}
}
} else if (TextUtils.equals(userID, userID2)) {
textGrade2.setText(String.valueOf(userScore));
if (!score.containsKey("paiming")) {
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
} else {
int ranking = score.getIntValue("paiming");
switch (ranking) {
case 1:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no1, imageGrade2);
break;
case 2:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no2, imageGrade2);
break;
case 3:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no3, imageGrade2);
break;
case 4:
ImgLoader.display(mContext, R.mipmap.icon_livepk_no4, imageGrade2);
break;
}
}
}
}
} }
} }

View File

@ -3,6 +3,7 @@ package com.yunbao.live.socket;
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_MSG_TO_USER; import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER;
import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK;
import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing;
import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot;
import android.app.Activity; import android.app.Activity;
@ -314,14 +315,12 @@ public class SocketSwClient {
mListener.onLinkDRMicPkApply(u); mListener.onLinkDRMicPkApply(u);
} else if (action3 == 2) { } else if (action3 == 2) {
//收到对方同意多人PK邀请 //收到对方同意多人PK邀请
if ("0".equals(map.getString("msgtype"))) {
return;
}
UserBean u = new UserBean(); UserBean u = new UserBean();
// u.setUserNiceName(map.getString("uname")); // u.setUserNiceName(map.getString("uname"));
u.setId(map.getString("pkuid")); u.setId(map.getString("pkuid"));
L.eSw("action3 == 2:" + u.getId()); L.eSw("action3 == 2:" + u.getId());
L.eSw("收到对方同意多人PK邀请"); L.eSw("收到对方同意多人PK邀请");
DRPKing = 0;
mListener.onLinkDRMicPkApplyOk(u); mListener.onLinkDRMicPkApplyOk(u);
} else if (action3 == 6) {//开始Pk } else if (action3 == 6) {//开始Pk
if (LiveRoomViewHolder.mHandler != null) { if (LiveRoomViewHolder.mHandler != null) {
@ -333,6 +332,7 @@ public class SocketSwClient {
// LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); // LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW)); Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW));
} }
DRPKing = 1;
} else if (action3 == 5) {//结束PK } else if (action3 == 5) {//结束PK
// endDRGif(); // endDRGif();
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
@ -353,6 +353,7 @@ public class SocketSwClient {
LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
}*/ }*/
isDRPK = 1; isDRPK = 1;
DRPKing = 0;
if (livePushSwViewHolder == null) { if (livePushSwViewHolder == null) {
if ("4".equals(map.getString("msgtype"))) { if ("4".equals(map.getString("msgtype"))) {
return; return;
@ -1355,7 +1356,7 @@ public class SocketSwClient {
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid()) .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()).param("pkuid", CommonAppConfig.getInstance().getUid())
.param("msgtype", 2).param("uid", CommonAppConfig.getInstance().getUid()) .param("msgtype", 2).param("uid", CommonAppConfig.getInstance().getUid())
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar()) .param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("is_auto ", "1") .param("is_auto", "1")
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()) .param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); .param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
msg1.create(); msg1.create();

View File

@ -8,9 +8,11 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
@ -238,17 +240,17 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
} }
}); });
//进入主播房间 //进入主播房间
swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken,liveUid, SWAuManager.getChannelName(liveUid)); swAuManager.joinRoom(CommonAppConfig.getInstance().getUid(), CommonAppConfig.SWToken, liveUid, SWAuManager.getChannelName(liveUid));
} }
@Override @Override
public void removeLiveUid(String uid) { public void removeLiveUid(String uid) {
//先结束PK //先结束PK
if(drMicUserList!=null){ if (drMicUserList != null) {
List<UserBean> tempList = new ArrayList<>(); List<UserBean> tempList = new ArrayList<>();
int index = -1; int index = -1;
for (int i = 0; i <drMicUserList.size(); i++) { for (int i = 0; i < drMicUserList.size(); i++) {
if(!drMicUserList.get(i).getId().equals(uid)){ if (!drMicUserList.get(i).getId().equals(uid)) {
tempList.add(drMicUserList.get(i)); tempList.add(drMicUserList.get(i));
} }
} }
@ -356,6 +358,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
if (detailsView1 != null) { if (detailsView1 != null) {
dr1_preview.removeView(detailsView1); dr1_preview.removeView(detailsView1);
} }
} }
/** /**
@ -415,10 +418,11 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
} }
}); });
} }
@Override @Override
public void endLiveMic() { public void endLiveMic() {
L.eSw("endLiveMic"); L.eSw("endLiveMic");
if(swAuManager!=null){ if (swAuManager != null) {
swAuManager.setMicAn(false); swAuManager.setMicAn(false);
userJoinLinkMic = false; userJoinLinkMic = false;
MicStatusManager.getInstance().clear(); MicStatusManager.getInstance().clear();
@ -891,7 +895,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
if ("UsertoRY".equals(str)) { if ("UsertoRY".equals(str)) {
//todo 新增dis监听 //todo 新增dis监听
if (isShow||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) { if (isShow || MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
return; return;
} }
isShow = true; isShow = true;
@ -911,7 +915,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
}); });
} else if ("inviteMic".equals(str)) { } else if ("inviteMic".equals(str)) {
if (isShowInvitation||MicStatusManager.getInstance().getMicStatus()==MicStatusManager.MIC_TYPE_OPEN) { if (isShowInvitation || MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
return; return;
} }
isShowInvitation = true; isShowInvitation = true;
@ -963,7 +967,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
} }
} }
public void endLiveMicUser(){ public void endLiveMicUser() {
endLiveMic(); endLiveMic();
} }

View File

@ -197,7 +197,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
btn_close.setVisibility(View.GONE);//隐藏连麦按钮 btn_close.setVisibility(View.GONE);//隐藏连麦按钮
EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", "")); EventBus.getDefault().post(new AnchorInfoEvent(true, "", "", ""));
closeButtonGone(); closeButtonGone();
L.eSw("ac333333333333333333333");
SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid()); SocketSendBean seed_msg = new SocketSendBean().param("_method_", Constants.SOCKET_LINK_MIC_PK).param("action", 9).param("msgtype", 10).param("win_uid", datas.getString("win_uid")).param("uid", CommonAppConfig.getInstance().getUid());
seed_msg.create(); seed_msg.create();
Log.i("seed", seed_msg.mResult.toString()); Log.i("seed", seed_msg.mResult.toString());

View File

@ -394,7 +394,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
} }
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(),isSw); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager(), isSw);
mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer); mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer);
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
@ -957,7 +957,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (mLiveAudienceViewHolder != null) { if (mLiveAudienceViewHolder != null) {
mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.removeCallbacks();
} }
if(mLivePlayViewHolder!=null){ if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.stopPlay2(); mLivePlayViewHolder.stopPlay2();
mLiveRoomViewHolder.cancelAllAnim(); mLiveRoomViewHolder.cancelAllAnim();
} }
@ -987,7 +987,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.release(); mLiveRyLinkMicPkPresenter.release();
mLiveRyLinkMicPkPresenter = null; mLiveRyLinkMicPkPresenter = null;
} }
if(mLiveSwLinkMicPkPresenter!=null){ if (mLiveSwLinkMicPkPresenter != null) {
mLiveSwLinkMicPkPresenter.clearData(); mLiveSwLinkMicPkPresenter.clearData();
mLiveSwLinkMicPkPresenter.release(); mLiveSwLinkMicPkPresenter.release();
mLiveSwLinkMicPkPresenter = null; mLiveSwLinkMicPkPresenter = null;
@ -1031,7 +1031,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
EventBus.getDefault() EventBus.getDefault()
.post(new LiveFloatEvent() .post(new LiveFloatEvent()
.setmLiveBean(mLiveBean) .setmLiveBean(mLiveBean)
.setmLiveSDK(isSw?2:mLiveSDK) .setmLiveSDK(isSw ? 2 : mLiveSDK)
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)); .setmLiveTypeVal(mLiveTypeVal));
} }
@ -1170,8 +1170,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() { DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override @Override
public void onConfirmClick(Dialog dialog) { public void onConfirmClick(Dialog dialog) {
if(isSw){ if (isSw) {
if(mLivePlayViewHolder!=null){ if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.endLiveMic(); mLivePlayViewHolder.endLiveMic();
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
.params("roomid", liveID) .params("roomid", liveID)
@ -1189,7 +1189,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal));
} }
} }
}else{ } else {
if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) { if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
return; return;
} }
@ -1277,15 +1277,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mFirstConnectSocket) { if (!mFirstConnectSocket) {
mFirstConnectSocket = true; mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if(isSw){ if (isSw) {
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
}else{ } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1); SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
} }
} }
if(isSw){ if (isSw) {
SocketSwChatUtil.getFakeFans(mLiveBean.getUid()); SocketSwChatUtil.getFakeFans(mLiveBean.getUid());
}else{ } else {
SocketRyChatUtil.getFakeFans(mLiveBean.getUid()); SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
} }
} }
@ -1735,8 +1735,18 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onLinkDRMicPkQuit(String uid) { public void onLinkDRMicPkQuit(String uid) {
L.eSw("onLinkDRMicPkQuit:"+uid); L.eSw("onLinkDRMicPkQuit:" + uid);
mLivePlayViewHolder.removeLiveUid(uid); mLivePlayViewHolder.removeLiveUid(uid);
int removeUid = 0;
for (int k = 0; k < pkScores.size(); k++) {
JSONObject score = pkScores.getJSONObject(k);
String userID = score.getString("id");
if (userID.equals(uid)) {
removeUid = k;
}
}
pkScores.remove(removeUid);
upDataPkScore(pkScores, -1);
} }
/** /**
@ -2166,9 +2176,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮"); MobclickAgent.onEvent(mContext, "live_room_light", "直播间点亮");
mLighted = true; mLighted = true;
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE; int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if(isSw){ if (isSw) {
SocketSwChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType); SocketSwChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}else{ } else {
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType); SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
} }
} }
@ -2228,9 +2238,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 更新主播映票数 * 更新主播映票数
*/ */
public void sendUpdateVotesMessage() { public void sendUpdateVotesMessage() {
if(isSw){ if (isSw) {
SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); SocketSwChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}else{ } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal); SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
} }
} }
@ -2354,6 +2364,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mViewPager.setCanScroll(enableScroll); mViewPager.setCanScroll(enableScroll);
} }
public JSONArray pkScores;
/** /**
* 用户端多人Pk * 用户端多人Pk
* *
@ -2362,6 +2374,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
*/ */
public void upDataPkScore(JSONArray pkScores, int time) { public void upDataPkScore(JSONArray pkScores, int time) {
L.eSw("upDataPkScore" + time); L.eSw("upDataPkScore" + time);
this.pkScores = pkScores;
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {
String liveId = mLiveBean.getUid(); String liveId = mLiveBean.getUid();
JSONObject liveModel = null; JSONObject liveModel = null;
@ -2376,8 +2389,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
pkScores.remove(index); pkScores.remove(index);
pkScores.add(0, liveModel); pkScores.add(0, liveModel);
if (time == -1) {
mLiveRoomViewHolder.upDataPkScore(pkScores);
} else {
mLiveRoomViewHolder.upDataPkScore(pkScores, time); mLiveRoomViewHolder.upDataPkScore(pkScores, time);
mLivePlayViewHolder.claerDrPkInfoView(); mLivePlayViewHolder.claerDrPkInfoView();
}
setPkStatus(true); setPkStatus(true);
} }
//通知心愿单位置换地方 //通知心愿单位置换地方

View File

@ -49,7 +49,7 @@
<FrameLayout <FrameLayout
android:id="@+id/pk_container" android:id="@+id/pk_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="270dp" android:layout_height="280dp"
android:layout_marginTop="130dp"> android:layout_marginTop="130dp">
<com.yunbao.live.custom.MyFrameLayout4 <com.yunbao.live.custom.MyFrameLayout4
@ -69,7 +69,7 @@
<LinearLayout <LinearLayout
android:id="@+id/dr_pk_view" android:id="@+id/dr_pk_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="270dp" android:layout_height="280dp"
android:layout_marginTop="130dp" android:layout_marginTop="130dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone"> android:visibility="gone">