12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- const GameNotificationKey = require('../utils/GameEnum').GameNotificationKey;
- const GameModule = require("../utils/GameModule");
- cc.Class({
- extends: cc.Component,
- properties: {
- coinRichText: cc.RichText,
- coinSkeleton: sp.Skeleton
- },
-
- onLoad () {
- this.vsize = cc.view.getVisibleSize();
- this.coinSkeleton.node.y = -600;
- },
- init(gold) {
- this.gold = gold;
- this.showCoin();
- },
- showCoin() {
- let coinY = (this.vsize.height - this.coinSkeleton.node.height)/2 - 350;
- let moveAction = cc.moveTo(0.8, 0, coinY).easing(cc.easeCubicActionOut());
- let scaleAction = cc.scaleTo(0.8, 1.5, 1.5);
- let spaw = cc.spawn(moveAction,scaleAction);
- let finished = cc.callFunc(() => {
- this.coinSkeleton.node.scale = 1.0;
- this.coinSkeleton.setAnimation(0, 'jinbi_hit', false);
- GameModule.audioMng.playUpdateBuilding();
- this.coinSkeleton.setCompleteListener(() => {
- });
- setTimeout(() => {
- this.showCoinText();
- }, 700);
- });
- this.coinSkeleton.node.runAction(cc.sequence(spaw, finished));
- GameEvent.fire(GameNotificationKey.PlaySuccessAnimation, true);
- GameEvent.fire('just_cat_hit');
- },
- showCoinText() {
- this.coinRichText.node.active = true;
- this.coinRichText.string = `<img src='coin_small'/><b> +${this.gold}</>`;
- setTimeout(() => {
- this.node.destroy();
- }, 1100);
- },
- start () {
- },
-
- });
|