Commit 66221ebf authored by haiyoucuv's avatar haiyoucuv

init

parent e3d9ec0f
This diff is collapsed.
......@@ -15,8 +15,8 @@
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"wrapModeS": "mirrored-repeat",
"wrapModeT": "mirrored-repeat",
"imageUuidOrDatabaseUri": "081e6f77-5816-4ab7-be1e-cc9917759e54",
"isUuid": true,
"visible": false,
......@@ -45,11 +45,11 @@
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"trimY": 31,
"width": 1620,
"height": 450,
"rawWidth": 1620,
"rawHeight": 450,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......@@ -84,23 +84,23 @@
],
"uv": [
0,
450,
481,
1620,
450,
0,
481,
0,
31,
1620,
0
31
],
"nuv": [
0,
0,
0.060546875,
1,
0.060546875,
0,
0,
1,
0.939453125,
1,
1
0.939453125
],
"minPos": [
-810,
......
......@@ -61,22 +61,25 @@ export class PropBtn extends Component {
cd = 0;
startCd(cd = 5) {
this.cdTxt.node.active = true;
this.cdMask.node.active = true;
this.cd = this.totalCd = cd;
tween(this as PropBtn)
.to(cd, { cd: 0 }, {
onUpdate: (target: PropBtn, ratio: number) => {
this.drawProcess(1 - ratio);
const cdStr = this.cd < 10 ? this.cd.toFixed(1) : Math.ceil(this.cd);
this.cdTxt.string = `${cdStr}s`;
},
onComplete: () => {
return new Promise<void>((resolve) => {
this.cdTxt.node.active = true;
this.cdMask.node.active = true;
this.cd = this.totalCd = cd;
tween(this as PropBtn)
.to(cd, { cd: 0 }, {
onUpdate: (target: PropBtn, ratio: number) => {
this.drawProcess(1 - ratio);
const cdStr = this.cd < 10 ? this.cd.toFixed(1) : Math.ceil(this.cd);
this.cdTxt.string = `${cdStr}s`;
}
})
.call(() => {
this.cdTxt.node.active = false;
this.cdMask.node.active = false;
}
})
.start();
resolve();
})
.start();
});
}
start() {
......
import { _decorator, Component, Graphics, Label, misc, Node, tween } from "cc";
import { _decorator, Component, easing, Graphics, Label, misc, Node, tween, v3 } from "cc";
const { ccclass, property, executeInEditMode } = _decorator;
......@@ -6,7 +6,7 @@ const { ccclass, property, executeInEditMode } = _decorator;
@executeInEditMode()
export class Target extends Component {
static _ins: Target = null;
private static _ins: Target = null;
static get ins() {
return this._ins;
}
......@@ -17,7 +17,8 @@ export class Target extends Component {
@property(Label) goalTxt: Label = null;
@property(Node) banner: Node = null;
@property(Node) mask: Node = null;
@property(Node) banner3: Node = null;
protected onLoad() {
Target._ins = this;
......@@ -28,7 +29,26 @@ export class Target extends Component {
}
start() {
this.startCd(10);
}
async showBanner3() {
this.banner3.active = true;
this.mask.active = true;
await new Promise<void>((resolve) => {
tween(this.banner3)
.delay(2.666)
.to(0.666, {
position: v3(0, 345, 0),
scale: v3(0.15, 0.15, 1)
}, {easing: easing.quadInOut})
.delay(0.1)
.call(() => {
this.mask.active = false;
this.banner3.active = false;
resolve();
})
.start();
});
}
totalCd = 0;
......
......@@ -24,6 +24,7 @@ import { useNick } from "./Common/AINick";
import { observer, render } from "../../store/decorators";
import gameStore from "../../store/gameStore";
import { PreCd } from "./Components/PreCd";
import { Target } from "./Components/Target";
const { ccclass, property } = _decorator;
......@@ -104,7 +105,11 @@ export class MainGame extends Scene {
this.initAnimal(this.maxAnimal);
// this.initAnimal(1);
PreCd.ins.node.active = true;
await Target.ins.showBanner3();
await PreCd.ins.startCd();
Target.ins.startCd(10);
// 设置游戏状态
this.setGameState(GameState.PLAY);
......
import { _decorator, Component, Node } from 'cc';
import { _decorator, Component, Node, tween } from "cc";
import { PropBtn } from "../Components/PropBtn";
import { MainGame } from "../MainGame";
const { ccclass, property } = _decorator;
@ccclass('SpeedPropBtn')
export class SpeedPropBtn extends PropBtn {
start() {
}
doUse() {
super.doUse();
MainGame.ins.player.moveScale += 1;
tween(this.node)
.delay(5)
.call(()=>{
MainGame.ins.player.moveScale -= 1;
});
this.startCd(15);
}
}
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