Commit 6e6a6831 authored by 范雪寒's avatar 范雪寒

feat: log

parent 3581f880
......@@ -270,6 +270,7 @@ cc.Class({
this.logList = [];
}
this.logList.push(str);
console.log(str);
if (this.logList.length == 1) {
this.showOneLog();
......@@ -277,14 +278,16 @@ cc.Class({
},
showOneLog() {
const str = this.logList.pop();
const str = this.logList[0];
if (str === undefined) {
return;
}
const node = new cc.Node();
node.anchorX = 0.5;
const label = node.addComponent(cc.RichText);
label.string = `<outline color=black width=3>${str}</outline>`;
label.maxWidth = this.node.width / 2;
node.x = this.node.width / 4;
node.y = -this.node.height / 2;
node.parent = this.node;
cc.tween(node)
......@@ -292,6 +295,7 @@ cc.Class({
.removeSelf()
.start();
setTimeout(() => {
this.logList.shift();
this.showOneLog();
}, 1000);
},
......
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