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

update hamer no spine

parent ca188e38
......@@ -8129,7 +8129,7 @@
"__id__": 180
}
],
"_active": false,
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
......@@ -8142,8 +8142,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 400,
"height": 600
"width": 300,
"height": 400
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -8181,7 +8181,7 @@
},
{
"__type__": "cc.Node",
"_name": "Bua",
"_name": "sprite2",
"_objFlags": 0,
"_parent": {
"__id__": 179
......@@ -8204,27 +8204,27 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 462.01,
"height": 540.78
"width": 447,
"height": 529
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
"x": 1,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
200,
-150,
203.733,
-122.061,
0,
0,
0,
0,
1,
1,
1,
0.7,
0.7,
1
]
},
......@@ -8239,10 +8239,10 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "55waGUsdFLKoZUlgvQto8N"
"_id": "e9wF5M37dP9IOn6qKpCrRV"
},
{
"__type__": "sp.Skeleton",
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
......@@ -8251,37 +8251,27 @@
"_enabled": true,
"_materials": [
{
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"paused": false,
"defaultSkin": "Bua",
"defaultAnimation": "Idle",
"_preCacheMode": 0,
"_cacheMode": 0,
"loop": false,
"premultipliedAlpha": true,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_skeletonCache": null,
"_animationName": "Idle",
"_animationQueue": [],
"_headAniInfo": null,
"_playTimes": 1,
"_isAniComplete": true,
"_N$skeletonData": {
"__uuid__": "a5d5b5a3-7ac9-4207-a35a-9fd1ce088b83"
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b860551f-9495-4e82-9762-f612f7edc8af"
},
"_N$_defaultCacheMode": 0,
"_N$debugSlots": false,
"_N$debugBones": false,
"_N$debugMesh": false,
"_N$useTint": false,
"_N$enableBatch": false,
"_id": "1aE3N4xspBUqI/yFdTvs1G"
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "cf2CMGcCpFL4r6z9Ih3qOw"
},
{
"__type__": "cc.Node",
......
{
"ver": "2.3.7",
"uuid": "044ac248-1050-4422-b27a-2f434c532718",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 447,
"height": 529,
"platformSettings": {},
"subMetas": {
"sprite2": {
"ver": "1.0.6",
"uuid": "b860551f-9495-4e82-9762-f612f7edc8af",
"importer": "sprite-frame",
"rawTextureUuid": "044ac248-1050-4422-b27a-2f434c532718",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 447,
"height": 529,
"rawWidth": 447,
"rawHeight": 529,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -23,7 +23,6 @@ export default class BehindFragment extends cc.Component {
if (this._isDropped) {
return;
}
console.log('shakeFragment', 1)
cc.tween(this.node)
.repeat(2, cc.tween(this.node)
......
......@@ -20,8 +20,6 @@ export default class BreakingJarController extends cc.Component {
@property(cc.Node)
private mask: cc.Node = null;
private _spine: sp.Skeleton = null;
private _skins = ["Ga", "Gai_lung", "Gay", "Bua",];
private _countFragment = 0;
private _fragmentsPosition: cc.Vec3[] = [];
......@@ -30,6 +28,7 @@ export default class BreakingJarController extends cc.Component {
private _isEnd = false;
private _behindJarChild: BehindFragment[] = [];
private _behindJarChildPosition: cc.Vec3[] = [];
private _hamerAvatar: cc.Sprite = null;
onLoad() {
......@@ -38,8 +37,6 @@ export default class BreakingJarController extends cc.Component {
// cc.PhysicsManager.DrawBits.e_jointBit |
// cc.PhysicsManager.DrawBits.e_shapeBit;
this._spine = this.hammerNode.getComponentInChildren(sp.Skeleton);
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
......@@ -53,6 +50,7 @@ export default class BreakingJarController extends cc.Component {
this._fragmentsPosition = this._fontFragments.map(item => item.position.clone());
this._behindJarChild = this.behindJar.children.map(item => item.getComponent(BehindFragment));
this._behindJarChildPosition = this.behindJar.children.map(item => item.position.clone());
this._hamerAvatar = this.hammerNode.getComponentInChildren(cc.Sprite);
this.initFog();
}
......@@ -131,7 +129,7 @@ export default class BreakingJarController extends cc.Component {
}
private beatGuild() {
// this.onHammer(cc.v2(100));
this.onHammer(cc.v2(-50, -50));
}
protected start(): void {
......@@ -141,7 +139,6 @@ export default class BreakingJarController extends cc.Component {
private resetBottle() {
this._countFragment = 0;
this._bodyFragments = [];
this._spine.setSkin(this._skins[Global.tool % this._skins.length]);
this._fontFragments.forEach((node, index) => {
node.position = this._fragmentsPosition[index];
......@@ -160,7 +157,6 @@ export default class BreakingJarController extends cc.Component {
private onHammer(newPos: cc.Vec2) {
this.hammerNode.active = true;
cc.Tween.stopAllByTarget(this.hammerNode);
this._spine.setAnimation(0, "Dap4", false);
cc.tween(this.hammerNode)
.to(0.5, { position: cc.v3(newPos.x, newPos.y, 0) })
......@@ -169,6 +165,12 @@ export default class BreakingJarController extends cc.Component {
.to(0.2, { position: cc.v3(400, -400) })
.call(() => this.hammerNode.active = false)
.start();
cc.tween(this._hamerAvatar.node)
.delay(0.2)
.to(0.2, { angle: -90 })
.to(0.05, { angle: 0 })
.start();
}
private shakeNode() {
......@@ -186,7 +188,6 @@ export default class BreakingJarController extends cc.Component {
const nodePos = this.node.convertToNodeSpaceAR(pos);
eventTarget.emit(CHECK_TOUCH, nodePos);
this._spine.setSkin(this._skins[Global.tool % this._skins.length]);
}
private onTouchEnd(event: cc.Event.EventTouch) {
......
import { BEAT_GUILD, eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, PLAY_BREAKING_SOUND, PLAY_DROP_SOUND, SHOW_CARD_POPUP, STOP_GUILD_TAP } from "../Events";
import { Global } from "../Global";
const { ccclass, property } = cc._decorator;
@ccclass
export default class BuaController extends cc.Component {
private spine: sp.Skeleton = null;
private _count = 0;
private _actions: Function[] = [];
private _skins = ["Ga", "Gai_lung", "Gay", "Bua",];
private _isPlay = false;
protected onLoad(): void {
this.spine = this.node.getComponentInChildren(sp.Skeleton);
this.spine.setSkin('Bua');
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
this._actions = [this.playAnimationDap1, this.playAnimationDap2, this.playAnimationDap3, this.playAnimationDap4];
eventTarget.on(BEAT_GUILD, this.beatGuild, this);
}
private beatGuild() {
this.spine.setAnimation(0, "Dap2", false);
this.spine.timeScale = 1.3;
}
public onSetTool() {
this.spine.setSkin(this._skins[Global.tool % this._skins.length]);
this.node.position = cc.v3(0, 0, 0);
this._isPlay = true;
}
private onTouchEnd(): void {
if (this._count + Global.tool > 3) {
this._count = 0;
}
}
private onTouchStart(): void {
eventTarget.emit(STOP_GUILD_TAP);
if (!this._isPlay) {
return;
}
this._actions[Global.tool + this._count].bind(this)();
this._count++;
if (Global.tool + this._count > 3) {
this._isPlay = false;
}
}
private playAnimationDap1(): void {
this.spine.setAnimation(0, "Dap1", false);
this.spine.timeScale = 1;
this.playSound();
this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT1);
}, 0.5)
}
private playAnimationDap2(): void {
this.spine.setAnimation(0, "Dap2", false);
this.spine.timeScale = 1.2;
this.playSound();
this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT2);
}, 0.4)
}
private playAnimationDap3(): void {
this.spine.setAnimation(0, "Dap3", false);
this.spine.timeScale = 1.4;
this.playSound();
this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT3);
}, 0.3)
}
private playAnimationDap4(): void {
this.spine.setAnimation(0, "Dap4", false);
this.spine.timeScale = 1.6;
this.playSound();
this.scheduleOnce(() => {
eventTarget.emit(PLAY_ANIM_NUT4);
eventTarget.emit(PLAY_BREAKING_SOUND);
}, 0.2)
cc.tween(this.node)
.delay(0.2)
.by(0.5, { position: cc.v3(0, -1500) })
.delay(0.5)
.call(() => {
eventTarget.emit(SHOW_CARD_POPUP);
})
.start();
}
private playSound() {
eventTarget.emit(PLAY_DROP_SOUND);
}
}
{
"ver": "1.1.0",
"uuid": "fa954246-a361-4f4c-84bf-a3471c3f7902",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { eventTarget, PLAY_ANIM_NUT1, PLAY_ANIM_NUT2, PLAY_ANIM_NUT3, PLAY_ANIM_NUT4, SHOW_ACTION_SCREEN, SHOW_START_SCREEN } from "../Events";
import BuaController from "../GamePlay/BuaController";
const { ccclass, property } = cc._decorator;
......@@ -10,7 +9,6 @@ export default class ActionScreen extends cc.Component {
@property(cc.Node)
private bottleAction: cc.Node = null;
private _buaController: BuaController = null;
private _spine: sp.Skeleton = null;
onLoad() {
......@@ -20,7 +18,6 @@ export default class ActionScreen extends cc.Component {
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._spine = this.bottleIdle.getComponent(sp.Skeleton);
}
......@@ -35,7 +32,6 @@ export default class ActionScreen extends cc.Component {
this._spine.setAnimation(0, 'Idle', true);
this.node.active = true;
this._buaController.onSetTool();
this.node.position = cc.v3();
}
......
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