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
77d6802b
Commit
77d6802b
authored
Mar 27, 2020
by
13732208043
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采茶叶
parent
f0cb48df
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
49 deletions
+88
-49
pick-tea.json
dist/customs/pick-tea.json
+1
-1
main.js
src/custom/pick-tea/debug/main.js
+38
-17
main.js.map
src/custom/pick-tea/debug/main.js.map
+1
-1
GameView.ts
src/custom/pick-tea/src/game/GameView.ts
+48
-30
No files found.
dist/customs/pick-tea.json
View file @
77d6802b
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/debug/main.js
View file @
77d6802b
...
...
@@ -170,15 +170,21 @@
this
.
pickTeaCount
=
new
engine
.
Label
();
this
.
progressbarBgImg
.
addChild
(
this
.
pickTeaCount
);
this
.
addChild
(
this
.
progressbarBgImg
);
this
.
initView
();
this
.
setPickTeaLevel
(
1
);
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
});
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
,
serverData
:
nowData
});
this
.
initChildrenPos
();
setInterval
(
function
()
{
_this
.
handGrasp
();
},
5000
);
};
GameView
.
prototype
.
reset
=
function
()
{
var
_this
=
this
;
console
.
log
(
'111111111reset1'
);
this
.
initView
();
setTimeout
(
function
()
{
return
_this
.
setPickTeaLevel
(
1
);
},
500
);
};
GameView
.
prototype
.
start
=
function
()
{
};
...
...
@@ -193,12 +199,6 @@
this
.
start
();
};
GameView
.
prototype
.
initView
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
basketSvgaGroup
.
length
;
i
++
)
{
this
.
basketSvgaGroup
[
i
].
visible
=
false
;
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
}
this
.
pickTeaBg
.
mouseEnabled
=
false
;
this
.
teaHalfImg
.
visible
=
false
;
this
.
pickTeaSvga
.
visible
=
false
;
...
...
@@ -207,6 +207,12 @@
this
.
initChildrenPos
();
};
GameView
.
prototype
.
initChildrenPos
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
basketSvgaGroup
.
length
;
i
++
)
{
this
.
basketSvgaGroup
[
i
].
visible
=
false
;
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
}
this
.
verseImg
.
x
=
props
.
versePos
[
0
];
this
.
verseImg
.
y
=
props
.
versePos
[
1
];
this
.
addOneSvga
.
x
=
props
.
addOneSvgaPos
[
0
];
...
...
@@ -248,6 +254,7 @@
this
.
verseLabel
.
y
=
15
;
this
.
verseLabel
[
'textHeight'
]
=
14
;
this
.
verseLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
this
.
verseImg
.
visible
=
false
;
this
.
verseImg
.
addChild
(
this
.
verseLabel
);
};
GameView
.
prototype
.
showVerse
=
function
()
{
...
...
@@ -285,21 +292,24 @@
console
.
log
(
'清理定时器,重新设置同步'
);
clearInterval
(
this
.
schedule
);
}
var
totalNum
=
200
;
var
nowNum
=
10
;
var
totalNum
=
TeaNums
.
totalNum
;
var
nowNum
=
TeaNums
.
nowNum
;
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
var
chaju
=
nowNum
-
totalNum
;
console
.
log
(
'
chaju'
,
chaju
);
var
surplus
=
nowNum
-
totalNum
;
console
.
log
(
'
surplus'
,
surplus
);
var
width
=
this
.
progressbarImg
.
width
;
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
);
var
serverData
=
TeaNums
.
serverData
;
var
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
/
1000
));
console
.
log
(
'fbdvalue'
,
fbdvalue
);
var
dataDiff
=
0
;
var
x
=
-
width
*
(
1
-
nowNum
/
totalNum
);
console
.
log
(
'x'
,
x
);
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
));
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
);
var
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
chaju
;
var
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
surplus
;
console
.
log
(
'进图条每秒比例原始step'
,
step
);
step
=
parseFloat
(
step
.
toFixed
(
3
));
console
.
log
(
'进图条每秒比例step'
,
step
);
...
...
@@ -325,8 +335,19 @@
}
_this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
dataDiff
++
;
myDate
=
new
Date
();
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
);
console
.
log
(
'nowData'
);
console
.
log
(
nowData
);
console
.
log
(
'nowData - serverData) / 1000 - dataDiff'
,
(
nowData
-
serverData
)
/
1000
-
(
fbdvalue
+
dataDiff
));
if
(
Math
.
abs
((
nowData
-
serverData
)
/
1000
)
-
dataDiff
>
(
fbdvalue
+
3
))
{
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
pauseTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
return
;
}
console
.
log
(
'this.progressbarImg.x'
,
_this
.
progressbarImg
.
x
);
},
speed
);
};
GameView
.
prototype
.
getTeaPercentage
=
function
(
nowNum
,
totalNum
)
{
...
...
@@ -387,7 +408,7 @@
console
.
log
(
_this
.
teaHalfImg
);
pickTeaSVGA
.
addChildAt
(
_this
.
teaHalfImg
,
10
);
pickTeaSVGA
.
gotoAndPlay
(
1
,
true
);
},
5
00
);
},
3
00
);
};
GameView
.
prototype
.
handGrasp
=
function
()
{
console
.
log
(
'handGrasp'
);
...
...
src/custom/pick-tea/debug/main.js.map
View file @
77d6802b
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/src/game/GameView.ts
View file @
77d6802b
...
...
@@ -169,10 +169,13 @@ export default class GameView extends engine.Container {
this
.
addChild
(
this
.
progressbarBgImg
);
this
.
initView
();
this
.
setPickTeaLevel
(
1
)
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
})
// this.initView();
// this.setPickTeaLevel(1)
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
,
serverData
:
nowData
})
this
.
initChildrenPos
();
setInterval
(()
=>
{
this
.
handGrasp
();
...
...
@@ -183,7 +186,11 @@ export default class GameView extends engine.Container {
}
reset
()
{
console
.
log
(
'111111111reset1'
)
//this.initView()
this
.
initView
()
setTimeout
(()
=>
this
.
setPickTeaLevel
(
1
)
,
500
)
}
start
()
{
...
...
@@ -201,12 +208,12 @@ export default class GameView extends engine.Container {
}
initView
()
{
for
(
let
i
=
0
;
i
<
this
.
basketSvgaGroup
.
length
;
i
++
)
{
this
.
basketSvgaGroup
[
i
].
visible
=
false
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];;
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
}
//
for (let i = 0; i < this.basketSvgaGroup.length; i++) {
//
this.basketSvgaGroup[i].visible = false
//
this.basketSvgaGroup[i].x = props.basketSvgaPos[0];
//
this.basketSvgaGroup[i].y = props.basketSvgaPos[1];;
//
this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);
//
}
this
.
pickTeaBg
.
mouseEnabled
=
false
;
this
.
teaHalfImg
.
visible
=
false
;
//this.teaHalfImg.source = '';
...
...
@@ -216,10 +223,14 @@ export default class GameView extends engine.Container {
this
.
initChildrenPos
()
}
initChildrenPos
()
{
for
(
let
i
=
0
;
i
<
this
.
basketSvgaGroup
.
length
;
i
++
)
{
this
.
basketSvgaGroup
[
i
].
visible
=
false
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];;
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
}
this
.
verseImg
.
x
=
props
.
versePos
[
0
]
this
.
verseImg
.
y
=
props
.
versePos
[
1
]
this
.
addOneSvga
.
x
=
props
.
addOneSvgaPos
[
0
]
this
.
addOneSvga
.
y
=
props
.
addOneSvgaPos
[
1
];
this
.
pickTeaSvga
.
x
=
props
.
pickTeaSvgaPos
[
0
];
...
...
@@ -273,7 +284,7 @@ export default class GameView extends engine.Container {
this
.
verseLabel
.
y
=
15
;
this
.
verseLabel
[
'textHeight'
]
=
14
;
this
.
verseLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
this
.
verseImg
.
visible
=
false
;
this
.
verseImg
.
addChild
(
this
.
verseLabel
);
// label.x = (width - label.width) / 2;
...
...
@@ -309,22 +320,25 @@ export default class GameView extends engine.Container {
console
.
log
(
'清理定时器,重新设置同步'
)
clearInterval
(
this
.
schedule
);
}
let
totalNum
=
200
//TeaNums.totalNum;
let
nowNum
=
10
//TeaNums.nowNum;
let
totalNum
=
TeaNums
.
totalNum
;
let
nowNum
=
TeaNums
.
nowNum
;
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
let
chaju
=
nowNum
-
totalNum
;
console
.
log
(
'
chaju'
,
chaju
);
let
surplus
=
nowNum
-
totalNum
;
console
.
log
(
'
surplus'
,
surplus
);
let
width
=
this
.
progressbarImg
.
width
;
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
)
let
serverData
=
TeaNums
.
serverData
;
//前后端本身的差值
let
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
/
1000
))
console
.
log
(
'fbdvalue'
,
fbdvalue
)
/**/
//设置数据校正
let
serverData
=
0
;
//
let serverData = 0;
let
dataDiff
=
0
;
/**/
//let rate = (443 - width * (1 - nowNum / totalNum))
...
...
@@ -333,7 +347,7 @@ export default class GameView extends engine.Container {
console
.
log
(
'x'
,
x
);
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
));
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
let
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
chaju
let
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
surplus
console
.
log
(
'进图条每秒比例原始step'
,
step
)
step
=
parseFloat
(
step
.
toFixed
(
3
));
...
...
@@ -363,15 +377,19 @@ export default class GameView extends engine.Container {
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
dataDiff
++
;
myDate
=
new
Date
();
nowData
=
myDate
.
getTime
();
// if ((nowData - serverData) / 1000 - dataDiff > 3) {
// clearInterval(this.schedule);
// engine.Tween.pauseTweens(teaFullRotation);
// engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
// return;
// }
console
.
log
(
'nowData'
,
nowData
)
//console.log('this.progressbarImg.x', this.progressbarImg.x)
console
.
log
(
'nowData'
)
console
.
log
(
nowData
)
console
.
log
(
'nowData - serverData) / 1000 - dataDiff'
,
(
nowData
-
serverData
)
/
1000
-
(
fbdvalue
+
dataDiff
))
if
(
Math
.
abs
((
nowData
-
serverData
)
/
1000
)
-
dataDiff
>
(
fbdvalue
+
3
))
{
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
pauseTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
return
;
}
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
},
speed
)
}
getTeaPercentage
(
nowNum
,
totalNum
)
{
...
...
@@ -442,7 +460,7 @@ export default class GameView extends engine.Container {
console
.
log
(
this
.
teaHalfImg
);
pickTeaSVGA
.
addChildAt
(
this
.
teaHalfImg
,
10
)
pickTeaSVGA
.
gotoAndPlay
(
1
,
true
);
},
5
00
)
},
3
00
)
}
handGrasp
()
{
console
.
log
(
'handGrasp'
)
...
...
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