调整PK天梯赛信息更新由接口转为IM推送

This commit is contained in:
zlzw 2024-01-02 15:42:55 +08:00
parent fbb801bf62
commit 30bdf83724
5 changed files with 61 additions and 7 deletions

View File

@ -263,6 +263,8 @@ public class Constants {
public static final String LIVE_SDK = "liveSdk"; public static final String LIVE_SDK = "liveSdk";
public static final String LIVE_KSY_CONFIG = "liveKsyConfig"; public static final String LIVE_KSY_CONFIG = "liveKsyConfig";
public static final String LIVE_PK_RANDOM_START="RankingStartRandomPK";
public static final int LIVE_SDK_KSY = 0;//金山推流 public static final int LIVE_SDK_KSY = 0;//金山推流
public static final int LIVE_SDK_TX = 1;//腾讯推流 public static final int LIVE_SDK_TX = 1;//腾讯推流

View File

@ -487,7 +487,8 @@ public class LiveAudienceEvent extends BaseModel {
IS_ATTENTION(72, "是否关注主播"), IS_ATTENTION(72, "是否关注主播"),
GIFT_WALL(73, "礼物墙"), GIFT_WALL(73, "礼物墙"),
UPDATE_FANS_TASK_STATUS(74, "更新粉丝任务状态"), UPDATE_FANS_TASK_STATUS(74, "更新粉丝任务状态"),
SUD_GAME_CREATE_ROOM(75, "主播创建sud游戏"); SUD_GAME_CREATE_ROOM(75, "主播创建sud游戏"),
PK_RANK_START(76, "PK排位赛开始");
private int type; private int type;
private String name; private String name;

View File

@ -774,6 +774,21 @@ public class SocketRyClient {
systemChatMessage2(stringBuffer.toString()); systemChatMessage2(stringBuffer.toString());
Bus.get().post(new QuickGiftingEvent().setHotNum(sendQuickGiftModel.getHotNum())); Bus.get().post(new QuickGiftingEvent().setHotNum(sendQuickGiftModel.getHotNum()));
break; break;
case Constants.LIVE_PK_RANDOM_START:
item = map.getJSONObject("ct");
item.getString("text");
item.getString("pktt_img");
item.getString("uid_win_continuity");
item.getString("pkuid_win_continuity");
pkRankBean = new PkRankBean();
pkRankBean.setBlueVal(item.getString("pkuid_win_continuity"));
pkRankBean.setRedVal( item.getString("uid_win_continuity"));
pkRankBean.setPkTopImgUrl(item.getString("pktt_img"));
EventBus.getDefault().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.PK_RANK_START)
.setObject(pkRankBean));
break;
} }
} }

View File

