调整PK排位赛判断
This commit is contained in:
parent
0f457efce6
commit
d53d250e6f
@ -706,7 +706,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 主播与主播PK 所有人收到PK开始的回调
|
||||
*/
|
||||
@Override
|
||||
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
|
||||
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname,String isLadders) {
|
||||
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
|
||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
@ -718,6 +718,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
|
||||
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
mLiveRoomViewHolder.initPkRank(isLadders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -763,13 +763,13 @@ public class SocketClient {
|
||||
break;
|
||||
case 2://收到对方确认主播PK回调
|
||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||
break;
|
||||
case 3://对方主播拒绝PK的回调
|
||||
mListener.onLinkMicPkRefuse();
|
||||
break;
|
||||
case 4://所有人收到PK开始址的回调
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||
break;
|
||||
case 5://PK时候断开连麦的回调
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
|
@ -247,7 +247,7 @@ public interface SocketMessageListener {
|
||||
/**
|
||||
* 主播与主播PK 所有人收到PK开始的回调
|
||||
*/
|
||||
void onLinkMicPkStart(String pkUid, String pkhead, String pkname);
|
||||
void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders);
|
||||
|
||||
/**
|
||||
* 主播与主播PK 断开连麦pk的回调
|
||||
|
@ -1004,13 +1004,13 @@ public class SocketRyClient {
|
||||
break;
|
||||
case 2://收到对方主播PK回调
|
||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||
break;
|
||||
case 3://对方主播拒绝PK的回调
|
||||
mListener.onLinkMicPkRefuse();
|
||||
break;
|
||||
case 4://所有人收到PK开始址的回调
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"));
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||
break;
|
||||
case 5://PK时候断开连麦的回调
|
||||
if (rtcRoom != null) {
|
||||
|
@ -1511,16 +1511,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
initPkRank();
|
||||
}
|
||||
|
||||
private void initPkRank() {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPkRanksList(mLiveUid, pkUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(listResponseModel -> {
|
||||
PkRankBean bean = listResponseModel.getData().getInfo();
|
||||
ToastUtil.show("触发PK排位赛");
|
||||
Log.i("PK", bean.toString());
|
||||
if (bean != null) {
|
||||
private void initPkRankView() {
|
||||
if(pkRankVf.getTag()!=null){
|
||||
return;
|
||||
}
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22));
|
||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = DpUtil.dp2px(2);
|
||||
@ -1530,30 +1524,50 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
ImageView titleIcon = new ImageView(mContext);
|
||||
mPkRankIcon = hourView.findViewById(R.id.wish_pic);
|
||||
mPkRankText = hourView.findViewById(R.id.wish_index);
|
||||
mPkRankText.setText(bean.getName());
|
||||
mPkRankText.setLayoutParams(textParams);
|
||||
mPkRankText.setGravity(Gravity.CENTER);
|
||||
titleIcon.setImageResource(R.mipmap.icon_pk_rank);
|
||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||
titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
mPkRankIcon.setLayoutParams(params);
|
||||
pkRankVf.addView(titleIcon);
|
||||
pkRankVf.addView(hourView);
|
||||
pkRankVf.startFlipping();
|
||||
pkRankVf.setTag("start");
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(bean.getPkTopImgUrl())){
|
||||
private void initPkRank() {
|
||||
initPkRank(null);
|
||||
}
|
||||
|
||||
public void initPkRank(String isLadders) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getPkRanksList(mLiveUid, pkUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(listResponseModel -> {
|
||||
PkRankBean bean = listResponseModel.getData().getInfo();
|
||||
if (bean != null) {
|
||||
Log.i("PK", bean.toString() + " | " + isLadders);
|
||||
initPkRankView();
|
||||
|
||||
mPkRankText.setText(bean.getName());
|
||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||
if (StringUtil.isEmpty(bean.getPkTopImgUrl()) || StringUtil.isEmpty(isLadders)) {
|
||||
return;
|
||||
}
|
||||
if(Integer.parseInt(bean.getRedVal())>2) {
|
||||
if (!StringUtil.isEmpty(isLadders)) {
|
||||
bean.setPkTopImgUrl(isLadders);
|
||||
}
|
||||
if (Integer.parseInt(bean.getRedVal()) > 2) {
|
||||
mRedVal.setVisibility(View.VISIBLE);
|
||||
mRedVal.setText(bean.getRedVal() + "連勝");
|
||||
}
|
||||
if(Integer.parseInt(bean.getBlueVal())>2) {
|
||||
if (Integer.parseInt(bean.getBlueVal()) > 2) {
|
||||
mBlueVal.setVisibility(View.VISIBLE);
|
||||
mBlueVal.setText(bean.getBlueVal() + "連勝");
|
||||
}
|
||||
mPkRankTopIcon.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext,bean.getPkTopImgUrl(),mPkRankTopIcon);
|
||||
ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon);
|
||||
}
|
||||
}, Throwable::printStackTrace)
|
||||
.isDisposed();
|
||||
@ -1593,6 +1607,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
private void updatePkRank(PkRankBean bean) {
|
||||
mPkRankText.setText(bean.getName());
|
||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||
initPkRank();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1784,8 +1799,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
uidR2 = "";
|
||||
uidR1 = "";
|
||||
uidR3 = "";
|
||||
|
||||
initPkRank();
|
||||
}
|
||||
|
||||
//双人pk关闭
|
||||
@ -1793,7 +1806,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mPkRankTopIcon.setVisibility(View.GONE);
|
||||
lt_pk_line.setVisibility(View.GONE);
|
||||
livePKUserListBean = new LivePKUserListBean();
|
||||
pkUid="";
|
||||
pkUid = "";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3561,6 +3574,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
case PK_TWO_START:
|
||||
pkUid = event.getObject().toString();
|
||||
UpPkTwo();
|
||||
initPkRank();
|
||||
break;
|
||||
case PK_TWO_END:
|
||||
closePkTwo();
|
||||
|
@ -923,7 +923,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname) {
|
||||
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders) {
|
||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||
Handler handler = new Handler();
|
||||
@ -934,6 +934,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid());
|
||||
if (!liveID.equals(CommonAppConfig.getInstance().getUid())) {
|
||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||
mLiveRoomViewHolder.initPkRank(isLadders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user