更新
This commit is contained in:
parent
9c8a116117
commit
ecc308799c
|
|
@ -17006,7 +17006,7 @@
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "672566d3-7fa9-4a05-9db6-9ed055735289"
|
"__uuid__": "672566d3-7fa9-4a05-9db6-9ed055735289"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 1,
|
||||||
"_sizeMode": 1,
|
"_sizeMode": 1,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_fillCenter": {
|
"_fillCenter": {
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
"height": 384,
|
"height": 384,
|
||||||
"rawWidth": 419,
|
"rawWidth": 419,
|
||||||
"rawHeight": 384,
|
"rawHeight": 384,
|
||||||
"borderTop": 0,
|
"borderTop": 80,
|
||||||
"borderBottom": 0,
|
"borderBottom": 104,
|
||||||
"borderLeft": 0,
|
"borderLeft": 0,
|
||||||
"borderRight": 0,
|
"borderRight": 0,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,30 @@ export default class CareerManager2 extends cc.Component {
|
||||||
private readonly informationAutoDestroy = () => {
|
private readonly informationAutoDestroy = () => {
|
||||||
this.playInformationOut();
|
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; //总列表信息
|
listData: any; //总列表信息
|
||||||
topRankData: any[] = []; //topRank 中 careerRankItem 对应的数据
|
topRankData: any[] = []; //topRank 中 careerRankItem 对应的数据
|
||||||
|
|
@ -53,6 +77,19 @@ export default class CareerManager2 extends cc.Component {
|
||||||
|
|
||||||
// this.init();
|
// 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) {
|
init(data, topData) {
|
||||||
this.destroyInformation();
|
this.destroyInformation();
|
||||||
|
|
@ -65,13 +102,7 @@ export default class CareerManager2 extends cc.Component {
|
||||||
this.rankTotal = 100;
|
this.rankTotal = 100;
|
||||||
this.rankList.setData(data, topData);
|
this.rankList.setData(data, topData);
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
let currentDate = new Date();
|
this.refreshCurrentDate();
|
||||||
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();
|
|
||||||
|
|
||||||
// const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
|
// const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
// if (canvasTemp) {
|
// if (canvasTemp) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"last-module-event-record-time": 1786359859460,
|
"last-module-event-record-time": 1787023031670,
|
||||||
"group-list": [
|
"group-list": [
|
||||||
"default",
|
"default",
|
||||||
"Map"
|
"Map"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user