單人PK卡0分 優化計算中

This commit is contained in:
18142669586 2023-01-10 13:27:13 +08:00
parent 652e569e2b
commit a22dfb6214

View File

@ -39,6 +39,7 @@ import com.tencent.trtc.TRTCCloud;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.http.HttpCallback; 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;
@ -304,18 +305,19 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
*/ */
int i = 0; int i = 0;
private void nextPkTimeCountDown() { private void nextPkTimeCountDown(int is) {
Log.i("vvvs", "mHandler:" + (mHandler != null));
if (mHandler != null) { if (mHandler != null) {
mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime()); mHandler.sendEmptyMessageAtTime(WHAT_PK_TIME, getNextSecondTime());
} }
if (mLiveLinkMicPkViewHolder != null) { if (mLiveLinkMicPkViewHolder != null) {
String s = mIsPkEnd ? mPkTimeString2 : mPkTimeString1; String s = mIsPkEnd ? mPkTimeString2 : mPkTimeString1;
String s1 = StringUtil.getDurationText(mPkTimeCount * 1000); String s1 = StringUtil.getDurationText(mPkTimeCount * 1000);
// if (i == 1 && s1.equals("00:01")) { Log.i("tag23333",mPkTimeCount+"mPkTimeCount"+s1+"is"+is);
// s1 = "00:00"; if (i == 1 && s1.equals("00:01")) {
// i = 0; s1 = "00:00";
// } i = 0;
}
if (rtcRoom != null) { if (rtcRoom != null) {
ScreenDimenUtil util = ScreenDimenUtil.getInstance(); ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
@ -328,8 +330,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
Log.i("tts", s1); Log.i("tts", s1);
mLiveLinkMicPkViewHolder.setTime(s + " " + s1); mLiveLinkMicPkViewHolder.setTime(s + " " + s1);
if (i == 0 && s1.equals("00:01") && mIsAnchor && !s.contains("懲罰")) { if ( s1.equals("00:01") && mIsAnchor && !s.contains("懲罰")) {
i = 1;
HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK") HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK")
.params("uid", CommonAppConfig.getInstance().getUid()) .params("uid", CommonAppConfig.getInstance().getUid())
.params("addtime", "00:00") .params("addtime", "00:00")
@ -384,11 +385,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* pk时间倒计时 * pk时间倒计时
*/ */
private void changePkTime() { private void changePkTime() {
if (mPkTimeCount < 0) return; if (mPkTimeCount<0)return;
mPkTimeCount--; mPkTimeCount--;
Log.i("vvvs", "mPkTimeCount:" + mPkTimeCount); Log.i("vvvs", "mPkTimeCount:" + mPkTimeCount);
if (mPkTimeCount >= 0) {// if (mPkTimeCount >= 0) {//
nextPkTimeCountDown(); nextPkTimeCountDown(1);
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setPkStatus(true); ((LiveAudienceActivity) mContext).setPkStatus(true);
} }
@ -1921,7 +1922,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
mPkTimeCount = pkTime; mPkTimeCount = pkTime;
Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer);
mPkTimeFromServer = pkTime; mPkTimeFromServer = pkTime;
nextPkTimeCountDown(); nextPkTimeCountDown(2);
} }
@ -1957,7 +1958,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); Log.d("mPkTimeCount1", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer);
// mPkTimeFromServer=pkTime; // mPkTimeFromServer=pkTime;
//恢复播放画面 //恢复播放画面
nextPkTimeCountDown(); nextPkTimeCountDown(3);
} }
@ -1984,7 +1985,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
mLiveLinkMicPkViewHolder.startAnim(); mLiveLinkMicPkViewHolder.startAnim();
mLiveLinkMicPkViewHolder.showTime(); mLiveLinkMicPkViewHolder.showTime();
nextPkTimeCountDown();
if (mIsAnchor) { if (mIsAnchor) {
((LiveRyAnchorActivity) mContext).setPkBtnVisible(false); ((LiveRyAnchorActivity) mContext).setPkBtnVisible(false);
mPkTimeCount = PK_TIME_MAX; mPkTimeCount = PK_TIME_MAX;
@ -1993,6 +1993,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
// mPkTimeCount=mPkTimeFromServer; // mPkTimeCount=mPkTimeFromServer;
mPkTimeCount = PK_TIME_MAX; mPkTimeCount = PK_TIME_MAX;
} }
nextPkTimeCountDown(4);
Log.d("mPkTimeCount2", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); Log.d("mPkTimeCount2", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer);
} }
@ -2036,7 +2037,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
mLiveLinkMicPkViewHolder.end(-1); mLiveLinkMicPkViewHolder.end(-1);
} }
mPkTimeCount = PK_TIME_MAX_2;//进入惩罚时间 mPkTimeCount = PK_TIME_MAX_2;//进入惩罚时间
nextPkTimeCountDown(); nextPkTimeCountDown(5);
} }
} }
@ -2164,7 +2165,6 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
mHandler.removeCallbacksAndMessages(null); mHandler.removeCallbacksAndMessages(null);
} }
mSocketRyClient = null; mSocketRyClient = null;
mHandler = null;
if (mLiveLinkMicPkViewHolder != null) { if (mLiveLinkMicPkViewHolder != null) {
mLiveLinkMicPkViewHolder.release(); mLiveLinkMicPkViewHolder.release();
} }