修改黄金矿工活动面板的倒计时规则

This commit is contained in:
keke 2026-10-10 17:15:37 +08:00
parent 85daacefe1
commit 1f3c329eb3
2 changed files with 60 additions and 49 deletions

View File

@ -601,7 +601,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "CountdownDigits", "_name": "CountdownLabel",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 5 "__id__": 5
@ -648,6 +648,9 @@
"_components": [ "_components": [
{ {
"__id__": 82 "__id__": 82
},
{
"__id__": 1079
} }
], ],
"_prefab": { "_prefab": {
@ -663,8 +666,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 300, "width": 208,
"height": 31 "height": 48
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -675,8 +678,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-216.877, -215.404,
612.993, 614.993,
0, 0,
0, 0,
0, 0,
@ -712,7 +715,7 @@
"__id__": 17 "__id__": 17
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 20 "__id__": 20
@ -894,7 +897,7 @@
"__id__": 22 "__id__": 22
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 25 "__id__": 25
@ -1079,7 +1082,7 @@
"__id__": 30 "__id__": 30
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 33 "__id__": 33
@ -1369,7 +1372,7 @@
"__id__": 35 "__id__": 35
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 38 "__id__": 38
@ -1551,7 +1554,7 @@
"__id__": 40 "__id__": 40
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 43 "__id__": 43
@ -1736,7 +1739,7 @@
"__id__": 48 "__id__": 48
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 51 "__id__": 51
@ -2026,7 +2029,7 @@
"__id__": 53 "__id__": 53
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 56 "__id__": 56
@ -2208,7 +2211,7 @@
"__id__": 58 "__id__": 58
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 61 "__id__": 61
@ -3095,49 +3098,36 @@
"sync": false "sync": false
}, },
{ {
"__type__": "bef06RsP29LE5VJ6q2m1Y1j", "__type__": "cc.Label",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 15 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"frames": [ "_materials": [
{ {
"__uuid__": "0be8cba5-0878-4aae-8176-b5e9cc996810" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
{
"__uuid__": "f4a29cd3-e764-4d78-aac0-39274314ea36"
},
{
"__uuid__": "cb06d1e2-76bc-4e4c-ae55-247d96cf2f71"
},
{
"__uuid__": "fa45f996-7b1c-4afd-8145-5fb98c5096da"
},
{
"__uuid__": "c7cb4d0d-998d-4b63-8e2f-3f330f57af36"
},
{
"__uuid__": "43574e26-80c6-4dac-a400-9e2f05fe6bc1"
},
{
"__uuid__": "cbba1cd8-b585-4c38-be4e-54555a60f3d2"
},
{
"__uuid__": "125d20d0-dc73-45fb-bc78-5394045eea26"
},
{
"__uuid__": "db2928c6-3b77-443f-b50f-aea2d0034510"
},
{
"__uuid__": "87521681-ee1a-4a1d-bbe6-818818cfc284"
} }
], ],
"slashFrame": null, "_srcBlendFactor": 770,
"height": 31, "_dstBlendFactor": 771,
"gap": -2.48, "_string": "6天10时",
"colonWidth": 0.48, "_N$string": "6天10时",
"_fontSize": 34,
"_lineHeight": 42,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 2,
"_N$cacheMode": 0,
"_id": "" "_id": ""
}, },
{ {
@ -39711,5 +39701,23 @@
}, },
"fileId": "", "fileId": "",
"sync": false "sync": false
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
} }
] ]

View File

@ -7,7 +7,7 @@ const { ccclass, property } = cc._decorator;
export default class CoinMadnessPanel extends cc.Component { export default class CoinMadnessPanel extends cc.Component {
@property(cc.Node) card: cc.Node = null; @property(cc.Node) card: cc.Node = null;
@property(cc.Node) dim: cc.Node = null; @property(cc.Node) dim: cc.Node = null;
@property(CoinMadnessDigits) countdown: CoinMadnessDigits = null; @property(cc.Label) countdown: cc.Label = null;
@property(cc.SpriteFrame) flyingCoin: cc.SpriteFrame = null; @property(cc.SpriteFrame) flyingCoin: cc.SpriteFrame = null;
@property(CoinMadnessDigits) totalDigits: CoinMadnessDigits = null; @property(CoinMadnessDigits) totalDigits: CoinMadnessDigits = null;
@property(cc.Node) lockedOffer: cc.Node = null; @property(cc.Node) lockedOffer: cc.Node = null;
@ -451,7 +451,10 @@ export default class CoinMadnessPanel extends cc.Component {
if (!this.data) return; if (!this.data) return;
const remaining = Math.max(0, Math.ceil(((this.data.state.config.endsAt || 0) - Date.now() - this.offset) / 1000)); const remaining = Math.max(0, Math.ceil(((this.data.state.config.endsAt || 0) - Date.now() - this.offset) / 1000));
const pad = (value: number) => value < 10 ? '0' + value : String(value); const pad = (value: number) => value < 10 ? '0' + value : String(value);
this.countdown.setText(pad(Math.floor(remaining / 3600)) + ':' + pad(Math.floor(remaining / 60) % 60) + ':' + pad(remaining % 60)); // Match the home entry: omit minutes (without rounding up) while at least one day remains.
this.countdown.string = remaining >= 86400
? Math.floor(remaining / 86400) + '天' + Math.floor(remaining % 86400 / 3600) + '时'
: pad(Math.floor(remaining / 3600)) + ':' + pad(Math.floor(remaining / 60) % 60) + ':' + pad(remaining % 60);
if (this.api.request && !remaining) { this.finishExpired(); return; } if (this.api.request && !remaining) { this.finishExpired(); return; }
} }
private async run(action: string, body: any) { private async run(action: string, body: any) {