@ -387,7 +387,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private FrameLayout pa_pao_layout; private FrameLayout pa_pao_layout;
private LinearLayout combo_layout; private LinearLayout combo_layout;
private TextView combo_number; private TextView combo_number;
private View quick_gift_reminder ; private View quick_gift_reminder;
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) { public void onUpdata(String str) {
@ -720,6 +720,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
} }
public void onQuickGifting3() { public void onQuickGifting3() {
IMLoginManager.get(mContext).setQuickGiftIfFirst(); IMLoginManager.get(mContext).setQuickGiftIfFirst();
quick_gift_reminder.setVisibility(View.GONE); quick_gift_reminder.setVisibility(View.GONE);
@ -1565,7 +1566,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
pa_pao_layout = (FrameLayout) findViewById(R.id.pa_pao_layout); pa_pao_layout = (FrameLayout) findViewById(R.id.pa_pao_layout);
combo_layout = (LinearLayout) findViewById(R.id.combo_layout); combo_layout = (LinearLayout) findViewById(R.id.combo_layout);
combo_number = (TextView) findViewById(R.id.combo_number); combo_number = (TextView) findViewById(R.id.combo_number);
quick_gift_reminder = findViewById(R.id.quick_gift_reminder); quick_gift_reminder = findViewById(R.id.quick_gift_reminder);
pa_pao_layout.setVisibility(View.GONE); pa_pao_layout.setVisibility(View.GONE);
combo_layout.setVisibility(View.GONE); combo_layout.setVisibility(View.GONE);
@ -2435,8 +2436,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
private String pkUidTmp = ""; private String pkUidTmp = "";
private String isLadders;
public void initPkRank(String isLadders) { public void initPkRank(String isLadders) {
this.isLadders = isLadders;
//PK状态下pkuid不能为空 //PK状态下pkuid不能为空
if (pkUidTmp.equals(pkUid) && !StringUtil.isEmpty(pkUid)) { if (pkUidTmp.equals(pkUid) && !StringUtil.isEmpty(pkUid)) {
return; return;
@ -2447,11 +2450,38 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
pkRankLayout.setTag(mLiveUid); pkRankLayout.setTag(mLiveUid);
pkUidTmp = pkUid; pkUidTmp = pkUid;
pkRankLayout.setVisibility(View.GONE);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveRankPk2, "rectangle_new.png", 1);
mRedVal.setVisibility(View.GONE); mRedVal.setVisibility(View.GONE);
mBlueVal.setVisibility(View.GONE); mBlueVal.setVisibility(View.GONE);
mPkRankTopIcon.setVisibility(View.GONE); mPkRankTopIcon.setVisibility(View.GONE);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveRankPk2, "rectangle_new.png", 1);
}
public void updatePkRankInfo(PkRankBean bean) {
pkRankLayout.setVisibility(View.VISIBLE);
liveRankPk2.setVisibility(View.VISIBLE);
if (Integer.parseInt(bean.getRedVal()) > 2) {
mRedVal.setVisibility(View.VISIBLE);
mRedVal.setText(bean.getRedVal() + (WordUtil.isNewZh() ? "連勝" : "Win"));
}
if (Integer.parseInt(bean.getBlueVal()) > 2) {
mBlueVal.setVisibility(View.VISIBLE);
mBlueVal.setText(bean.getBlueVal() + (WordUtil.isNewZh() ? "連勝" : "Win"));
}
mPkRankTopIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon);
if (mRedVal.getVisibility() == View.VISIBLE) {
RelativeLayout.LayoutParams redValLayoutParams = (RelativeLayout.LayoutParams) mRedVal.getLayoutParams();
redValLayoutParams.bottomMargin = DpUtil.dp2px(10);
mRedVal.setLayoutParams(redValLayoutParams);
}
if (mBlueVal.getVisibility() == View.VISIBLE) {
RelativeLayout.LayoutParams blueValLayoutParams = (RelativeLayout.LayoutParams) mBlueVal.getLayoutParams();
blueValLayoutParams.bottomMargin = DpUtil.dp2px(10);
mBlueVal.setLayoutParams(blueValLayoutParams);
}
}
public void initRankPKInfo(String mLiveUid){
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getRandomPk(mLiveUid, pkUid, new com.yunbao.common.http.base.HttpCallback<PkRankBean>() { .getRandomPk(mLiveUid, pkUid, new com.yunbao.common.http.base.HttpCallback<PkRankBean>() {
@Override @Override
@ -2531,7 +2561,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
pkUidTmp = ""; pkUidTmp = "";
} }
}); });
} }
/** /**
@ -2555,7 +2584,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* @param rank 小时榜 * @param rank 小时榜
*/ */
public void setHourRankData(long rank) { public void setHourRankData(long rank) {
if (mHotText != null) { if (mHotText != null) {
if (rank == 0) { if (rank == 0) {
mHotText.setText(R.string.no_rank_data); mHotText.setText(R.string.no_rank_data);
} else { } else {
@ -2584,9 +2613,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
} }
public void setHotNum(String hotNum) { public void setHotNum(String hotNum) {
setHotData(formatBigNum.formatBigNum(hotNum)); setHotData(formatBigNum.formatBigNum(hotNum));
} }
/** /**
* 更新心愿单进度 * 更新心愿单进度
* *
@ -4872,6 +4903,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
case UPDATE_FANS_TASK_STATUS: case UPDATE_FANS_TASK_STATUS:
updateFansMessageRed(); updateFansMessageRed();
break; break;
case PK_RANK_START:
updatePkRankInfo((PkRankBean) event.getObject());
break;
} }
} }

View File

@ -498,6 +498,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists()); mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists());
//设置靓号 //设置靓号
mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum()); mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum());
//初始化天梯赛信息
mLiveRoomViewHolder.initRankPKInfo(String.valueOf(data.getLiveInfo().getUid()));
if (!StringUtil.isEmpty(mLiveBean.getGiftId())) { if (!StringUtil.isEmpty(mLiveBean.getGiftId())) {
mLiveRoomViewHolder.openGiftDialog(mLiveBean.getGiftId()); mLiveRoomViewHolder.openGiftDialog(mLiveBean.getGiftId());
} }