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
19bfc091
Commit
19bfc091
authored
Apr 28, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move slot to fragment
parent
296dfde1
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1511 additions
and
2661 deletions
+1511
-2661
main.fire
assets/main.fire
+1502
-2619
Events.ts
assets/scripts/Events.ts
+1
-2
FragmentJarController.ts
assets/scripts/GamePlay/FragmentJarController.ts
+8
-2
SlotController.ts
assets/scripts/GamePlay/SlotController.ts
+0
-28
SlotController.ts.meta
assets/scripts/GamePlay/SlotController.ts.meta
+0
-10
No files found.
assets/main.fire
View file @
19bfc091
This diff is collapsed.
Click to expand it.
assets/scripts/Events.ts
View file @
19bfc091
...
...
@@ -26,5 +26,4 @@ export const CHECK_FRAGMENT = 'CHECK_FRAGMENT';
export
const
HAMMER
=
'HAMMER'
;
export
const
RESET_BOTTLE
=
'RESET_BOTTLE'
;
export
const
RESET_FRAGMENT
=
'RESET_FRAGMENT'
;
export
const
DROP_FRAGMENT
=
'DROP_FRAGMENT'
;
export
const
BEAT_FRAGMENT
=
'BEAT_FRAGMENT'
;
\ No newline at end of file
export
const
DROP_FRAGMENT
=
'DROP_FRAGMENT'
;
\ No newline at end of file
assets/scripts/GamePlay/FragmentJarController.ts
View file @
19bfc091
import
{
BEAT_FRAGMENT
,
CHECK_FRAGMENT
,
CHECK_TOUCH
,
DROP_FRAGMENT
,
eventTarget
,
HAMMER
,
PLAY_DROP_SOUND
,
RESET_FRAGMENT
}
from
"../Events"
;
import
{
CHECK_FRAGMENT
,
CHECK_TOUCH
,
DROP_FRAGMENT
,
eventTarget
,
HAMMER
,
PLAY_DROP_SOUND
,
RESET_FRAGMENT
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -9,11 +9,15 @@ export default class FragmentJarController extends cc.Component {
private
_siblingIndex
:
number
=
0
;
private
_isDropped
:
boolean
=
false
;
private
_numberOfBeats
=
3
;
private
_slots
:
cc
.
Node
[]
=
[];
onLoad
()
{
this
.
_physicsCollider
=
this
.
node
.
getComponent
(
cc
.
PhysicsPolygonCollider
);
this
.
_rg
=
this
.
node
.
getComponent
(
cc
.
RigidBody
);
this
.
_siblingIndex
=
this
.
node
.
getSiblingIndex
();
this
.
_slots
=
this
.
node
.
children
;
this
.
_slots
.
forEach
(
slot
=>
slot
.
active
=
false
);
this
.
reset
();
eventTarget
.
on
(
CHECK_TOUCH
,
this
.
checkTouch
,
this
);
...
...
@@ -41,7 +45,9 @@ export default class FragmentJarController extends cc.Component {
return
;
}
eventTarget
.
emit
(
BEAT_FRAGMENT
,
this
.
_siblingIndex
,
this
.
_numberOfBeats
);
if
(
this
.
_slots
.
length
>
0
)
{
this
.
_slots
[
Math
.
min
(
3
-
this
.
_numberOfBeats
,
1
)].
active
=
true
;
}
this
.
_numberOfBeats
--
;
eventTarget
.
emit
(
HAMMER
,
point
);
...
...
assets/scripts/GamePlay/SlotController.ts
deleted
100644 → 0
View file @
296dfde1
import
{
BEAT_FRAGMENT
,
eventTarget
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
SlotController
extends
cc
.
Component
{
private
_slots
:
cc
.
Node
[][]
=
[];
protected
onLoad
():
void
{
this
.
_slots
=
this
.
node
.
children
.
map
(
fragment
=>
fragment
.
children
.
map
(
slot
=>
{
slot
.
active
=
false
;
return
slot
;
}));
console
.
log
(
'this._slots'
,
this
.
_slots
)
eventTarget
.
on
(
BEAT_FRAGMENT
,
this
.
onBeat
,
this
);
}
private
onBeat
(
fragmentIndex
:
number
,
beatIndex
:
number
):
void
{
if
(
3
-
beatIndex
>
1
)
{
this
.
_slots
[
fragmentIndex
].
map
(
slot
=>
slot
.
active
=
false
);
return
;
}
this
.
_slots
[
fragmentIndex
][
3
-
beatIndex
].
active
=
true
;
}
}
assets/scripts/GamePlay/SlotController.ts.meta
deleted
100644 → 0
View file @
296dfde1
{
"ver": "1.1.0",
"uuid": "2dadf33a-b19b-4abb-9a33-ec0d14e46375",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
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