Commit 3b28ba3c authored by Vũ Gia Vương's avatar Vũ Gia Vương

fix ainm hu

parent f85e41d8
...@@ -709,7 +709,6 @@ ...@@ -709,7 +709,6 @@
"__id__": 12 "__id__": 12
}, },
"_enabled": true, "_enabled": true,
"text": null,
"_id": "a8/vxo82JDpZc7wn+//wVR" "_id": "a8/vxo82JDpZc7wn+//wVR"
}, },
{ {
...@@ -1241,8 +1240,8 @@ ...@@ -1241,8 +1240,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
2500,
0, 0,
-2500,
0, 0,
0, 0,
0, 0,
...@@ -1291,7 +1290,7 @@ ...@@ -1291,7 +1290,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1200, "width": 3000,
"height": 1920 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -2955,7 +2954,7 @@ ...@@ -2955,7 +2954,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-2500, -3000,
0, 0,
0, 0,
0, 0,
...@@ -3522,8 +3521,8 @@ ...@@ -3522,8 +3521,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-3500,
0, 0,
2500,
0, 0,
0, 0,
0, 0,
...@@ -3572,7 +3571,7 @@ ...@@ -3572,7 +3571,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1200, "width": 3000,
"height": 1920 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
......
import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, PLAY_BREAKING_SOUND, PLAY_DROP_SOUND, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP } from "../Events"; import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, PLAY_BREAKING_SOUND, PLAY_DROP_SOUND, SHOW_CARD_POPUP } from "../Events";
import { Global } from "../Global"; import { Global } from "../Global";
import ChumController from "./ChumController";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -12,7 +11,6 @@ export default class BuaController extends cc.Component { ...@@ -12,7 +11,6 @@ export default class BuaController extends cc.Component {
private _actions: Function[] = []; private _actions: Function[] = [];
private _skins = ["Ga", "Gai_lung", "Gay", "Bua",]; private _skins = ["Ga", "Gai_lung", "Gay", "Bua",];
private _isPlay = false; private _isPlay = false;
private _beatTotal = [1, 2, 3, 4];
protected onLoad(): void { protected onLoad(): void {
this.spine = this.node.getComponentInChildren(sp.Skeleton); this.spine = this.node.getComponentInChildren(sp.Skeleton);
...@@ -22,22 +20,14 @@ export default class BuaController extends cc.Component { ...@@ -22,22 +20,14 @@ export default class BuaController extends cc.Component {
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this); this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this); this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
this._actions = [this.playAnimationDap1, this.playAnimationDap2, this.playAnimationDap3, this.playAnimationDap4]; this._actions = [this.playAnimationDap1, this.playAnimationDap2, this.playAnimationDap3, this.playAnimationDap4];
this._isPlay = true;
} }
public onSetTool() { public onSetTool() {
this.spine.setSkin(this._skins[Global.tool % this._skins.length]); this.spine.setSkin(this._skins[Global.tool % this._skins.length]);
this.node.position = cc.v3(0, 0, 0); this.node.position = cc.v3(0, 0, 0);
this._isPlay = true;
} }
// private onTouchStart(): void {
// this._actions[this._count].bind(this)();
// // this._actions[3 - Global.tool].bind(this)();
// console.log('this._count', this._count)
// this._count = (this._count + 1) % this._actions.length;
// }
private onTouchEnd(): void { private onTouchEnd(): void {
if (this._count + Global.tool > 3) { if (this._count + Global.tool > 3) {
this._count = 0; this._count = 0;
...@@ -45,15 +35,14 @@ export default class BuaController extends cc.Component { ...@@ -45,15 +35,14 @@ export default class BuaController extends cc.Component {
} }
private onTouchStart(): void { private onTouchStart(): void {
if(!this._isPlay){
return;
}
this._actions[Global.tool + this._count].bind(this)(); this._actions[Global.tool + this._count].bind(this)();
if (this._count == 0) { this._count++;
this._actions.slice(0, Global.tool + this._count).forEach((action, index) => { if(Global.tool + this._count > 3 ){
this.scheduleOnce(() => { this._isPlay = false;
action.bind(this)();
}, 0.2 * index)
})
} }
this._count = (this._count + 1) % this._actions.length;
} }
private playAnimationDap1(): void { private playAnimationDap1(): void {
...@@ -75,7 +64,6 @@ export default class BuaController extends cc.Component { ...@@ -75,7 +64,6 @@ export default class BuaController extends cc.Component {
} }
private playAnimationDap3(): void { private playAnimationDap3(): void {
console.log('playAnimationDap3',)
this.spine.setAnimation(0, "Dap3", false); this.spine.setAnimation(0, "Dap3", false);
this.spine.timeScale = 1.4; this.spine.timeScale = 1.4;
this.playSound(); this.playSound();
...@@ -94,11 +82,12 @@ export default class BuaController extends cc.Component { ...@@ -94,11 +82,12 @@ export default class BuaController extends cc.Component {
}, 0.2) }, 0.2)
cc.tween(this.node) cc.tween(this.node)
.delay(0.2)
.by(0.5, { position: cc.v3(0, -1500) })
.delay(0.5) .delay(0.5)
.call(() => { .call(() => {
eventTarget.emit(SHOW_CARD_POPUP); eventTarget.emit(SHOW_CARD_POPUP);
}) })
.by(0.5, { position: cc.v3(1000,) })
.start(); .start();
} }
......
...@@ -24,7 +24,7 @@ export default class ChumController extends cc.Component { ...@@ -24,7 +24,7 @@ export default class ChumController extends cc.Component {
} }
private onTouchStart(): void { private onTouchStart(): void {
} }
private stopAnimation(): void { private stopAnimation(): void {
...@@ -32,25 +32,29 @@ export default class ChumController extends cc.Component { ...@@ -32,25 +32,29 @@ export default class ChumController extends cc.Component {
} }
public playAnimationNut1(): void { public playAnimationNut1(): void {
this.node.active = true; this.playAnimation("nut1")
this.spine.setAnimation(0, "nut1", true);
this.spine.timeScale = 1; this.spine.timeScale = 1;
} }
public playAnimationNut2(): void { public playAnimationNut2(): void {
this.spine.setAnimation(0, "nut2", true); this.playAnimation("nut2")
this.spine.timeScale = 1; this.spine.timeScale = 1;
} }
public playAnimationNut3(): void { public playAnimationNut3(): void {
console.log('playAnimationNut3', ) this.node.active = true;
this.spine.setAnimation(0, "nut3", true); this.playAnimation("nut3")
this.spine.timeScale = 0.5; this.spine.timeScale = 0.5;
} }
public playAnimationNut4(): void { public playAnimationNut4(): void {
this.spine.setAnimation(0, "nut4", false); this.playAnimation("nut4", false)
this.spine.timeScale = 0.5; this.spine.timeScale = 0.5;
} }
private playAnimation(animName: string, isLoop: boolean = true): void {
this.node.active = true;
this.spine.setAnimation(0, animName, isLoop);
}
} }
...@@ -4,9 +4,6 @@ const { ccclass, property } = cc._decorator; ...@@ -4,9 +4,6 @@ const { ccclass, property } = cc._decorator;
@ccclass @ccclass
export default class HuController extends cc.Component { export default class HuController extends cc.Component {
@property(cc.Label)
private text: cc.Label = null;
private spine: sp.Skeleton = null; private spine: sp.Skeleton = null;
private _isRotate: boolean = false; private _isRotate: boolean = false;
...@@ -79,7 +76,6 @@ export default class HuController extends cc.Component { ...@@ -79,7 +76,6 @@ export default class HuController extends cc.Component {
} }
private onTouchStart(event: cc.Event.EventTouch): void { private onTouchStart(event: cc.Event.EventTouch): void {
console.log('onTouchStart',)
if (!this._pointStart) { if (!this._pointStart) {
this.setRotateAnim(); this.setRotateAnim();
} }
......
import { eventTarget, PLAY_ANIM_NUT1, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP, SHOW_START_SCREEN } from "../Events"; import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP, SHOW_START_SCREEN } from "../Events";
import BuaController from "../GamePlay/BuaController"; import BuaController from "../GamePlay/BuaController";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -17,8 +17,10 @@ export default class ActionScreen extends cc.Component { ...@@ -17,8 +17,10 @@ export default class ActionScreen extends cc.Component {
eventTarget.on(SHOW_ACTION_SCREEN, this.showScreen, this); eventTarget.on(SHOW_ACTION_SCREEN, this.showScreen, this);
eventTarget.on(SHOW_START_SCREEN, this.hideScreen, this); eventTarget.on(SHOW_START_SCREEN, this.hideScreen, this);
eventTarget.on(PLAY_ANIM_NUT1, this.hideBottle, this); eventTarget.on(PLAY_ANIM_NUT1, this.hideBottle, this);
eventTarget.on(PLAY_ANIM_NUT2, this.hideBottle, this);
eventTarget.on(PLAY_ANIM_NUT3, this.hideBottle, this);
eventTarget.on(PLAY_ANIM_NUT4, this.hideBottle, this);
this._buaController = this.getComponentInChildren(BuaController); this._buaController = this.getComponentInChildren(BuaController);
// this.node.active = false;
this._spine = this.bottleIdle.getComponent(sp.Skeleton); this._spine = this.bottleIdle.getComponent(sp.Skeleton);
} }
......
...@@ -18,7 +18,6 @@ export default class SelectPopup extends cc.Component { ...@@ -18,7 +18,6 @@ export default class SelectPopup extends cc.Component {
private showPopup() { private showPopup() {
console.log('showPopup', 11)
this.node.active = true; this.node.active = true;
} }
private onOkBtnClick() { private onOkBtnClick() {
......
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