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
2a109b3d
Commit
2a109b3d
authored
Oct 22, 2023
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: v0.9
parent
9fe63b50
Changes
33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
8960 additions
and
4823 deletions
+8960
-4823
PK_Game.fire
assets/PK_Game/scene/PK_Game.fire
+7158
-4546
PK_Game.ts
assets/PK_Game/scene/PK_Game.ts
+225
-150
AI_PK_Game.ts
assets/PK_Game/script/AI_PK_Game.ts
+40
-29
Server_PK_Game.ts
assets/PK_Game/script/Server_PK_Game.ts
+174
-95
defaultData_PK_Game.ts
assets/PK_Game/script/defaultData_PK_Game.ts
+150
-0
layers.meta
assets/PK_Game/script/layers.meta
+12
-0
cup_PK_Game.ts
assets/PK_Game/script/layers/cup_PK_Game.ts
+46
-0
cup_PK_Game.ts.meta
assets/PK_Game/script/layers/cup_PK_Game.ts.meta
+9
-0
endLayer_PK_Game.ts
assets/PK_Game/script/layers/endLayer_PK_Game.ts
+73
-0
endLayer_PK_Game.ts.meta
assets/PK_Game/script/layers/endLayer_PK_Game.ts.meta
+9
-0
gameLayer_PK_Game.ts
assets/PK_Game/script/layers/gameLayer_PK_Game.ts
+255
-0
gameLayer_PK_Game.ts.meta
assets/PK_Game/script/layers/gameLayer_PK_Game.ts.meta
+9
-0
homeLayer_PK_Game.ts
assets/PK_Game/script/layers/homeLayer_PK_Game.ts
+43
-0
homeLayer_PK_Game.ts.meta
assets/PK_Game/script/layers/homeLayer_PK_Game.ts.meta
+9
-0
matchLayer_PK_Game.ts
assets/PK_Game/script/layers/matchLayer_PK_Game.ts
+142
-0
matchLayer_PK_Game.ts.meta
assets/PK_Game/script/layers/matchLayer_PK_Game.ts.meta
+9
-0
myInfo_PK_Game.ts
assets/PK_Game/script/layers/myInfo_PK_Game.ts
+76
-0
myInfo_PK_Game.ts.meta
assets/PK_Game/script/layers/myInfo_PK_Game.ts.meta
+9
-0
picSelectCell_PK_Game.ts
assets/PK_Game/script/layers/picSelectCell_PK_Game.ts
+89
-0
picSelectCell_PK_Game.ts.meta
assets/PK_Game/script/layers/picSelectCell_PK_Game.ts.meta
+9
-0
player_PK_Game.ts
assets/PK_Game/script/layers/player_PK_Game.ts
+27
-0
player_PK_Game.ts.meta
assets/PK_Game/script/layers/player_PK_Game.ts.meta
+9
-0
rankLayer_PK_Game.ts
assets/PK_Game/script/layers/rankLayer_PK_Game.ts
+106
-0
rankLayer_PK_Game.ts.meta
assets/PK_Game/script/layers/rankLayer_PK_Game.ts.meta
+9
-0
selectItem_PK_Game.ts
assets/PK_Game/script/layers/selectItem_PK_Game.ts
+35
-0
selectItem_PK_Game.ts.meta
assets/PK_Game/script/layers/selectItem_PK_Game.ts.meta
+9
-0
txiSelectCell_PK_Game.ts
assets/PK_Game/script/layers/txiSelectCell_PK_Game.ts
+78
-0
txiSelectCell_PK_Game.ts.meta
assets/PK_Game/script/layers/txiSelectCell_PK_Game.ts.meta
+9
-0
util_PK_Game.ts
assets/PK_Game/script/util_PK_Game.ts
+38
-0
img_jin.png
assets/PK_Game/texture/rank/img_jin.png
+0
-0
img_jin.png.meta
assets/PK_Game/texture/rank/img_jin.png.meta
+36
-0
builder.json
settings/builder.json
+55
-0
project.json
settings/project.json
+3
-3
No files found.
assets/PK_Game/scene/PK_Game.fire
View file @
2a109b3d
This diff is collapsed.
Click to expand it.
assets/PK_Game/scene/PK_Game.ts
View file @
2a109b3d
This diff is collapsed.
Click to expand it.
assets/PK_Game/script/AI_PK_Game.ts
View file @
2a109b3d
...
...
@@ -2,54 +2,65 @@
import
{
NetworkHelper
}
from
"
./NetworkHelper_PK_Game
"
;
import
{
asyncDelay
}
from
"
./util_PK_Game
"
;
const
ansPro
=
[
0.1
,
0.2
,
0.3
,
0.4
,
0.7
,
0.8
,
0.9
]
export
class
AI
{
networkHelper
:
NetworkHelper
;
playerData
:
any
;
_status
=
{
state
:
-
1
,
// -1:未开始 0 准备阶段 1 roll 2 判定
Red
:
-
1
,
Blue
:
0
,
step
:
0
,
current
:
"
Blue
"
,
jump
:
null
,
};
anspronum
:
number
;
constructor
(
networkHelper
:
NetworkHelper
,
playerData
:
any
)
{
this
.
networkHelper
=
networkHelper
;
this
.
playerData
=
playerData
;
this
.
anspronum
=
ansPro
[
this
.
playerData
.
lv
]
}
async
onFrameEvent
(
data
)
{
console
.
log
(
"
AI get event:
"
+
JSON
.
stringify
(
data
));
if
(
data
.
type
==
"
SERVER_updateStatus
"
)
{
if
(
data
.
type
==
"
SERVER_allPlayerInfo
"
)
{
this
.
networkHelper
.
sendFrame
({
type
:
"
gamePrepare
"
,
uuid
:
this
.
playerData
.
uuid
,
});
}
if
(
data
.
type
==
"
SERVER_gameEv
"
)
{
this
.
_status
=
JSON
.
parse
(
JSON
.
stringify
(
data
.
status
));
cc
.
log
(
"
ai on msg SERVER_gameEv
"
)
if
(
!
data
.
question
)
{
return
;
cc
.
log
(
data
);
}
let
rigthIndex
=
data
.
question
.
rightIndex
;
if
(
this
.
playerData
.
color
!=
this
.
_status
.
current
)
return
let
time
=
2
+
Math
.
floor
(
Math
.
random
()
*
4
)
if
(
!
this
.
_status
.
step
)
{
await
asyncDelay
(
Math
.
random
()
*
3
+
2
);
await
asyncDelay
(
time
);
console
.
log
(
"
AI rolling
"
);
this
.
networkHelper
.
sendFrame
({
type
:
"
roll
"
,
uuid
:
this
.
playerData
.
uuid
,
});
let
index
=
0
;
if
(
Math
.
random
()
<=
this
.
anspronum
)
{
index
=
rigthIndex
;
}
else
{
await
asyncDelay
(
Math
.
random
()
*
3
+
2
);
if
(
Math
.
random
()
<
0.7
)
{
this
.
networkHelper
.
sendFrame
({
type
:
"
right
"
,
uuid
:
this
.
playerData
.
uuid
,
});
}
else
{
this
.
networkHelper
.
sendFrame
({
type
:
"
wrong
"
,
uuid
:
this
.
playerData
.
uuid
,
});
index
=
Math
.
floor
(
Math
.
random
()
*
3.99
);
while
(
index
==
rigthIndex
)
{
index
=
Math
.
floor
(
Math
.
random
()
*
3.99
);
}
}
this
.
networkHelper
.
sendFrame
({
type
:
"
anserQues
"
,
uuid
:
this
.
playerData
.
uuid
,
index
:
index
});
}
}
...
...
assets/PK_Game/script/Server_PK_Game.ts
View file @
2a109b3d
This diff is collapsed.
Click to expand it.
assets/PK_Game/script/defaultData_PK_Game.ts
View file @
2a109b3d
export
const
defaultData
=
{
myInfo
:
{
lv
:
0
,
score
:
1666
,
rank
:
-
1
,
url
:
"
http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png
"
,
name
:
"
test
"
},
question
:
[
{
info
:
"
1+1=?
"
,
type
:
1
,
ans
:
[
1
,
2
,
3
,
4
],
rightIndex
:
1
},
{
info
:
"
1+1=?
"
,
type
:
2
,
ans
:
[
"
http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f596e586a31ac2813b1702557941c022.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f0f396c52c42239913fd94523db979fa.png
"
,
"
http://staging-teach.cdn.ireadabc.com/9f2d2ef622fa33d4e2abcbdc4b40ab6a.png
"
,],
rightIndex
:
1
},
{
info
:
"
1+1=?
"
,
type
:
1
,
ans
:
[
1
,
2
,
3
,
4
],
rightIndex
:
1
},
{
info
:
"
1+1=?
"
,
type
:
2
,
ans
:
[
"
http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f596e586a31ac2813b1702557941c022.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f0f396c52c42239913fd94523db979fa.png
"
,
"
http://staging-teach.cdn.ireadabc.com/9f2d2ef622fa33d4e2abcbdc4b40ab6a.png
"
,],
rightIndex
:
1
},
{
info
:
"
1+1=?
"
,
type
:
2
,
ans
:
[
"
http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f596e586a31ac2813b1702557941c022.png
"
,
"
http://staging-teach.cdn.ireadabc.com/f0f396c52c42239913fd94523db979fa.png
"
,
"
http://staging-teach.cdn.ireadabc.com/9f2d2ef622fa33d4e2abcbdc4b40ab6a.png
"
,],
rightIndex
:
2
},
],
rank
:
[
{
name
:
"
好奇宝宝4536
"
,
score
:
800
,
},
{
name
:
"
好奇宝宝773
"
,
score
:
1560
,
},
{
name
:
"
好奇宝宝656
"
,
score
:
550
,
},
{
name
:
"
好奇宝宝17
"
,
score
:
28830
},
{
name
:
"
好奇宝宝44
"
,
score
:
39842
},
{
name
:
"
好奇宝宝999
"
,
score
:
0
},
{
name
:
"
恩
"
,
score
:
140
},
{
name
:
"
。
"
,
score
:
360
},
{
name
:
"
博学笃志
"
,
score
:
1470
},
{
name
:
"
小香菜
"
,
score
:
440
},
{
name
:
"
Jess1e
"
,
score
:
1850
},
{
name
:
"
鱼是野
"
,
score
:
5860
},
{
name
:
"
莫尔er
"
,
score
:
9870
},
{
name
:
"
泛舟
"
,
score
:
4550
},
{
name
:
"
好奇宝宝580
"
,
score
:
"
5170
"
,
},
{
name
:
"
Tears.Smile
"
,
score
:
610
},
{
name
:
"
懒猫小迪
"
,
score
:
570
},
{
name
:
"
五颜六色的
"
,
score
:
1020
},
{
name
:
"
可可
"
,
score
:
50
},
{
name
:
"
浅蓝
"
,
score
:
1040
},
{
name
:
"
小汤圆
"
,
score
:
900
},
{
name
:
"
momo
"
,
score
:
8390
},
],
};
\ No newline at end of file
assets/PK_Game/script/layers.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.1.2",
"uuid": "a099a409-00f0-447c-bc2b-e53489224d28",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/cup_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getLv
,
getMinLv
}
from
"
../util_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
Cup
extends
cc
.
Component
{
@
property
(
cc
.
SpriteFrame
)
iconList
=
[];
@
property
(
cc
.
SpriteFrame
)
lvIconList
=
[];
@
property
(
cc
.
Sprite
)
icon
:
cc
.
Sprite
=
null
;
@
property
(
cc
.
Sprite
)
lvIcon
:
cc
.
Sprite
=
null
;
@
property
(
cc
.
Label
)
lb_minlv
:
cc
.
Label
=
null
;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
init
(
score
)
{
let
lv
=
getLv
(
score
);
let
minlv
=
getMinLv
(
score
);
lv
=
Math
.
min
(
lv
,
3
);
minlv
=
Math
.
min
(
minlv
,
4
);
this
.
icon
.
spriteFrame
=
this
.
iconList
[
lv
];
this
.
lvIcon
.
spriteFrame
=
this
.
lvIconList
[
lv
];
this
.
lb_minlv
.
string
=
[
"
I
"
,
"
II
"
,
"
III
"
,
"
IV
"
,
"
V
"
][
minlv
];
}
// update (dt) {}
}
assets/PK_Game/script/layers/cup_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "f627f21c-b954-43c2-88f3-d443d80729ef",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/endLayer_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
Player
from
"
./player_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
EndLayer
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
winRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loseRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
Button
)
btn_restart
:
cc
.
Button
=
null
;
@
property
(
cc
.
Node
)
blueHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
blueScore
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
blueName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
redHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
redScore
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
redName
:
cc
.
Label
=
null
;
mainCom
:
any
;
onLoad
()
{
this
.
btn_restart
.
node
.
on
(
"
click
"
,
this
.
onClickRestart
,
this
)
}
bind
onClickRestart
()
{
this
.
mainCom
.
backHome
();
}
init
(
data
,
mydata
,
otherData
)
{
let
root
=
this
.
loseRoot
;
if
(
data
.
blueRight
>=
data
.
redRight
)
{
this
.
winRoot
.
active
=
true
;
}
root
.
opacity
=
0
;
cc
.
tween
(
root
).
delay
(
0.5
).
to
(
1
,
{
opacity
:
255
}).
start
();
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueScore
.
string
=
mydata
.
score
;
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redName
.
string
=
otherData
.
name
;
this
.
redScore
.
string
=
otherData
.
score
;
}
// update (dt) {}
}
assets/PK_Game/script/layers/endLayer_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "22f22490-dea9-4e88-b71d-1c675dfdb180",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/gameLayer_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
asyncDelay
}
from
"
../util_PK_Game
"
;
import
PicCell
from
"
./picSelectCell_PK_Game
"
;
import
Player
from
"
./player_PK_Game
"
;
import
TxtCell
from
"
./txiSelectCell_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
GameLayer
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
questionBar
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
questionTime
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
blueBar
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
redBar
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
vsNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
blueHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
redHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
blueScore
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
blueName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
redScore
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
redName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
lb_info
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
lb_tips
:
cc
.
Label
=
null
;
@
property
(
cc
.
ProgressBar
)
timeprobar
:
cc
.
ProgressBar
=
null
;
@
property
(
cc
.
ProgressBar
)
blueprobar
:
cc
.
ProgressBar
=
null
;
@
property
(
cc
.
ProgressBar
)
redprobar
:
cc
.
ProgressBar
=
null
;
@
property
(
cc
.
Node
)
txtRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rootCover
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
cupStart
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
cupEnd
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
picRoot
:
cc
.
Node
=
null
;
blueX
:
number
;
redX
:
number
;
rightIndex
:
any
;
mainCom
:
any
;
list
:
cc
.
Node
[];
totaltime
:
number
=
-
1
;
countTime
:
number
;
cupY
:
number
;
cupX
:
number
;
onLoad
()
{
this
.
blueX
=
this
.
blueBar
.
x
;
this
.
redX
=
this
.
redBar
.
x
;
this
.
cupX
=
this
.
cupStart
.
x
;
this
.
cupY
=
this
.
cupStart
.
y
;
this
.
lb_tips
.
node
.
active
=
false
;
}
async
init
(
mydata
,
otherData
,
callback
)
{
this
.
questionBar
.
active
=
false
;
this
.
txtRoot
.
active
=
false
;
this
.
cupEnd
.
active
=
false
;
this
.
picRoot
.
active
=
false
;
this
.
cupStart
.
active
=
true
;
this
.
cupStart
.
opacity
=
255
;
this
.
blueBar
.
x
=
this
.
blueX
-
cc
.
winSize
.
width
;
this
.
redBar
.
x
=
this
.
redX
+
cc
.
winSize
.
width
;
this
.
cupStart
.
y
=
this
.
cupY
+
500
;
this
.
cupStart
.
x
=
this
.
cupX
;
this
.
cupStart
.
scale
=
1
;
this
.
blueHead
.
getComponent
(
Player
).
init
(
mydata
.
url
);
this
.
blueName
.
string
=
mydata
.
name
;
this
.
blueScore
.
string
=
mydata
.
score
;
this
.
redHead
.
getComponent
(
Player
).
init
(
otherData
.
headUrl
);
this
.
redName
.
string
=
otherData
.
name
;
this
.
redScore
.
string
=
otherData
.
score
;
cc
.
tween
(
this
.
cupStart
).
to
(
0.15
,
{
y
:
this
.
cupY
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
blueBar
).
to
(
0.35
,
{
x
:
this
.
blueX
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
redBar
).
to
(
0.35
,
{
x
:
this
.
redX
},
{
easing
:
"
sineIn
"
}).
start
()
await
asyncDelay
(
0.5
)
callback
&&
callback
();
}
async
initQuestion
(
question
,
index
)
{
this
.
rootCover
.
active
=
false
;
this
.
questionBar
.
active
=
false
;
this
.
rightIndex
=
question
.
rightIndex
;
let
ans
=
question
.
ans
;
this
.
lb_tips
.
string
=
`第
${
index
+
1
}
题`
this
.
lb_tips
.
node
.
active
=
true
;
await
asyncDelay
(
1
);
this
.
totaltime
=
10.2
;
this
.
countTime
=
0
;
this
.
questionBar
.
active
=
true
;
this
.
lb_tips
.
node
.
active
=
false
;
this
.
lb_info
.
string
=
question
.
info
;
if
(
question
.
type
==
1
)
{
this
.
txtRoot
.
active
=
true
;
this
.
picRoot
.
active
=
false
;
this
.
list
=
this
.
txtRoot
.
children
;
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
++
i
)
{
this
.
list
[
i
].
getComponent
(
TxtCell
).
init
(
i
,
ans
[
i
],
i
==
question
.
rightIndex
,
(
index
)
=>
{
this
.
mainCom
.
playLocalAudio
(
"
btn
"
);
this
.
mainCom
.
networkHelper
.
sendFrame
({
type
:
"
anserQues
"
,
uuid
:
this
.
mainCom
.
playerId
,
index
:
index
});
this
.
rootCover
.
active
=
true
;
})
}
}
else
{
this
.
txtRoot
.
active
=
false
;
this
.
picRoot
.
active
=
true
;
this
.
list
=
this
.
picRoot
.
children
;
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
++
i
)
{
this
.
list
[
i
].
getComponent
(
PicCell
).
init
(
i
,
ans
[
i
],
i
==
question
.
rightIndex
,
(
index
)
=>
{
this
.
mainCom
.
playLocalAudio
(
"
btn
"
);
this
.
mainCom
.
networkHelper
.
sendFrame
({
type
:
"
anserQues
"
,
uuid
:
this
.
mainCom
.
playerId
,
index
:
index
});
this
.
rootCover
.
active
=
true
;
})
}
}
}
async
settle
(
data
)
{
let
ans
=
data
.
ans
;
for
(
let
i
=
0
;
i
<
ans
.
length
;
++
i
)
{
let
info
=
ans
[
i
];
if
(
info
.
uuid
!=
this
.
mainCom
.
playerId
)
{
this
.
list
[
info
.
index
].
getComponent
(
TxtCell
)?.
onClickItem
(
null
,
2
);
this
.
list
[
info
.
index
].
getComponent
(
PicCell
)?.
onClickItem
(
null
,
2
);
}
}
this
.
redprobar
.
progress
=
data
.
status
.
redRight
/
data
.
status
.
total
;
this
.
blueprobar
.
progress
=
data
.
status
.
blueRight
/
data
.
status
.
total
;
await
asyncDelay
(
1
);
this
.
lb_info
.
string
=
""
;
this
.
txtRoot
.
active
=
false
;
this
.
picRoot
.
active
=
false
;
this
.
questionBar
.
active
=
false
;
cc
.
log
(
data
);
}
hide
()
{
this
.
redprobar
.
progress
=
0
;
this
.
blueprobar
.
progress
=
0
;
cc
.
tween
(
this
.
blueBar
).
to
(
0.35
,
{
x
:
this
.
blueX
-
cc
.
winSize
.
width
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
redBar
).
to
(
0.35
,
{
x
:
this
.
redX
+
cc
.
winSize
.
width
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
cupStart
).
to
(
0.5
,
{
x
:
this
.
cupEnd
.
x
,
y
:
this
.
cupEnd
.
y
,
scale
:
this
.
cupEnd
.
scale
}).
call
(()
=>
{
this
.
node
.
active
=
false
;
}).
start
();
}
update
(
dt
)
{
if
(
this
.
totaltime
>
0
)
{
this
.
countTime
+=
dt
;
let
left
=
this
.
totaltime
-
this
.
countTime
;
if
(
left
>=
0
)
{
this
.
timeprobar
.
progress
=
(
this
.
totaltime
-
this
.
countTime
)
/
this
.
totaltime
;
this
.
questionTime
.
string
=
""
+
Math
.
floor
(
this
.
totaltime
-
this
.
countTime
)
}
else
{
this
.
totaltime
=
-
1
;
this
.
countTime
=
0
this
.
rootCover
.
active
=
true
;
}
}
}
}
assets/PK_Game/script/layers/gameLayer_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "a6b22835-57c0-488e-bb43-46113b11cf34",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/homeLayer_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
Cup
from
"
./cup_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
HomeLayer
extends
cc
.
Component
{
@
property
(
cc
.
Button
)
btn_start
=
null
;
@
property
(
cc
.
Label
)
lb_gold
=
null
;
@
property
(
cc
.
Label
)
lb_lv
=
null
;
@
property
(
cc
.
Label
)
lb_award
=
null
;
@
property
(
cc
.
Label
)
lb_cost
=
null
;
_startCallBack
:
Function
;
onLoad
()
{
this
.
btn_start
.
node
.
on
(
"
click
"
,
this
.
onClickStart
,
this
)
}
onClickStart
()
{
this
.
_startCallBack
&&
this
.
_startCallBack
();
}
initCup
(
score
)
{
this
.
node
.
getChildByName
(
"
cup
"
).
getComponent
(
Cup
).
init
(
score
);
}
set
startCallBack
(
callback
:
Function
)
{
this
.
_startCallBack
=
callback
;
}
// update (dt) {}
}
assets/PK_Game/script/layers/homeLayer_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "a988384c-e0b9-49e7-ad09-9a1923676a8a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/matchLayer_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
asyncDelay
,
getLv
,
getMinLv
}
from
"
../util_PK_Game
"
;
import
Player
from
"
./player_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
MatchLayer
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
blueBar
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
redBar
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
vsNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
blueHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
redHead
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
blueLv
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
blueName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
redLv
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
redName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
searchNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
matchNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
matchlb
:
cc
.
Label
=
null
;
blueX
:
number
;
redX
:
number
;
matchCount
:
number
;
onLoad
()
{
this
.
blueBar
.
active
=
false
;
this
.
redBar
.
active
=
false
;
this
.
vsNode
.
active
=
false
;
this
.
blueX
=
this
.
blueBar
.
x
;
this
.
redX
=
this
.
redBar
.
x
;
this
.
matchCount
=
0
;
this
.
schedule
(()
=>
{
this
.
matchlb
.
string
=
`寻找中
${[
"
.
"
,
"
..
"
,
"
...
"
][
this
.
matchCount
%
3
]}
`
;
this
.
matchCount
++
},
0.4
)
}
async
startMatch
(
data
)
{
this
.
blueBar
.
active
=
false
;
this
.
redBar
.
active
=
false
;
this
.
vsNode
.
active
=
false
;
this
.
blueHead
.
getComponent
(
Player
).
init
(
data
.
url
);
let
lv
=
getLv
(
data
.
score
);
let
minlv
=
getMinLv
(
data
.
score
);
lv
=
Math
.
min
(
lv
,
3
);
minlv
=
Math
.
min
(
minlv
,
4
);
let
lvstr
=
[
"
黑铁
"
,
"
青铜
"
,
"
白银
"
,
"
黄金
"
][
lv
]
let
minlvstr
=
[
"
I
"
,
"
II
"
,
"
III
"
,
"
IV
"
,
"
V
"
][
minlv
];
this
.
blueLv
.
string
=
lvstr
+
""
+
minlvstr
;
this
.
blueName
.
string
=
data
.
name
;
this
.
blueBar
.
x
=
this
.
blueX
-
cc
.
winSize
.
width
;
this
.
redBar
.
x
=
this
.
blueX
+
cc
.
winSize
.
width
;
await
asyncDelay
(
0.1
);
this
.
blueBar
.
active
=
true
;
cc
.
log
(
"
,,,,,,,,,,,,,,
"
+
cc
.
easeBackInOut
.
name
)
cc
.
tween
(
this
.
blueBar
).
to
(
0.35
,
{
x
:
this
.
blueX
},
{
easing
:
"
sineIn
"
}).
start
()
await
asyncDelay
(
1.5
);
this
.
matchCount
=
0
;
this
.
searchNode
.
active
=
true
;
this
.
matchNode
.
active
=
false
;
this
.
redLv
.
node
.
active
=
false
;
this
.
redName
.
node
.
active
=
false
;
this
.
redBar
.
active
=
true
;
cc
.
tween
(
this
.
redBar
).
to
(
0.3
,
{
x
:
this
.
redX
},
{
easing
:
"
sineIn
"
}).
start
()
}
async
addOther
(
data
,
callback
)
{
this
.
redBar
.
active
=
true
;
this
.
searchNode
.
active
=
false
;
this
.
matchNode
.
active
=
true
;
this
.
redLv
.
node
.
active
=
true
;
this
.
redName
.
node
.
active
=
true
;
this
.
redHead
.
getComponent
(
Player
).
init
(
data
.
headUrl
);
// this.redLv.string = data.lv;
let
lv
=
getLv
(
data
.
score
);
let
minlv
=
getMinLv
(
data
.
score
);
lv
=
Math
.
min
(
lv
,
3
);
minlv
=
Math
.
min
(
minlv
,
4
);
let
lvstr
=
[
"
黑铁
"
,
"
青铜
"
,
"
白银
"
,
"
黄金
"
][
lv
]
let
minlvstr
=
[
"
I
"
,
"
II
"
,
"
III
"
,
"
IV
"
,
"
V
"
][
minlv
];
this
.
redLv
.
string
=
lvstr
+
""
+
minlvstr
;
this
.
redName
.
string
=
data
.
name
;
this
.
vsNode
.
active
=
true
;
this
.
vsNode
.
scale
=
1.5
;
this
.
vsNode
.
opacity
=
0
;
cc
.
tween
(
this
.
vsNode
).
to
(
0.3
,
{
opacity
:
255
,
scale
:
1
}).
start
();
await
asyncDelay
(
0.6
);
cc
.
tween
(
this
.
vsNode
).
to
(
0.1
,
{
opacity
:
0
}).
start
();
cc
.
tween
(
this
.
blueBar
).
by
(
0.3
,
{
x
:
-
cc
.
winSize
.
width
},
{
easing
:
"
sineIn
"
}).
start
()
cc
.
tween
(
this
.
redBar
).
by
(
0.3
,
{
x
:
cc
.
winSize
.
width
},
{
easing
:
"
sineIn
"
}).
start
()
await
asyncDelay
(
0.4
);
callback
&&
callback
()
}
// update (dt) {}
}
assets/PK_Game/script/layers/matchLayer_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "1a838b43-9811-4389-8bbd-6c63be7e7c9d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/myInfo_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
Cup
from
"
./cup_PK_Game
"
;
import
Player
from
"
./player_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
MyInfo
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
root
:
cc
.
Node
=
null
;
@
property
(
cc
.
Mask
)
barMask
:
cc
.
Mask
=
null
;
@
property
(
cc
.
Node
)
head
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btn_rank
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btn_rise
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
lb_rank
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
lb_score
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
lb_name
:
cc
.
Label
=
null
;
mainCom
:
any
;
onLoad
()
{
this
.
btn_rise
.
on
(
"
click
"
,
this
.
onClickRisk
,
this
)
this
.
btn_rank
.
on
(
"
click
"
,
this
.
onClickRank
,
this
)
}
openMask
()
{
this
.
barMask
.
enabled
=
true
;
}
hideMask
()
{
this
.
barMask
.
enabled
=
false
;
}
onClickRank
()
{
this
.
mainCom
.
showRank
();
}
onClickRisk
()
{
this
.
mainCom
.
showRisk
();
}
hide
()
{
cc
.
tween
(
this
.
root
).
to
(
0.2
,
{
y
:
-
180
},
{
easing
:
"
sineOut
"
}).
start
();
}
show
()
{
cc
.
tween
(
this
.
root
).
to
(
0.2
,
{
y
:
180
},
{
easing
:
"
sineIn
"
}).
start
();
}
init
(
data
)
{
this
.
lb_score
.
string
=
data
.
score
;
this
.
lb_name
.
string
=
data
.
name
;
this
.
lb_rank
.
string
=
data
.
rank
;
this
.
head
.
getComponent
(
Player
).
init
(
data
.
url
);
this
.
root
.
getChildByName
(
"
cup
"
).
getComponent
(
Cup
).
init
(
data
.
score
);
}
// update (dt) {}
}
assets/PK_Game/script/layers/myInfo_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "090fb3b3-f578-40d3-ae21-2074e4b7233c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/picSelectCell_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getSpriteFrimeByUrl
}
from
"
../util_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
PicCell
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
rightNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
wrongNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Sprite
)
icon
:
cc
.
Sprite
=
null
;
@
property
(
cc
.
Node
)
leftRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rightRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
SpriteFrame
)
rightSp
:
cc
.
SpriteFrame
=
null
;
@
property
(
cc
.
SpriteFrame
)
wrongSp
:
cc
.
SpriteFrame
=
null
;
isRight
:
any
;
index
:
any
;
clickCall
:
Function
;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
onLoad
()
{
this
.
node
.
on
(
"
click
"
,
this
.
onClickItem
,
this
)
}
onClickItem
(
handle
,
side
)
{
let
parent
=
side
==
2
?
this
.
rightRoot
:
this
.
leftRoot
;
if
(
this
.
isRight
)
{
this
.
rightNode
.
active
=
true
;
let
node
=
new
cc
.
Node
();
node
.
addComponent
(
cc
.
Sprite
);
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
rightSp
;
node
.
parent
=
parent
;
}
else
{
this
.
wrongNode
.
active
=
true
;
let
node
=
new
cc
.
Node
();
node
.
addComponent
(
cc
.
Sprite
);
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
wrongSp
;
node
.
parent
=
parent
;
}
if
(
handle
)
{
this
.
clickCall
&&
this
.
clickCall
(
this
.
index
);
}
}
init
(
index
,
url
,
isRight
,
callback
:
Function
)
{
this
.
rightNode
.
active
=
false
;
this
.
wrongNode
.
active
=
false
;
this
.
leftRoot
.
removeAllChildren
();
this
.
rightRoot
.
removeAllChildren
();
this
.
isRight
=
isRight
;
this
.
clickCall
=
callback
;
this
.
index
=
index
;
getSpriteFrimeByUrl
(
url
,
(
sf
:
cc
.
SpriteFrame
)
=>
{
this
.
icon
.
spriteFrame
=
sf
;
this
.
icon
.
node
.
scale
=
Math
.
max
(
360
/
this
.
node
.
width
,
360
/
this
.
node
.
height
)
})
}
// update (dt) {}
}
assets/PK_Game/script/layers/picSelectCell_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "ba3c3aad-3f0d-4493-9e5c-b9817fe37d84",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/player_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getSpriteFrimeByUrl
}
from
"
../util_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
Player
extends
cc
.
Component
{
@
property
(
cc
.
Sprite
)
icon
:
cc
.
Sprite
=
null
;
init
(
url
?)
{
let
defaultUrl
=
"
http://staging-teach.cdn.ireadabc.com/0751c28419a0e8ffb1f0e84435b081ce.png
"
getSpriteFrimeByUrl
(
url
||
defaultUrl
,
(
sf
:
cc
.
SpriteFrame
)
=>
{
this
.
icon
.
spriteFrame
=
sf
;
this
.
icon
.
node
.
scale
=
Math
.
max
(
this
.
node
.
width
/
this
.
icon
.
node
.
width
,
this
.
node
.
height
/
this
.
icon
.
node
.
height
)
})
}
// update (dt) {}
}
assets/PK_Game/script/layers/player_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "e2fbaa3b-83c6-4b23-ada6-4d373384c8a3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/rankLayer_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getLv
}
from
"
../util_PK_Game
"
;
import
Player
from
"
./player_PK_Game
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
RankLayer
extends
cc
.
Component
{
@
property
(
cc
.
Button
)
btn_close
:
cc
.
Button
=
null
;
@
property
(
cc
.
Node
)
rank1Root
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rank2Root
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rank3Root
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
itemTemp
:
cc
.
Node
=
null
;
@
property
(
cc
.
ScrollView
)
sviewt
:
cc
.
ScrollView
=
null
;
@
property
(
cc
.
SpriteFrame
)
iconList
=
[];
private
_data
:
any
;
private
_staticeData
:
any
;
mainCom
:
any
;
onLoad
()
{
this
.
itemTemp
.
active
=
false
;
this
.
btn_close
.
node
.
on
(
"
click
"
,
this
.
onClickClose
,
this
)
}
onClickClose
()
{
cc
.
tween
(
this
.
node
).
to
(
0.3
,
{
y
:
-
cc
.
winSize
.
height
},
{
easing
:
"
sineOut
"
}).
start
();
this
.
mainCom
.
hideRank
();
}
init
(
data
)
{
this
.
_staticeData
=
data
;
}
setMyInfo
(
data
)
{
let
tempData
=
[...
this
.
_staticeData
,
{
score
:
data
.
score
,
name
:
data
.
name
,
isMe
:
true
}]
this
.
_data
=
tempData
.
sort
((
a
,
b
)
=>
{
return
b
.
score
-
a
.
score
;
})
let
rank
=
0
;
for
(
let
i
=
0
;
i
<
this
.
_data
.
length
;
++
i
)
{
if
(
this
.
_data
[
i
].
isMe
)
{
rank
=
i
;
break
;
}
}
return
rank
;
}
show
()
{
this
.
node
.
y
=
-
cc
.
winSize
.
height
;
cc
.
tween
(
this
.
node
).
to
(
0.3
,
{
y
:
0
},
{
easing
:
"
sineIn
"
}).
start
();
this
.
rank1Root
.
getChildByName
(
"
lb_score
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
0
].
score
;
this
.
rank1Root
.
getChildByName
(
"
lb_name
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
0
].
name
;
this
.
rank1Root
.
getChildByName
(
"
head
"
).
getComponent
(
Player
).
init
();
this
.
rank2Root
.
getChildByName
(
"
lb_score
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
1
].
score
;
this
.
rank2Root
.
getChildByName
(
"
lb_name
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
1
].
name
;
this
.
rank2Root
.
getChildByName
(
"
head
"
).
getComponent
(
Player
).
init
();
this
.
rank3Root
.
getChildByName
(
"
lb_score
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
2
].
score
;
this
.
rank3Root
.
getChildByName
(
"
lb_name
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
2
].
name
;
this
.
rank3Root
.
getChildByName
(
"
head
"
).
getComponent
(
Player
).
init
();
this
.
sviewt
.
content
.
removeAllChildren
();
for
(
let
i
=
3
;
i
<
this
.
_data
.
length
;
++
i
)
{
let
cell
=
cc
.
instantiate
(
this
.
itemTemp
);
cell
.
active
=
true
;
cell
.
parent
=
this
.
sviewt
.
content
;
cell
.
getChildByName
(
"
head
"
).
getComponent
(
Player
).
init
();
cell
.
getChildByName
(
"
lb_score
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
i
].
score
;
cell
.
getChildByName
(
"
lb_name
"
).
getComponent
(
cc
.
Label
).
string
=
this
.
_data
[
i
].
name
;
cell
.
getChildByName
(
"
lb_rank
"
).
getComponent
(
cc
.
Label
).
string
=
`
${
i
+
1
}
`
;
cell
.
getChildByName
(
"
icon
"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
iconList
[
getLv
(
this
.
_data
[
i
].
score
)];
}
}
}
assets/PK_Game/script/layers/rankLayer_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "ce59a32a-c4bc-4e12-919f-ee0dc18f0680",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/selectItem_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
SeletctItem
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
right
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
wrong
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
txt
:
cc
.
Label
=
null
;
@
property
(
cc
.
Sprite
)
icon
:
cc
.
Sprite
=
null
;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start
()
{
}
// update (dt) {}
}
assets/PK_Game/script/layers/selectItem_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "a43aa617-a5f3-4fd4-834c-f8b32596d289",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/layers/txiSelectCell_PK_Game.ts
0 → 100644
View file @
2a109b3d
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
TxtCell
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
bg
:
cc
.
Node
=
null
;
@
property
(
cc
.
Color
)
rightColor
:
cc
.
Color
=
null
;
@
property
(
cc
.
Color
)
wrongColr
:
cc
.
Color
=
null
;
@
property
(
cc
.
Label
)
lb_info
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
leftRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rightRoot
:
cc
.
Node
=
null
;
@
property
(
cc
.
SpriteFrame
)
rightSp
:
cc
.
SpriteFrame
=
null
;
@
property
(
cc
.
SpriteFrame
)
wrongSp
:
cc
.
SpriteFrame
=
null
;
isRight
:
any
;
clickCall
:
Function
;
index
:
any
;
onLoad
()
{
this
.
node
.
on
(
"
click
"
,
this
.
onClickItem
,
this
)
}
onClickItem
(
handle
,
side
)
{
let
parent
=
side
==
2
?
this
.
rightRoot
:
this
.
leftRoot
;
if
(
this
.
isRight
)
{
this
.
bg
.
color
=
this
.
rightColor
.
clone
();
let
node
=
new
cc
.
Node
();
node
.
addComponent
(
cc
.
Sprite
);
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
rightSp
;
node
.
parent
=
parent
;
}
else
{
this
.
bg
.
color
=
this
.
wrongColr
.
clone
();
let
node
=
new
cc
.
Node
();
node
.
addComponent
(
cc
.
Sprite
);
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
this
.
wrongSp
;
node
.
parent
=
parent
;
}
if
(
handle
)
{
this
.
clickCall
&&
this
.
clickCall
(
this
.
index
);
}
}
init
(
index
,
info
,
isRight
,
clickCall
:
Function
)
{
this
.
leftRoot
.
removeAllChildren
();
this
.
rightRoot
.
removeAllChildren
();
this
.
bg
.
color
=
cc
.
Color
.
WHITE
.
clone
();
this
.
lb_info
.
string
=
info
;
this
.
isRight
=
isRight
;
this
.
clickCall
=
clickCall
;
this
.
index
=
index
;
}
// update (dt) {}
}
assets/PK_Game/script/layers/txiSelectCell_PK_Game.ts.meta
0 → 100644
View file @
2a109b3d
{
"ver": "1.0.8",
"uuid": "bfb8282f-e21c-4603-8261-3115914f6fb8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/PK_Game/script/util_PK_Game.ts
View file @
2a109b3d
export
enum
gameState
{
}
export
function
getPosByAngle
(
angle
,
len
)
{
const
radian
=
angle
*
Math
.
PI
/
180
;
...
...
@@ -375,3 +385,31 @@ export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1
.
playAnimation
(
animationName
,
time
);
});
}
export
function
getLv
(
num
)
{
if
(
num
<
1000
)
{
return
0
;
}
else
if
(
num
<
5000
)
{
return
1
;
}
else
if
(
num
<
20000
)
{
return
2
;
}
else
{
return
3
;
}
}
export
function
getMinLv
(
num
)
{
if
(
num
<
1000
)
{
return
Math
.
floor
(
num
/
200
);
}
else
if
(
num
<
5000
)
{
return
Math
.
floor
((
num
-
1000
)
/
800
);;
}
else
if
(
num
<
20000
)
{
return
Math
.
floor
((
num
-
5000
)
/
3000
);;
}
else
{
return
Math
.
floor
((
num
-
20000
)
/
6000
);;
}
}
assets/PK_Game/texture/rank/img_jin.png
0 → 100644
View file @
2a109b3d
75.9 KB
assets/PK_Game/texture/rank/img_jin.png.meta
0 → 100644
View file @
2a109b3d
{
"ver": "2.3.5",
"uuid": "7b847b9a-71a2-4501-9c60-2388a53df47a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 583,
"height": 475,
"platformSettings": {},
"subMetas": {
"img_jin": {
"ver": "1.0.4",
"uuid": "671d22ef-f6f6-4159-9319-8415e1c4ef72",
"rawTextureUuid": "7b847b9a-71a2-4501-9c60-2388a53df47a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 0,
"trimY": 1,
"width": 583,
"height": 474,
"rawWidth": 583,
"rawHeight": 475,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
settings/builder.json
0 → 100644
View file @
2a109b3d
{
"title"
:
"PK_Game"
,
"packageName"
:
"org.cocos2d.demo"
,
"startScene"
:
"0737ce42-24f0-45c6-8e1a-8bdab4f74ba3"
,
"excludeScenes"
:
[],
"orientation"
:
{
"landscapeRight"
:
true
,
"landscapeLeft"
:
true
,
"portrait"
:
false
,
"upsideDown"
:
false
},
"webOrientation"
:
"auto"
,
"inlineSpriteFrames"
:
true
,
"inlineSpriteFrames_native"
:
true
,
"mainCompressionType"
:
"default"
,
"mainIsRemote"
:
false
,
"optimizeHotUpdate"
:
false
,
"md5Cache"
:
true
,
"nativeMd5Cache"
:
true
,
"encryptJs"
:
true
,
"xxteaKey"
:
"5d6df4d4-9a15-4f"
,
"zipCompressJs"
:
true
,
"fb-instant-games"
:
{},
"android"
:
{
"packageName"
:
"org.cocos2d.demo"
,
"REMOTE_SERVER_ROOT"
:
""
},
"ios"
:
{
"packageName"
:
"org.cocos2d.demo"
,
"REMOTE_SERVER_ROOT"
:
""
,
"ios_enable_jit"
:
true
},
"mac"
:
{
"packageName"
:
"org.cocos2d.demo"
,
"REMOTE_SERVER_ROOT"
:
""
,
"width"
:
1280
,
"height"
:
720
},
"win32"
:
{
"REMOTE_SERVER_ROOT"
:
""
,
"width"
:
1280
,
"height"
:
720
},
"android-instant"
:
{
"packageName"
:
"org.cocos2d.demo"
,
"REMOTE_SERVER_ROOT"
:
""
,
"pathPattern"
:
""
,
"scheme"
:
"https"
,
"host"
:
""
,
"skipRecord"
:
false
,
"recordPath"
:
""
},
"appBundle"
:
false
,
"agreements"
:
{}
}
settings/project.json
View file @
2a109b3d
...
...
@@ -11,10 +11,10 @@
"3D Physics/Builtin"
],
"preview-port"
:
7456
,
"design-resolution-width"
:
64
0
,
"design-resolution-height"
:
960
,
"design-resolution-width"
:
108
0
,
"design-resolution-height"
:
1
960
,
"fit-width"
:
true
,
"fit-height"
:
fals
e
,
"fit-height"
:
tru
e
,
"use-project-simulator-setting"
:
false
,
"simulator-orientation"
:
false
,
"use-customize-simulator"
:
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