Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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
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
劳工
zeroing-libs
Commits
3d35f1ef
Commit
3d35f1ef
authored
Mar 27, 2020
by
13732208043
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
茶叶更新
parent
57aa8bf6
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
27 deletions
+17
-27
pick-tea.json
dist/customs/pick-tea.json
+1
-1
main.js
src/custom/pick-tea/debug/main.js
+2
-12
main.js.map
src/custom/pick-tea/debug/main.js.map
+1
-1
GameView.ts
src/custom/pick-tea/src/game/GameView.ts
+13
-13
No files found.
dist/customs/pick-tea.json
View file @
3d35f1ef
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/debug/main.js
View file @
3d35f1ef
...
...
@@ -194,7 +194,6 @@
var
nowNum
=
TeaNums
.
nowNum
+
1
;
var
surplus
=
nowNum
-
totalNum
;
if
(
surplus
==
0
)
{
console
.
log
(
'达到最大长度'
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
;
this
.
teaHalfFlagImg
.
visible
=
false
;
this
.
teaFullFlagImg
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
;
...
...
@@ -202,21 +201,17 @@
this
.
addOneSvga
.
stop
();
return
;
}
console
.
log
(
'surplus'
,
surplus
);
var
width
=
this
.
progressbarImg
.
width
;
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
var
serverData
=
TeaNums
.
serverData
;
var
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
));
console
.
log
(
'fbdvalue'
,
fbdvalue
);
var
dataDiff
=
0
;
var
x
=
-
width
*
(
1
-
nowNum
/
totalNum
);
console
.
log
(
'x'
,
x
);
console
.
log
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)));
showLog
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)));
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
))
+
this
.
teaFullFlagImg
.
width
/
2
-
Math
.
abs
(
this
.
teaFullFlagImg
.
x
);
console
.
l
og
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
);
showL
og
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
);
var
step
=
(
this
.
teaFullFlagImg
.
width
/
2
-
this
.
progressbarImg
.
x
)
/
surplus
;
console
.
log
(
'step'
,
step
);
this
.
addOneSvga
.
play
(
1
,
true
);
var
speed
=
props
.
pickTeaSpeed
;
var
teaFullRotation
=
engine
.
Tween
.
get
(
this
.
teaHalfFlagImg
,
{
loop
:
true
})
...
...
@@ -225,7 +220,6 @@
});
this
.
schedule
=
setInterval
(
function
()
{
if
(
nowNum
==
totalNum
)
{
console
.
log
(
'达到最大长度'
);
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
removeTweens
(
teaFullRotation
);
_this
.
progressbarImg
.
x
=
_this
.
teaFullFlagImg
.
width
/
2
;
...
...
@@ -234,7 +228,6 @@
_this
.
addOneSvga
.
visible
=
!
_this
.
teaHalfFlagImg
.
visible
;
_this
.
addOneSvga
.
stop
();
}
console
.
log
(
'nowNum'
,
nowNum
,
'totalNum'
,
totalNum
);
_this
.
getTeaPercentage
(
nowNum
,
totalNum
);
if
(
_this
.
progressbarImg
.
x
<
_this
.
teaFullFlagImg
.
width
/
2
+
step
)
{
_this
.
progressbarImg
.
x
-=
step
;
...
...
@@ -244,8 +237,6 @@
myDate
=
new
Date
();
nowData
=
myDate
.
getTime
();
if
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
>
(
fbdvalue
+
3000
))
{
console
.
log
(
'校准数据前后数据偏差过大'
);
console
.
log
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
-
(
fbdvalue
+
3000
));
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
removeTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
...
...
@@ -265,7 +256,6 @@
if
(
nowNum
<
(
portion
*
2
))
{
teaPercentage
=
1
;
}
console
.
log
(
'teaPercentage'
,
teaPercentage
);
if
(
this
.
nowPercentage
!=
teaPercentage
)
{
this
.
nowPercentage
=
teaPercentage
;
this
.
updateTeaPercentage
(
teaPercentage
);
...
...
src/custom/pick-tea/debug/main.js.map
View file @
3d35f1ef
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/src/game/GameView.ts
View file @
3d35f1ef
...
...
@@ -316,7 +316,7 @@ export default class GameView extends engine.Container {
let
surplus
=
nowNum
-
totalNum
;
if
(
surplus
==
0
)
{
console
.
l
og
(
'达到最大长度'
);
showL
og
(
'达到最大长度'
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
this
.
teaHalfFlagImg
.
visible
=
false
;
this
.
teaFullFlagImg
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
...
...
@@ -324,14 +324,14 @@ export default class GameView extends engine.Container {
this
.
addOneSvga
.
stop
();
return
;
}
console
.
l
og
(
'surplus'
,
surplus
);
showL
og
(
'surplus'
,
surplus
);
let
width
=
this
.
progressbarImg
.
width
;
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
let
serverData
=
TeaNums
.
serverData
;
//前后端本身的差值
let
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
))
console
.
l
og
(
'fbdvalue'
,
fbdvalue
)
showL
og
(
'fbdvalue'
,
fbdvalue
)
/**/
//设置数据校正
// let serverData = 0;
...
...
@@ -340,17 +340,17 @@ export default class GameView extends engine.Container {
//let rate = (443 - width * (1 - nowNum / totalNum))
//已经走得
let
x
=
-
width
*
(
1
-
nowNum
/
totalNum
)
console
.
l
og
(
'x'
,
x
);
console
.
l
og
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)))
showL
og
(
'x'
,
x
);
showL
og
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)))
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
))
+
this
.
teaFullFlagImg
.
width
/
2
-
Math
.
abs
(
this
.
teaFullFlagImg
.
x
)
//)//this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)
console
.
l
og
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
showL
og
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
let
step
=
(
this
.
teaFullFlagImg
.
width
/
2
-
this
.
progressbarImg
.
x
)
/
surplus
console
.
l
og
(
'step'
,
step
)
showL
og
(
'step'
,
step
)
//step = parseFloat(step.toFixed(6));
//
console.l
og('进图条每秒比例step', step)
//
showL
og('进图条每秒比例step', step)
this
.
addOneSvga
.
play
(
1
,
true
);
let
speed
=
props
.
pickTeaSpeed
;
...
...
@@ -361,7 +361,7 @@ export default class GameView extends engine.Container {
})
this
.
schedule
=
setInterval
(()
=>
{
if
(
nowNum
==
totalNum
)
{
console
.
l
og
(
'达到最大长度'
);
showL
og
(
'达到最大长度'
);
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
removeTweens
(
teaFullRotation
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
...
...
@@ -370,7 +370,7 @@ export default class GameView extends engine.Container {
this
.
addOneSvga
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
this
.
addOneSvga
.
stop
();
}
console
.
l
og
(
'nowNum'
,
nowNum
,
'totalNum'
,
totalNum
)
//showL
og('nowNum', nowNum, 'totalNum', totalNum)
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
if
(
this
.
progressbarImg
.
x
<
this
.
teaFullFlagImg
.
width
/
2
+
step
)
{
this
.
progressbarImg
.
x
-=
step
;
...
...
@@ -381,8 +381,8 @@ export default class GameView extends engine.Container {
nowData
=
myDate
.
getTime
();
if
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
>
(
fbdvalue
+
3000
))
{
console
.
l
og
(
'校准数据前后数据偏差过大'
);
console
.
l
og
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
-
(
fbdvalue
+
3000
))
showL
og
(
'校准数据前后数据偏差过大'
);
showL
og
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
-
(
fbdvalue
+
3000
))
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
removeTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
...
...
@@ -402,7 +402,7 @@ export default class GameView extends engine.Container {
if
(
nowNum
<
(
portion
*
2
))
{
teaPercentage
=
1
;
}
console
.
l
og
(
'teaPercentage'
,
teaPercentage
)
showL
og
(
'teaPercentage'
,
teaPercentage
)
if
(
this
.
nowPercentage
!=
teaPercentage
)
{
showLog
(
'状态改变'
)
this
.
nowPercentage
=
teaPercentage
;
...
...
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