Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tb_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
钱根
tb_project
Commits
8cb78db7
Commit
8cb78db7
authored
Sep 05, 2021
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0905
parent
e9a9bef4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
3809 deletions
+77
-3809
package.json
package.json
+1
-1
ResJson.ts
src/ResJson.ts
+17
-3778
GameOverPanel.ts
src/panels/GameOverPanel.ts
+17
-0
PrizeShowPanel.ts
src/panels/PrizeShowPanel.ts
+4
-4
GameOverScene.ts
src/scenes/GameOverScene/GameOverScene.ts
+20
-16
DeviceMotion.ts
src/scenes/GameScene/DeviceMotion.ts
+1
-1
GameScene.ts
src/scenes/GameScene/GameScene.ts
+17
-9
No files found.
package.json
View file @
8cb78db7
...
...
@@ -38,7 +38,7 @@
"upload"
:
"node scripts/upload"
,
"build"
:
"npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS"
,
"watch"
:
"webpack --watch"
,
"dev"
:
"node scripts/devServer -p
8099
"
,
"dev"
:
"node scripts/devServer -p
9011
"
,
"dev1"
:
"webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0"
,
"buildTS"
:
"webpack --config webpack.prod.js && node scripts/mergeJs"
,
"copyJs"
:
"node scripts/copyJs"
,
...
...
src/ResJson.ts
View file @
8cb78db7
This diff is collapsed.
Click to expand it.
src/panels/GameOverPanel.ts
View file @
8cb78db7
...
...
@@ -120,6 +120,15 @@ export class GameOverPanel extends Panel {
this
.
drawBtn
.
startAniRange
(
110
,
this
.
drawBtn
.
totalFrames
,
1
)
await
sleep
(
2000
)
if
(
!
this
.
data
.
isWinPrize
)
{
this
.
hidePanel
()
// @ts-ignore
my
&&
my
.
showToast
({
content
:
'很遗憾,您未中奖'
})
changeScene
(
GameOverScene
,
this
.
data
)
return
}
const
{
data
,
success
}
=
await
sendTbNet
(
TbNetName
.
drawLotteryPrize
,
{
id
:
Tools
.
globalData
.
startId
})
...
...
@@ -138,6 +147,14 @@ export class GameOverPanel extends Panel {
})
changeScene
(
GameOverScene
,
this
.
data
)
}
}
else
{
// 默认错误就 很遗憾吧
this
.
hidePanel
()
// @ts-ignore
my
&&
my
.
showToast
({
content
:
'很遗憾,您未中奖'
})
changeScene
(
GameOverScene
,
this
.
data
)
}
},
1
),
this
)
}
...
...
src/panels/PrizeShowPanel.ts
View file @
8cb78db7
...
...
@@ -24,10 +24,10 @@ export class PrizeShowPanel extends Panel {
preview
.
width
=
300
preview
.
height
=
300
preview
.
position
.
set
(
150
,
236
)
//
preview.mask = panelCtn.addChild(new FYGE.Graphics())
//
.beginFill()
//
.drawRoundedRect(150, 236, 300, 300, 20)
//
.endFill()
preview
.
mask
=
panelCtn
.
addChild
(
new
FYGE
.
Graphics
())
.
beginFill
()
.
drawRoundedRect
(
150
,
236
,
300
,
300
,
20
)
.
endFill
()
UI
.
Btn
(
panelCtn
,
'confirm-btn.png'
,
function
()
{
this
.
btnDelay
(
this
)
...
...
src/scenes/GameOverScene/GameOverScene.ts
View file @
8cb78db7
...
...
@@ -78,22 +78,26 @@ export class GameOverScene extends Scene {
},
this
)
_s
.
anchorTexture
.
set
(
0.5
,
0.5
)
var
bottomCont
=
UI
.
Ctn
(
this
)
bottomCont
.
position
.
set
(
0
,
layers
.
stageOffsetY
+
layers
.
stageHeight
-
130
+
layers
.
stageOffsetY
-
90
)
var
isJordan
=
Tools
.
globalData
.
shopId
==
10003
UI
.
Rect
(
bottomCont
,
layers
.
stageWidth
,
130
,
0xffffff
)
UI
.
Sp
(
bottomCont
,
'product-link__icon.png'
,
50
,
25
)
UI
.
Txt
(
bottomCont
,
`
${
isJordan
?
'Jordan女子商品'
:
'Nike瑜伽商品'
}
`
,
24
,
'#111111'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
500
,
160
,
40
,
true
)
UI
.
Txt
(
bottomCont
,
`
${
isJordan
?
'让你充满活力和灵感'
:
'让你的体态更加健康'
}
`
,
22
,
'#111111'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
500
,
160
,
70
,
true
)
UI
.
Sp
(
bottomCont
,
'jump-icon.png'
,
600
,
40
)
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
function
()
{
this
.
btnDelay
(
this
)
addData
(
7
)
// @ts-ignore
sendTbNet
(
TbNetName
.
navigateToOutside
,
{
url
:
this
.
data
.
productLink
})
},
this
)
if
(
this
.
data
.
productLink
)
{
var
bottomCont
=
UI
.
Ctn
(
this
)
bottomCont
.
position
.
set
(
0
,
layers
.
stageOffsetY
+
layers
.
stageHeight
-
130
+
layers
.
stageOffsetY
-
90
)
var
isJordan
=
Tools
.
globalData
.
shopId
==
10003
UI
.
Rect
(
bottomCont
,
layers
.
stageWidth
,
130
,
0xffffff
)
UI
.
Sp
(
bottomCont
,
'product-link__icon.png'
,
50
,
25
)
UI
.
Txt
(
bottomCont
,
`
${
isJordan
?
'Jordan女子商品'
:
'Nike瑜伽商品'
}
`
,
24
,
'#111111'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
500
,
160
,
40
,
true
)
UI
.
Txt
(
bottomCont
,
`
${
isJordan
?
'让你充满活力和灵感'
:
'让你的体态更加健康'
}
`
,
22
,
'#111111'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
500
,
160
,
70
,
true
)
UI
.
Sp
(
bottomCont
,
'jump-icon.png'
,
600
,
40
)
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
function
()
{
this
.
btnDelay
(
this
)
addData
(
7
)
// @ts-ignore
sendTbNet
(
TbNetName
.
navigateToOutside
,
{
url
:
this
.
data
.
productLink
})
},
this
)
}
}
showNumberUp
()
{
...
...
src/scenes/GameScene/DeviceMotion.ts
View file @
8cb78db7
...
...
@@ -36,6 +36,7 @@ class DeviceMotion {
if
(
my
)
{
const
{
platform
}
=
await
getSystemInfo
()
this
.
platform
=
platform
.
toLowerCase
()
this
.
_tmdremoveEvents
()
//@ts-ignore
my
.
onDeviceMotionChange
((
res
)
=>
{
// 通过 platform 进行判断当前是 弧度制还是 角度值
...
...
@@ -73,7 +74,6 @@ class DeviceMotion {
}
destory
()
{
this
.
_tmdremoveEvents
()
this
.
subs
=
[]
DeviceMotion
.
_instance
=
null
}
...
...
src/scenes/GameScene/GameScene.ts
View file @
8cb78db7
...
...
@@ -102,10 +102,11 @@ class RandomArray {
}
getRandomValue
()
{
if
(
this
.
len
==
0
)
{
this
.
arr
=
this
.
iarr
if
(
!
this
.
arr
.
length
)
{
this
.
arr
=
[...
this
.
iarr
]
}
var
i
=
Math
.
floor
(
Math
.
random
()
*
this
.
len
)
var
len
=
this
.
arr
.
length
var
i
=
Math
.
floor
(
Math
.
random
()
*
len
)
var
value
=
this
.
arr
[
i
]
this
.
arr
.
splice
(
i
,
1
)
return
value
...
...
@@ -214,8 +215,8 @@ export class GameScene extends MotionInitScene {
async
onSubmit
(
params
)
{
const
{
data
,
success
,
message
}
=
await
sendTbNet
(
TbNetName
.
submitGame
,
params
)
if
(
success
)
{
const
{
score
,
isNewRecord
,
productLink
,
isWinPrize
,}
=
data
if
(
isWinPrize
)
{
const
{
score
,
isNewRecord
,
productLink
,
isWinPrize
,
level
}
=
data
if
(
level
!=
0
)
{
//@ts-ignore
my
&&
my
.
vibrateShort
()
...
...
@@ -225,10 +226,17 @@ export class GameScene extends MotionInitScene {
}
}
else
{
//@ts-ignore
my
&&
my
.
showToast
({
content
:
message
});
sendTbNet
(
TbNetName
.
navigateBack
)
var
fakeData
=
{
score
:
this
.
score
,
level
:
[
10
,
20
,
30
].
findIndex
(
i
=>
this
.
score
>=
i
),
fake
:
true
,
isWinPrize
:
false
}
if
(
fakeData
.
level
!=
-
1
)
{
showPanel
(
GameOverPanel
,
fakeData
)
return
}
changeScene
(
GameOverScene
,
fakeData
)
}
}
...
...
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