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
8df614f3
Commit
8df614f3
authored
Jun 15, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1c89e887
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
149 additions
and
924 deletions
+149
-924
recycling.json
dist/customs/recycling.json
+13
-1
app.js
src/custom/recycling/debug/app.js
+5
-5
main.js
src/custom/recycling/debug/main.js
+1
-912
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
meta.json
src/custom/recycling/meta.json
+12
-0
Conveyors.ts
src/custom/recycling/src/game/Conveyors.ts
+6
-3
GameView.ts
src/custom/recycling/src/game/GameView.ts
+10
-1
transStores.ts
src/custom/recycling/src/game/datas/transStores.ts
+1
-1
RightTips.ts
src/custom/recycling/src/game/views/RightTips.ts
+45
-0
WrongTips.ts
src/custom/recycling/src/game/views/WrongTips.ts
+55
-0
No files found.
dist/customs/recycling.json
View file @
8df614f3
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/app.js
View file @
8df614f3
...
...
@@ -46,16 +46,16 @@ function launchWithCustomModule(customModule) {
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
,
maxScore
:
2
});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
00
,
maxScore
:
22
2
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
200
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
8
,
maxScore
:
2
});
//
setTimeout(() => {
//
engine.globalEvent.dispatchEvent('recycling-start', { time: 8, maxScore: 2 });
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
1000
*
10
);
//
const d = engine.gameStage.sceneContainer.getChildAt(0);
//
}, 1000 * 10);
});
engine
.
globalEvent
.
addEventListener
(
'recycling-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
...
...
src/custom/recycling/debug/main.js
View file @
8df614f3
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/main.js.map
View file @
8df614f3
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/custom/recycling/meta.json
View file @
8df614f3
...
...
@@ -20,6 +20,18 @@
"uuid"
:
"1e7dd156-b59a-491d-8154-af2ecf425a8b"
,
"ext"
:
".jpg"
},
{
"name"
:
"wrongTips"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/875c53d7034aaca6a532c78122f79c9f98f132c1.png"
,
"uuid"
:
"bc35abf4-2541-4751-9122-e8e185c52e45"
,
"ext"
:
".png"
},
{
"name"
:
"rightTips"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/61a6c5a09466497ab999a4a504606ce9f923be6b.png"
,
"uuid"
:
"388ed033-852a-496c-bed8-d941243ea531"
,
"ext"
:
".png"
},
{
"name"
:
"idlerWheel"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png"
,
...
...
src/custom/recycling/src/game/Conveyors.ts
View file @
8df614f3
...
...
@@ -9,6 +9,7 @@ import checkHit from "./utils/checkHit";
import
removeChild
from
"./utils/removeChild"
;
import
removeEle
from
"./utils/removeEle"
;
import
shuffle
from
"./utils/shuffle"
;
import
{
getTargetRect
}
from
"./views/WrongTips"
;
export
default
class
Conveyors
extends
engine
.
Sprite
{
...
...
@@ -250,14 +251,14 @@ export default class Conveyors extends engine.Sprite {
}
onStageMouseMove
(
e
:
engine
.
MouseEvent
)
{
console
.
log
(
'onStageMouseMove'
)
//
console.log('onStageMouseMove')
const
view
=
this
.
_currentDragView
;
view
.
x
=
e
.
stageX
-
view
.
texture
.
width
/
2
;
view
.
y
=
e
.
stageY
-
view
.
texture
.
height
/
2
;
}
onStageMouseUp
(
e
:
engine
.
MouseEvent
)
{
console
.
log
(
'onStageMouseUp'
)
//
console.log('onStageMouseUp')
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
)
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
if
(
!
this
.
_currentDragView
)
return
;
...
...
@@ -265,8 +266,10 @@ export default class Conveyors extends engine.Sprite {
if
(
result
)
{
//落入
if
(
result
==
this
.
_currentDragView
[
'type'
])
{
//匹配
this
.
addscore
();
this
.
wrapper
.
rightTips
.
play
(
getTargetRect
(
result
,
this
.
wrapper
));
}
else
{
//不匹配
engine
.
Tween
.
get
(
this
.
_currentTarget
).
to
({
scaleX
:
1
,
scaleY
:
1
},
300
).
call
(()
=>
{
});
this
.
wrapper
.
wrongTips
.
play
(
getTargetRect
(
result
,
this
.
wrapper
));
}
this
.
stores
.
push
({
targetType
:
result
,
itemType
:
this
.
_currentDragView
[
'type'
],
itemName
:
this
.
_currentDragView
[
'name'
]
});
...
...
@@ -283,7 +286,7 @@ export default class Conveyors extends engine.Sprite {
});
}
clear
()
{
clear
()
{
this
.
conveyor0
.
x
=
0
;
this
.
conveyor1
.
x
=
764
;
this
.
conveyorsPool
.
forEach
(
i
=>
{
...
...
src/custom/recycling/src/game/GameView.ts
View file @
8df614f3
...
...
@@ -10,6 +10,8 @@ import uiConfig from "./uiConfig";
import
getGuideInfo
,
{
setGuide
}
from
"./utils/getGuideInfo"
;
import
CountDownGroup
from
"./views/CountDownGroup"
;
import
GuideView
from
"./views/guideView"
;
import
WrongTips
from
"./views/WrongTips"
;
import
RightTips
from
"./views/RightTips"
;
export
default
class
GameView
extends
engine
.
Container
{
private
_timer
;
...
...
@@ -22,6 +24,8 @@ export default class GameView extends engine.Container {
countdown
:
CountDownGroup
;
guide
:
GuideView
;
conveyors
:
Conveyors
;
wrongTips
:
WrongTips
;
rightTips
:
RightTips
;
constructor
()
{
super
();
...
...
@@ -60,7 +64,12 @@ export default class GameView extends engine.Container {
this
.
addChild
(
this
.
countdown
)
this
.
guide
=
new
GuideView
();
this
.
addChild
(
this
.
guide
)
this
.
addChild
(
this
.
guide
);
this
.
wrongTips
=
new
WrongTips
();
this
.
rightTips
=
new
RightTips
()
this
.
addChild
(
this
.
wrongTips
)
this
.
addChild
(
this
.
rightTips
)
}
...
...
src/custom/recycling/src/game/datas/transStores.ts
View file @
8df614f3
...
...
@@ -71,7 +71,7 @@ const getTargetName = (type: GarbageTypes) => {
break
;
case
GarbageTypes
.
dryWaste
:
return
'
干
垃圾'
return
'
其他
垃圾'
break
;
default
:
...
...
src/custom/recycling/src/game/views/RightTips.ts
0 → 100644
View file @
8df614f3
import
{
getTextureByName
}
from
"../utils"
;
import
{
props
}
from
"../../props"
;
export
default
class
RightTips
extends
engine
.
Sprite
{
img
:
engine
.
Image
;
txt
:
engine
.
TextField
;
private
SCORE
=
props
.
onceScore
||
2
;
constructor
()
{
super
();
this
.
img
=
new
engine
.
Image
();
this
.
img
.
texture
=
getTextureByName
(
'rightTips'
)
this
.
addChild
(
this
.
img
);
this
.
img
.
anchorX
=
88
/
2
;
this
.
img
.
anchorY
=
85
/
2
;
this
.
visible
=
false
;
this
.
txt
=
new
engine
.
TextField
();
this
.
addChild
(
this
.
txt
)
this
.
txt
.
text
=
'+'
+
this
.
SCORE
this
.
txt
.
size
=
60
;
this
.
txt
.
fillColor
=
'#437726'
// this.txt.bold = true
engine
.
playSound
}
play
(
rect
:
engine
.
Rectangle
)
{
this
.
visible
=
true
;
this
.
txt
.
x
=
100
;
engine
.
Tween
.
get
(
this
.
txt
).
set
({
y
:
60
,
alpha
:
1
})
.
to
({
y
:
-
50
},
500
)
.
to
({
alpha
:
0
})
const
DUR
=
70
;
engine
.
Tween
.
get
(
this
.
img
).
set
({
x
:
0
,
y
:
0
,
scaleX
:
0
,
scaleY
:
0
,
alpha
:
1
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
200
,
engine
.
Ease
.
getBackOut
(
1
))
.
wait
(
200
)
.
to
({
alpha
:
0
},
300
)
this
.
x
=
rect
.
x
+
180
;
this
.
y
=
rect
.
y
;
}
}
\ No newline at end of file
src/custom/recycling/src/game/views/WrongTips.ts
0 → 100644
View file @
8df614f3
import
{
getTextureByName
}
from
"../utils"
;
import
{
GarbageTypes
}
from
"../datas/GarbageTypes"
;
import
GameView
from
"../GameView"
;
export
default
class
WrongTips
extends
engine
.
Sprite
{
img
:
engine
.
Image
;
constructor
()
{
super
();
this
.
img
=
new
engine
.
Image
();
this
.
img
.
texture
=
getTextureByName
(
'wrongTips'
)
//wrongTips
this
.
addChild
(
this
.
img
);
this
.
img
.
anchorX
=
88
/
2
;
this
.
img
.
anchorY
=
85
/
2
;
this
.
visible
=
false
;
}
play
(
rect
:
engine
.
Rectangle
)
{
this
.
visible
=
true
;
const
dur
=
70
;
const
stren
=
20
;
engine
.
Tween
.
get
(
this
.
img
).
set
({
x
:
0
,
y
:
0
,
scaleX
:
1
,
scaleY
:
1
,
alpha
:
1
})
.
to
({
x
:
stren
},
dur
)
.
to
({
x
:
0
},
dur
)
.
to
({
x
:
-
stren
},
dur
)
.
to
({
x
:
0
},
dur
)
.
wait
(
200
)
.
to
({
alpha
:
0
},
300
)
this
.
x
=
rect
.
x
+
180
;
this
.
y
=
rect
.
y
;
}
}
export
const
getTargetRect
=
(
targetType
,
gameview
:
GameView
)
=>
{
switch
(
targetType
)
{
case
GarbageTypes
.
dryWaste
:
return
gameview
.
dryWaste
break
;
case
GarbageTypes
.
wetWaste
:
return
gameview
.
wetWaste
break
;
case
GarbageTypes
.
harmfulWaste
:
return
gameview
.
harmfulWaste
break
;
case
GarbageTypes
.
recoverableWaste
:
return
gameview
.
recoverableWaste
break
;
default
:
break
;
}
}
\ No newline at end of file
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