Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PK_Game
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
PK_Game
Commits
c551f77e
Commit
c551f77e
authored
Oct 24, 2023
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: v1.5
parent
60b86dc9
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
577 additions
and
394 deletions
+577
-394
pkgame.meta
assets/PK_Game/prefab/pkgame.meta
+12
-0
PK_Game.fire
assets/PK_Game/scene/PK_Game.fire
+519
-366
PK_Game.ts
assets/PK_Game/scene/PK_Game.ts
+2
-0
Server_PK_Game.ts
assets/PK_Game/script/Server_PK_Game.ts
+24
-12
endLayer_PK_Game.ts
assets/PK_Game/script/layers/endLayer_PK_Game.ts
+3
-3
gameLayer_PK_Game.ts
assets/PK_Game/script/layers/gameLayer_PK_Game.ts
+17
-13
bg.png
assets/PK_Game/texture/bg.png
+0
-0
No files found.
assets/PK_Game/prefab/pkgame.meta
0 → 100644
View file @
c551f77e
{
"ver": "1.1.2",
"uuid": "5eefde91-544f-4097-a088-5d1c218e0a2f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/scene/PK_Game.fire
View file @
c551f77e
This diff is collapsed.
Click to expand it.
assets/PK_Game/scene/PK_Game.ts
View file @
c551f77e
...
@@ -97,6 +97,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -97,6 +97,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
initView
()
{
initView
()
{
const
bgNode
=
cc
.
find
(
'
Canvas/bg
'
);
const
bgNode
=
cc
.
find
(
'
Canvas/bg
'
);
bgNode
.
scale
=
this
.
_mapScaleMax
;
bgNode
.
scale
=
this
.
_mapScaleMax
;
// this.node.getChildByName("cover").scale = this._mapScaleMin;
this
.
homeLayerCom
=
this
.
homeLayer
.
getComponent
(
HomeLayer
);
this
.
homeLayerCom
=
this
.
homeLayer
.
getComponent
(
HomeLayer
);
this
.
matchLayerCom
=
this
.
matchLayer
.
getComponent
(
MatchLayer
);
this
.
matchLayerCom
=
this
.
matchLayer
.
getComponent
(
MatchLayer
);
this
.
gameLayerCom
=
this
.
gameLayer
.
getComponent
(
GameLayer
);
this
.
gameLayerCom
=
this
.
gameLayer
.
getComponent
(
GameLayer
);
...
...
assets/PK_Game/script/Server_PK_Game.ts
View file @
c551f77e
...
@@ -100,8 +100,11 @@ export class GameServer {
...
@@ -100,8 +100,11 @@ export class GameServer {
blueRight
:
0
,
blueRight
:
0
,
redRight
:
0
,
redRight
:
0
,
total
:
0
,
total
:
0
,
addRedScore
:
0
,
roundAddRedScore
:
0
,
addBlueScore
:
0
,
roundAddBlueScore
:
0
,
totalAddRedScore
:
0
,
totalAddBlueScore
:
0
,
};
};
startGame
()
{
startGame
()
{
...
@@ -112,6 +115,10 @@ export class GameServer {
...
@@ -112,6 +115,10 @@ export class GameServer {
this
.
gameStatus
.
state
=
0
;
this
.
gameStatus
.
state
=
0
;
this
.
gameStatus
.
blueRight
=
0
;
this
.
gameStatus
.
blueRight
=
0
;
this
.
gameStatus
.
redRight
=
0
;
this
.
gameStatus
.
redRight
=
0
;
this
.
gameStatus
.
roundAddRedScore
=
0
;
this
.
gameStatus
.
roundAddBlueScore
=
0
;
this
.
gameStatus
.
totalAddRedScore
=
0
;
this
.
gameStatus
.
totalAddBlueScore
=
0
;
this
.
gameStatus
.
total
=
this
.
lvData
[
this
.
matchLv
].
questionNun
;
this
.
gameStatus
.
total
=
this
.
lvData
[
this
.
matchLv
].
questionNun
;
this
.
networkHelper
.
sendFrame
({
this
.
networkHelper
.
sendFrame
({
type
:
"
SERVER_updateStatus
"
,
type
:
"
SERVER_updateStatus
"
,
...
@@ -199,8 +206,8 @@ export class GameServer {
...
@@ -199,8 +206,8 @@ export class GameServer {
this
.
prepareNum
=
0
this
.
prepareNum
=
0
this
.
gameStatus
.
index
=
0
;
this
.
gameStatus
.
index
=
0
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
a
ddBlueScore
=
0
;
this
.
gameStatus
.
roundA
ddBlueScore
=
0
;
this
.
gameStatus
.
a
ddRedScore
=
0
;
this
.
gameStatus
.
roundA
ddRedScore
=
0
;
this
.
answerIndex
=
0
;
this
.
answerIndex
=
0
;
this
.
answerCount
=
0
;
this
.
answerCount
=
0
;
this
.
answerData
=
[];
this
.
answerData
=
[];
...
@@ -227,12 +234,17 @@ export class GameServer {
...
@@ -227,12 +234,17 @@ export class GameServer {
if
(
quetion
.
rightIndex
==
data
.
index
)
{
if
(
quetion
.
rightIndex
==
data
.
index
)
{
if
(
sender
.
color
==
"
Red
"
)
{
if
(
sender
.
color
==
"
Red
"
)
{
this
.
gameStatus
.
redRight
+=
1
;
this
.
gameStatus
.
redRight
+=
1
;
this
.
gameStatus
.
addRedScore
=
10
-
Math
.
floor
((
Date
.
now
()
-
this
.
startTime
)
/
1000
);
this
.
gameStatus
.
roundAddRedScore
=
10
-
Math
.
floor
((
Date
.
now
()
-
this
.
startTime
)
/
1000
);
this
.
gameStatus
.
addRedScore
=
Math
.
max
(
0
,
this
.
gameStatus
.
addRedScore
)
this
.
gameStatus
.
roundAddRedScore
=
Math
.
max
(
0
,
this
.
gameStatus
.
roundAddRedScore
)
this
.
gameStatus
.
totalAddRedScore
+=
this
.
gameStatus
.
roundAddRedScore
;
}
else
{
}
else
{
this
.
gameStatus
.
blueRight
+=
1
;
this
.
gameStatus
.
blueRight
+=
1
;
this
.
gameStatus
.
addBlueScore
=
10
-
Math
.
floor
((
Date
.
now
()
-
this
.
startTime
)
/
1000
);
this
.
gameStatus
.
roundAddBlueScore
=
10
-
Math
.
floor
((
Date
.
now
()
-
this
.
startTime
)
/
1000
);
this
.
gameStatus
.
addBlueScore
=
Math
.
max
(
0
,
this
.
gameStatus
.
addBlueScore
)
this
.
gameStatus
.
roundAddBlueScore
=
Math
.
max
(
0
,
this
.
gameStatus
.
roundAddBlueScore
)
this
.
gameStatus
.
totalAddBlueScore
+=
this
.
gameStatus
.
roundAddBlueScore
;
}
}
}
}
...
@@ -261,8 +273,8 @@ export class GameServer {
...
@@ -261,8 +273,8 @@ export class GameServer {
this
.
prepareNum
=
0
this
.
prepareNum
=
0
this
.
answerIndex
++
;
this
.
answerIndex
++
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
a
ddBlueScore
=
0
;
this
.
gameStatus
.
roundA
ddBlueScore
=
0
;
this
.
gameStatus
.
a
ddRedScore
=
0
;
this
.
gameStatus
.
roundA
ddRedScore
=
0
;
this
.
gameStatus
.
index
=
this
.
answerIndex
;
this
.
gameStatus
.
index
=
this
.
answerIndex
;
this
.
answerCount
=
0
;
this
.
answerCount
=
0
;
this
.
answerData
=
[];
this
.
answerData
=
[];
...
@@ -326,8 +338,8 @@ export class GameServer {
...
@@ -326,8 +338,8 @@ export class GameServer {
this
.
prepareNum
=
0
this
.
prepareNum
=
0
this
.
answerIndex
++
;
this
.
answerIndex
++
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
state
=
1
;
this
.
gameStatus
.
a
ddBlueScore
=
0
;
this
.
gameStatus
.
roundA
ddBlueScore
=
0
;
this
.
gameStatus
.
a
ddRedScore
=
0
;
this
.
gameStatus
.
roundA
ddRedScore
=
0
;
this
.
gameStatus
.
index
=
this
.
answerIndex
;
this
.
gameStatus
.
index
=
this
.
answerIndex
;
this
.
answerCount
=
0
;
this
.
answerCount
=
0
;
this
.
answerData
=
[];
this
.
answerData
=
[];
...
...
assets/PK_Game/script/layers/endLayer_PK_Game.ts
View file @
c551f77e
...
@@ -72,7 +72,7 @@ export default class EndLayer extends cc.Component {
...
@@ -72,7 +72,7 @@ export default class EndLayer extends cc.Component {
let
root
=
this
.
loseRoot
;
let
root
=
this
.
loseRoot
;
let
golden
=
this
.
loseGold
;
let
golden
=
this
.
loseGold
;
if
(
data
.
status
.
blueRight
>=
data
.
status
.
redRight
)
{
if
(
data
.
status
.
totalAddBlueScore
>=
data
.
status
.
totalAddRedScore
)
{
root
=
this
.
winRoot
;
root
=
this
.
winRoot
;
golden
=
this
.
winGold
;
golden
=
this
.
winGold
;
this
.
mainCom
.
playLocalAudio
(
"
win
"
)
this
.
mainCom
.
playLocalAudio
(
"
win
"
)
...
@@ -101,11 +101,11 @@ export default class EndLayer extends cc.Component {
...
@@ -101,11 +101,11 @@ export default class EndLayer extends cc.Component {
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueScore
.
string
=
mydata
.
score
;
this
.
blueScore
.
string
=
data
.
status
.
totalAddBlueScore
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redName
.
string
=
otherData
.
name
;
this
.
redName
.
string
=
otherData
.
name
;
this
.
redScore
.
string
=
otherData
.
score
;
this
.
redScore
.
string
=
data
.
status
.
totalAddRedScore
}
}
...
...
assets/PK_Game/script/layers/gameLayer_PK_Game.ts
View file @
c551f77e
...
@@ -77,6 +77,7 @@ export default class GameLayer extends cc.Component {
...
@@ -77,6 +77,7 @@ export default class GameLayer extends cc.Component {
countTime
:
number
;
countTime
:
number
;
cupY
:
number
;
cupY
:
number
;
cupX
:
number
;
cupX
:
number
;
startScore
:
any
;
onLoad
()
{
onLoad
()
{
...
@@ -96,6 +97,7 @@ export default class GameLayer extends cc.Component {
...
@@ -96,6 +97,7 @@ export default class GameLayer extends cc.Component {
this
.
questionTime
.
string
=
"
10
"
;
this
.
questionTime
.
string
=
"
10
"
;
this
.
startScore
=
mydata
.
score
;
this
.
picRoot
.
active
=
false
;
this
.
picRoot
.
active
=
false
;
this
.
cupStart
.
active
=
true
;
this
.
cupStart
.
active
=
true
;
...
@@ -108,11 +110,12 @@ export default class GameLayer extends cc.Component {
...
@@ -108,11 +110,12 @@ export default class GameLayer extends cc.Component {
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueScore
.
string
=
mydata
.
score
;
this
.
blueScore
.
string
=
"
0
"
;
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redName
.
string
=
otherData
.
name
;
this
.
redName
.
string
=
otherData
.
name
;
this
.
redScore
.
string
=
otherData
.
score
;
this
.
redScore
.
string
=
"
0
"
;
cc
.
tween
(
this
.
cupStart
).
to
(
0.15
,
{
y
:
this
.
cupY
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
cupStart
).
to
(
0.15
,
{
y
:
this
.
cupY
},
{
easing
:
"
sineIn
"
}).
start
()
...
@@ -234,29 +237,30 @@ export default class GameLayer extends cc.Component {
...
@@ -234,29 +237,30 @@ export default class GameLayer extends cc.Component {
let
addBlueScore
=
+
data
.
status
.
addBlueScore
;
let
roundAddBlueScore
=
+
data
.
status
.
roundAddBlueScore
;
let
addRedScore
=
+
data
.
status
.
addRedScore
;
let
roundAddRedScore
=
+
data
.
status
.
roundAddRedScore
;
if
(
roundAddBlueScore
>
0
)
{
if
(
addBlueScore
>
0
)
{
let
bluescore
=
+
this
.
blueScore
.
string
;
this
.
blueScore
.
string
=
data
.
status
.
totalAddBlueScore
;
this
.
blueScore
.
string
=
bluescore
+
data
.
status
.
addBlueScore
;
cc
.
sys
.
localStorage
.
setItem
(
"
mySocre
"
,
this
.
startScore
+
data
.
status
.
totalAddBlueScore
)
cc
.
sys
.
localStorage
.
setItem
(
"
mySocre
"
,
+
this
.
blueScore
.
string
)
let
lbnode
=
cc
.
instantiate
(
this
.
blueScore
.
node
);
let
lbnode
=
cc
.
instantiate
(
this
.
blueScore
.
node
);
lbnode
.
parent
=
this
.
blueScore
.
node
.
parent
;
lbnode
.
parent
=
this
.
blueScore
.
node
.
parent
;
lbnode
.
color
=
cc
.
Color
.
RED
;
lbnode
.
color
=
cc
.
Color
.
RED
;
lbnode
.
getComponent
(
cc
.
Label
).
string
=
"
+
"
+
a
ddBlueScore
;
lbnode
.
getComponent
(
cc
.
Label
).
string
=
"
+
"
+
roundA
ddBlueScore
;
cc
.
tween
(
lbnode
).
by
(
1
,
{
y
:
100
,
opacity
:
-
255
},
{
easing
:
"
sineOut
"
}).
removeSelf
().
start
();
cc
.
tween
(
lbnode
).
by
(
1
,
{
y
:
100
,
opacity
:
-
255
},
{
easing
:
"
sineOut
"
}).
removeSelf
().
start
();
}
}
if
(
a
ddRedScore
>
0
)
{
if
(
roundA
ddRedScore
>
0
)
{
let
redscore
=
+
this
.
redScore
.
string
;
this
.
redScore
.
string
=
redscore
+
data
.
status
.
a
ddRedScore
;
this
.
redScore
.
string
=
data
.
status
.
totalA
ddRedScore
;
let
lbnode
=
cc
.
instantiate
(
this
.
redScore
.
node
);
let
lbnode
=
cc
.
instantiate
(
this
.
redScore
.
node
);
lbnode
.
parent
=
this
.
redScore
.
node
.
parent
;
lbnode
.
parent
=
this
.
redScore
.
node
.
parent
;
lbnode
.
color
=
cc
.
Color
.
RED
;
lbnode
.
color
=
cc
.
Color
.
RED
;
lbnode
.
getComponent
(
cc
.
Label
).
string
=
"
+
"
+
a
ddRedScore
;
lbnode
.
getComponent
(
cc
.
Label
).
string
=
"
+
"
+
roundA
ddRedScore
;
this
.
mainCom
.
otherData
.
score
=
+
this
.
redScore
.
string
;
this
.
mainCom
.
otherData
.
score
=
+
this
.
redScore
.
string
;
...
...
assets/PK_Game/texture/bg.png
View replaced file @
60b86dc9
View file @
c551f77e
This diff is collapsed.
Click to expand it.
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