Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
l2_boardgame2_tree
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
l2_boardgame2_tree
Commits
c67bfeb5
Commit
c67bfeb5
authored
Jul 21, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成
parent
26b6f182
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
555 additions
and
1026 deletions
+555
-1026
l2_boardgame2.fire
assets/l2_boardgame2/scene/l2_boardgame2.fire
+372
-880
l2_boardgame2.ts
assets/l2_boardgame2/scene/l2_boardgame2.ts
+161
-133
AI.ts
assets/l2_boardgame2/script/AI.ts
+16
-7
Server.ts
assets/l2_boardgame2/script/Server.ts
+6
-6
No files found.
assets/l2_boardgame2/scene/l2_boardgame2.fire
View file @
c67bfeb5
This diff is collapsed.
Click to expand it.
assets/l2_boardgame2/scene/l2_boardgame2.ts
View file @
c67bfeb5
This diff is collapsed.
Click to expand it.
assets/l2_boardgame2/script/AI.ts
View file @
c67bfeb5
...
...
@@ -8,7 +8,7 @@ export class AI {
Red
:
0
,
Blue
:
0
,
letter
:
""
,
current
:
"
Blue
"
,
current
:
"
Red
"
,
};
constructor
(
networkHelper
:
NetworkHelper
,
playerData
:
any
)
{
...
...
@@ -49,12 +49,21 @@ export class AI {
//调试加速 2 Math.random() * 3 + 4
await
asyncDelay
(
Math
.
random
()
*
3
+
4
);
const
idx
=
this
.
getNextRightIdx
();
this
.
networkHelper
.
sendFrame
({
type
:
"
right
"
,
idx
:
idx
,
uuid
:
this
.
playerData
.
uuid
,
color
:
this
.
playerData
.
color
,
});
if
(
Math
.
random
()
<
0.8
)
{
this
.
networkHelper
.
sendFrame
({
type
:
"
right
"
,
idx
:
idx
,
uuid
:
this
.
playerData
.
uuid
,
color
:
this
.
playerData
.
color
,
});
}
else
{
this
.
networkHelper
.
sendFrame
({
type
:
"
wrong
"
,
uuid
:
this
.
playerData
.
uuid
,
color
:
this
.
playerData
.
color
,
});
}
}
}
}
...
...
assets/l2_boardgame2/script/Server.ts
View file @
c67bfeb5
...
...
@@ -58,7 +58,7 @@ export class GameServer {
name
:
this
.
nameList
.
splice
(
0
,
1
)[
0
],
uuid
:
player
.
uuid
,
color
:
player
.
uuid
==
this
.
networkHelper
.
room
.
roomInfo
.
owner
?
"
Blue
"
:
"
Red
"
,
player
.
uuid
==
this
.
networkHelper
.
room
.
roomInfo
.
owner
?
"
Red
"
:
"
Blue
"
,
isAI
:
player
.
isAI
,
headUrl
:
this
.
headUrls
.
splice
(
0
,
1
)[
0
],
});
...
...
@@ -82,7 +82,7 @@ export class GameServer {
Red
:
0
,
Blue
:
0
,
letter
:
""
,
current
:
"
Blue
"
,
current
:
"
Red
"
,
};
startGame
()
{
this
.
networkHelper
.
sendFrame
({
...
...
@@ -108,13 +108,13 @@ export class GameServer {
const
playerInfo
=
{
uuid
:
"
ai_
"
+
i
,
isAI
:
true
,
color
:
"
Red
"
,
color
:
"
Blue
"
,
};
this
.
_aiPlayerList
.
push
(
new
AI
(
this
.
networkHelper
,
playerInfo
));
this
.
addPlayer
(
playerInfo
);
}
//TODO:调试加速
},
1000
)
//RandomInt(10000, 15000)
},
1000
0
)
//RandomInt(10000, 15000)
);
}
}
...
...
@@ -128,9 +128,9 @@ export class GameServer {
console
.
log
(
'
letterList:
'
,
letterList
);
if
(
letterList
.
length
>
0
)
{
if
(
this
.
gameStatus
.
letter
==
""
)
{
// let max = Math.max(
letterList.length - 2
, 0);
// let max = Math.max(
9
, 0);
// let letter = letterList[max];//[RandomInt(letterList.length) % 3];//转盘只有1-3
// if (this.gameStatus.current
!
= 'Blue') {
// if (this.gameStatus.current
=
= 'Blue') {
// letter = letterList[0]
// }
let
letter
=
letterList
[
RandomInt
(
letterList
.
length
)
%
3
];
...
...
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