123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import { MouseConst } from "./MouseConst";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class MouseDecor extends cc.Component {
- @property(cc.Node)
- flowerLeft: cc.Node = null;
- @property(cc.Node)
- flowerRight: cc.Node = null;
- @property(cc.Node)
- grassLeft: cc.Node = null;
- @property(cc.Node)
- grassRight: cc.Node = null;
- @property(cc.Node)
- goldLeft: cc.Node = null;
- @property(cc.Node)
- goldRight: cc.Node = null;
- @property(cc.Node)
- rodarate: cc.Node = null;
- onEnterSuper() {
- cc.tween(this.flowerLeft)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.flowerLeft.x - this.flowerLeft.width })
- .start();
- cc.tween(this.flowerRight)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.flowerRight.x + this.flowerRight.width })
- .start();
- cc.tween(this.grassLeft)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.grassLeft.x + 100, y: this.grassLeft.y - 60 })
- .start();
- cc.tween(this.grassRight)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.grassRight.x - 100, y: this.grassRight.y - 60 })
- .start();
- cc.tween(this.goldLeft)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.goldLeft.x + 150, y: this.goldLeft.y + 100 })
- .start();
- cc.tween(this.goldRight)
- .to(MouseConst.SUPER_ENTER_TIME, { x: this.goldRight.x - 150, y: this.goldRight.y + 100 })
- .call(() => {
- cc.tween(this.rodarate)
- .delay(1)
- .set({ scale: 0, opacity: 255, active: true })
- .to(0.2, { scale: 1.2 })
- .to(0.1, { scale: 1 })
- .start();
- })
- .start();
- }
- onExitSuper() {
- cc.tween(this.flowerLeft)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.flowerLeft.x + this.flowerLeft.width })
- .start();
- cc.tween(this.flowerRight)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.flowerRight.x - this.flowerRight.width })
- .start();
- cc.tween(this.grassLeft)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.grassLeft.x - 100, y: this.grassLeft.y + 60 })
- .start();
- cc.tween(this.grassRight)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.grassRight.x + 100, y: this.grassRight.y + 60 })
- .start();
- cc.tween(this.goldLeft)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.goldLeft.x - 150, y: this.goldLeft.y - 100 })
- .start();
- cc.tween(this.goldRight)
- .to(MouseConst.SUPER_EXIT_TIME, { x: this.goldRight.x + 150, y: this.goldRight.y - 100 })
- .start();
- cc.tween(this.rodarate)
- .delay(0.3)
- .to(0.3, { opacity: 0 })
- .set({ active: false })
- .start();
- }
- }
|