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

update new jar v4

parent 3aa52172
......@@ -1564,9 +1564,6 @@
{
"__id__": 34
},
{
"__id__": 80
},
{
"__id__": 82
},
......@@ -3131,20 +3128,24 @@
"_parent": {
"__id__": 34
},
"_children": [],
"_children": [
{
"__id__": 76
}
],
"_active": true,
"_components": [
{
"__id__": 76
"__id__": 78
},
{
"__id__": 77
"__id__": 79
},
{
"__id__": 78
"__id__": 80
},
{
"__id__": 79
"__id__": 81
}
],
"_prefab": null,
......@@ -3195,6 +3196,100 @@
"groupIndex": 0,
"_id": "8fBtnfrUZPDYV9pmMQ9NG1"
},
{
"__type__": "cc.Node",
"_name": "Bot Jar",
"_objFlags": 0,
"_parent": {
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 77
}
],
"_prefab": null,
"_opacity": 125,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 500,
"height": 130
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-47.478,
-28.795,
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": "24bKgPtkJO4Zxf2oBT40aD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 76
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3a5PS6DetIwKkCcTjTPHyw"
},
{
"__type__": "cc.Sprite",
"_name": "",
......@@ -3288,100 +3383,6 @@
},
"_id": "eeFB4br1NIgK+p+s0WPgFV"
},
{
"__type__": "cc.Node",
"_name": "Bot Jar",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 81
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 510,
"height": 140
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-129.876,
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": "24bKgPtkJO4Zxf2oBT40aD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3a5PS6DetIwKkCcTjTPHyw"
},
{
"__type__": "cc.Node",
"_name": "present",
......@@ -3621,8 +3622,8 @@
0,
0,
1,
3,
3,
1,
1,
3
]
},
......@@ -10517,7 +10518,7 @@
"__id__": 2
},
"_children": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 232
......
......@@ -29,4 +29,5 @@ export const RESET_FRAGMENT = 'RESET_FRAGMENT';
export const DROP_ALL_FRAGMENT = 'DROP_ALL_FRAGMENT';
export const DROP_TOP_FRAGMENT = 'DROP_TOP_FRAGMENT';
export const DROP_BEHIND_FRAGMENT = 'DROP_BEHIND_FRAGMENT';
export const SHAKE_FRAGMENT = 'SHAKE_FRAGMENT';
\ No newline at end of file
export const SHAKE_FRAGMENT = 'SHAKE_FRAGMENT';
export const SHOW_FOG = 'SHOW_FOG';
\ No newline at end of file
......@@ -18,10 +18,12 @@ export default class BehindFragment extends cc.Component {
eventTarget.on(RESET_FRAGMENT, this.reset, this);
eventTarget.on(SHAKE_FRAGMENT, this.shakeFragment, this);
}
public shakeFragment() {
if (this._isDropped) {
return;
}
console.log('shakeFragment', 1)
cc.tween(this.node)
.repeat(2, cc.tween(this.node)
......@@ -30,13 +32,18 @@ export default class BehindFragment extends cc.Component {
)
.start();
}
public onDrop() {
this._isDropped = true;
this.scheduleOnce(() => {
this._rg.type = cc.RigidBodyType.Dynamic;
this._rg.gravityScale = 10;
this._physicsCollider.enabled = true;
}, 1.1);
const position = cc.v3(Math.random() * 100 - 50, Math.random() * 100);
cc.tween(this.node)
.by(1, { position })
.call(() => {
this._rg.type = cc.RigidBodyType.Dynamic;
this._rg.gravityScale = 10;
this._physicsCollider.enabled = true;
})
.start();
}
public reset() {
......
import { BEAT_GUILD, CHECK_FRAGMENT, CHECK_TOUCH, DROP_TOP_FRAGMENT, eventTarget, HAMMER, RESET_BOTTLE, RESET_FRAGMENT, SHAKE_FRAGMENT, SHOW_CARD_POPUP, STOP_GUILD_TAP } from "../Events";
import { BEAT_GUILD, CHECK_FRAGMENT, CHECK_TOUCH, DROP_ALL_FRAGMENT, DROP_TOP_FRAGMENT, eventTarget, HAMMER, RESET_BOTTLE, RESET_FRAGMENT, SHAKE_FRAGMENT, SHOW_CARD_POPUP, SHOW_FOG, STOP_GUILD_TAP } from "../Events";
import { Global } from "../Global";
import BehindFragment from "./BehindFragment";
import FragmentJarController from "./FragmentJarController";
......@@ -47,15 +47,87 @@ export default class BreakingJarController extends cc.Component {
eventTarget.on(HAMMER, this.onHammer, this);
eventTarget.on(RESET_BOTTLE, this.resetBottle, this);
eventTarget.on(BEAT_GUILD, this.beatGuild, this);
eventTarget.on(SHOW_FOG, this.showFog, this);
this._fontFragments = this.getComponentsInChildren(FragmentJarController).map(item => item.node);
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.particleFont.enabled = false;
this.particleBehind.enabled = false;
this.mask.active = false;
this.initFog();
}
private initFog() {
this.particleBehind.node.active = false;
this.particleFont.node.active = false;
this.particleFont.stopSystem();
this.particleBehind.stopSystem();
this.mask.opacity = 0;
}
private showFog(position: cc.Vec3) {
if (this._countFragment > 0) {
return;
}
this.particleFont.node.active = true;
this.particleBehind.node.active = true;
this.particleFont.node.position = position;
this.particleFont.resetSystem();
this.particleBehind.resetSystem();
this.mask.active = true;
this.mask.opacity = 200;
this.mask.scale = 1;
cc.tween(this.mask)
.to(2, { scale: 1.5 })
.to(5, { opacity: 255, scale: 2 })
.start();
}
private checkFragment(fragmentNode: cc.Node) {
const fontFragment = this._fontFragments.findIndex(item => item === fragmentNode);
const behindFragment = this._behindJarChild[fontFragment];
// behindFragment.onDrop();
if (this._isEnd) {
return;
}
this._bodyFragments.push(fragmentNode.name);
this._countFragment++;
if (this._countFragment == 2) {
cc.tween(this.mask)
.to(1, { opacity: 200 })
.start();
}
if (this._countFragment == 3) {
this.particleFont.stopSystem();
this.particleBehind.stopSystem();
cc.Tween.stopAllByTarget(this.mask);
cc.tween(this.mask)
.to(1, { opacity: 0 })
.call(() => {
eventTarget.emit(DROP_ALL_FRAGMENT);
this._behindJarChild.forEach(item => item.onDrop());
})
.delay(2)
.call(() => eventTarget.emit(SHOW_CARD_POPUP))
.start();
this._isEnd = true;
return;
}
const isSpecial = this.fragmentSpecialNodes.some(item => item === fragmentNode);
const isDropTop = this.fragmentSpecialNodes.every(item => item.getComponent(FragmentJarController).isDropped);
if (isSpecial && isDropTop) {
eventTarget.emit(DROP_TOP_FRAGMENT);
}
}
private beatGuild() {
......@@ -82,6 +154,7 @@ export default class BreakingJarController extends cc.Component {
eventTarget.emit(RESET_FRAGMENT);
this._isEnd = false;
this.initFog();
}
private onHammer(newPos: cc.Vec2) {
......@@ -107,33 +180,6 @@ export default class BreakingJarController extends cc.Component {
.start();
}
private checkFragment(fragmentNode: cc.Node) {
const fontFragment = this._fontFragments.findIndex(item => item === fragmentNode);
const behindFragment = this._behindJarChild[fontFragment];
// behindFragment.onDrop();
if (this._isEnd) {
return;
}
this._bodyFragments.push(fragmentNode.name);
this._countFragment++;
if (this._countFragment == 9) {
console.log('this._countFragment', this._countFragment)
this.scheduleOnce(() => eventTarget.emit(SHOW_CARD_POPUP), 1.5);
this._isEnd = true;
return;
}
const isSpecial = this.fragmentSpecialNodes.some(item => item === fragmentNode);
const isDropTop = this.fragmentSpecialNodes.every(item => item.getComponent(FragmentJarController).isDropped);
if (isSpecial && isDropTop) {
eventTarget.emit(DROP_TOP_FRAGMENT);
}
}
private onTouchStart(event: cc.Event.EventTouch) {
eventTarget.emit(STOP_GUILD_TAP);
const pos = event.getLocation();
......
import { CHECK_FRAGMENT, CHECK_TOUCH, DROP_ALL_FRAGMENT, DROP_TOP_FRAGMENT, eventTarget, HAMMER, PLAY_DROP_SOUND, RESET_FRAGMENT, SHAKE_FRAGMENT } from "../Events";
import { CHECK_FRAGMENT, CHECK_TOUCH, DROP_ALL_FRAGMENT, DROP_TOP_FRAGMENT, eventTarget, HAMMER, PLAY_DROP_SOUND, RESET_FRAGMENT, SHAKE_FRAGMENT, SHOW_FOG } from "../Events";
const { ccclass, property } = cc._decorator;
......@@ -77,6 +77,7 @@ export default class FragmentJarController extends cc.Component {
}
this._numberOfBeats--;
if (this._slots.length > 0) {
cc.tween(this)
.delay(0.5)
......@@ -85,17 +86,17 @@ export default class FragmentJarController extends cc.Component {
})
.start();
}
eventTarget.emit(HAMMER, point);
if (this._numberOfBeats == 1) {
eventTarget.emit(SHOW_FOG, this.node.position);
}
if (this._numberOfBeats > 0) {
return;
}
// if (this.isBottom) {
// eventTarget.emit(DROP_ALL_FRAGMENT)
// return;
// }
this.dropFragment();
}
......
......@@ -43,13 +43,13 @@ export default class Main extends cc.Component {
protected start(): void {
this.scheduleOnce(() => {
this.testDevice();
this.setShake();
}, 2)
}
private testDevice() {
private setShake() {
window.addEventListener("devicemotion", (event) => {
if (!event.accelerationIncludingGravity) {
return;
......
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