Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
l3_boardgame2_hole
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
l3_boardgame2_hole
Commits
98a207cf
Commit
98a207cf
authored
Jul 30, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.30调整
parent
9186d6e6
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
446 additions
and
377 deletions
+446
-377
LoadingLayer.prefab
...3_boardgame2_hole/prefab/LoadingLayer/LoadingLayer.prefab
+1
-1
BoardGame2_hole_PlayerOffLineLayer.js
.../PlayerOffLineLayer/BoardGame2_hole_PlayerOffLineLayer.js
+0
-0
BoardGame2_hole_PlayerOffLineLayer.js.meta
...erOffLineLayer/BoardGame2_hole_PlayerOffLineLayer.js.meta
+0
-0
l3_boardgame2_hole.fire
assets/l3_boardgame2_hole/scene/l3_boardgame2_hole.fire
+400
-366
l3_boardgame2_hole.ts
assets/l3_boardgame2_hole/scene/l3_boardgame2_hole.ts
+44
-9
BoardGame2_hole_LoadingLayer.ts
...l3_boardgame2_hole/script/BoardGame2_hole_LoadingLayer.ts
+0
-0
BoardGame2_hole_LoadingLayer.ts.meta
...ardgame2_hole/script/BoardGame2_hole_LoadingLayer.ts.meta
+1
-1
No files found.
assets/l3_boardgame2_hole/prefab/LoadingLayer/LoadingLayer.prefab
View file @
98a207cf
...
@@ -2159,7 +2159,7 @@
...
@@ -2159,7 +2159,7 @@
"_id": ""
"_id": ""
},
},
{
{
"__type__": "
4d354gk3w1AIKtlOv2FygBk
",
"__type__": "
ed40a8PbYdCDYoyW/46QqC7
",
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
...
...
assets/l3_boardgame2_hole/prefab/PlayerOffLineLayer/BoardGame2_PlayerOffLineLayer.js
→
assets/l3_boardgame2_hole/prefab/PlayerOffLineLayer/BoardGame2_
hole_
PlayerOffLineLayer.js
View file @
98a207cf
File moved
assets/l3_boardgame2_hole/prefab/PlayerOffLineLayer/BoardGame2_PlayerOffLineLayer.js.meta
→
assets/l3_boardgame2_hole/prefab/PlayerOffLineLayer/BoardGame2_
hole_
PlayerOffLineLayer.js.meta
View file @
98a207cf
File moved
assets/l3_boardgame2_hole/scene/l3_boardgame2_hole.fire
View file @
98a207cf
This diff is collapsed.
Click to expand it.
assets/l3_boardgame2_hole/scene/l3_boardgame2_hole.ts
View file @
98a207cf
...
@@ -8,6 +8,7 @@ import {
...
@@ -8,6 +8,7 @@ import {
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
NetworkHelper
}
from
"
../script/NetworkHelper
"
;
import
{
NetworkHelper
}
from
"
../script/NetworkHelper
"
;
import
{
GameServer
}
from
"
../script/Server
"
;
import
{
GameServer
}
from
"
../script/Server
"
;
import
{
build
}
from
"
../../../bin/buildCocos
"
;
let
win
:
any
=
window
;
let
win
:
any
=
window
;
let
courseware
=
win
.
courseware
;
let
courseware
=
win
.
courseware
;
...
@@ -48,6 +49,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -48,6 +49,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
Blue
:
0
,
Blue
:
0
,
letter
:
""
,
letter
:
""
,
current
:
"
Red
"
,
current
:
"
Red
"
,
BuleLast
:
0
};
};
playerId
;
playerId
;
isRoomOwner
;
isRoomOwner
;
...
@@ -110,6 +112,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -110,6 +112,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initBg
();
this
.
initBg
();
this
.
initLoadingLayer
();
this
.
initLoadingLayer
();
this
.
initPiece
();
this
.
initPiece
();
this
.
antAction
();
}
}
addComponents
()
{
addComponents
()
{
cc
.
find
(
'
Canvas/bg/chessBoard/boardItems
'
).
children
.
forEach
(
node
=>
{
cc
.
find
(
'
Canvas/bg/chessBoard/boardItems
'
).
children
.
forEach
(
node
=>
{
...
@@ -173,7 +176,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -173,7 +176,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
loadingLayerNode
=
cc
.
instantiate
(
this
.
loadingLayerPrefab
);
const
loadingLayerNode
=
cc
.
instantiate
(
this
.
loadingLayerPrefab
);
loadingLayerBase
.
addChild
(
loadingLayerNode
);
loadingLayerBase
.
addChild
(
loadingLayerNode
);
this
.
loadingLayer
=
loadingLayerNode
.
getComponent
(
"
BoardGame2_LoadingLayer
"
);
this
.
loadingLayer
=
loadingLayerNode
.
getComponent
(
"
BoardGame2_
hole_
LoadingLayer
"
);
this
.
loadingLayer
.
setMaxPlayerNumber
(
2
);
this
.
loadingLayer
.
setMaxPlayerNumber
(
2
);
this
.
loadingLayer
.
onLoadFinished
(()
=>
{
this
.
loadingLayer
.
onLoadFinished
(()
=>
{
this
.
playAudioByUrl
(
this
.
data
.
gameStartAudio
);
this
.
playAudioByUrl
(
this
.
data
.
gameStartAudio
);
...
@@ -601,6 +604,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -601,6 +604,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showStars
(
piece
);
this
.
showStars
(
piece
);
piece
[
'
rightTween
'
]
=
true
;
piece
[
'
rightTween
'
]
=
true
;
this
.
playLocalAudio
(
"
落子
"
);
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
],
...
@@ -631,7 +635,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -631,7 +635,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
piece
.
stopAllActions
();
piece
.
stopAllActions
();
await
this
.
playLocalAudio
(
"
落子
"
);
piece
.
zIndex
=
0
;
piece
.
zIndex
=
0
;
}
}
...
@@ -659,7 +662,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -659,7 +662,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
updateStatus
(
status
=
null
)
{
updateStatus
(
status
=
null
)
{
if
(
status
)
{
if
(
status
)
{
console
.
log
(
status
);
console
.
log
(
"
status:
"
+
JSON
.
stringify
(
status
)
);
this
.
_status
=
JSON
.
parse
(
JSON
.
stringify
(
status
));
this
.
_status
=
JSON
.
parse
(
JSON
.
stringify
(
status
));
}
else
{
}
else
{
// console.log("喵喵喵");
// console.log("喵喵喵");
...
@@ -852,12 +855,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -852,12 +855,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// console.log("item.data.letter = " + item.data.letter);
// console.log("item.data.letter = " + item.data.letter);
//根据当前startIdx和下一步的letter位置找 idx
//根据当前startIdx和下一步的letter位置找 idx
let
letterList
=
this
.
getLetterList
();
let
letterList
=
this
.
getLetterList
();
let
i
d
x
=
letterList
.
findIndex
(
letter
=>
letter
==
status
.
letter
);
let
i
nde
x
=
letterList
.
findIndex
(
letter
=>
letter
==
status
.
letter
);
if
(
i
d
x
==
-
1
)
{
if
(
i
nde
x
==
-
1
)
{
console
.
log
(
"
error
"
)
console
.
log
(
"
error
"
)
}
}
const
startIdx
=
status
[
status
.
current
];
const
startIdx
=
status
[
status
.
current
];
let
nextIdx
=
startIdx
+
i
d
x
+
1
;
let
nextIdx
=
startIdx
+
i
nde
x
+
1
;
// const idx = ["G", "H", "I", "J", "K", "L"].findIndex(
// const idx = ["G", "H", "I", "J", "K", "L"].findIndex(
// (letter) => letter == status.letter
// (letter) => letter == status.letter
// );
// );
...
@@ -868,7 +871,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -868,7 +871,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pieceBlue
[
"
cantMove
"
]
=
true
;
pieceBlue
[
"
cantMove
"
]
=
true
;
this
.
stopBlinkTheDice
();
this
.
stopBlinkTheDice
();
// console.log("status1 = " + JSON.stringify(status));
// console.log("status1 = " + JSON.stringify(status));
await
this
.
rollTheDice
(
i
d
x
);
await
this
.
rollTheDice
(
i
nde
x
);
pieceRed
[
"
cantMove
"
]
=
false
;
pieceRed
[
"
cantMove
"
]
=
false
;
pieceBlue
[
"
cantMove
"
]
=
false
;
pieceBlue
[
"
cantMove
"
]
=
false
;
// console.log("status2 = " + JSON.stringify(status));
// console.log("status2 = " + JSON.stringify(status));
...
@@ -916,6 +919,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -916,6 +919,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
color
:
playerMe
.
color
,
color
:
playerMe
.
color
,
});
});
}
}
}
else
{
const
node
=
cc
.
find
(
`Canvas/bg/chessBoard/piece
${
status
.
current
}
`
);
node
[
"
touchStartPos
"
]
=
{
nodeX
:
node
.
x
,
nodeY
:
node
.
y
,
touchX
:
node
.
x
,
touchY
:
node
.
y
,
};
let
rightBlock
=
this
.
getRightBlock
();
let
idx
=
this
.
getNextRightIdx
();
let
lastIdx
=
this
.
_status
.
Blue
;
this
.
_status
.
BuleLast
=
lastIdx
;
await
this
.
pieceFindRightBlock
(
rightBlock
,
idx
);
}
}
}
else
if
(
item
.
data
.
type
==
"
SERVER_playerRight
"
)
{
}
else
if
(
item
.
data
.
type
==
"
SERVER_playerRight
"
)
{
console
.
log
(
"
SERVER_playerRight:
"
+
JSON
.
stringify
(
item
.
data
));
console
.
log
(
"
SERVER_playerRight:
"
+
JSON
.
stringify
(
item
.
data
));
...
@@ -942,7 +960,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -942,7 +960,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
// console.log("SERVER_playerRight: " + JSON.stringify(item.data));
// console.log("SERVER_playerRight: " + JSON.stringify(item.data));
// console.log("this._status = " + JSON.stringify(this._status));
// console.log("this._status = " + JSON.stringify(this._status));
let
rightBlock
=
this
.
getRightBlock
();
// this._status.Blue = this._status.BuleLast;
let
rightBlock
=
this
.
getCurrentBlock
();
// console.log(rightBlock);
// console.log(rightBlock);
let
idx
=
this
.
getNextRightIdx
();
let
idx
=
this
.
getNextRightIdx
();
// console.log("targetIdx->" + idx);
// console.log("targetIdx->" + idx);
...
@@ -950,13 +969,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -950,13 +969,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
pieceBlue
=
cc
.
find
(
"
Canvas/bg/chessBoard/pieceBlue
"
);
const
pieceBlue
=
cc
.
find
(
"
Canvas/bg/chessBoard/pieceBlue
"
);
pieceRed
[
"
cantMove
"
]
=
false
;
pieceRed
[
"
cantMove
"
]
=
false
;
pieceBlue
[
"
cantMove
"
]
=
false
;
pieceBlue
[
"
cantMove
"
]
=
false
;
await
this
.
pieceFindRightBlock
(
rightBlock
,
idx
);
//
await this.pieceFindRightBlock(rightBlock, idx);
const
riData
=
rightBlock
.
getComponent
(
"
BoardGame2_ItemData_i
"
);
const
riData
=
rightBlock
.
getComponent
(
"
BoardGame2_ItemData_i
"
);
if
(
riData
.
jump
!=
""
)
{
if
(
riData
.
jump
!=
""
)
{
rightBlock
=
this
.
jumpBlock
(
parseInt
(
riData
.
jump
));
rightBlock
=
this
.
jumpBlock
(
parseInt
(
riData
.
jump
));
idx
=
parseInt
(
riData
.
jump
);
//this.getNextRightIdx();
idx
=
parseInt
(
riData
.
jump
);
//this.getNextRightIdx();
await
this
.
pieceFindRightBlock
(
rightBlock
,
idx
);
await
this
.
pieceFindRightBlock
(
rightBlock
,
idx
);
this
.
_status
.
BuleLast
=
this
.
_status
.
Blue
;
}
}
await
this
.
playLocalAudio
(
"
正确
"
);
await
this
.
playLocalAudio
(
"
正确
"
);
...
@@ -978,7 +998,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -978,7 +998,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
playerMe
.
color
==
this
.
_status
.
current
)
{
if
(
playerMe
.
color
==
this
.
_status
.
current
)
{
await
this
.
pieceGoBack
(
node
);
await
this
.
pieceGoBack
(
node
);
}
else
{
}
else
{
this
.
_status
.
Blue
=
this
.
_status
.
BuleLast
;
this
.
rollPieceOnce
(
node
);
this
.
rollPieceOnce
(
node
);
await
this
.
pieceGoBack
(
node
);
}
}
node
[
"
cantMove
"
]
=
false
;
node
[
"
cantMove
"
]
=
false
;
...
@@ -1163,6 +1185,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1163,6 +1185,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
"
tokenId
"
:
"
6144295408558b08dd000001
"
,
"
tokenId
"
:
"
6144295408558b08dd000001
"
,
"
applicationId
"
:
"
154838659000009e
"
"
applicationId
"
:
"
154838659000009e
"
}
}
testData
.
result
.
overall
=
Math
.
random
()
*
100
;
if
(
this
.
recrodEnd
(
testData
))
{
if
(
this
.
recrodEnd
(
testData
))
{
this
.
playLocalAudio
(
"
正确
"
);
this
.
playLocalAudio
(
"
正确
"
);
await
this
.
showVoiceGood
();
await
this
.
showVoiceGood
();
...
@@ -1385,6 +1408,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -1385,6 +1408,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
});
}
}
private
antAction
()
{
let
ant
=
cc
.
find
(
"
bg/snow/antDragon
"
,
this
.
node
);
cc
.
tween
(
ant
).
repeatForever
(
cc
.
tween
()
.
to
(
3
,
{
x
:
-
824
,
y
:
-
67
}).
call
(()
=>
{
ant
.
scaleX
=
1
,
ant
.
angle
=
45
})
.
to
(
3
,
{
x
:
-
890
,
y
:
-
190
}).
call
(()
=>
{
ant
.
scaleX
=
-
1
,
ant
.
angle
=
0
})
.
to
(
3
,
{
x
:
-
730
,
y
:
-
400
}).
call
(()
=>
{
ant
.
scaleX
=
-
1
,
ant
.
angle
=
0
})
.
to
(
3
,
{
x
:
-
680
,
y
:
-
200
}).
call
(()
=>
{
ant
.
scaleX
=
1
,
ant
.
angle
=
0
})
).
start
();
}
playLocalAudio
(
audioName
)
{
playLocalAudio
(
audioName
)
{
const
audio
=
cc
const
audio
=
cc
.
find
(
`audioClips/
${
audioName
}
`
)
.
find
(
`audioClips/
${
audioName
}
`
)
...
...
assets/l3_boardgame2_hole/script/BoardGame2_LoadingLayer.ts
→
assets/l3_boardgame2_hole/script/BoardGame2_
hole_
LoadingLayer.ts
View file @
98a207cf
File moved
assets/l3_boardgame2_hole/script/BoardGame2_LoadingLayer.ts.meta
→
assets/l3_boardgame2_hole/script/BoardGame2_
hole_
LoadingLayer.ts.meta
View file @
98a207cf
{
{
"ver": "1.0.8",
"ver": "1.0.8",
"uuid": "
4d354824-df0d-4020-ab65-3afd85ca0064
",
"uuid": "
ed40af0f-6d87-420d-8a32-5bfe3a42a0bb
",
"isPlugin": false,
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInNative": true,
...
...
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