This commit is contained in:
COMPUTER\EDY 2026-08-18 16:30:55 +08:00
parent 9c8a116117
commit ecc308799c
4 changed files with 42 additions and 11 deletions

View File

@ -17006,7 +17006,7 @@
"_spriteFrame": {
"__uuid__": "672566d3-7fa9-4a05-9db6-9ed055735289"
},
"_type": 0,
"_type": 1,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {

View File

@ -28,8 +28,8 @@
"height": 384,
"rawWidth": 419,
"rawHeight": 384,
"borderTop": 0,
"borderBottom": 0,
"borderTop": 80,
"borderBottom": 104,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}

View File

@ -40,6 +40,30 @@ export default class CareerManager2 extends cc.Component {
private readonly informationAutoDestroy = () => {
this.playInformationOut();
};
private currentDateKey: string = "";
private readonly refreshCurrentDate = () => {
if (!this.bg || !cc.isValid(this.bg, true)) {
return;
}
const currentDate = new Date();
const dateKey = `${currentDate.getFullYear()}-${currentDate.getMonth()}-${currentDate.getDate()}`;
if (dateKey === this.currentDateKey) {
return;
}
const monthNode = this.bg.getChildByName("month");
const dayNode = this.bg.getChildByName("day");
const monthLabel = monthNode && monthNode.getComponent(cc.Label);
const dayLabel = dayNode && dayNode.getComponent(cc.Label);
if (!monthLabel || !dayLabel) {
return;
}
monthLabel.string = (currentDate.getMonth() + 1).toString();
dayLabel.string = currentDate.getDate().toString();
this.currentDateKey = dateKey;
};
listData: any; //总列表信息
topRankData: any[] = []; //topRank 中 careerRankItem 对应的数据
@ -53,6 +77,19 @@ export default class CareerManager2 extends cc.Component {
// this.init();
}
onEnable() {
this.refreshCurrentDate();
this.unschedule(this.refreshCurrentDate);
this.schedule(this.refreshCurrentDate, 60);
cc.game.off(cc.game.EVENT_SHOW, this.refreshCurrentDate, this);
cc.game.on(cc.game.EVENT_SHOW, this.refreshCurrentDate, this);
}
onDisable() {
this.unschedule(this.refreshCurrentDate);
cc.game.off(cc.game.EVENT_SHOW, this.refreshCurrentDate, this);
}
//初始化数据
init(data, topData) {
this.destroyInformation();
@ -65,13 +102,7 @@ export default class CareerManager2 extends cc.Component {
this.rankTotal = 100;
this.rankList.setData(data, topData);
// 获取当前日期
let currentDate = new Date();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
if (this.bg.getChildByName("month"))
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
if (this.bg.getChildByName("day"))
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
this.refreshCurrentDate();
// const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
// if (canvasTemp) {

View File

@ -1,5 +1,5 @@
{
"last-module-event-record-time": 1786359859460,
"last-module-event-record-time": 1787023031670,
"group-list": [
"default",
"Map"