Commit ac391f38 authored by haiyoucuv's avatar haiyoucuv

init

parent a4cdb39c
......@@ -6041,8 +6041,12 @@
"graphics": {
"__id__": 155
},
"cdTxt": null,
"goalTxt": null,
"cdTxt": {
"__id__": 144
},
"goalTxt": {
"__id__": 158
},
"_id": "dfl2fX641H3qOpggystLiY"
},
{
......
......@@ -14,7 +14,6 @@ export class PropBtn extends Component {
cdTxt: Label;
onLoad() {
this.img = this.node.getChildByName("img").getComponent(Sprite);
this.nameTxt = this.node.getChildByName("name").getComponent(Label);
......@@ -46,8 +45,7 @@ export class PropBtn extends Component {
startCd(cd = 5) {
this.cdTxt.node.active = true;
this.cdMask.node.active = true;
this.totalCd = cd;
this.cd = cd;
this.cd = this.totalCd = cd;
tween(this as PropBtn)
.to(cd, { cd: 0 }, {
onUpdate: (target: PropBtn, ratio: number) => {
......@@ -66,9 +64,6 @@ export class PropBtn extends Component {
}
update(deltaTime: number) {
}
}
import { _decorator, Component, Graphics, Label, math, misc, Node } from "cc";
import { _decorator, Component, Graphics, Label, math, misc, Node, tween } from "cc";
const { ccclass, property, executeInEditMode } = _decorator;
......@@ -13,18 +13,31 @@ export class Target extends Component {
@property(Label) goalTxt: Label = null;
start() {
// this.graphics.clear();
// this.graphics.moveTo(120, 0);
// this.graphics.lineTo(120, -51);
// this.graphics.arc(110, -51, 10, 0, -Math.PI / 2, false);
// this.graphics.lineTo(-110, -61);
// this.graphics.arc(-110, -51, 10, -Math.PI / 2, -Math.PI, false);
// this.graphics.lineTo(-120, 0);
// this.graphics.stroke();
this.drawProcess(0.5);
this.startCd(10);
}
totalCd = 0;
cd = 0;
startCd(cd = 5) {
this.graphics.node.active = true;
this.cd = this.totalCd = cd;
tween(this as Target)
.to(cd, { cd: 0 }, {
onUpdate: (target: Target, ratio: number) => {
this.drawProcess(1 - ratio);
this.cdTxt.string = `${~~this.cd}`;
},
onComplete: () => {
this.cdTxt.string = `0`;
this.graphics.node.active = false;
}
})
.start();
}
drawProcess = (() => {
const phases = [
51,
......@@ -105,7 +118,4 @@ export class Target extends Component {
};
})();
update(deltaTime: number) {
}
}
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