Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OPW_BoardGame_L5R4
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
OPW_BoardGame_L5R4
Commits
7cddcdc0
Commit
7cddcdc0
authored
Nov 24, 2022
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加倒计时逻辑
parent
e9739239
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
456 additions
and
318 deletions
+456
-318
OPW_BoardGame_L5R4.fire
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.fire
+416
-318
OPW_BoardGame_L5R4.ts
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.ts
+40
-0
No files found.
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.fire
View file @
7cddcdc0
This diff is collapsed.
Click to expand it.
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.ts
View file @
7cddcdc0
...
@@ -19,6 +19,8 @@ const MSG_SWITCHSIDE = "msg_switch_side";
...
@@ -19,6 +19,8 @@ const MSG_SWITCHSIDE = "msg_switch_side";
const
MSG_ROLLING
=
"
msg_rolling
"
;
const
MSG_ROLLING
=
"
msg_rolling
"
;
const
MSG_GO
=
"
msg_go
"
;
const
MSG_GO
=
"
msg_go
"
;
const
MSG_BACK
=
"
msg_back
"
;
const
MSG_BACK
=
"
msg_back
"
;
const
MSG_TIMEOUT
=
"
msg_timeout
"
;
const
MSG_FINISH
=
"
msg_finish
"
;
const
MSG_PLAYER_TO_TREE
=
"
msg_player_to_tree
"
;
const
MSG_PLAYER_TO_TREE
=
"
msg_player_to_tree
"
;
const
MSG_PLAYER_TO_HOME
=
"
msg_player_to_home
"
;
const
MSG_PLAYER_TO_HOME
=
"
msg_player_to_home
"
;
const
MSG_PROFIX_END
=
"
__END__
"
;
const
MSG_PROFIX_END
=
"
__END__
"
;
...
@@ -181,6 +183,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -181,6 +183,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
loadingLayer
.
setMaxPlayerNumber
(
2
);
this
.
loadingLayer
.
setMaxPlayerNumber
(
2
);
this
.
loadingLayer
.
onLoadFinished
(()
=>
{
this
.
loadingLayer
.
onLoadFinished
(()
=>
{
this
.
initSide
();
this
.
initSide
();
this
.
initTimer
();
});
});
}
}
...
@@ -354,6 +357,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -354,6 +357,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
});
}
}
timerCount
=
10
;
timeLabel
=
null
;
// 初始化倒计时
initTimer
()
{
const
timerHandle
=
()
=>
{
if
(
this
.
timerCount
>
0
)
{
this
.
timerCount
--
;
this
.
timeLabel
.
string
=
this
.
timerCount
+
""
;
}
else
{
// 时间到
if
(
this
.
isRoomOwner
)
{
// 房主发起时间到事件
this
.
runEvent
(
MSG_TIMEOUT
,
{});
}
this
.
unschedule
(
timerHandle
);
}
}
this
.
timeLabel
=
cc
.
find
(
"
Canvas/timer/count
"
).
getComponent
(
cc
.
Label
);
this
.
schedule
(
timerHandle
,
1
);
}
// 用户自定义事件
// 用户自定义事件
eventsMap
=
{};
eventsMap
=
{};
registerEvent
(
name
,
callback
,
endCallback
?)
{
registerEvent
(
name
,
callback
,
endCallback
?)
{
...
@@ -613,6 +637,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -613,6 +637,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
})
})
// 时间到
this
.
registerEvent
(
MSG_TIMEOUT
,
(
param
,
next
)
=>
{
console
.
log
(
"
时间到
"
)
this
.
turntable
.
disable
();
this
.
turntable
.
stopBlink
();
setTimeout
(()
=>
{
next
()
},
2000
);
},
()
=>
{
this
.
runEvent
(
MSG_FINISH
,
{})
})
// 结束
this
.
registerEvent
(
MSG_FINISH
,
(
param
,
next
)
=>
{
console
.
log
(
"
游戏结束
"
)
})
}
}
// 获取下一道题的索引
// 获取下一道题的索引
...
...
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