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
8b46d24e
Commit
8b46d24e
authored
Mar 31, 2025
by
Vũ Gia Vương
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bottle idle in action screen
parent
6e6b468c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
220 additions
and
86 deletions
+220
-86
main.fire
assets/main.fire
+174
-64
Events.ts
assets/scripts/Events.ts
+5
-1
BuaController.ts
assets/scripts/GamePlay/BuaController.ts
+14
-12
ChumController.ts
assets/scripts/GamePlay/ChumController.ts
+8
-3
HuController.ts
assets/scripts/GamePlay/HuController.ts
+3
-3
ActionScreen.ts
assets/scripts/UI/ActionScreen.ts
+16
-3
No files found.
assets/main.fire
View file @
8b46d24e
This diff is collapsed.
Click to expand it.
assets/scripts/Events.ts
View file @
8b46d24e
...
...
@@ -7,4 +7,8 @@ export const SHOW_CARD_POPUP = 'SHOW_CARD_POPUP';
export
const
STOP_ANIM_CHUM
=
'STOP_ANIM_CHUM'
;
export
const
SHOW_SELECT_POPUP
=
'SHOW_SELECT_POPUP'
;
export
const
PLAY_ROLLING_SOUND
=
'PLAY_ROLLING_SOUND'
;
\ No newline at end of file
export
const
PLAY_ROLLING_SOUND
=
'PLAY_ROLLING_SOUND'
;
export
const
PLAY_ANIM_NUT1
=
'PLAY_ANIM_NUT1'
;
export
const
PLAY_ANIM_NUT2
=
'PLAY_ANIM_NUT2'
;
export
const
PLAY_ANIM_NUT3
=
'PLAY_ANIM_NUT3'
;
export
const
PLAY_ANIM_NUT4
=
'PLAY_ANIM_NUT4'
;
\ No newline at end of file
assets/scripts/GamePlay/BuaController.ts
View file @
8b46d24e
import
{
eventTarget
,
SHOW_ACTION_SCREEN
,
SHOW_CARD_POPUP
}
from
"../Events"
;
import
{
eventTarget
,
PLAY_ANIM_NUT1
,
PLAY_ANIM_NUT2
,
PLAY_ANIM_NUT3
,
PLAY_ANIM_NUT4
,
SHOW_ACTION_SCREEN
,
SHOW_CARD_POPUP
}
from
"../Events"
;
import
{
Global
}
from
"../Global"
;
import
ChumController
from
"./ChumController"
;
...
...
@@ -7,17 +7,12 @@ const { ccclass, property } = cc._decorator;
@
ccclass
export
default
class
BuaController
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
private
chumNode
:
cc
.
Node
=
null
;
private
_chumCtrl
:
ChumController
=
null
;
private
spine
:
sp
.
Skeleton
=
null
;
private
_count
=
0
;
private
_actions
:
Function
[]
=
[];
private
_skins
=
[
"Bua"
,
"Ga"
,
"Gai_lung"
,
"Gay"
]
protected
onLoad
():
void
{
this
.
_chumCtrl
=
this
.
chumNode
.
getComponent
(
ChumController
);
this
.
spine
=
this
.
node
.
getComponent
(
sp
.
Skeleton
);
this
.
spine
.
setSkin
(
'Bua'
);
...
...
@@ -40,31 +35,39 @@ export default class BuaController extends cc.Component {
this
.
spine
.
setAnimation
(
0
,
"Dap1"
,
false
);
this
.
spine
.
timeScale
=
1
;
this
.
playSound
();
this
.
_chumCtrl
.
playAnimationNut1
();
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
.
_chumCtrl
.
playAnimationNut2
();
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
.
_chumCtrl
.
playAnimationNut3
();
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
.
_chumCtrl
.
playAnimationNut4
();
this
.
scheduleOnce
(()
=>
{
eventTarget
.
emit
(
PLAY_ANIM_NUT4
);
},
0.2
)
cc
.
tween
(
this
.
node
)
.
by
(
0.5
,
{
position
:
cc
.
v3
(
3
00
,)
})
.
by
(
0.5
,
{
position
:
cc
.
v3
(
10
00
,)
})
.
call
(()
=>
{
eventTarget
.
emit
(
SHOW_CARD_POPUP
);
})
...
...
@@ -72,6 +75,5 @@ export default class BuaController extends cc.Component {
}
private
playSound
()
{
// this.node.getComponent(cc.AudioSource).play();
}
}
assets/scripts/GamePlay/ChumController.ts
View file @
8b46d24e
import
{
eventTarget
,
SHOW_ACTION_SCREEN
,
STOP_ANIM_CHUM
}
from
"../Events"
;
import
{
eventTarget
,
PLAY_ANIM_NUT1
,
PLAY_ANIM_NUT2
,
PLAY_ANIM_NUT3
,
PLAY_ANIM_NUT4
,
SHOW_ACTION_SCREEN
,
STOP_ANIM_CHUM
}
from
"../Events"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -16,11 +16,15 @@ export default class ChumController extends cc.Component {
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
);
this
.
_actions
=
[
this
.
playAnimationNut1
,
this
.
playAnimationNut2
,
this
.
playAnimationNut3
,
this
.
playAnimationNut4
];
eventTarget
.
on
(
STOP_ANIM_CHUM
,
this
.
stopAnimation
,
this
);
eventTarget
.
on
(
PLAY_ANIM_NUT1
,
this
.
playAnimationNut1
,
this
);
eventTarget
.
on
(
PLAY_ANIM_NUT2
,
this
.
playAnimationNut2
,
this
);
eventTarget
.
on
(
PLAY_ANIM_NUT3
,
this
.
playAnimationNut3
,
this
);
eventTarget
.
on
(
PLAY_ANIM_NUT4
,
this
.
playAnimationNut4
,
this
);
}
private
onTouchStart
():
void
{
// this._actions[this._count].bind(this)();
// this._count = (this._count + 1) % this._actions.length;
}
private
stopAnimation
():
void
{
...
...
@@ -28,6 +32,7 @@ export default class ChumController extends cc.Component {
}
public
playAnimationNut1
():
void
{
this
.
node
.
active
=
true
;
this
.
spine
.
setAnimation
(
0
,
"nut1"
,
true
);
this
.
spine
.
timeScale
=
1
;
}
...
...
assets/scripts/GamePlay/HuController.ts
View file @
8b46d24e
...
...
@@ -25,15 +25,14 @@ export default class HuController extends cc.Component {
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onTouchMove
,
this
)
this
.
spine
.
setCompleteListener
(()
=>
this
.
setRotateAnim
());
}
protected
start
():
void
{
this
.
scheduleOnce
(()
=>
this
.
testDevice
,
3
);
}
private
testDevice
()
{
this
.
text
.
string
=
'testDevice'
;
console
.
log
(
'testDevice'
,)
window
.
addEventListener
(
"devicemotion"
,
(
event
)
=>
{
if
(
!
event
.
accelerationIncludingGravity
)
{
return
;
...
...
@@ -85,6 +84,7 @@ export default class HuController extends cc.Component {
}
private
onTouchStart
(
event
:
cc
.
Event
.
EventTouch
):
void
{
console
.
log
(
'onTouchStart'
,
)
if
(
!
this
.
_pointStart
)
{
this
.
setRotateAnim
();
}
...
...
assets/scripts/UI/ActionScreen.ts
View file @
8b46d24e
import
{
eventTarget
,
SHOW_ACTION_SCREEN
,
SHOW_CARD_POPUP
,
SHOW_START_SCREEN
}
from
"../Events"
;
import
{
eventTarget
,
PLAY_ANIM_NUT1
,
SHOW_ACTION_SCREEN
,
SHOW_CARD_POPUP
,
SHOW_START_SCREEN
}
from
"../Events"
;
import
BuaController
from
"../GamePlay/BuaController"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
ActionScreen
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
private
bottleIdle
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
private
bottleAction
:
cc
.
Node
=
null
;
private
_buaController
:
BuaController
=
null
;
onLoad
()
{
this
.
node
.
position
=
cc
.
v3
();
this
.
node
.
active
=
false
;
eventTarget
.
on
(
SHOW_ACTION_SCREEN
,
this
.
showScreen
,
this
);
eventTarget
.
on
(
SHOW_START_SCREEN
,
this
.
hideScreen
,
this
);
eventTarget
.
on
(
PLAY_ANIM_NUT1
,
this
.
hideBottle
,
this
);
this
.
_buaController
=
this
.
getComponentInChildren
(
BuaController
);
// this.node.active = false;
}
private
hideBottle
()
{
this
.
bottleAction
.
active
=
true
;
this
.
bottleIdle
.
active
=
false
;
}
private
showScreen
()
{
this
.
bottleAction
.
active
=
false
;
this
.
bottleIdle
.
active
=
true
;
this
.
node
.
active
=
true
;
this
.
_buaController
.
onSetTool
();
this
.
node
.
position
=
cc
.
v3
();
}
private
hideScreen
()
{
...
...
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