Commit 3bfe8fce authored by haiyoucuv's avatar haiyoucuv

整理一下代码

parent deb491a5
......@@ -13,6 +13,7 @@
<file url="file://$PROJECT_DIR$/assets/plugin/declare-process.js" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/assets/plugin/declare-process.js.meta" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/assets/store" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/preview-template/mock/loop/changeDetails.do.json" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/preview-template/mock/loop/prizeRecord.do.json" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/../../批量压缩资源/点我开始处理资源压缩.bat" charset="GBK" />
<file url="PROJECT" charset="GBK" />
......
import { _decorator, Component, Node, Label, Color } from 'cc';
import { dateFormatter, strFormat } from 'db://assets/Scripts/Utils/Utils';
import { ScrollListItem } from 'db://assets/Scripts/ScrollList/ScrollListItem';
const { ccclass, property } = _decorator;
const {ccclass, property} = _decorator;
@ccclass("RecordScrollListItem")
export class RecordScrollListItem extends ScrollListItem {
start() {}
start() {
}
onItemRender(data, ...param: any[]) {
if (Object.keys(data).includes("ifGetPrize")) {
this.node.getChildByName("Title").getComponent(Label).string = `获得${data?.score || 0}游园币`;
this.node.getChildByName("Time").getComponent(Label).string = `${dateFormatter(data?.timestamp, "yyyy.MM.dd hh:mm")}`;
if(!!data?.ifGetPrize) {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(255, 5, 0, 255);
this.node.getChildByName("Desc").getComponent(Label).string = `获得宝箱`;
} else {
this.node.getChildByName("Desc").getComponent(Label).string = `未获得宝箱`;
this.node.getChildByName("Desc").getComponent(Label).color = new Color(16, 168, 73, 255);
}
} else {
this.node.getChildByName("Title").getComponent(Label).string = strFormat(data?.source, 30);
this.node.getChildByName("Time").getComponent(Label).string = `${dateFormatter(data?.timestamp, "yyyy.MM.dd hh:mm")}`;
this.node.getChildByName("Desc").getComponent(Label).string = `挑战次数${data?.type || ""}${data?.num}`;
if (data?.type == "-") {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(16, 168, 73, 255);
onItemRender(data, ...param: any[]) {
if (Object.keys(data).includes("ifGetPrize")) {
this.node.getChildByName("Title").getComponent(Label).string = `获得${data?.score || 0}游园币`;
this.node.getChildByName("Time").getComponent(Label).string = `${dateFormatter(data?.timestamp, "yyyy.MM.dd hh:mm")}`;
if (!!data?.ifGetPrize) {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(255, 5, 0, 255);
this.node.getChildByName("Desc").getComponent(Label).string = `获得宝箱`;
} else {
this.node.getChildByName("Desc").getComponent(Label).string = `未获得宝箱`;
this.node.getChildByName("Desc").getComponent(Label).color = new Color(16, 168, 73, 255);
}
} else {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(255, 5, 0, 255);
const arr = data?.source.split("@");
let source = arr[0];
if (arr.length > 1) {
source += arr[arr.length - 1].slice(1);
}
this.node.getChildByName("Title").getComponent(Label).string = strFormat(source, 30);
this.node.getChildByName("Time").getComponent(Label).string = `${dateFormatter(data?.timestamp, "yyyy.MM.dd hh:mm")}`;
this.node.getChildByName("Desc").getComponent(Label).string = `挑战次数${data?.type || ""}${data?.num}`;
if (data?.type == "-") {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(16, 168, 73, 255);
} else {
this.node.getChildByName("Desc").getComponent(Label).color = new Color(255, 5, 0, 255);
}
}
}
}
}
......@@ -13,7 +13,7 @@
"num": 1
},
{
"source": "culpa do et amet dolor",
"source": "AAAAA@1@1@1任务",
"type": "+",
"timestamp": -12505387.003454074,
"num": 999
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment