Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
l2_boardgame4_double
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_boardgame4_double
Commits
2818bd73
Commit
2818bd73
authored
Jul 25, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ff8c32d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
54 deletions
+78
-54
l2_boardgame2_tree.fire
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.fire
+34
-34
l2_boardgame2_tree.ts
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.ts
+33
-14
AI.ts
assets/l2_boardgame2_tree/script/AI.ts
+2
-2
Server.ts
assets/l2_boardgame2_tree/script/Server.ts
+9
-4
No files found.
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.fire
View file @
2818bd73
...
@@ -2548,7 +2548,7 @@
...
@@ -2548,7 +2548,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "1_
wig
",
"_name": "1_
hut
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -2571,8 +2571,8 @@
...
@@ -2571,8 +2571,8 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width":
213
,
"width":
162
,
"height": 1
3
3
"height": 1
6
3
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -2583,8 +2583,8 @@
...
@@ -2583,8 +2583,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
106.16
1,
-134.63
1,
-
511.964
,
-
480.639
,
0,
0,
0,
0,
0,
0,
...
@@ -2606,7 +2606,7 @@
...
@@ -2606,7 +2606,7 @@
"_is3DNode": false,
"_is3DNode": false,
"_groupIndex": 0,
"_groupIndex": 0,
"groupIndex": 0,
"groupIndex": 0,
"_id": "
1edYDv58ZHGJAdRS5exndm
"
"_id": "
36n4nfGjlLkKYs3BtdeqDb
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -2624,7 +2624,7 @@
...
@@ -2624,7 +2624,7 @@
"_srcBlendFactor": 770,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_dstBlendFactor": 771,
"_spriteFrame": {
"_spriteFrame": {
"__uuid__": "
244ce4ee-c6cc-42af-b227-473ccf53e97
3"
"__uuid__": "
f6fbb3cd-32a3-4fff-842d-ac94799532e
3"
},
},
"_type": 0,
"_type": 0,
"_sizeMode": 1,
"_sizeMode": 1,
...
@@ -2638,11 +2638,11 @@
...
@@ -2638,11 +2638,11 @@
"_fillRange": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_atlas": null,
"_atlas": null,
"_id": "
0eNv2wyGNGpJpZXRZokVOq
"
"_id": "
8fOy84vRdIop1OVa7Dm92a
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "2_
mop
",
"_name": "2_
cug
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -2736,7 +2736,7 @@
...
@@ -2736,7 +2736,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "3_
dig
",
"_name": "3_
cub
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -2830,7 +2830,7 @@
...
@@ -2830,7 +2830,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "4_
hot
",
"_name": "4_
bun
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -2924,7 +2924,7 @@
...
@@ -2924,7 +2924,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "5_
log
",
"_name": "5_
up
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3018,7 +3018,7 @@
...
@@ -3018,7 +3018,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "6_
pit
",
"_name": "6_
hug
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3112,7 +3112,7 @@
...
@@ -3112,7 +3112,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "7_
pop
",
"_name": "7_
bud
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3206,7 +3206,7 @@
...
@@ -3206,7 +3206,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "8_
pin
",
"_name": "8_
cut
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3300,7 +3300,7 @@
...
@@ -3300,7 +3300,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "9_
fox
",
"_name": "9_
run
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3394,7 +3394,7 @@
...
@@ -3394,7 +3394,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "10_
ho
p",
"_name": "10_
cu
p",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 46
"__id__": 46
...
@@ -3788,7 +3788,7 @@
...
@@ -3788,7 +3788,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "1_
wig
",
"_name": "1_
hum
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -3811,8 +3811,8 @@
...
@@ -3811,8 +3811,8 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width":
162
,
"width":
213
,
"height": 1
6
3
"height": 1
3
3
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -3823,8 +3823,8 @@
...
@@ -3823,8 +3823,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-134.63
1,
106.16
1,
-
476.431
,
-
511.964
,
0,
0,
0,
0,
0,
0,
...
@@ -3846,7 +3846,7 @@
...
@@ -3846,7 +3846,7 @@
"_is3DNode": false,
"_is3DNode": false,
"_groupIndex": 0,
"_groupIndex": 0,
"groupIndex": 0,
"groupIndex": 0,
"_id": "
36n4nfGjlLkKYs3BtdeqDb
"
"_id": "
1edYDv58ZHGJAdRS5exndm
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -3864,7 +3864,7 @@
...
@@ -3864,7 +3864,7 @@
"_srcBlendFactor": 770,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_dstBlendFactor": 771,
"_spriteFrame": {
"_spriteFrame": {
"__uuid__": "
f6fbb3cd-32a3-4fff-842d-ac94799532e
3"
"__uuid__": "
244ce4ee-c6cc-42af-b227-473ccf53e97
3"
},
},
"_type": 0,
"_type": 0,
"_sizeMode": 1,
"_sizeMode": 1,
...
@@ -3878,11 +3878,11 @@
...
@@ -3878,11 +3878,11 @@
"_fillRange": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_atlas": null,
"_atlas": null,
"_id": "
8fOy84vRdIop1OVa7Dm92a
"
"_id": "
0eNv2wyGNGpJpZXRZokVOq
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "2_
mop
",
"_name": "2_
nut
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -3976,7 +3976,7 @@
...
@@ -3976,7 +3976,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "3_
di
g",
"_name": "3_
mu
g",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4070,7 +4070,7 @@
...
@@ -4070,7 +4070,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "4_
hot
",
"_name": "4_
bug
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4164,7 +4164,7 @@
...
@@ -4164,7 +4164,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "5_
log
",
"_name": "5_
mud
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4258,7 +4258,7 @@
...
@@ -4258,7 +4258,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "6_
pit
",
"_name": "6_
fun
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4352,7 +4352,7 @@
...
@@ -4352,7 +4352,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "7_
pop
",
"_name": "7_
gun
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4446,7 +4446,7 @@
...
@@ -4446,7 +4446,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "8_p
in
",
"_name": "8_p
up
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4540,7 +4540,7 @@
...
@@ -4540,7 +4540,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "9_
fox
",
"_name": "9_
jug
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
@@ -4634,7 +4634,7 @@
...
@@ -4634,7 +4634,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "10_
hop
",
"_name": "10_
tub
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 72
"__id__": 72
...
...
assets/l2_boardgame2_tree/scene/l2_boardgame2_tree.ts
View file @
2818bd73
...
@@ -129,6 +129,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -129,6 +129,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
}
}
});
});
cc
.
find
(
'
Canvas/bg/chessBoard/righttIems
'
).
children
.
forEach
(
node
=>
{
let
itemData
=
node
.
getComponent
(
"
BoardGame2_ItemData
"
);
if
(
!
itemData
)
{
itemData
=
node
.
addComponent
(
'
BoardGame2_ItemData
'
);
let
name
=
node
.
name
;
console
.
log
(
name
);
if
(
name
==
'
start
'
||
name
==
'
end
'
)
{
}
else
{
let
arr
=
name
.
split
(
'
_
'
);
itemData
.
letter
=
arr
[
1
];
itemData
.
idx
=
Number
(
arr
[
0
]);
itemData
.
word
=
arr
[
1
];
itemData
.
jump
=
0
;
}
}
});
}
}
getJumpList
()
{
getJumpList
()
{
...
@@ -238,13 +255,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -238,13 +255,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
pieceNodeRed
=
cc
.
find
(
`Canvas/bg/chessBoard/pieceRed`
);
const
pieceNodeRed
=
cc
.
find
(
`Canvas/bg/chessBoard/pieceRed`
);
const
startIdxRed
=
this
.
_status
[
"
Red
"
];
const
startIdxRed
=
this
.
_status
[
"
Red
"
];
const
boardNodeRed
=
board
.
children
[
startIdxRed
];
const
boardNodeRed
=
board
.
children
[
startIdxRed
];
pieceNodeRed
.
x
=
boardNodeRed
.
x
+
offsetX
.
Red
;
pieceNodeRed
.
x
=
boardNodeRed
.
x
;
//
+ offsetX.Red;
pieceNodeRed
.
y
=
boardNodeRed
.
y
+
offsetY
.
Red
;
pieceNodeRed
.
y
=
boardNodeRed
.
y
+
offsetY
.
Red
;
const
right
=
cc
.
find
(
"
Canvas/bg/chessBoard/righttIems
"
);
const
pieceNodeBlue
=
cc
.
find
(
`Canvas/bg/chessBoard/pieceBlue`
);
const
pieceNodeBlue
=
cc
.
find
(
`Canvas/bg/chessBoard/pieceBlue`
);
const
startIdxBlue
=
this
.
_status
[
"
Blue
"
];
const
startIdxBlue
=
this
.
_status
[
"
Blue
"
];
const
boardNodeBlue
=
board
.
children
[
startIdxBlue
];
const
boardNodeBlue
=
right
.
children
[
startIdxBlue
];
pieceNodeBlue
.
x
=
boardNodeBlue
.
x
+
offsetX
.
Blue
;
pieceNodeBlue
.
x
=
boardNodeBlue
.
x
;
//
+ offsetX.Blue;
pieceNodeBlue
.
y
=
boardNodeBlue
.
y
+
offsetY
.
Blue
;
pieceNodeBlue
.
y
=
boardNodeBlue
.
y
+
offsetY
.
Blue
;
}
}
...
@@ -495,12 +514,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -495,12 +514,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
getCurrentBlock
()
{
getCurrentBlock
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
return
board
.
children
[
startIdx
]
return
board
.
children
[
startIdx
]
}
}
getRightBlock
()
{
getRightBlock
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
// console.log("startIdx = " + JSON.stringify(startIdx));
// console.log("startIdx = " + JSON.stringify(startIdx));
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
...
@@ -522,13 +541,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -522,13 +541,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
jumpBlock
(
idx
)
{
jumpBlock
(
idx
)
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
targetNode
=
board
.
children
[
idx
];
const
targetNode
=
board
.
children
[
idx
];
return
targetNode
;
return
targetNode
;
}
}
getNextRightIdx
()
{
getNextRightIdx
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
const
targetNode
=
board
.
children
[
i
];
const
targetNode
=
board
.
children
[
i
];
...
@@ -541,7 +560,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -541,7 +560,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
checkNodeInRightBlock
(
node
,
color
)
{
checkNodeInRightBlock
(
node
,
color
)
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
color
];
const
startIdx
=
this
.
_status
[
color
];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
...
@@ -587,7 +606,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -587,7 +606,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
async
pieceFindRightBlock
(
rightBlock
,
idx
)
{
async
pieceFindRightBlock
(
rightBlock
,
idx
)
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
color
=
this
.
_status
.
current
;
const
color
=
this
.
_status
.
current
;
const
piece
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
color
}
`
);
const
piece
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
color
}
`
);
const
prograssbar
=
cc
.
find
(
const
prograssbar
=
cc
.
find
(
...
@@ -601,7 +620,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -601,7 +620,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log(idx + "_进度条高:" + targetHeight);
// console.log(idx + "_进度条高:" + targetHeight);
const
offsetX
=
{
Red
:
-
45
,
Blue
:
45
};
const
offsetX
=
{
Red
:
-
45
,
Blue
:
45
};
const
offsetY
=
{
Red
:
-
90
,
Blue
:
-
90
};
const
offsetY
=
{
Red
:
-
45
,
Blue
:
-
45
};
this
.
_status
[
color
]
=
idx
;
this
.
_status
[
color
]
=
idx
;
await
this
.
playLocalAudio
(
"
正确
"
);
await
this
.
playLocalAudio
(
"
正确
"
);
...
@@ -611,7 +630,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -611,7 +630,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
piece
[
'
rightTween
'
]
=
true
;
piece
[
'
rightTween
'
]
=
true
;
await
asyncTweenTo
(
piece
,
1
,
{
await
asyncTweenTo
(
piece
,
1
,
{
x
:
rightBlock
.
x
+
offsetX
[
color
],
x
:
rightBlock
.
x
,
//
+ offsetX[color],
y
:
rightBlock
.
y
+
offsetY
[
color
],
y
:
rightBlock
.
y
+
offsetY
[
color
],
});
});
piece
[
'
rightTween
'
]
=
false
;
piece
[
'
rightTween
'
]
=
false
;
...
@@ -761,7 +780,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -761,7 +780,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
getLetterList
()
{
getLetterList
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
letterList
=
[];
const
letterList
=
[];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
-
1
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
-
1
;
i
++
)
{
...
@@ -982,7 +1001,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -982,7 +1001,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
playerMe
=
this
.
allPlayerList
.
find
(
const
playerMe
=
this
.
allPlayerList
.
find
(
(
player
)
=>
player
.
uuid
==
this
.
playerId
(
player
)
=>
player
.
uuid
==
this
.
playerId
);
);
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
idx
=
board
.
children
.
length
;
const
idx
=
board
.
children
.
length
;
const
rightBlock
=
board
.
children
[
idx
-
1
];
const
rightBlock
=
board
.
children
[
idx
-
1
];
...
@@ -1285,7 +1304,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1285,7 +1304,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
offsetX
=
{
Red
:
-
45
,
Blue
:
45
};
const
offsetX
=
{
Red
:
-
45
,
Blue
:
45
};
const
offsetY
=
{
Red
:
-
90
,
Blue
:
-
90
};
const
offsetY
=
{
Red
:
-
90
,
Blue
:
-
90
};
const
pieceNode
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
color
}
`
);
const
pieceNode
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
color
}
`
);
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
color
];
const
startIdx
=
this
.
_status
[
color
];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
...
...
assets/l2_boardgame2_tree/script/AI.ts
View file @
2818bd73
...
@@ -50,7 +50,7 @@ export class AI {
...
@@ -50,7 +50,7 @@ export class AI {
await
asyncDelay
(
Math
.
random
()
*
3
+
4
);
await
asyncDelay
(
Math
.
random
()
*
3
+
4
);
const
idx
=
this
.
getNextRightIdx
();
const
idx
=
this
.
getNextRightIdx
();
if
(
Math
.
random
()
<
0.8
)
{
if
(
Math
.
random
()
<
1
)
{
this
.
networkHelper
.
sendFrame
({
this
.
networkHelper
.
sendFrame
({
type
:
"
right
"
,
type
:
"
right
"
,
idx
:
idx
,
idx
:
idx
,
...
@@ -77,7 +77,7 @@ export class AI {
...
@@ -77,7 +77,7 @@ export class AI {
}
}
getNextRightIdx
()
{
getNextRightIdx
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
_status
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
const
startIdx
=
this
.
_status
[
this
.
_status
.
current
];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
const
targetNode
=
board
.
children
[
i
];
const
targetNode
=
board
.
children
[
i
];
...
...
assets/l2_boardgame2_tree/script/Server.ts
View file @
2818bd73
...
@@ -114,7 +114,7 @@ export class GameServer {
...
@@ -114,7 +114,7 @@ export class GameServer {
this
.
addPlayer
(
playerInfo
);
this
.
addPlayer
(
playerInfo
);
}
}
//TODO:调试加速
//TODO:调试加速
},
1000
0
)
//RandomInt(10000, 15000)
},
1000
)
//RandomInt(10000, 15000)
);
);
}
}
}
}
...
@@ -214,18 +214,23 @@ export class GameServer {
...
@@ -214,18 +214,23 @@ export class GameServer {
}
}
getLetterList
()
{
getLetterList
()
{
const
board
=
cc
.
find
(
"
Canvas/bg/chessBoard/boardIt
ems
"
);
const
board
=
this
.
gameStatus
.
current
==
"
Red
"
?
cc
.
find
(
"
Canvas/bg/chessBoard/boardItems
"
)
:
cc
.
find
(
"
Canvas/bg/chessBoard/righttI
ems
"
);
const
color
=
this
.
gameStatus
.
current
;
const
color
=
this
.
gameStatus
.
current
;
// console.log("color = " + color);
// console.log("color = " + color);
// console.log("this.gameStatus = " + JSON.stringify(this.gameStatus));
// console.log("this.gameStatus = " + JSON.stringify(this.gameStatus));
cons
t
startIdx
=
this
.
gameStatus
[
color
];
le
t
startIdx
=
this
.
gameStatus
[
color
];
// console.log("startIdx = " + startIdx);
// console.log("startIdx = " + startIdx);
if
(
startIdx
<
0
){
startIdx
=
0
;
}
const
letterList
=
[];
const
letterList
=
[];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
-
1
;
i
++
)
{
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
-
1
;
i
++
)
{
const
targetNode
=
board
.
children
[
i
];
const
targetNode
=
board
.
children
[
i
];
const
itemData
=
targetNode
.
getComponent
(
"
BoardGame2_ItemData
"
);
const
itemData
=
targetNode
.
getComponent
(
"
BoardGame2_ItemData
"
);
const
nodeLetter
=
itemData
.
letter
.
toUpperCase
();
const
nodeLetter
=
itemData
.
letter
.
toUpperCase
();
if
(
nodeLetter
==
''
)
{
console
.
log
(
"
11
"
)
}
if
(
!
letterList
.
find
((
letter
)
=>
letter
==
nodeLetter
))
{
if
(
!
letterList
.
find
((
letter
)
=>
letter
==
nodeLetter
))
{
letterList
.
push
(
nodeLetter
);
letterList
.
push
(
nodeLetter
);
}
}
...
...
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