Commit 8b46d24e authored by Vũ Gia Vương's avatar Vũ Gia Vương

fix bottle idle in action screen

parent 6e6b468c
...@@ -81,25 +81,25 @@ ...@@ -81,25 +81,25 @@
"__id__": 52 "__id__": 52
}, },
{ {
"__id__": 61 "__id__": 63
}, },
{ {
"__id__": 24 "__id__": 24
}, },
{ {
"__id__": 63 "__id__": 65
}, },
{ {
"__id__": 76 "__id__": 78
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 80 "__id__": 82
}, },
{ {
"__id__": 81 "__id__": 83
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2526,13 +2526,16 @@ ...@@ -2526,13 +2526,16 @@
"__id__": 53 "__id__": 53
}, },
{ {
"__id__": 56 "__id__": 55
},
{
"__id__": 58
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 60 "__id__": 62
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2585,7 +2588,7 @@ ...@@ -2585,7 +2588,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Chum", "_name": "hu-3s",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 52 "__id__": 52
...@@ -2595,9 +2598,6 @@ ...@@ -2595,9 +2598,6 @@
"_components": [ "_components": [
{ {
"__id__": 54 "__id__": 54
},
{
"__id__": 55
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2611,8 +2611,8 @@ ...@@ -2611,8 +2611,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1093, "width": 1080,
"height": 2547.04 "height": 1920
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -2623,15 +2623,15 @@ ...@@ -2623,15 +2623,15 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 5.456,
-150, 60.013,
0, 0,
0, 0,
0, 0,
0, 0,
1, 1,
1, 0.9,
1, 0.9,
1 1
] ]
}, },
...@@ -2646,7 +2646,7 @@ ...@@ -2646,7 +2646,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "32I7/gEANEv4ZYYMJj/1is" "_id": "d7NUHxWZhIRbtTLl/Gl65i"
}, },
{ {
"__type__": "sp.Skeleton", "__type__": "sp.Skeleton",
...@@ -2680,7 +2680,7 @@ ...@@ -2680,7 +2680,7 @@
"_playTimes": 0, "_playTimes": 0,
"_isAniComplete": true, "_isAniComplete": true,
"_N$skeletonData": { "_N$skeletonData": {
"__uuid__": "6254bb53-0ce0-44c2-9033-fcc936cfbb8f" "__uuid__": "94dfd4d1-2b3e-45dd-8797-089cef59f346"
}, },
"_N$_defaultCacheMode": 0, "_N$_defaultCacheMode": 0,
"_N$debugSlots": false, "_N$debugSlots": false,
...@@ -2688,18 +2688,125 @@ ...@@ -2688,18 +2688,125 @@
"_N$debugMesh": false, "_N$debugMesh": false,
"_N$useTint": false, "_N$useTint": false,
"_N$enableBatch": false, "_N$enableBatch": false,
"_id": "cebTgTiHdBrI0XLqLYoPWZ" "_id": "e7MXjBnTpMSaCPdGnHUecZ"
},
{
"__type__": "cc.Node",
"_name": "Chum",
"_objFlags": 0,
"_parent": {
"__id__": 52
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 56
},
{
"__id__": 57
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1093,
"height": 2547.04
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-150,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "32I7/gEANEv4ZYYMJj/1is"
}, },
{ {
"__type__": "d7d73L1pxdMD4Pi4WPAHUMG", "__type__": "d7d73L1pxdMD4Pi4WPAHUMG",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 53 "__id__": 55
}, },
"_enabled": true, "_enabled": true,
"_id": "32Nb7fXTdNIYe2FGNiHQD8" "_id": "32Nb7fXTdNIYe2FGNiHQD8"
}, },
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
},
"_enabled": true,
"_materials": [
{
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
}
],
"paused": false,
"defaultSkin": "default",
"defaultAnimation": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"loop": true,
"premultipliedAlpha": true,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_skeletonCache": null,
"_animationName": "default",
"_animationQueue": [],
"_headAniInfo": null,
"_playTimes": 0,
"_isAniComplete": true,
"_N$skeletonData": {
"__uuid__": "6254bb53-0ce0-44c2-9033-fcc936cfbb8f"
},
"_N$_defaultCacheMode": 0,
"_N$debugSlots": false,
"_N$debugBones": false,
"_N$debugMesh": false,
"_N$useTint": false,
"_N$enableBatch": false,
"_id": "cebTgTiHdBrI0XLqLYoPWZ"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "buaPos", "_name": "buaPos",
...@@ -2709,7 +2816,7 @@ ...@@ -2709,7 +2816,7 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 57 "__id__": 59
} }
], ],
"_active": true, "_active": true,
...@@ -2767,16 +2874,16 @@ ...@@ -2767,16 +2874,16 @@
"_name": "Bua", "_name": "Bua",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 56 "__id__": 58
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 58 "__id__": 60
}, },
{ {
"__id__": 59 "__id__": 61
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2832,12 +2939,9 @@ ...@@ -2832,12 +2939,9 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 57 "__id__": 59
}, },
"_enabled": true, "_enabled": true,
"chumNode": {
"__id__": 53
},
"_id": "de4Eqj7wlDIqqcvtH5WY/o" "_id": "de4Eqj7wlDIqqcvtH5WY/o"
}, },
{ {
...@@ -2845,7 +2949,7 @@ ...@@ -2845,7 +2949,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 57 "__id__": 59
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2890,6 +2994,12 @@ ...@@ -2890,6 +2994,12 @@
"__id__": 52 "__id__": 52
}, },
"_enabled": true, "_enabled": true,
"bottleIdle": {
"__id__": 53
},
"bottleAction": {
"__id__": 55
},
"_id": "45yzC1EPtJP4Z8W/DF1iwD" "_id": "45yzC1EPtJP4Z8W/DF1iwD"
}, },
{ {
...@@ -2903,7 +3013,7 @@ ...@@ -2903,7 +3013,7 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 62 "__id__": 64
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2959,7 +3069,7 @@ ...@@ -2959,7 +3069,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 61 "__id__": 63
}, },
"_enabled": true, "_enabled": true,
"_id": "96hHP+ssxLNpn8/i2AKAyI" "_id": "96hHP+ssxLNpn8/i2AKAyI"
...@@ -2973,19 +3083,19 @@ ...@@ -2973,19 +3083,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 64 "__id__": 66
}, },
{ {
"__id__": 67 "__id__": 69
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 74 "__id__": 76
}, },
{ {
"__id__": 75 "__id__": 77
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3041,16 +3151,16 @@ ...@@ -3041,16 +3151,16 @@
"_name": "The", "_name": "The",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 63 "__id__": 65
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 65 "__id__": 67
}, },
{ {
"__id__": 66 "__id__": 68
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3106,7 +3216,7 @@ ...@@ -3106,7 +3216,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 64 "__id__": 66
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3148,7 +3258,7 @@ ...@@ -3148,7 +3258,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 64 "__id__": 66
}, },
"_enabled": true, "_enabled": true,
"_id": "8aU9CpQKRFmJMSMUCpaItu" "_id": "8aU9CpQKRFmJMSMUCpaItu"
...@@ -3158,17 +3268,17 @@ ...@@ -3158,17 +3268,17 @@
"_name": "Replay Button", "_name": "Replay Button",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 63 "__id__": 65
}, },
"_children": [ "_children": [
{ {
"__id__": 68 "__id__": 70
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 73 "__id__": 75
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3224,20 +3334,20 @@ ...@@ -3224,20 +3334,20 @@
"_name": "Background", "_name": "Background",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 67 "__id__": 69
}, },
"_children": [ "_children": [
{ {
"__id__": 69 "__id__": 71
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 71 "__id__": 73
}, },
{ {
"__id__": 72 "__id__": 74
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3293,13 +3403,13 @@ ...@@ -3293,13 +3403,13 @@
"_name": "Label", "_name": "Label",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 68 "__id__": 70
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 70 "__id__": 72
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3355,7 +3465,7 @@ ...@@ -3355,7 +3465,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 69 "__id__": 71
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3388,7 +3498,7 @@ ...@@ -3388,7 +3498,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 68 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3420,7 +3530,7 @@ ...@@ -3420,7 +3530,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 68 "__id__": 70
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
...@@ -3447,7 +3557,7 @@ ...@@ -3447,7 +3557,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 67 "__id__": 69
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -3520,7 +3630,7 @@ ...@@ -3520,7 +3630,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
}, },
"_N$target": { "_N$target": {
"__id__": 68 "__id__": 70
}, },
"_id": "adCMRaOEVD5LOjd7MAm9EO" "_id": "adCMRaOEVD5LOjd7MAm9EO"
}, },
...@@ -3529,7 +3639,7 @@ ...@@ -3529,7 +3639,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 63 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"_id": "bcaw0ZNyRPGoK8ATotq1yF" "_id": "bcaw0ZNyRPGoK8ATotq1yF"
...@@ -3539,7 +3649,7 @@ ...@@ -3539,7 +3649,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 63 "__id__": 65
}, },
"_enabled": true, "_enabled": true,
"_id": "17J7OqMb1NsbF4iJiNTrDS" "_id": "17J7OqMb1NsbF4iJiNTrDS"
...@@ -3553,13 +3663,13 @@ ...@@ -3553,13 +3663,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 77 "__id__": 79
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 79 "__id__": 81
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3615,13 +3725,13 @@ ...@@ -3615,13 +3725,13 @@
"_name": "beer-bottle-rolling-on-a-sidewalk-82234", "_name": "beer-bottle-rolling-on-a-sidewalk-82234",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 76 "__id__": 78
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 78 "__id__": 80
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3677,7 +3787,7 @@ ...@@ -3677,7 +3787,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 77 "__id__": 79
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -3696,11 +3806,11 @@ ...@@ -3696,11 +3806,11 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 76 "__id__": 78
}, },
"_enabled": true, "_enabled": true,
"rollingSound": { "rollingSound": {
"__id__": 78 "__id__": 80
}, },
"_id": "a5vu6IE1ROn6VO7UPM9J3p" "_id": "a5vu6IE1ROn6VO7UPM9J3p"
}, },
......
...@@ -8,3 +8,7 @@ export const STOP_ANIM_CHUM = 'STOP_ANIM_CHUM'; ...@@ -8,3 +8,7 @@ export const STOP_ANIM_CHUM = 'STOP_ANIM_CHUM';
export const SHOW_SELECT_POPUP = 'SHOW_SELECT_POPUP'; export const SHOW_SELECT_POPUP = 'SHOW_SELECT_POPUP';
export const PLAY_ROLLING_SOUND = 'PLAY_ROLLING_SOUND'; export const PLAY_ROLLING_SOUND = 'PLAY_ROLLING_SOUND';
export const PLAY_ANIM_NUT1 = 'PLAY_ANIM_NUT1';
export const PLAY_ANIM_NUT2 = 'PLAY_ANIM_NUT2';
export const PLAY_ANIM_NUT3 = 'PLAY_ANIM_NUT3';
export const PLAY_ANIM_NUT4 = 'PLAY_ANIM_NUT4';
\ No newline at end of file
import { eventTarget, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP } from "../Events"; import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP } from "../Events";
import { Global } from "../Global"; import { Global } from "../Global";
import ChumController from "./ChumController"; import ChumController from "./ChumController";
...@@ -7,17 +7,12 @@ const { ccclass, property } = cc._decorator; ...@@ -7,17 +7,12 @@ const { ccclass, property } = cc._decorator;
@ccclass @ccclass
export default class BuaController extends cc.Component { export default class BuaController extends cc.Component {
@property(cc.Node)
private chumNode: cc.Node = null;
private _chumCtrl: ChumController = null;
private spine: sp.Skeleton = null; private spine: sp.Skeleton = null;
private _count = 0; private _count = 0;
private _actions: Function[] = []; private _actions: Function[] = [];
private _skins = ["Bua", "Ga", "Gai_lung", "Gay"] private _skins = ["Bua", "Ga", "Gai_lung", "Gay"]
protected onLoad(): void { protected onLoad(): void {
this._chumCtrl = this.chumNode.getComponent(ChumController);
this.spine = this.node.getComponent(sp.Skeleton); this.spine = this.node.getComponent(sp.Skeleton);
this.spine.setSkin('Bua'); this.spine.setSkin('Bua');
...@@ -40,31 +35,39 @@ export default class BuaController extends cc.Component { ...@@ -40,31 +35,39 @@ export default class BuaController extends cc.Component {
this.spine.setAnimation(0, "Dap1", false); this.spine.setAnimation(0, "Dap1", false);
this.spine.timeScale = 1; this.spine.timeScale = 1;
this.playSound(); this.playSound();
this._chumCtrl.playAnimationNut1(); this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT1);
}, 0.5)
} }
private playAnimationDap2(): void { private playAnimationDap2(): void {
this.spine.setAnimation(0, "Dap2", false); this.spine.setAnimation(0, "Dap2", false);
this.spine.timeScale = 1.2; this.spine.timeScale = 1.2;
this.playSound(); this.playSound();
this._chumCtrl.playAnimationNut2(); this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT2);
}, 0.4)
} }
private playAnimationDap3(): void { private playAnimationDap3(): void {
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();
this._chumCtrl.playAnimationNut3(); this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT3);
}, 0.3)
} }
private playAnimationDap4(): void { private playAnimationDap4(): void {
this.spine.setAnimation(0, "Dap4", false); this.spine.setAnimation(0, "Dap4", false);
this.spine.timeScale = 1.6; this.spine.timeScale = 1.6;
this.playSound(); this.playSound();
this._chumCtrl.playAnimationNut4(); this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT4);
}, 0.2)
cc.tween(this.node) cc.tween(this.node)
.by(0.5, { position: cc.v3(300,) }) .by(0.5, { position: cc.v3(1000,) })
.call(() => { .call(() => {
eventTarget.emit(SHOW_CARD_POPUP); eventTarget.emit(SHOW_CARD_POPUP);
}) })
...@@ -72,6 +75,5 @@ export default class BuaController extends cc.Component { ...@@ -72,6 +75,5 @@ export default class BuaController extends cc.Component {
} }
private playSound() { private playSound() {
// this.node.getComponent(cc.AudioSource).play();
} }
} }
import { eventTarget, SHOW_ACTION_SCREEN, STOP_ANIM_CHUM } from "../Events"; import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, SHOW_ACTION_SCREEN, STOP_ANIM_CHUM } from "../Events";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -16,11 +16,15 @@ export default class ChumController extends cc.Component { ...@@ -16,11 +16,15 @@ export default class ChumController 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._actions = [this.playAnimationNut1, this.playAnimationNut2, this.playAnimationNut3, this.playAnimationNut4]; this._actions = [this.playAnimationNut1, this.playAnimationNut2, this.playAnimationNut3, this.playAnimationNut4];
eventTarget.on(STOP_ANIM_CHUM, this.stopAnimation, this); eventTarget.on(STOP_ANIM_CHUM, this.stopAnimation, this);
eventTarget.on(PLAY_ANIM_NUT1, this.playAnimationNut1, this);
eventTarget.on(PLAY_ANIM_NUT2, this.playAnimationNut2, this);
eventTarget.on(PLAY_ANIM_NUT3, this.playAnimationNut3, this);
eventTarget.on(PLAY_ANIM_NUT4, this.playAnimationNut4, this);
} }
private onTouchStart(): void { private onTouchStart(): void {
// this._actions[this._count].bind(this)();
// this._count = (this._count + 1) % this._actions.length;
} }
private stopAnimation(): void { private stopAnimation(): void {
...@@ -28,6 +32,7 @@ export default class ChumController extends cc.Component { ...@@ -28,6 +32,7 @@ export default class ChumController extends cc.Component {
} }
public playAnimationNut1(): void { public playAnimationNut1(): void {
this.node.active = true;
this.spine.setAnimation(0, "nut1", true); this.spine.setAnimation(0, "nut1", true);
this.spine.timeScale = 1; this.spine.timeScale = 1;
} }
......
...@@ -25,15 +25,14 @@ export default class HuController extends cc.Component { ...@@ -25,15 +25,14 @@ export default class HuController extends cc.Component {
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this) this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this)
this.spine.setCompleteListener(() => this.setRotateAnim()); this.spine.setCompleteListener(() => this.setRotateAnim());
}
protected start(): void {
this.scheduleOnce(() => this.testDevice, 3); this.scheduleOnce(() => this.testDevice, 3);
} }
private testDevice() { private testDevice() {
this.text.string = 'testDevice'; this.text.string = 'testDevice';
console.log('testDevice',) console.log('testDevice',)
window.addEventListener("devicemotion", (event) => { window.addEventListener("devicemotion", (event) => {
if (!event.accelerationIncludingGravity) { if (!event.accelerationIncludingGravity) {
return; return;
...@@ -85,6 +84,7 @@ export default class HuController extends cc.Component { ...@@ -85,6 +84,7 @@ 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, SHOW_ACTION_SCREEN, SHOW_CARD_POPUP, SHOW_START_SCREEN } from "../Events"; import { eventTarget, PLAY_ANIM_NUT1, 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;
@ccclass @ccclass
export default class ActionScreen extends cc.Component { export default class ActionScreen extends cc.Component {
@property(cc.Node)
private bottleIdle: cc.Node = null;
@property(cc.Node)
private bottleAction: cc.Node = null;
private _buaController: BuaController = null; private _buaController: BuaController = null;
onLoad() { 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); eventTarget.on(SHOW_START_SCREEN, this.hideScreen, this);
eventTarget.on(PLAY_ANIM_NUT1, this.hideBottle, this);
this._buaController = this.getComponentInChildren(BuaController); this._buaController = this.getComponentInChildren(BuaController);
// this.node.active = false;
}
private hideBottle() {
this.bottleAction.active = true;
this.bottleIdle.active = false;
} }
private showScreen() { private showScreen() {
this.bottleAction.active = false;
this.bottleIdle.active = true;
this.node.active = true; this.node.active = true;
this._buaController.onSetTool(); this._buaController.onSetTool();
this.node.position = cc.v3();
} }
private hideScreen() { private hideScreen() {
......
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