Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dap-hu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Gia Vương
dap-hu
Commits
d2272422
Commit
d2272422
authored
Apr 28, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add behind fragment
parent
19bfc091
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1278 additions
and
587 deletions
+1278
-587
main.fire
assets/main.fire
+1193
-560
Events.ts
assets/scripts/Events.ts
+2
-1
BehindFragment.ts
assets/scripts/GamePlay/BehindFragment.ts
+31
-0
BehindFragment.ts.meta
assets/scripts/GamePlay/BehindFragment.ts.meta
+10
-0
BreakingJarController.ts
assets/scripts/GamePlay/BreakingJarController.ts
+37
-24
FragmentJarController.ts
assets/scripts/GamePlay/FragmentJarController.ts
+5
-2
No files found.
assets/main.fire
View file @
d2272422
This diff is collapsed.
Click to expand it.
assets/scripts/Events.ts
View file @
d2272422
...
@@ -27,3 +27,4 @@ export const HAMMER = 'HAMMER';
...
@@ -27,3 +27,4 @@ export const HAMMER = 'HAMMER';
export
const
RESET_BOTTLE
=
'RESET_BOTTLE'
;
export
const
RESET_BOTTLE
=
'RESET_BOTTLE'
;
export
const
RESET_FRAGMENT
=
'RESET_FRAGMENT'
;
export
const
RESET_FRAGMENT
=
'RESET_FRAGMENT'
;
export
const
DROP_FRAGMENT
=
'DROP_FRAGMENT'
;
export
const
DROP_FRAGMENT
=
'DROP_FRAGMENT'
;
export
const
DROP_BEHIND_FRAGMENT
=
'DROP_BEHIND_FRAGMENT'
;
\ No newline at end of file
assets/scripts/GamePlay/BehindFragment.ts
0 → 100644
View file @
d2272422
import
{
eventTarget
,
RESET_FRAGMENT
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
BehindFragment
extends
cc
.
Component
{
private
_rg
:
cc
.
RigidBody
=
null
;
private
_physicsCollider
:
cc
.
PhysicsCollider
=
null
;
onLoad
()
{
this
.
_rg
=
this
.
node
.
getComponent
(
cc
.
RigidBody
);
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
_physicsCollider
=
this
.
node
.
getComponent
(
cc
.
PhysicsCollider
);
this
.
_physicsCollider
.
enabled
=
false
;
eventTarget
.
on
(
RESET_FRAGMENT
,
this
.
reset
,
this
);
}
public
onDrop
()
{
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Dynamic
;
this
.
_rg
.
gravityScale
=
10
;
this
.
_physicsCollider
.
enabled
=
true
;
}
public
reset
()
{
this
.
_physicsCollider
.
enabled
=
false
;
this
.
_rg
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
node
.
angle
=
0
;
}
}
assets/scripts/GamePlay/BehindFragment.ts.meta
0 → 100644
View file @
d2272422
{
"ver": "1.1.0",
"uuid": "2c4e47d9-d7cd-4f92-9b79-1bb85932b7e9",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/scripts/GamePlay/BreakingJarController.ts
View file @
d2272422
import
{
BEAT_GUILD
,
CHECK_FRAGMENT
,
CHECK_TOUCH
,
DROP_FRAGMENT
,
eventTarget
,
HAMMER
,
RESET_BOTTLE
,
RESET_FRAGMENT
,
SHOW_CARD_POPUP
,
STOP_GUILD_TAP
}
from
"../Events"
;
import
{
BEAT_GUILD
,
CHECK_FRAGMENT
,
CHECK_TOUCH
,
DROP_FRAGMENT
,
eventTarget
,
HAMMER
,
RESET_BOTTLE
,
RESET_FRAGMENT
,
SHOW_CARD_POPUP
,
STOP_GUILD_TAP
}
from
"../Events"
;
import
{
Global
}
from
"../Global"
;
import
{
Global
}
from
"../Global"
;
import
BehindFragment
from
"./BehindFragment"
;
import
FragmentJarController
from
"./FragmentJarController"
;
import
FragmentJarController
from
"./FragmentJarController"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -9,6 +10,8 @@ export default class BreakingJarController extends cc.Component {
...
@@ -9,6 +10,8 @@ export default class BreakingJarController extends cc.Component {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
private
hammerNode
:
cc
.
Node
=
null
;
private
hammerNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
private
behindJar
:
cc
.
Node
=
null
;
private
_spine
:
sp
.
Skeleton
=
null
;
private
_spine
:
sp
.
Skeleton
=
null
;
private
_skins
=
[
"Ga"
,
"Gai_lung"
,
"Gay"
,
"Bua"
,];
private
_skins
=
[
"Ga"
,
"Gai_lung"
,
"Gay"
,
"Bua"
,];
...
@@ -18,26 +21,11 @@ export default class BreakingJarController extends cc.Component {
...
@@ -18,26 +21,11 @@ export default class BreakingJarController extends cc.Component {
private
_fragmentsNode
:
cc
.
Node
[]
=
[];
private
_fragmentsNode
:
cc
.
Node
[]
=
[];
private
_bodyFragments
:
string
[]
=
[];
private
_bodyFragments
:
string
[]
=
[];
private
_isEnd
=
false
;
private
_isEnd
=
false
;
private
_behindJarChild
:
BehindFragment
[]
=
[];
private
_BG
:
cc
.
Node
=
null
;
private
_behindJarChildPosition
:
cc
.
Vec3
[]
=
[];
private
_behindJar
:
cc
.
Node
=
null
;
private
_frontJar
:
cc
.
Node
=
null
;
private
_slotsJar
:
cc
.
Node
=
null
;
private
_behindJarChild
:
cc
.
Node
[]
=
[];
private
_frontJarChild
:
cc
.
Node
[]
=
[];
private
_slotsJarChild
:
cc
.
Node
[]
=
[];
onLoad
()
{
onLoad
()
{
[
this
.
_BG
,
this
.
_behindJar
,
this
.
_frontJar
,
this
.
_slotsJar
]
=
this
.
node
.
children
;
// this._behindJarChild = this._behindJar.children;
// this._frontJarChild = this._frontJar.children;
// this._slotsJarChild = this._slotsJar.children;
// this._slotsJarChild.forEach((slot) => {
// slot.active = false;
// })
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
// cc.director.getPhysicsManager().debugDrawFlags = cc.PhysicsManager.DrawBits.e_aabbBit |
// cc.director.getPhysicsManager().debugDrawFlags = cc.PhysicsManager.DrawBits.e_aabbBit |
// cc.PhysicsManager.DrawBits.e_jointBit |
// cc.PhysicsManager.DrawBits.e_jointBit |
...
@@ -55,6 +43,8 @@ export default class BreakingJarController extends cc.Component {
...
@@ -55,6 +43,8 @@ export default class BreakingJarController extends cc.Component {
this
.
_fragmentsNode
=
this
.
getComponentsInChildren
(
FragmentJarController
).
map
(
item
=>
item
.
node
);
this
.
_fragmentsNode
=
this
.
getComponentsInChildren
(
FragmentJarController
).
map
(
item
=>
item
.
node
);
this
.
_fragmentsPosition
=
this
.
_fragmentsNode
.
map
(
item
=>
item
.
position
.
clone
());
this
.
_fragmentsPosition
=
this
.
_fragmentsNode
.
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
());
}
}
private
beatGuild
()
{
private
beatGuild
()
{
...
@@ -73,6 +63,12 @@ export default class BreakingJarController extends cc.Component {
...
@@ -73,6 +63,12 @@ export default class BreakingJarController extends cc.Component {
this
.
_fragmentsNode
.
forEach
((
node
,
index
)
=>
{
this
.
_fragmentsNode
.
forEach
((
node
,
index
)
=>
{
node
.
position
=
this
.
_fragmentsPosition
[
index
];
node
.
position
=
this
.
_fragmentsPosition
[
index
];
})
})
this
.
_behindJarChild
.
forEach
((
behindFragment
,
index
)
=>
{
behindFragment
.
node
.
position
=
this
.
_behindJarChildPosition
[
index
];
behindFragment
.
reset
();
})
eventTarget
.
emit
(
RESET_FRAGMENT
);
eventTarget
.
emit
(
RESET_FRAGMENT
);
this
.
_isEnd
=
false
;
this
.
_isEnd
=
false
;
}
}
...
@@ -90,23 +86,40 @@ export default class BreakingJarController extends cc.Component {
...
@@ -90,23 +86,40 @@ export default class BreakingJarController extends cc.Component {
.
start
();
.
start
();
}
}
private
checkFragment
(
name
:
string
)
{
private
checkFragment
(
fragmentNode
:
cc
.
Node
)
{
const
fragmentIndex
=
this
.
_fragmentsNode
.
findIndex
(
item
=>
item
===
fragmentNode
);
const
behindFragment
=
this
.
_behindJarChild
[
fragmentIndex
];
behindFragment
.
onDrop
();
if
(
this
.
_isEnd
)
{
if
(
this
.
_isEnd
)
{
return
;
return
;
}
}
if
(
!
name
.
includes
(
'nap'
))
{
this
.
_bodyFragments
.
push
(
name
);
this
.
_bodyFragments
.
push
(
fragmentNode
.
name
);
}
this
.
_countFragment
++
;
this
.
_countFragment
++
;
if
(
this
.
_countFragment
==
8
)
{
if
(
this
.
_countFragment
==
8
)
{
this
.
scheduleOnce
(()
=>
eventTarget
.
emit
(
SHOW_CARD_POPUP
),
1.5
);
this
.
scheduleOnce
(()
=>
eventTarget
.
emit
(
SHOW_CARD_POPUP
),
1.5
);
this
.
_isEnd
=
true
;
this
.
_isEnd
=
true
;
}
}
if
(
this
.
_bodyFragments
.
length
==
6
)
{
eventTarget
.
emit
(
DROP_FRAGMENT
);
}
}
}
// private checkFragment(name: string) {
// if (this._isEnd) {
// return;
// }
// if (!name.includes('nap')) {
// this._bodyFragments.push(name);
// }
// this._countFragment++;
// if (this._countFragment == 8) {
// this.scheduleOnce(() => eventTarget.emit(SHOW_CARD_POPUP), 1.5);
// this._isEnd = true;
// }
// if (this._bodyFragments.length == 6) {
// eventTarget.emit(DROP_FRAGMENT);
// }
// }
private
onTouchStart
(
event
:
cc
.
Event
.
EventTouch
)
{
private
onTouchStart
(
event
:
cc
.
Event
.
EventTouch
)
{
eventTarget
.
emit
(
STOP_GUILD_TAP
);
eventTarget
.
emit
(
STOP_GUILD_TAP
);
const
pos
=
event
.
getLocation
();
const
pos
=
event
.
getLocation
();
...
...
assets/scripts/GamePlay/FragmentJarController.ts
View file @
d2272422
...
@@ -31,6 +31,8 @@ export default class FragmentJarController extends cc.Component {
...
@@ -31,6 +31,8 @@ export default class FragmentJarController extends cc.Component {
this
.
node
.
angle
=
0
;
this
.
node
.
angle
=
0
;
this
.
node
.
setSiblingIndex
(
this
.
_siblingIndex
);
this
.
node
.
setSiblingIndex
(
this
.
_siblingIndex
);
this
.
_isDropped
=
false
;
this
.
_isDropped
=
false
;
this
.
_numberOfBeats
=
3
;
this
.
node
.
children
.
forEach
(
slot
=>
slot
.
active
=
false
);
}
}
private
checkTouch
(
point
:
cc
.
Vec2
)
{
private
checkTouch
(
point
:
cc
.
Vec2
)
{
...
@@ -59,8 +61,9 @@ export default class FragmentJarController extends cc.Component {
...
@@ -59,8 +61,9 @@ export default class FragmentJarController extends cc.Component {
private
dropFragment
()
{
private
dropFragment
()
{
this
.
_isDropped
=
true
;
this
.
_isDropped
=
true
;
const
pos
=
this
.
node
.
position
;
const
pos
=
this
.
node
.
position
;
// this.node.setSiblingIndex(-1);
this
.
node
.
setSiblingIndex
(
-
1
);
eventTarget
.
emit
(
CHECK_FRAGMENT
,
this
.
node
.
name
);
// eventTarget.emit(CHECK_FRAGMENT, this.node.name);
eventTarget
.
emit
(
CHECK_FRAGMENT
,
this
.
node
);
cc
.
tween
(
this
.
node
)
cc
.
tween
(
this
.
node
)
.
delay
(
0.5
)
.
delay
(
0.5
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment