Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP_Boardgame_L3R4
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
OP_Boardgame_L3R4
Commits
f14dd5c9
Commit
f14dd5c9
authored
Jul 27, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
a10dd21d
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
2723 additions
and
1294 deletions
+2723
-1294
MuliSemibold_BW0dG.ttf
assets/OP_Boardgame_L3R4/fonts/MuliSemibold_BW0dG.ttf
+0
-0
MuliSemibold_BW0dG.ttf.meta
assets/OP_Boardgame_L3R4/fonts/MuliSemibold_BW0dG.ttf.meta
+5
-0
AI.ts
assets/OP_Boardgame_L3R4/network/AI.ts
+3
-7
Server.ts
assets/OP_Boardgame_L3R4/network/Server.ts
+56
-16
OP_Boardgame_L3R4.fire
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.fire
+2373
-1230
OP_Boardgame_L3R4.ts
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.ts
+153
-41
defaultData.ts
assets/OP_Boardgame_L3R4/script/defaultData.ts
+13
-0
end.meta
assets/OP_Boardgame_L3R4/textures/end.meta
+12
-0
bg.png
assets/OP_Boardgame_L3R4/textures/end/bg.png
+0
-0
bg.png.meta
assets/OP_Boardgame_L3R4/textures/end/bg.png.meta
+36
-0
labelLoss.png
assets/OP_Boardgame_L3R4/textures/end/labelLoss.png
+0
-0
labelLoss.png.meta
assets/OP_Boardgame_L3R4/textures/end/labelLoss.png.meta
+36
-0
labelWin.png
assets/OP_Boardgame_L3R4/textures/end/labelWin.png
+0
-0
labelWin.png.meta
assets/OP_Boardgame_L3R4/textures/end/labelWin.png.meta
+36
-0
No files found.
assets/OP_Boardgame_L3R4/fonts/MuliSemibold_BW0dG.ttf
0 → 100755
View file @
f14dd5c9
File added
assets/OP_Boardgame_L3R4/fonts/MuliSemibold_BW0dG.ttf.meta
0 → 100644
View file @
f14dd5c9
{
"ver": "1.1.0",
"uuid": "79f0f099-3ac8-4fab-b77e-065c19b5d71a",
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/network/AI.ts
View file @
f14dd5c9
...
...
@@ -19,9 +19,6 @@ export class AI {
if
(
!
this
.
_status
?.
round
&&
serverStatus
.
round
==
1
)
{
this
.
_status
=
serverStatus
;
this
.
startGame
();
}
else
if
(
this
.
_status
.
round
==
1
&&
serverStatus
.
round
==
2
)
{
this
.
_status
=
serverStatus
;
this
.
startGame
();
}
this
.
_status
=
serverStatus
;
}
...
...
@@ -29,11 +26,10 @@ export class AI {
startGame
()
{
const
boatIdxList
=
this
.
_status
.
boats
.
map
((
boat
,
idx
)
=>
boat
.
show
?
idx
:
-
1
)
.
filter
(
idx
=>
idx
!=
-
1
)
.
map
((
boat
,
idx
)
=>
idx
)
.
sort
(()
=>
Math
.
random
()
-
0.5
);
let
time
=
0
;
for
(
let
i
=
0
;
i
<
8
;
i
++
)
{
let
time
=
6
;
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
time
+=
this
.
params
.
testDuration
+
Math
.
random
()
*
5
;
setTimeout
(()
=>
{
if
(
Math
.
random
()
<
0.7
)
{
...
...
assets/OP_Boardgame_L3R4/network/Server.ts
View file @
f14dd5c9
...
...
@@ -35,7 +35,7 @@ export class GameServer {
this
.
networkHelper
.
startFrameSync
();
this
.
gameStatus
=
{
round
:
0
,
// 0: 未开始, 1:
回合1, 2: 回合2, 3
: 已结束
round
:
0
,
// 0: 未开始, 1:
游戏中, 2
: 已结束
boats
:
[],
};
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
...
...
@@ -86,6 +86,12 @@ export class GameServer {
type
:
"
SERVER_updateStatus
"
,
status
:
this
.
gameStatus
,
});
console
.
log
(
'
this.params =
'
,
this
.
params
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
timeOutFlg
=
true
;
this
.
checkover
();
},
this
.
params
.
roundTime
*
1000
));
}
onPlayerJoin
(
event
)
{
...
...
@@ -135,9 +141,10 @@ export class GameServer {
this
.
startAI
();
}
}
else
if
(
data
.
type
==
"
right
"
)
{
if
(
this
.
gameStatus
.
round
==
3
)
{
return
;
if
(
this
.
gameStatus
.
round
==
2
)
{
return
;
}
console
.
log
(
'
data.boatIdx =
'
,
data
.
boatIdx
);
this
.
gameStatus
.
boats
[
data
.
boatIdx
][
data
.
playerId
]
=
'
right
'
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
...
...
@@ -145,9 +152,10 @@ export class GameServer {
});
this
.
checkover
();
}
else
if
(
data
.
type
==
"
wrong
"
)
{
if
(
this
.
gameStatus
.
round
==
3
)
{
return
;
if
(
this
.
gameStatus
.
round
==
2
)
{
return
;
}
console
.
log
(
'
data.boatIdx =
'
,
data
.
boatIdx
);
this
.
gameStatus
.
boats
[
data
.
boatIdx
][
data
.
playerId
]
=
'
wrong
'
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
...
...
@@ -161,20 +169,52 @@ export class GameServer {
}
}
timeOutFlg
=
false
;
firstCompletePlayerId
;
checkover
()
{
if
(
this
.
gameStatus
.
boats
.
filter
(
boat
=>
boat
.
show
)
.
every
(
boat
=>
Object
.
keys
(
boat
).
length
==
3
)
)
{
this
.
gameStatus
.
round
++
;
this
.
gameStatus
.
boats
.
forEach
(
boat
=>
{
boat
.
show
=
!
boat
.
show
;
});
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
status
:
this
.
gameStatus
,
if
(
!
this
.
firstCompletePlayerId
)
{
this
.
playerList
.
forEach
(
player
=>
{
if
(
this
.
gameStatus
.
boats
.
every
(
boat
=>
boat
[
player
.
uuid
]))
{
this
.
firstCompletePlayerId
=
player
.
uuid
;
}
});
}
if
(
this
.
gameStatus
.
boats
.
some
(
boat
=>
Object
.
keys
(
boat
).
length
!=
3
))
{
// 有人没有完成游戏
if
(
!
this
.
timeOutFlg
)
{
return
;
}
}
this
.
gameStatus
.
round
=
2
;
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
status
:
this
.
gameStatus
,
});
const
idScoreMap
=
{};
this
.
gameStatus
.
boats
.
forEach
(
boat
=>
{
Object
.
keys
(
boat
).
forEach
(
key
=>
{
if
(
boat
[
key
]
==
'
right
'
)
{
if
(
!
idScoreMap
[
key
])
{
idScoreMap
[
key
]
=
0
;
}
idScoreMap
[
key
]
++
;
}
});
});
let
winnerId
=
null
;
Object
.
keys
(
idScoreMap
).
forEach
(
key
=>
{
if
(
winnerId
==
null
||
idScoreMap
[
key
]
>
idScoreMap
[
winnerId
])
{
winnerId
=
key
;
}
else
if
(
idScoreMap
[
key
]
==
idScoreMap
[
winnerId
])
{
winnerId
=
this
.
firstCompletePlayerId
;
}
});
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_playerWin
"
,
winnerId
:
winnerId
,
});
}
startAI
()
{
...
...
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.fire
View file @
f14dd5c9
This diff is collapsed.
Click to expand it.
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.ts
View file @
f14dd5c9
This diff is collapsed.
Click to expand it.
assets/OP_Boardgame_L3R4/script/defaultData.ts
View file @
f14dd5c9
export
const
defaultData
=
{
roundTime
:
80
,
testDuration
:
5
,
audioOnEnterMatch
:
''
,
audioOnEnterGame
:
''
,
auidoDuringGame
:
''
,
// TODO:
audioOnFirstTest
:
''
,
audioDuringTest
:
''
,
// TODO:
audioRight
:
''
,
audioWrong
:
''
,
audioWinInTime
:
''
,
audioLossInTime
:
''
,
audioWinOutTime
:
''
,
audioLossOutTime
:
''
,
audioAfterGame
:
''
,
// TODO:
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/textures/end.meta
0 → 100644
View file @
f14dd5c9
{
"ver": "1.1.2",
"uuid": "3e5bb1d7-2141-4c18-b3bd-174805d444ea",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/textures/end/bg.png
0 → 100644
View file @
f14dd5c9
160 KB
assets/OP_Boardgame_L3R4/textures/end/bg.png.meta
0 → 100644
View file @
f14dd5c9
{
"ver": "2.3.5",
"uuid": "8d5c696c-93bc-4ccf-816c-dc1b5db0c2f6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2176,
"height": 485,
"platformSettings": {},
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "415ce19c-14be-4e76-aae5-3554e72085b4",
"rawTextureUuid": "8d5c696c-93bc-4ccf-816c-dc1b5db0c2f6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2176,
"height": 485,
"rawWidth": 2176,
"rawHeight": 485,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/textures/end/labelLoss.png
0 → 100644
View file @
f14dd5c9
68 KB
assets/OP_Boardgame_L3R4/textures/end/labelLoss.png.meta
0 → 100644
View file @
f14dd5c9
{
"ver": "2.3.5",
"uuid": "46cbf903-b8ab-43ea-a423-128ed16c4328",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1064,
"height": 451,
"platformSettings": {},
"subMetas": {
"labelLoss": {
"ver": "1.0.4",
"uuid": "52e98523-d799-4cdf-9139-173d2199edd6",
"rawTextureUuid": "46cbf903-b8ab-43ea-a423-128ed16c4328",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1064,
"height": 451,
"rawWidth": 1064,
"rawHeight": 451,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/textures/end/labelWin.png
0 → 100644
View file @
f14dd5c9
59.4 KB
assets/OP_Boardgame_L3R4/textures/end/labelWin.png.meta
0 → 100644
View file @
f14dd5c9
{
"ver": "2.3.5",
"uuid": "d850d933-91e1-4073-9358-afaef2b4f40f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1070,
"height": 451,
"platformSettings": {},
"subMetas": {
"labelWin": {
"ver": "1.0.4",
"uuid": "0c0827af-f3ed-48c9-92ed-f74057731852",
"rawTextureUuid": "d850d933-91e1-4073-9358-afaef2b4f40f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1070,
"height": 451,
"rawWidth": 1070,
"rawHeight": 451,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"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