Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
L5R3_GuessingGame
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
L5R3_GuessingGame
Commits
a65acba6
Commit
a65acba6
authored
Nov 28, 2022
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
d839df51
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
656 additions
and
449 deletions
+656
-449
猫咪正确语音.mp3
assets/L5R3_GuessingGame/audios/class/猫咪正确语音.mp3
+0
-0
猫咪正确语音.mp3.meta
assets/L5R3_GuessingGame/audios/class/猫咪正确语音.mp3.meta
+8
-0
猫咪错误语音.mp3
assets/L5R3_GuessingGame/audios/class/猫咪错误语音.mp3
+0
-0
猫咪错误语音.mp3.meta
assets/L5R3_GuessingGame/audios/class/猫咪错误语音.mp3.meta
+8
-0
L5R3_GuessingGame.fire
assets/L5R3_GuessingGame/scene/L5R3_GuessingGame.fire
+589
-319
L5R3_GuessingGame.ts
assets/L5R3_GuessingGame/scene/L5R3_GuessingGame.ts
+38
-127
Server.ts
assets/L5R3_GuessingGame/script/Server.ts
+12
-2
music.png
assets/L5R3_GuessingGame/texture/cards/music.png
+0
-0
music.png.meta
assets/L5R3_GuessingGame/texture/cards/music.png.meta
+1
-1
No files found.
assets/L5R3_GuessingGame/audios/class/猫咪正确语音.mp3
0 → 100644
View file @
a65acba6
File added
assets/L5R3_GuessingGame/audios/class/猫咪正确语音.mp3.meta
0 → 100644
View file @
a65acba6
{
"ver": "2.0.1",
"uuid": "27d2950b-be88-42a5-92ad-b052a8abe60d",
"downloadMode": 0,
"duration": 1.032,
"subMetas": {}
}
\ No newline at end of file
assets/L5R3_GuessingGame/audios/class/猫咪错误语音.mp3
0 → 100644
View file @
a65acba6
File added
assets/L5R3_GuessingGame/audios/class/猫咪错误语音.mp3.meta
0 → 100644
View file @
a65acba6
{
"ver": "2.0.1",
"uuid": "cd0f3fe8-0035-4260-a348-7258fa68d0da",
"downloadMode": 0,
"duration": 0.984,
"subMetas": {}
}
\ No newline at end of file
assets/L5R3_GuessingGame/scene/L5R3_GuessingGame.fire
View file @
a65acba6
This diff is collapsed.
Click to expand it.
assets/L5R3_GuessingGame/scene/L5R3_GuessingGame.ts
View file @
a65acba6
...
@@ -27,6 +27,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -27,6 +27,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
pp
=
null
pp
=
null
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
btn_record
:
cc
.
Node
=
null
@
property
(
cc
.
Node
)
cover
=
null
cover
=
null
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
recordCat
=
null
recordCat
=
null
...
@@ -63,8 +65,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -63,8 +65,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
_catSpeaking
:
boolean
;
private
_catSpeaking
:
boolean
;
private
_audioNode
:
cc
.
Node
;
private
_audioNode
:
cc
.
Node
;
private
_canChosendCard
:
boolean
=
true
;
private
_canChosendCard
:
boolean
=
true
;
_wordData
:
{
monkey
:
string
[];
tiger
:
string
[];
pencil
:
string
[];
music
:
string
[];
honey
:
string
[];
baby
:
string
[];
}
;
_wordData
:
any
;
private
_otherWord
:
any
;
private
_otherWord
:
any
;
private
_isRecording
:
any
;
onLoad
()
{
onLoad
()
{
...
@@ -108,6 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -108,6 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio
()
{
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
// TODO 根据自己的配置预加载音频资源
// 猫咪读条音频(匹配界面开始匹配前): audioUrl_loading
// 猫咪读条音频(匹配界面开始匹配前): audioUrl_loading
// 猫咪选牌提示音频: audioUrl_start
// 猫咪选牌提示音频: audioUrl_start
// 猫咪选牌超时自动选择音频: audioUrl_waiting_firstRound
// 猫咪选牌超时自动选择音频: audioUrl_waiting_firstRound
...
@@ -119,6 +123,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -119,6 +123,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 猫咪胜利结束音频(两轮游戏都结束): audioUrl_win
// 猫咪胜利结束音频(两轮游戏都结束): audioUrl_win
// 猫咪失败结束音频(两轮游戏都结束): audioUrl_lose
// 猫咪失败结束音频(两轮游戏都结束): audioUrl_lose
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_loading
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_loading
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_start
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_start
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_waiting_firstRound
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
audioUrl_waiting_firstRound
});
...
@@ -189,7 +195,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -189,7 +195,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
inputNode
.
on
(
"
click
"
,
this
.
_reqestWord
,
this
);
this
.
inputNode
.
on
(
"
click
"
,
this
.
_reqestWord
,
this
);
this
.
pp
.
active
=
false
;
this
.
pp
.
active
=
false
;
this
.
pp
.
on
(
"
click
"
,
this
.
openCoursView
,
this
);
this
.
btn_record
.
active
=
false
;
this
.
btn_record
.
on
(
"
click
"
,
this
.
openCoursView
,
this
);
this
.
initwordAnswerData
();
this
.
initwordAnswerData
();
}
}
...
@@ -259,7 +267,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -259,7 +267,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
networkHelper
=
new
NetworkHelper
();
this
.
networkHelper
=
new
NetworkHelper
();
this
.
initNetworkListener
();
this
.
initNetworkListener
();
do
{
do
{
this
.
playerId
=
await
this
.
networkHelper
.
init
(
"
op_L5_R
1_bingo
"
,
2
);
this
.
playerId
=
await
this
.
networkHelper
.
init
(
"
op_L5_R
3_guessing
"
,
2
);
if
(
this
.
playerId
===
null
)
{
if
(
this
.
playerId
===
null
)
{
this
.
log
(
"
onDestroy
"
);
this
.
log
(
"
onDestroy
"
);
this
.
networkHelper
.
onDestroy
();
this
.
networkHelper
.
onDestroy
();
...
@@ -392,9 +400,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -392,9 +400,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
else
{
}
else
{
this
.
unschedule
(
this
.
longTimeNoAction
)
this
.
unschedule
(
this
.
longTimeNoAction
)
this
.
schedule
(
this
.
longTimeNoAction
,
15
,
6
,
15
);
this
.
schedule
(
this
.
longTimeNoAction
,
15
,
6
,
15
)
console
.
log
(
"
===============
"
);
console
.
log
(
data
.
list
);
data
.
list
.
forEach
((
val
)
=>
{
if
(
val
.
uuid
!=
this
.
playerId
)
{
this
.
_otherWord
=
val
.
word
;
}
})
console
.
log
(
"
other word=
"
+
this
.
_otherWord
);
console
.
log
(
"
===============
"
);
}
}
}
}
else
if
(
type
==
MsgType
.
USER_REQ_EV
)
{
else
if
(
type
==
MsgType
.
USER_REQ_EV
)
{
...
@@ -490,8 +506,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -490,8 +506,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_sendMsg
(
MsgType
.
USER_PREPARE_REQ
,
{});
this
.
_sendMsg
(
MsgType
.
USER_PREPARE_REQ
,
{});
this
.
_keyboard
.
showOut
();
this
.
_keyboard
.
showOut
();
this
.
inputNode
.
active
=
true
;
this
.
inputNode
.
active
=
true
;
this
.
pp
.
addComponent
(
cc
.
Button
);
this
.
btn_record
.
active
=
true
;
}
}
let
cards
=
this
.
cardRoot
.
children
;
let
cards
=
this
.
cardRoot
.
children
;
...
@@ -644,108 +659,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -644,108 +659,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
}
}
_updateProgrss
(
redScore
,
blueScore
,
round
)
{
let
realRedScore
=
(
Math
.
floor
(
redScore
/
100
)
+
redScore
%
100
);
let
realBlueScore
=
(
Math
.
floor
(
blueScore
/
100
)
+
blueScore
%
100
);
if
(
round
==
1
)
{
this
.
_redLightList
.
children
.
forEach
((
node
)
=>
{
node
.
active
=
+
node
.
name
<=
redScore
%
100
})
this
.
_blueLightList
.
children
.
forEach
((
node
)
=>
{
node
.
active
=
+
node
.
name
<=
blueScore
%
100
})
}
else
{
this
.
_redLightList
.
children
.
forEach
((
node
)
=>
{
node
.
active
=
+
node
.
name
<=
Math
.
floor
(
redScore
/
100
)
})
this
.
_blueLightList
.
children
.
forEach
((
node
)
=>
{
node
.
active
=
+
node
.
name
<=
Math
.
floor
(
blueScore
/
100
)
})
}
}
async
_updateCards
(
list
,
delay
?)
{
for
(
let
i
=
0
;
i
<
list
.
length
;
++
i
)
{
let
data
=
list
[
i
];
let
word
=
data
.
word
;
let
uuid
=
data
.
uuid
;
let
cardBg
=
this
.
_wordCardRoot
.
children
[
i
];
if
(
cardBg
.
getChildByName
(
"
word
"
))
{
continue
;
}
else
{
if
(
delay
)
{
await
asyncDelay
(
0.2
)
}
let
wordNode
=
this
.
getSprNode
(
word
)
wordNode
.
parent
=
cardBg
;
wordNode
.
name
=
"
word
"
;
wordNode
.
x
=
0
;
wordNode
.
y
=
0
;
wordNode
.
zIndex
=
10
;
let
side
=
this
.
_getSideByUuid
(
uuid
);
if
(
side
==
"
Red
"
)
{
let
coverBg
=
this
.
getSprNode
(
"
RedBox
"
);
coverBg
.
parent
=
cardBg
;
coverBg
.
name
=
"
cover
"
coverBg
.
x
=
0
;
coverBg
.
y
=
0
;
}
else
if
(
side
==
"
Blue
"
)
{
let
coverBg
=
this
.
getSprNode
(
"
BlueBox
"
);
coverBg
.
parent
=
cardBg
;
coverBg
.
name
=
"
cover
"
coverBg
.
x
=
0
;
coverBg
.
y
=
0
;
}
}
}
}
async
_reInitCards
()
{
for
(
let
i
=
0
;
i
<
16
;
++
i
)
{
let
cardBg
=
this
.
_wordCardRoot
.
children
[
i
];
let
cover
=
cardBg
.
getChildByName
(
"
cover
"
);
cover
&&
(
cover
.
parent
=
null
);
}
}
async
_updateRound2Cards
(
list
)
{
list
.
forEach
((
val
)
=>
{
let
index
=
val
.
index
;
let
uuid
=
val
.
uuid
;
let
cardBg
=
this
.
_wordCardRoot
.
children
[
index
];
if
(
cardBg
.
getChildByName
(
"
cover1
"
))
{
}
else
{
let
side
=
this
.
_getSideByUuid
(
uuid
);
if
(
side
==
"
Red
"
)
{
let
coverBg
=
this
.
getSprNode
(
"
RedBox
"
);
coverBg
.
parent
=
cardBg
;
coverBg
.
name
=
"
cover1
"
coverBg
.
zIndex
=
5
;
coverBg
.
x
=
0
;
coverBg
.
y
=
0
;
}
else
if
(
side
==
"
Blue
"
)
{
let
coverBg
=
this
.
getSprNode
(
"
BlueBox
"
);
coverBg
.
parent
=
cardBg
;
coverBg
.
name
=
"
cover1
"
;
coverBg
.
zIndex
=
5
coverBg
.
x
=
0
;
coverBg
.
y
=
0
;
}
}
})
}
_getSideByUuid
(
uuid
)
{
_getSideByUuid
(
uuid
)
{
let
side
=
""
;
let
side
=
""
;
this
.
_playerList
.
forEach
((
player
)
=>
{
this
.
_playerList
.
forEach
((
player
)
=>
{
...
@@ -837,13 +751,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -837,13 +751,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
async
openCoursView
(
node
,
word
)
{
async
openCoursView
(
node
,
word
)
{
if
(
this
.
_isRecording
)
return
;
this
.
_isRecording
=
true
this
.
btn_record
.
getChildByName
(
"
lb
"
).
getComponent
(
cc
.
Label
).
string
=
"
录音中。。。
"
;
this
.
unschedule
(
this
.
longTimeNoAction
)
this
.
unschedule
(
this
.
longTimeNoAction
)
this
.
schedule
(
this
.
longTimeNoAction
,
15
,
6
,
15
)
this
.
schedule
(
this
.
longTimeNoAction
,
15
,
6
,
15
)
this
.
cover
.
active
=
true
;
this
.
recordCat
.
active
=
false
;
// this.cat.active = false;
// this.cat.active = false;
this
.
_clockNode
.
active
=
false
;
//
this._clockNode.active = false;
let
probar
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
probar
"
);
let
probar
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
probar
"
);
let
pass
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
pass
"
);
let
pass
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
pass
"
);
let
loss
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
loss
"
);
let
loss
=
this
.
cover
.
getChildByName
(
"
bg
"
).
getChildByName
(
"
loss
"
);
...
@@ -899,7 +816,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -899,7 +816,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// await asyncDelay(0.5);
// await asyncDelay(0.5);
if
(
!
cc
.
sys
.
isBrowser
&&
window
[
"
courseware
"
]?.
startRecord
)
{
if
(
!
cc
.
sys
.
isBrowser
&&
window
[
"
courseware
"
]?.
startRecord
)
{
window
[
"
courseware
"
]?.
st
art
Record
((
res
,
b
)
=>
{
window
[
"
courseware
"
]?.
st
op
Record
((
res
,
b
)
=>
{
if
(
typeof
res
==
"
string
"
)
{
if
(
typeof
res
==
"
string
"
)
{
res
=
JSON
.
parse
(
res
);
res
=
JSON
.
parse
(
res
);
...
@@ -919,24 +836,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -919,24 +836,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
async
_coursewareEnd
(
text
:
string
)
{
async
_coursewareEnd
(
text
:
string
)
{
this
.
_isRecording
=
false
;
this
.
btn_record
.
getChildByName
(
"
lb
"
).
getComponent
(
cc
.
Label
).
string
=
"
点击向我提问
"
;
this
.
cover
.
active
=
false
;
this
.
cover
.
active
=
false
;
let
strs
:
Array
<
string
>
=
this
.
_wordData
[
this
.
_otherWord
];
let
strs
:
Array
<
string
>
=
this
.
_wordData
[
this
.
_otherWord
];
if
(
strs
.
indexOf
(
text
))
{
this
.
pp
.
getChildByName
(
"
lb
"
).
getComponent
(
cc
.
Label
).
string
=
"
Yes
"
;
console
.
log
(
"
匹配问题?
"
)
console
.
log
(
strs
)
if
(
strs
.
indexOf
(
text
)
>
-
1
)
{
this
.
playLocalAudio
(
"
right
"
)
}
else
{
}
else
{
this
.
p
p
.
getChildByName
(
"
lb
"
).
getComponent
(
cc
.
Label
).
string
=
"
No
"
;
this
.
p
layLocalAudio
(
"
wrong
"
)
}
}
let
tips
=
`点击气泡框按照下列方式问:
Is your word (正确单词)
Can you eat it?
It is (颜色)?
It is a/an animal/fruit?`
;
asyncDelay
(
2
).
then
(()
=>
{
this
.
pp
.
getChildByName
(
"
lb
"
).
getComponent
(
cc
.
Label
).
string
=
tips
;
})
}
}
initwordAnswerData
()
{
initwordAnswerData
()
{
...
...
assets/L5R3_GuessingGame/script/Server.ts
View file @
a65acba6
...
@@ -176,7 +176,11 @@ export class GameServer {
...
@@ -176,7 +176,11 @@ export class GameServer {
}
else
{
}
else
{
clearInterval
(
this
.
_timer
)
this
.
_senMsg
({
type
:
MsgType
.
ROUND_END_EV
,
data
:
{
round
:
2
,
uuid
:
"
none
"
,
isWin
:
false
,
list
:
this
.
_gameData
.
getAnswerList
()
}
})
}
}
...
@@ -225,7 +229,13 @@ export class GameServer {
...
@@ -225,7 +229,13 @@ export class GameServer {
this
.
_userPrepareCount
=
0
;
this
.
_userPrepareCount
=
0
;
this
.
_lastTime
=
Date
.
now
();
this
.
_lastTime
=
Date
.
now
();
this
.
_shecduleTimer
();
this
.
_shecduleTimer
();
this
.
_timer
=
setInterval
(
this
.
_shecduleTimer
.
bind
(
this
),
1000
)
this
.
_timer
=
setInterval
(
this
.
_shecduleTimer
.
bind
(
this
),
1000
);
this
.
_senMsg
({
type
:
MsgType
.
ROUND_START_EV
,
data
:
{
round
:
this
.
_gameData
.
Round
,
list
:
this
.
_gameData
.
getAnswerList
()
}
});
}
}
}
}
...
...
assets/L5R3_GuessingGame/texture/cards/
notes
.png
→
assets/L5R3_GuessingGame/texture/cards/
music
.png
View file @
a65acba6
File moved
assets/L5R3_GuessingGame/texture/cards/
notes
.png.meta
→
assets/L5R3_GuessingGame/texture/cards/
music
.png.meta
View file @
a65acba6
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
"height": 151,
"height": 151,
"platformSettings": {},
"platformSettings": {},
"subMetas": {
"subMetas": {
"
notes
": {
"
music
": {
"ver": "1.0.4",
"ver": "1.0.4",
"uuid": "6334925f-7619-4254-a1d1-0889d833499f",
"uuid": "6334925f-7619-4254-a1d1-0889d833499f",
"rawTextureUuid": "e4d8a837-6c88-45fa-96b9-e4cebcc01c76",
"rawTextureUuid": "e4d8a837-6c88-45fa-96b9-e4cebcc01c76",
...
...
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