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

feat: log

parent 3581f880
...@@ -270,6 +270,7 @@ cc.Class({ ...@@ -270,6 +270,7 @@ cc.Class({
this.logList = []; this.logList = [];
} }
this.logList.push(str); this.logList.push(str);
console.log(str);
if (this.logList.length == 1) { if (this.logList.length == 1) {
this.showOneLog(); this.showOneLog();
...@@ -277,14 +278,16 @@ cc.Class({ ...@@ -277,14 +278,16 @@ cc.Class({
}, },
showOneLog() { showOneLog() {
const str = this.logList.pop(); const str = this.logList[0];
if (str === undefined) { if (str === undefined) {
return; return;
} }
const node = new cc.Node(); const node = new cc.Node();
node.anchorX = 0.5;
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 / 4;
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)
...@@ -292,6 +295,7 @@ cc.Class({ ...@@ -292,6 +295,7 @@ cc.Class({
.removeSelf() .removeSelf()
.start(); .start();
setTimeout(() => { setTimeout(() => {
this.logList.shift();
this.showOneLog(); this.showOneLog();
}, 1000); }, 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