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
f0cb48df
Commit
f0cb48df
authored
Mar 26, 2020
by
13732208043
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采茶叶
parent
a699f487
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
25 deletions
+45
-25
pick-tea.json
dist/customs/pick-tea.json
+2
-2
app.js
src/custom/pick-tea/debug/app.js
+0
-16
main.js
src/custom/pick-tea/debug/main.js
+11
-2
main.js.map
src/custom/pick-tea/debug/main.js.map
+1
-1
meta.json
src/custom/pick-tea/meta.json
+1
-1
GameView.ts
src/custom/pick-tea/src/game/GameView.ts
+30
-3
No files found.
dist/customs/pick-tea.json
View file @
f0cb48df
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/debug/app.js
View file @
f0cb48df
/**
* Created by renjianfeng on 2020-03-13.
*/
/*
event-pickTeaGame-init //游戏初始化
event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画
event-getBasket-Type //获得篮子类型 设置篮子类型 纸篮子 布篮子 竹篮子 木篮子 0 1 2 3
event-hand-grasp //手抓去点击
//event-wait-uplevel //待升级
event-add-oneScore //+1
event-pick-tea //采茶叶
event-tea-skyup //茶叶向上飞
event-setchange-TeaNum
event-setBasket-Type //设置篮子类型
*/
const
customId
=
'pick-tea'
;
...
...
src/custom/pick-tea/debug/main.js
View file @
f0cb48df
...
...
@@ -281,6 +281,10 @@
};
GameView
.
prototype
.
setTeaNum
=
function
(
TeaNums
)
{
var
_this
=
this
;
if
(
this
.
schedule
)
{
console
.
log
(
'清理定时器,重新设置同步'
);
clearInterval
(
this
.
schedule
);
}
var
totalNum
=
200
;
var
nowNum
=
10
;
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
...
...
@@ -288,6 +292,9 @@
var
chaju
=
nowNum
-
totalNum
;
console
.
log
(
'chaju'
,
chaju
);
var
width
=
this
.
progressbarImg
.
width
;
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
);
var
x
=
-
width
*
(
1
-
nowNum
/
totalNum
);
console
.
log
(
'x'
,
x
);
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
));
...
...
@@ -302,10 +309,10 @@
.
to
({
rotation
:
360
},
speed
).
call
(
function
()
{
_this
.
teaHalfFlagImg
.
rotation
=
0
;
});
var
schedule
=
setInterval
(
function
()
{
this
.
schedule
=
setInterval
(
function
()
{
if
(
nowNum
==
totalNum
)
{
console
.
log
(
'达到最大长度'
);
clearInterval
(
schedule
);
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
pauseTweens
(
teaFullRotation
);
_this
.
progressbarImg
.
x
=
0
;
_this
.
teaHalfFlagImg
.
visible
=
false
;
...
...
@@ -318,6 +325,8 @@
}
_this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
);
},
speed
);
};
GameView
.
prototype
.
getTeaPercentage
=
function
(
nowNum
,
totalNum
)
{
...
...
src/custom/pick-tea/debug/main.js.map
View file @
f0cb48df
This diff is collapsed.
Click to expand it.
src/custom/pick-tea/meta.json
View file @
f0cb48df
...
...
@@ -10,7 +10,7 @@
"verses"
:
{
"alias"
:
"诗句"
,
"type"
:
"array<string>"
,
"default"
:
"今朝有酒今朝醉,今宵更有湘江月,雨过林霏清石气,秋将山翠入诗心,生怕芳丛鹰嘴芽,老郎封寄谪仙家"
"default"
:
"今朝有酒今朝醉,今宵更有湘江月
,找出霏霏满碗花
,雨过林霏清石气,秋将山翠入诗心,生怕芳丛鹰嘴芽,老郎封寄谪仙家"
},
"verseLabel"
:
{
"alias"
:
"提示语框xys"
,
...
...
src/custom/pick-tea/src/game/GameView.ts
View file @
f0cb48df
...
...
@@ -81,6 +81,7 @@ export default class GameView extends engine.Container {
//当前速度
private
speed
:
number
private
schedule
:
any
// 当前场景上面的物品
private
goodsItems
=
[]
...
...
@@ -171,8 +172,11 @@ export default class GameView extends engine.Container {
this
.
initView
();
this
.
setPickTeaLevel
(
1
)
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
})
setInterval
(()
=>
{
this
.
handGrasp
();
//this.setTeaNum({ totalNum: 430, nowNum: 120 })
},
5000
)
...
...
@@ -301,6 +305,10 @@ export default class GameView extends engine.Container {
/*采茶叶活动*/
//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶
setTeaNum
(
TeaNums
)
{
if
(
this
.
schedule
)
{
console
.
log
(
'清理定时器,重新设置同步'
)
clearInterval
(
this
.
schedule
);
}
let
totalNum
=
200
//TeaNums.totalNum;
let
nowNum
=
10
//TeaNums.nowNum;
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
...
...
@@ -308,6 +316,17 @@ export default class GameView extends engine.Container {
let
chaju
=
nowNum
-
totalNum
;
console
.
log
(
'chaju'
,
chaju
);
let
width
=
this
.
progressbarImg
.
width
;
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
,
nowData
)
/**/
//设置数据校正
let
serverData
=
0
;
let
dataDiff
=
0
;
/**/
//let rate = (443 - width * (1 - nowNum / totalNum))
//已经走得
let
x
=
-
width
*
(
1
-
nowNum
/
totalNum
)
...
...
@@ -327,10 +346,10 @@ export default class GameView extends engine.Container {
.
to
({
rotation
:
360
},
speed
).
call
(()
=>
{
this
.
teaHalfFlagImg
.
rotation
=
0
;
})
let
schedule
=
setInterval
(()
=>
{
this
.
schedule
=
setInterval
(()
=>
{
if
(
nowNum
==
totalNum
)
{
console
.
log
(
'达到最大长度'
);
clearInterval
(
schedule
);
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
pauseTweens
(
teaFullRotation
);
this
.
progressbarImg
.
x
=
0
this
.
teaHalfFlagImg
.
visible
=
false
;
...
...
@@ -343,7 +362,15 @@ export default class GameView extends engine.Container {
}
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
dataDiff
++
;
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)
},
speed
)
}
...
...
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