Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_16
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_16
Commits
6eb5ec8c
Commit
6eb5ec8c
authored
Jan 26, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
1155d1ba
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
135 additions
and
116 deletions
+135
-116
.DS_Store
.DS_Store
+0
-0
op_16.fire
assets/op_16/scene/op_16.fire
+96
-101
op_16.ts
assets/op_16/scene/op_16.ts
+17
-6
LoadingLayer.ts
assets/op_16/script/LoadingLayer.ts
+1
-1
Server.ts
assets/op_16/script/Server.ts
+21
-8
No files found.
.DS_Store
View file @
6eb5ec8c
No preview for this file type
assets/op_16/scene/op_16.fire
View file @
6eb5ec8c
This diff is collapsed.
Click to expand it.
assets/op_16/scene/op_16.ts
View file @
6eb5ec8c
...
...
@@ -18,11 +18,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio
()
{
// TODO 根据自己的配置预加载音频资源
this
.
_audioResList
.
push
({
url
:
this
.
data
.
gameStartAudio
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
gameLoadingAudio
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingWheel
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingPiece
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingTurn
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
gameStartAudio
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
gameLoadingAudio
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingWheel
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingPiece
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
waitingTurn
});
}
addPreloadAnima
()
{
...
...
@@ -80,6 +80,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
bg
=
cc
.
find
(
'
Canvas/bg
'
);
bg
.
scale
=
Math
.
min
(
canvas
.
width
/
bg
.
width
,
canvas
.
height
/
bg
.
height
);
const
chessBoardBg
=
cc
.
find
(
'
Canvas/bg/chessBoard/bg
'
);
const
offsetX
=
chessBoardBg
.
width
*
chessBoardBg
.
scaleX
/
2
+
(
canvas
.
width
-
chessBoardBg
.
width
*
chessBoardBg
.
scaleX
)
/
4
;
const
lifeblue
=
cc
.
find
(
'
Canvas/bg/Lifeblue
'
);
lifeblue
.
x
=
-
offsetX
;
const
lifered
=
cc
.
find
(
'
Canvas/bg/Lifered
'
);
lifered
.
x
=
offsetX
;
}
loadingLayer
;
...
...
@@ -327,6 +335,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
const
targetNode
=
board
.
children
[
i
];
const
itemData
=
targetNode
.
getComponent
(
'
ItemData
'
);
if
(
itemData
.
letter
.
toLowerCase
()
==
this
.
_status
.
letter
.
toLowerCase
())
{
return
targetNode
;
}
...
...
@@ -539,9 +548,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
'
SERVER_playerWin:
'
+
JSON
.
stringify
(
item
.
data
));
const
node
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
this
.
_status
.
current
}
`
);
const
playerMe
=
this
.
allPlayerList
.
find
(
player
=>
player
.
uuid
==
this
.
playerId
);
const
rightBlock
=
this
.
getRightBlock
();
const
board
=
cc
.
find
(
'
Canvas/bg/chessBoard/boardItems
'
);
const
idx
=
board
.
children
.
length
;
const
rightBlock
=
board
.
children
[
idx
-
1
];
this
.
pieceFindRightBlock
(
rightBlock
,
idx
);
if
(
playerMe
.
color
==
this
.
_status
.
current
)
{
this
.
showWin
();
...
...
assets/op_16/script/LoadingLayer.ts
View file @
6eb5ec8c
...
...
@@ -10,7 +10,7 @@ export default class SceneComponent extends cc.Component {
// 生命周期 onLoad
onLoad
()
{
this
.
initSize
();
//
this.initSize();
}
_designSize
;
// 设计分辨率
...
...
assets/op_16/script/Server.ts
View file @
6eb5ec8c
...
...
@@ -112,15 +112,25 @@ export class GameServer {
}
}
else
if
(
data
.
type
==
'
right
'
)
{
this
.
gameStatus
[
data
.
color
]
=
data
.
idx
;
this
.
changeSide
();
this
.
networkHelper
.
sendFrame
({
type
:
'
SERVER_playerRight
'
,
idx
:
data
.
idx
,
uuid
:
data
.
uuid
,
color
:
data
.
color
});
const
letterList
=
this
.
getLetterList
();
console
.
log
(
'
letterList =
'
+
JSON
.
stringify
(
letterList
));
if
(
letterList
.
length
>
0
)
{
this
.
changeSide
();
this
.
networkHelper
.
sendFrame
({
type
:
'
SERVER_playerRight
'
,
idx
:
data
.
idx
,
uuid
:
data
.
uuid
,
color
:
data
.
color
});
}
else
{
this
.
networkHelper
.
sendFrame
({
type
:
'
SERVER_playerWin
'
,
color
:
this
.
gameStatus
.
current
});
}
}
else
if
(
data
.
type
==
'
wrong
'
)
{
this
.
gameStatus
[
data
.
color
]
=
data
.
idx
;
console
.
log
(
'
data =
'
+
JSON
.
stringify
(
data
));
// this.gameStatus[data.color] = data.idx;
this
.
changeSide
();
this
.
networkHelper
.
sendFrame
({
type
:
'
SERVER_playerWrong
'
,
...
...
@@ -137,7 +147,10 @@ export class GameServer {
getLetterList
()
{
const
board
=
cc
.
find
(
'
Canvas/bg/chessBoard/boardItems
'
);
const
color
=
this
.
gameStatus
.
current
;
console
.
log
(
"
color =
"
+
color
);
console
.
log
(
'
this.gameStatus =
'
+
JSON
.
stringify
(
this
.
gameStatus
));
const
startIdx
=
this
.
gameStatus
[
color
];
console
.
log
(
'
startIdx =
'
+
startIdx
);
const
letterList
=
[];
for
(
let
i
=
startIdx
+
1
;
i
<
board
.
children
.
length
;
i
++
)
{
...
...
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