PK模式PK值增加福袋礼物统计

This commit is contained in:
huangjian
2020-12-19 11:42:43 +08:00
parent 76f19bfb7a
commit f0d01c13a1
3 changed files with 49 additions and 14 deletions

View File

@@ -244,8 +244,8 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
}
private void initRefreshView() {
mBinding.refreshLayout.setOnRefreshListener(() -> {
mBinding.refreshLayout.setRefreshing(false);
mBinding.refreshLayout.setOnRefreshListener(refreshLayout -> {
mBinding.refreshLayout.finishRefresh();
tryLoadData(true);
getHomeConcern();
EventBus.getDefault().post(new RefreshHomeDataEvent());

View File

@@ -81,11 +81,15 @@
</LinearLayout>
<com.yizhuan.erban.utils.VpSwipeRefreshLayout
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="@color/white"/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
@@ -241,7 +245,7 @@
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</com.yizhuan.erban.utils.VpSwipeRefreshLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout>

View File

@@ -2,7 +2,9 @@ package com.yizhuan.xchat_android_core.room.pk.model;
import android.annotation.SuppressLint;
import android.os.CountDownTimer;
import androidx.annotation.Nullable;
import android.util.SparseArray;
import com.google.gson.Gson;
@@ -13,10 +15,13 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.base.BaseModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftList;
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiver;
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
import com.yizhuan.xchat_android_core.gift.bean.MultiGiftReceiveInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.magic.MagicModel;
@@ -115,7 +120,10 @@ public class PkModel extends BaseModel implements IPkModel {
|| RoomEvent.RECEIVE_MUTLT_NORMALEI_GIFT == roomEvent.getEvent()
|| RoomEvent.RECEIVE_ALL_MIC__NORMALEI_GIFT == roomEvent.getEvent()
|| RoomEvent.RECEIVED_SINGLE_MAGIC == roomEvent.getEvent()
|| RoomEvent.RECEIVED_ALL_MIC_MAGIC == roomEvent.getEvent());
|| RoomEvent.RECEIVED_ALL_MIC_MAGIC == roomEvent.getEvent()
|| RoomEvent.RECEIVE_LUCKY_GIFT == roomEvent.getEvent()
|| RoomEvent.RECEIVE_MULTI_LUCKY_GIFT == roomEvent.getEvent()
|| RoomEvent.RECEIVE_ALL_MIC_LUCKY_GIFT == roomEvent.getEvent());
}
})
@@ -208,6 +216,27 @@ public class PkModel extends BaseModel implements IPkModel {
}
break;
case RoomEvent.RECEIVE_LUCKY_GIFT:
case RoomEvent.RECEIVE_MULTI_LUCKY_GIFT:
case RoomEvent.RECEIVE_ALL_MIC_LUCKY_GIFT:
LuckyBagGifts luckyBagGifts = roomEvent.getLuckygiftMultiReceiverInfo();
teamId = getTeamIdInPKMemberList(String.valueOf(luckyBagGifts.getTargetUid()));
if (teamId != 0) {
if (curPkInfo.getVoteMode() == PK_VOTE_MODE_GIFT_VALUE) {
int totalPrice = 0;
for (GiftList giftList : luckyBagGifts.getGiftList()) {
GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftList.getGiftId());
if (giftInfo != null) {
totalPrice += giftList.getGiftNum() * giftInfo.getGoldPrice();
}
}
addTeamScoreByGiftValue(teamId, totalPrice);
} else if (curPkInfo.getVoteMode() == PK_VOTE_MODE_PEOPLE_COUNT) {
addTeamScoreByPeopleCount(teamId, luckyBagGifts.getUid(), luckyBagGifts.getTargetUid());
}
}
break;
}
}
});
@@ -215,6 +244,7 @@ public class PkModel extends BaseModel implements IPkModel {
/**
* 判断是否是钻石礼物
*
* @param giftInfo
* @return
*/
@@ -224,8 +254,9 @@ public class PkModel extends BaseModel implements IPkModel {
/**
* 根据人数统计
*
* @param teamId
* @param uid 送礼物者
* @param uid 送礼物者
* @param targetUid 收礼物者
*/
private void addTeamScoreByPeopleCount(int teamId, long uid, long targetUid) {
@@ -590,9 +621,9 @@ public class PkModel extends BaseModel implements IPkModel {
/**
* 创建PK
*
* @param pkMode pk模式1:团队2个人
* @param voteMode 投票方式1礼物价值2送礼物人数
* @param duration pk持续时间以秒为单位
* @param pkMode pk模式1:团队2个人
* @param voteMode 投票方式1礼物价值2送礼物人数
* @param duration pk持续时间以秒为单位
* @param redTeamMembers
* @param blueTeamMembers
* @return
@@ -724,7 +755,6 @@ public class PkModel extends BaseModel implements IPkModel {
}
/**
* 开始PK
*
@@ -1279,14 +1309,15 @@ public class PkModel extends BaseModel implements IPkModel {
@FormUrlEncoded
@POST("/room/pk/create")
Single<ServiceResult<RoomPkData>> createPK(@Field("roomUid") long roomUid,
@Field("operUid") long operUid,
@Field("pkMode") int pkMode,
@Field("voteMode") int voteMode,
@Field("duration") long duration);
@Field("operUid") long operUid,
@Field("pkMode") int pkMode,
@Field("voteMode") int voteMode,
@Field("duration") long duration);
/**
* 开始pk
*
* @param roomUid 房间UID
* @param pkId pk唯一标识
* @param joinUsers 参与PK的用户排麦用户格式转化为json排麦用户格式只需要设置type和uid标识用户和所在队伍