Commit 3581f880 authored by 范雪寒's avatar 范雪寒

feat: showlog

parent 56d3fee4
...@@ -1181,7 +1181,7 @@ ...@@ -1181,7 +1181,7 @@
"__id__": 7 "__id__": 7
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 2,
"_target": null, "_target": null,
"_alignFlags": 45, "_alignFlags": 45,
"_left": 0, "_left": 0,
......
...@@ -266,20 +266,34 @@ cc.Class({ ...@@ -266,20 +266,34 @@ cc.Class({
}, },
showLog(str) { showLog(str) {
console.log('str = ' + str); if (!this.logList) {
this.logList = [];
}
this.logList.push(str);
if (this.logList.length == 1) {
this.showOneLog();
}
},
showOneLog() {
const str = this.logList.pop();
if (str === undefined) {
return;
}
const node = new cc.Node(); const node = new cc.Node();
const label = node.addComponent(cc.RichText); const label = node.addComponent(cc.RichText);
label.string = `<outline color=black width=3>${str}</outline>`; label.string = `<outline color=black width=3>${str}</outline>`;
label.maxWidth = this.node.width / 2; label.maxWidth = this.node.width / 2;
// node.x = this.node.width / 2;
node.y = -this.node.height / 2; node.y = -this.node.height / 2;
node.parent = this.node; node.parent = this.node;
cc.tween(node) cc.tween(node)
.to(5, { y: this.node.height }) .to(5, { y: this.node.height })
.call(() => { .removeSelf()
node.removeFromParent();
})
.start(); .start();
setTimeout(() => {
this.showOneLog();
}, 1000);
}, },
getRainbowColorList() { getRainbowColorList() {
......
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