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

update hamer no spine

parent ca188e38
...@@ -8129,7 +8129,7 @@ ...@@ -8129,7 +8129,7 @@
"__id__": 180 "__id__": 180
} }
], ],
"_active": false, "_active": true,
"_components": [], "_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
...@@ -8142,8 +8142,8 @@ ...@@ -8142,8 +8142,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 400, "width": 300,
"height": 600 "height": 400
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -8181,7 +8181,7 @@ ...@@ -8181,7 +8181,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Bua", "_name": "sprite2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 179 "__id__": 179
...@@ -8204,27 +8204,27 @@ ...@@ -8204,27 +8204,27 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 462.01, "width": 447,
"height": 540.78 "height": 529
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 1,
"y": 0.5 "y": 0
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
200, 203.733,
-150, -122.061,
0, 0,
0, 0,
0, 0,
0, 0,
1, 1,
1, 0.7,
1, 0.7,
1 1
] ]
}, },
...@@ -8239,10 +8239,10 @@ ...@@ -8239,10 +8239,10 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "55waGUsdFLKoZUlgvQto8N" "_id": "e9wF5M37dP9IOn6qKpCrRV"
}, },
{ {
"__type__": "sp.Skeleton", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
...@@ -8251,37 +8251,27 @@ ...@@ -8251,37 +8251,27 @@
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"paused": false, "_srcBlendFactor": 770,
"defaultSkin": "Bua", "_dstBlendFactor": 771,
"defaultAnimation": "Idle", "_spriteFrame": {
"_preCacheMode": 0, "__uuid__": "b860551f-9495-4e82-9762-f612f7edc8af"
"_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"
}, },
"_N$_defaultCacheMode": 0, "_type": 0,
"_N$debugSlots": false, "_sizeMode": 1,
"_N$debugBones": false, "_fillType": 0,
"_N$debugMesh": false, "_fillCenter": {
"_N$useTint": false, "__type__": "cc.Vec2",
"_N$enableBatch": false, "x": 0,
"_id": "1aE3N4xspBUqI/yFdTvs1G" "y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "cf2CMGcCpFL4r6z9Ih3qOw"
}, },
{ {
"__type__": "cc.Node", "__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 { ...@@ -23,7 +23,6 @@ export default class BehindFragment extends cc.Component {
if (this._isDropped) { if (this._isDropped) {
return; return;
} }
console.log('shakeFragment', 1)
cc.tween(this.node) cc.tween(this.node)
.repeat(2, cc.tween(this.node) .repeat(2, cc.tween(this.node)
......
...@@ -20,8 +20,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -20,8 +20,6 @@ export default class BreakingJarController extends cc.Component {
@property(cc.Node) @property(cc.Node)
private mask: cc.Node = null; private mask: cc.Node = null;
private _spine: sp.Skeleton = null;
private _skins = ["Ga", "Gai_lung", "Gay", "Bua",];
private _countFragment = 0; private _countFragment = 0;
private _fragmentsPosition: cc.Vec3[] = []; private _fragmentsPosition: cc.Vec3[] = [];
...@@ -30,6 +28,7 @@ export default class BreakingJarController extends cc.Component { ...@@ -30,6 +28,7 @@ export default class BreakingJarController extends cc.Component {
private _isEnd = false; private _isEnd = false;
private _behindJarChild: BehindFragment[] = []; private _behindJarChild: BehindFragment[] = [];
private _behindJarChildPosition: cc.Vec3[] = []; private _behindJarChildPosition: cc.Vec3[] = [];
private _hamerAvatar: cc.Sprite = null;
onLoad() { onLoad() {
...@@ -38,8 +37,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -38,8 +37,6 @@ export default class BreakingJarController extends cc.Component {
// cc.PhysicsManager.DrawBits.e_jointBit | // cc.PhysicsManager.DrawBits.e_jointBit |
// cc.PhysicsManager.DrawBits.e_shapeBit; // 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_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);
...@@ -53,6 +50,7 @@ export default class BreakingJarController extends cc.Component { ...@@ -53,6 +50,7 @@ export default class BreakingJarController extends cc.Component {
this._fragmentsPosition = this._fontFragments.map(item => item.position.clone()); this._fragmentsPosition = this._fontFragments.map(item => item.position.clone());
this._behindJarChild = this.behindJar.children.map(item => item.getComponent(BehindFragment)); this._behindJarChild = this.behindJar.children.map(item => item.getComponent(BehindFragment));
this._behindJarChildPosition = this.behindJar.children.map(item => item.position.clone()); this._behindJarChildPosition = this.behindJar.children.map(item => item.position.clone());
this._hamerAvatar = this.hammerNode.getComponentInChildren(cc.Sprite);
this.initFog(); this.initFog();
} }
...@@ -131,7 +129,7 @@ export default class BreakingJarController extends cc.Component { ...@@ -131,7 +129,7 @@ export default class BreakingJarController extends cc.Component {
} }
private beatGuild() { private beatGuild() {
// this.onHammer(cc.v2(100)); this.onHammer(cc.v2(-50, -50));
} }
protected start(): void { protected start(): void {
...@@ -141,7 +139,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -141,7 +139,6 @@ export default class BreakingJarController extends cc.Component {
private resetBottle() { private resetBottle() {
this._countFragment = 0; this._countFragment = 0;
this._bodyFragments = []; this._bodyFragments = [];
this._spine.setSkin(this._skins[Global.tool % this._skins.length]);
this._fontFragments.forEach((node, index) => { this._fontFragments.forEach((node, index) => {
node.position = this._fragmentsPosition[index]; node.position = this._fragmentsPosition[index];
...@@ -160,7 +157,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -160,7 +157,6 @@ export default class BreakingJarController extends cc.Component {
private onHammer(newPos: cc.Vec2) { private onHammer(newPos: cc.Vec2) {
this.hammerNode.active = true; this.hammerNode.active = true;
cc.Tween.stopAllByTarget(this.hammerNode); cc.Tween.stopAllByTarget(this.hammerNode);
this._spine.setAnimation(0, "Dap4", false);
cc.tween(this.hammerNode) cc.tween(this.hammerNode)
.to(0.5, { position: cc.v3(newPos.x, newPos.y, 0) }) .to(0.5, { position: cc.v3(newPos.x, newPos.y, 0) })
...@@ -169,6 +165,12 @@ export default class BreakingJarController extends cc.Component { ...@@ -169,6 +165,12 @@ export default class BreakingJarController extends cc.Component {
.to(0.2, { position: cc.v3(400, -400) }) .to(0.2, { position: cc.v3(400, -400) })
.call(() => this.hammerNode.active = false) .call(() => this.hammerNode.active = false)
.start(); .start();
cc.tween(this._hamerAvatar.node)
.delay(0.2)
.to(0.2, { angle: -90 })
.to(0.05, { angle: 0 })
.start();
} }
private shakeNode() { private shakeNode() {
...@@ -186,7 +188,6 @@ export default class BreakingJarController extends cc.Component { ...@@ -186,7 +188,6 @@ export default class BreakingJarController extends cc.Component {
const nodePos = this.node.convertToNodeSpaceAR(pos); const nodePos = this.node.convertToNodeSpaceAR(pos);
eventTarget.emit(CHECK_TOUCH, nodePos); eventTarget.emit(CHECK_TOUCH, nodePos);
this._spine.setSkin(this._skins[Global.tool % this._skins.length]);
} }
private onTouchEnd(event: cc.Event.EventTouch) { 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 { 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; const { ccclass, property } = cc._decorator;
...@@ -10,7 +9,6 @@ export default class ActionScreen extends cc.Component { ...@@ -10,7 +9,6 @@ export default class ActionScreen extends cc.Component {
@property(cc.Node) @property(cc.Node)
private bottleAction: cc.Node = null; private bottleAction: cc.Node = null;
private _buaController: BuaController = null;
private _spine: sp.Skeleton = null; private _spine: sp.Skeleton = null;
onLoad() { onLoad() {
...@@ -20,7 +18,6 @@ export default class ActionScreen extends cc.Component { ...@@ -20,7 +18,6 @@ export default class ActionScreen extends cc.Component {
eventTarget.on(PLAY_ANIM_NUT2, this.hideBottle, this); eventTarget.on(PLAY_ANIM_NUT2, this.hideBottle, this);
eventTarget.on(PLAY_ANIM_NUT3, this.hideBottle, this); eventTarget.on(PLAY_ANIM_NUT3, this.hideBottle, this);
eventTarget.on(PLAY_ANIM_NUT4, this.hideBottle, this); eventTarget.on(PLAY_ANIM_NUT4, this.hideBottle, this);
this._buaController = this.getComponentInChildren(BuaController);
this._spine = this.bottleIdle.getComponent(sp.Skeleton); this._spine = this.bottleIdle.getComponent(sp.Skeleton);
} }
...@@ -35,7 +32,6 @@ export default class ActionScreen extends cc.Component { ...@@ -35,7 +32,6 @@ export default class ActionScreen extends cc.Component {
this._spine.setAnimation(0, 'Idle', true); this._spine.setAnimation(0, 'Idle', true);
this.node.active = true; this.node.active = true;
this._buaController.onSetTool();
this.node.position = cc.v3(); 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