龙虎榜

This commit is contained in:
TJH 2025-12-29 17:54:19 +08:00
parent 1e724360fd
commit 816b16ee90
6 changed files with 120 additions and 28 deletions

View File

@ -1037,7 +1037,7 @@
"__id__": 378
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 387
@ -22172,7 +22172,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -369,
"x": -320,
"y": 0,
"z": 0
},
@ -22353,7 +22353,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -190,
"x": -140,
"y": 0,
"z": 0
},
@ -22534,7 +22534,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 15,
"x": 50,
"y": 0,
"z": 0
},
@ -22715,7 +22715,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 205,
"x": 220,
"y": 0,
"z": 0
},
@ -23575,7 +23575,7 @@
"__id__": 1106
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 1115
@ -24034,7 +24034,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -369,
"x": -320,
"y": 0,
"z": 0
},
@ -24215,7 +24215,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -190,
"x": -140,
"y": 0,
"z": 0
},
@ -24396,7 +24396,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 15,
"x": 50,
"y": 0,
"z": 0
},
@ -24577,7 +24577,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 205,
"x": 220,
"y": 0,
"z": 0
},

View File

@ -80,7 +80,7 @@ export class RankHistoryList extends Component {
this.historyIndex = 1;
this.updateHistoryArrows();
this.refreshSelfRankingInfo(null);
await this.loadHistoryData(this.currentHistoryType, this.historyIndex);
}
@ -114,11 +114,10 @@ export class RankHistoryList extends Component {
// ==================== 历史记录逻辑 ====================
async loadHistoryData(type: string, index: number) {
this.setRankHistoryRadioBtn(type);
this.refreshSelfRankingInfo(null);
if (!this.isTypeAvailable(type)) {
console.log(`${type} 历史榜单活动未开启`);
this.rankHistoryLoadingNode.active = false;
this.refreshSelfRankingInfo(null);
this.rankHistoryLoadingNode.active = false;
this.showActivityNotOpenTip();
return;
}
@ -163,7 +162,7 @@ export class RankHistoryList extends Component {
this.selfInfo.getChildByName('Rank').getChildByName('sp_1').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('sp_2').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('sp_3').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').active = true;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').getComponent(Label).string = '-';
this.selfInfo.getChildByName('Uid').getComponent(Label).string = '-';
this.selfInfo.getChildByName('Shop').getComponent(Label).string = '-';

View File

@ -77,7 +77,7 @@ export class RankList extends Component {
this.rankList.active = true;
this.currentRankType = '';
this.updateRankButtonsAvailability();
this.refreshSelfRankingInfo(null);
await this.switchRankTab(defaultType);
}
@ -116,14 +116,14 @@ export class RankList extends Component {
}
async switchRankTab(type: string) {
if (this.currentRankType === type) {
if (this.currentRankType === type) {
return;
}
this.currentRankType = type;
this.setRankRadioBtn(type);
this.refreshSelfRankingInfo(null);
if (!this.isTypeAvailable(type)) {
console.log(`${type} 榜单活动未开启`);
this.rankLoadingNode.active = false;
@ -131,8 +131,7 @@ export class RankList extends Component {
this.msg_1.active = false;
}
this.marqueeTexts = [];
this.currentMarqueeIndex = 0;
this.refreshSelfRankingInfo(null);
this.currentMarqueeIndex = 0;
this.showActivityNotOpenTip();
if (this.countdownTimer) {
clearInterval(this.countdownTimer);
@ -183,7 +182,19 @@ export class RankList extends Component {
console.error('获取排行榜数据失败:', error);
this.showActivityNotOpenTip();
Tween.stopAllByTarget(this.rankLoadingNode);
if (this.countdownTimer) {
clearInterval(this.countdownTimer);
this.countdownTimer = null;
}
this.rankingEndTime.getComponent(Label).string = "--:--:--";
this.rankLoadingNode.active = false;
// 停止跑马灯
if (this.msg_1 && this.msg_1.isValid) {
Tween.stopAllByTarget(this.msg_1);
this.msg_1.active = false;
}
this.marqueeTexts = [];
this.currentMarqueeIndex = 0;
}
}
@ -264,6 +275,9 @@ export class RankList extends Component {
this.rankingListVScroll.setTotalCount(rankInfos.List.length);
this.rankingListVScroll.renderItemFn = (node: Node, idx: number) => {
let itemData = rankInfos.List[idx];
if (!itemData) {
return;
}
node.getChildByName('bg').active = idx % 2 === 0;
node.getChildByName('bg2').active = idx % 2 !== 0;
node.getChildByName('Rank').getChildByName('sp_1').active = idx === 0;
@ -285,7 +299,7 @@ export class RankList extends Component {
this.selfInfo.getChildByName('Rank').getChildByName('sp_1').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('sp_2').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('sp_3').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').active = false;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').active = true;
this.selfInfo.getChildByName('Rank').getChildByName('rankLab').getComponent(Label).string = '-';
this.selfInfo.getChildByName('Uid').getComponent(Label).string = '-';
this.selfInfo.getChildByName('Shop').getComponent(Label).string = '-';

View File

@ -46,7 +46,7 @@ export class RewardList extends Component {
init(rewardListNode: Node) {
this.rewardList = rewardListNode;
this.rewardLoadingNode = this.rewardList.getChildByName('list').getChildByName('loading');
this.rewardLoadingNode = this.rewardList.getChildByName('list').getChildByName('loading');
this.rewardListVScroll = this.rewardList.getChildByName('list').getChildByName('vScroll').getComponent(VirtualScrollView);
this.rewardRadioDWM = this.rewardList.getChildByName('rewardRadioDWM');
this.rewardRadioDayBtn = this.rewardRadioDWM.getChildByName('dayBtn');
@ -106,7 +106,7 @@ export class RewardList extends Component {
showActivityNotOpenTip() {
this.activityNotOpenTip.active = true;
this.rewardListVScroll.setTotalCount(0);
this.rewardListVScroll.setTotalCount(0);
}
async switchRewardTab(type: string) {
@ -315,7 +315,7 @@ export class RewardList extends Component {
this.isReceiving = false;
this.setButtonsInteractable(true);
}
}
}
setButtonsInteractable(interactable: boolean) {
let receiveBtn = this.rewardReceivedBtn.getComponent(Button);
@ -431,7 +431,7 @@ export class RewardList extends Component {
this.countdownTimer = null;
}
let endTime = SlotRankingDataManager.instance.getRankEndTimeByType(type);
let endTime = SlotRankingDataManager.instance.getRankEndTimeByType(type);
this.updateCountdown(endTime);
@ -452,7 +452,7 @@ export class RewardList extends Component {
return;
}
let timeStr = this.formatCountdown(remainingSeconds);
let timeStr = this.formatCountdown(remainingSeconds);
}
formatCountdown(seconds: number): string {

View File

@ -67,9 +67,10 @@ export class SlotRanking extends Component {
this.initComponents();
this.rankingBtn.setPosition(this.startPos);
this.rankingBtn.active = SlotRankingDataManager.instance.getRankListStatus() === 0 || SlotRankingDataManager.instance.getRankListStatus() === 1;
this.rankingBtn.getChildByName('icon').getComponent(sp.Skeleton).color = SlotRankingDataManager.instance.getRankListStatus() === 0 ? Color.WHITE : Color.GRAY;
this.rankingBtn.active = SlotRankingDataManager.instance.getRankListStatus() === 0 || SlotRankingDataManager.instance.getRankListStatus() === 1 || SlotRankingDataManager.instance.getRankMaxCloseTimeIsBiggerThanCurTime();
this.rankingBtn.getComponent(Button).interactable = SlotRankingDataManager.instance.getRankListStatus() === 0;
this.rankingBtn.getChildByName('icon').getComponent(sp.Skeleton).color = SlotRankingDataManager.instance.getRankListStatus() === 0 ? Color.WHITE : Color.GRAY;
this.rankingBtn.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
this.rankingBtn.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
@ -147,6 +148,14 @@ export class SlotRanking extends Component {
return false;
}
if (this.slotScene.hasEliminate) {
return false;
}
if (!this.rankingBtn.getComponent(Button).interactable) {
return false;
}
return true;
}

View File

@ -13,6 +13,76 @@ export class SlotRankingDataManager {
set rankList(list: any) { this._rankList = list; }
get rankList(): any { return this._rankList; }
/**
*
* {
"List": [
{
"Id": "20251225_day_faketrans-VND",
"Name": "",
"Type": "day",
"StartTime": 1766592000,
"EndTime": 1766689200,
"CloseTime": 1766775600,
"Status": 0,
"Rewards": [
10,
8,
5,
3,
3,
3,
3,
3,
3,
3
],
"SpinLimit": 10,
"BetLimit": 1000000
},
{
"Id": "20251222_week_faketrans-VND",
"Name": "",
"Type": "week",
"StartTime": 1766592000,
"EndTime": 1766678400,
"CloseTime": 1766764800,
"Status": 0,
"Rewards": [
10,
5,
5,
5,
5,
5,
5,
5,
5,
5
],
"SpinLimit": 10,
"BetLimit": 5000000
}
]
}
*/
getRankMaxCloseTimeIsBiggerThanCurTime(): boolean {
if (!this._rankList || !this._rankList.List || this._rankList.List.length === 0) {
// 代表当前没有活动开启,则说明关闭入口按钮
return false;
}
let maxCloseTime = 0;
for (let item of this._rankList.List) {
if (item.CloseTime > maxCloseTime) {
maxCloseTime = item.CloseTime;
}
}
return Date.now() <= (maxCloseTime * 1000);
}
getRankListStatus(): number {
if (!this._rankList || !this._rankList.List || this._rankList.List.length === 0) {
return 2;