Commit 6e6b468c authored by Vũ Gia Vương's avatar Vũ Gia Vương

update main logic, hide hammer when show card

parent 22254b11
This diff is collapsed.
......@@ -27,7 +27,8 @@ export default class BuaController extends cc.Component {
}
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);
}
private onTouchStart(): void {
......@@ -62,9 +63,12 @@ export default class BuaController extends cc.Component {
this.playSound();
this._chumCtrl.playAnimationNut4();
this.scheduleOnce(() => {
eventTarget.emit(SHOW_CARD_POPUP);
}, 0.5)
cc.tween(this.node)
.by(0.5, { position: cc.v3(300,) })
.call(() => {
eventTarget.emit(SHOW_CARD_POPUP);
})
.start();
}
private playSound() {
......
......@@ -28,20 +28,18 @@ export default class HuController extends cc.Component {
}
protected start(): void {
this.scheduleOnce(() => this.testDevice, 1);
console.log('testDevice',)
this.scheduleOnce(() => this.testDevice, 3);
}
private testDevice() {
this.text.string = 'testDevice';
console.log('testDevice',)
window.addEventListener("devicemotion", (event) => {
if (!event.accelerationIncludingGravity) {
return;
}
this.text.string = `
x: ${event.accelerationIncludingGravity.x},
y: ${event.accelerationIncludingGravity.y},
z: ${event.accelerationIncludingGravity.z}`;
this.text.string = `lac`;
const x = event.accelerationIncludingGravity.x;
const y = event.accelerationIncludingGravity.y;
const z = event.accelerationIncludingGravity.z;
......
import { eventTarget, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP } from "../Events";
import { eventTarget, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP, SHOW_START_SCREEN } from "../Events";
import BuaController from "../GamePlay/BuaController";
const { ccclass, property } = cc._decorator;
......@@ -11,7 +11,8 @@ export default class ActionScreen extends cc.Component {
onLoad() {
this.node.position = cc.v3();
this.node.active = false;
eventTarget.on(SHOW_ACTION_SCREEN, this.showScreen, this);
eventTarget.on(SHOW_ACTION_SCREEN, this.showScreen, this);
eventTarget.on(SHOW_START_SCREEN, this.hideScreen, this);
this._buaController = this.getComponentInChildren(BuaController);
}
......@@ -20,4 +21,8 @@ export default class ActionScreen extends cc.Component {
this._buaController.onSetTool();
}
private hideScreen() {
this.node.active = false;
}
}
import { eventTarget, SHOW_CARD_POPUP, STOP_ANIM_CHUM } from "../Events";
import { eventTarget, SHOW_CARD_POPUP, SHOW_START_SCREEN, STOP_ANIM_CHUM } from "../Events";
const { ccclass, property } = cc._decorator;
......@@ -25,6 +25,7 @@ export default class CardPopup extends cc.Component {
private onReplayBtnClick() {
this.node.active = false;
eventTarget.emit(SHOW_START_SCREEN);
eventTarget.emit(STOP_ANIM_CHUM);
}
}
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