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
63f061c8
Commit
63f061c8
authored
Jun 15, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
87951f14
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1718 additions
and
23 deletions
+1718
-23
recycling.json
dist/customs/recycling.json
+301
-1
app.js
src/custom/recycling/debug/app.js
+1
-1
main.js
src/custom/recycling/debug/main.js
+767
-1
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
meta.json
src/custom/recycling/meta.json
+307
-0
Conveyor.ts
src/custom/recycling/src/game/Conveyor.ts
+3
-0
Conveyors.ts
src/custom/recycling/src/game/Conveyors.ts
+230
-0
GameView.ts
src/custom/recycling/src/game/GameView.ts
+13
-19
Garbage.ts
src/custom/recycling/src/game/datas/Garbage.ts
+14
-0
GarbageConfig.ts
src/custom/recycling/src/game/datas/GarbageConfig.ts
+56
-0
GarbageTypes.ts
src/custom/recycling/src/game/datas/GarbageTypes.ts
+6
-0
removeEle.ts
src/custom/recycling/src/game/utils/removeEle.ts
+6
-0
shuffle.ts
src/custom/recycling/src/game/utils/shuffle.ts
+13
-0
No files found.
dist/customs/recycling.json
View file @
63f061c8
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/app.js
View file @
63f061c8
...
@@ -46,7 +46,7 @@ function launchWithCustomModule(customModule) {
...
@@ -46,7 +46,7 @@ function launchWithCustomModule(customModule) {
},
100
);
},
100
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
00
,
speed
:
3
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
200
);
},
200
);
...
...
src/custom/recycling/debug/main.js
View file @
63f061c8
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/main.js.map
View file @
63f061c8
This diff is collapsed.
Click to expand it.
src/custom/recycling/meta.json
View file @
63f061c8
This diff is collapsed.
Click to expand it.
src/custom/recycling/src/game/Conveyor.ts
View file @
63f061c8
...
@@ -9,6 +9,9 @@ export default class Conveyor extends engine.Sprite {
...
@@ -9,6 +9,9 @@ export default class Conveyor extends engine.Sprite {
idx4
:
engine
.
Sprite
;
idx4
:
engine
.
Sprite
;
constructor
()
{
constructor
()
{
super
();
super
();
this
.
y
=
904.21
;
const
sp
=
new
engine
.
Sprite
(
getTextureByName
(
'conveyor'
));
const
sp
=
new
engine
.
Sprite
(
getTextureByName
(
'conveyor'
));
this
.
addChild
(
sp
);
this
.
addChild
(
sp
);
...
...
src/custom/recycling/src/game/Conveyors.ts
0 → 100644
View file @
63f061c8
import
{
props
}
from
"../props"
;
import
Conveyor
from
"./Conveyor"
;
import
Garbage
from
"./datas/Garbage"
;
import
GarbageConfig
from
"./datas/GarbageConfig"
;
import
removeEle
from
"./utils/removeEle"
;
import
shuffle
from
"./utils/shuffle"
;
import
{
getTextureByName
}
from
"./utils"
;
export
default
class
Conveyors
extends
engine
.
Sprite
{
conveyor0
:
Conveyor
;
conveyor1
:
Conveyor
;
private
conveyorsPool
:
any
[]
=
[];
private
GarbageConfig
:
any
[]
=
GarbageConfig
.
config
;
// 本局游戏的20种垃圾
private
currConfigPool
:
any
[]
=
[];
private
currGamePool
:
any
[]
=
[];
score
:
number
;
p
:
any
;
constructor
(
p
)
{
super
();
this
.
p
=
p
;
}
initData
(
conveyor0
,
conveyor1
)
{
this
.
conveyor0
=
conveyor0
;
this
.
conveyor1
=
conveyor1
;
this
.
conveyorsPool
.
push
(
this
.
conveyor0
);
this
.
conveyorsPool
.
push
(
this
.
conveyor1
);
}
private
setDefault
(){
this
.
score
=
0
;
this
.
clear
();
this
.
currConfigPool
=
shuffle
(
this
.
GarbageConfig
);
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
this
.
currConfigPool
[
i
].
idx
=
i
;
this
.
currConfigPool
[
i
].
isRight
=
false
;
this
.
currConfigPool
[
i
].
isMistake
=
false
;
this
.
currConfigPool
[
i
].
isOnStage
=
false
;
this
.
currGamePool
.
push
(
this
.
currConfigPool
[
i
]);
}
let
gamePoolIdx
=
0
;
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
let
g
=
this
.
currGamePool
[
gamePoolIdx
];
gamePoolIdx
+=
1
;
let
garbage
=
new
Garbage
(
getTextureByName
(
g
.
source
));
g
.
isOnStage
=
true
;
garbage
.
type
=
g
.
type
;
garbage
.
name
=
g
.
name
;
garbage
.
anchorX
=
g
.
width
/
2
;
garbage
.
anchorY
=
g
.
height
;
garbage
.
x
=
0
;
garbage
.
y
=
90
;
this
.
conveyor1
[
`idx
${
i
}
`
].
addChild
(
garbage
)
garbage
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDwon_garbage
,
this
);
}
}
startConveyors
()
{
this
.
setDefault
();
engine
.
gameStage
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
}
onEnterFrame
(
ENTER_FRAME
:
string
,
onEnterFrame
:
any
,
arg2
:
this
)
{
if
(
this
.
score
==
100
)
{
this
.
gameOver
();
}
this
.
conveyorsPool
.
forEach
(
conveyor
=>
{
conveyor
.
x
-=
props
.
speed
||
3
;
});
if
(
this
.
conveyorsPool
.
length
>
1
)
{
if
(
this
.
conveyorsPool
[
this
.
conveyorsPool
.
length
-
1
].
x
<=
764
)
{
// 最后一个传送带完全进入屏幕时 往后添加一个传送带
const
conveyor
=
new
Conveyor
();
conveyor
.
x
=
this
.
conveyorsPool
[
this
.
conveyorsPool
.
length
-
1
].
x
+
764
;
this
.
p
.
addChild
(
conveyor
);
this
.
conveyorsPool
.
push
(
conveyor
);
}
else
{
//筛选出currGamePool里还未正确和添加在舞台上的
let
asdasd
=
[]
for
(
var
n
=
0
;
n
<
this
.
currGamePool
.
length
;
n
++
)
{
let
cgg
=
this
.
currGamePool
[
n
];
if
(
!
cgg
.
isRight
&&
!
cgg
.
isOnStage
)
{
asdasd
.
push
(
cgg
);
}
}
//最后一个传送带
let
cc
=
this
.
conveyorsPool
[
this
.
conveyorsPool
.
length
-
1
]
for
(
var
m
=
0
;
m
<
5
;
m
++
)
{
if
(
!
cc
[
`idx
${
m
}
`
].
children
[
0
])
{
let
g
=
asdasd
.
shift
();
if
(
g
)
{
g
.
isOnStage
=
true
;
let
garbage
=
new
Garbage
(
g
.
source
);
garbage
.
type
=
g
.
type
;
garbage
.
name
=
g
.
name
;
garbage
.
anchorX
=
g
.
width
/
2
;
garbage
.
anchorY
=
g
.
height
;
garbage
.
x
=
0
;
garbage
.
y
=
90
;
cc
[
`idx
${
m
}
`
].
addChild
(
garbage
);
garbage
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDwon_garbage
,
this
);
}
else
{
break
}
}
}
}
// 从场景移除
if
(
this
.
conveyorsPool
[
0
].
x
<
-
750
)
{
for
(
var
k
=
0
;
k
<
this
.
currGamePool
.
length
;
k
++
)
{
let
garbage
=
this
.
currGamePool
[
k
]
let
cc
=
this
.
conveyorsPool
[
0
][
`idx
${
4
}
`
]
if
(
cc
.
children
[
0
])
{
if
(
garbage
.
name
==
cc
.
children
[
0
].
$name
)
{
garbage
.
isOnStage
=
false
;
removeEle
(
garbage
,
this
.
currGamePool
);
this
.
currGamePool
.
push
(
garbage
);
cc
.
removeChild
(
cc
.
children
[
0
])
break
}
}
}
this
.
conveyorsPool
.
shift
();
}
else
if
(
this
.
conveyorsPool
[
0
].
x
<
-
600
)
{
for
(
var
k
=
0
;
k
<
this
.
currGamePool
.
length
;
k
++
)
{
let
garbage
=
this
.
currGamePool
[
k
]
let
cc
=
this
.
conveyorsPool
[
0
][
`idx
${
3
}
`
]
if
(
cc
.
children
[
0
])
{
if
(
garbage
.
name
==
cc
.
children
[
0
].
$name
)
{
garbage
.
isOnStage
=
false
;
removeEle
(
garbage
,
this
.
currGamePool
);
this
.
currGamePool
.
push
(
garbage
);
cc
.
removeChild
(
cc
.
children
[
0
])
break
}
}
}
}
else
if
(
this
.
conveyorsPool
[
0
].
x
<
-
450
)
{
for
(
var
k
=
0
;
k
<
this
.
currGamePool
.
length
;
k
++
)
{
let
garbage
=
this
.
currGamePool
[
k
]
let
cc
=
this
.
conveyorsPool
[
0
][
`idx
${
2
}
`
]
if
(
cc
.
children
[
0
])
{
if
(
garbage
.
name
==
cc
.
children
[
0
].
$name
)
{
garbage
.
isOnStage
=
false
;
removeEle
(
garbage
,
this
.
currGamePool
);
this
.
currGamePool
.
push
(
garbage
);
cc
.
removeChild
(
cc
.
children
[
0
])
break
}
}
}
}
else
if
(
this
.
conveyorsPool
[
0
].
x
<
-
300
)
{
for
(
var
k
=
0
;
k
<
this
.
currGamePool
.
length
;
k
++
)
{
let
garbage
=
this
.
currGamePool
[
k
]
let
cc
=
this
.
conveyorsPool
[
0
][
`idx
${
1
}
`
]
if
(
cc
.
children
[
0
])
{
if
(
garbage
.
name
==
cc
.
children
[
0
].
$name
)
{
garbage
.
isOnStage
=
false
;
removeEle
(
garbage
,
this
.
currGamePool
);
this
.
currGamePool
.
push
(
garbage
);
cc
.
removeChild
(
cc
.
children
[
0
])
break
}
}
}
}
else
if
(
this
.
conveyorsPool
[
0
].
x
<
-
150
)
{
for
(
var
k
=
0
;
k
<
this
.
currGamePool
.
length
;
k
++
)
{
let
garbage
=
this
.
currGamePool
[
k
]
let
cc
=
this
.
conveyorsPool
[
0
][
`idx
${
0
}
`
]
if
(
cc
.
children
[
0
])
{
if
(
garbage
.
name
==
cc
.
children
[
0
].
$name
)
{
garbage
.
isOnStage
=
false
;
removeEle
(
garbage
,
this
.
currGamePool
);
this
.
currGamePool
.
push
(
garbage
);
cc
.
removeChild
(
cc
.
children
[
0
])
break
}
}
}
}
}
}
addscore
(
n
)
{
this
.
score
+=
n
;
engine
.
globalEvent
.
dispatchEvent
(
'recycling-score-update'
,
{
score
:
this
.
score
});
}
gameOver
()
{
engine
.
gameStage
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
}
onDwon_garbage
()
{
}
private
clear
()
{
this
.
currGamePool
=
[];
}
timeout
()
{
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
}
}
\ No newline at end of file
src/custom/recycling/src/game/GameView.ts
View file @
63f061c8
...
@@ -9,11 +9,11 @@ import uiConfig from "./uiConfig";
...
@@ -9,11 +9,11 @@ import uiConfig from "./uiConfig";
import
getGuideInfo
,
{
setGuide
}
from
"./utils/getGuideInfo"
;
import
getGuideInfo
,
{
setGuide
}
from
"./utils/getGuideInfo"
;
import
CountDownGroup
from
"./views/CountDownGroup"
;
import
CountDownGroup
from
"./views/CountDownGroup"
;
import
GuideView
from
"./views/guideView"
;
import
GuideView
from
"./views/guideView"
;
import
Conveyors
from
"./Conveyors"
;
export
default
class
GameView
extends
engine
.
Container
{
export
default
class
GameView
extends
engine
.
Container
{
private
_timer
;
private
_timer
;
private
_timeCounter
=
0
;
private
_timeCounter
=
0
;
score
=
0
;
uiMap
:
any
;
uiMap
:
any
;
wetWaste
:
engine
.
Rectangle
;
wetWaste
:
engine
.
Rectangle
;
harmfulWaste
:
engine
.
Rectangle
;
harmfulWaste
:
engine
.
Rectangle
;
...
@@ -21,6 +21,7 @@ export default class GameView extends engine.Container {
...
@@ -21,6 +21,7 @@ export default class GameView extends engine.Container {
recoverableWaste
:
engine
.
Rectangle
;
recoverableWaste
:
engine
.
Rectangle
;
countdown
:
CountDownGroup
;
countdown
:
CountDownGroup
;
guide
:
GuideView
;
guide
:
GuideView
;
conveyors
:
Conveyors
;
constructor
()
{
constructor
()
{
super
();
super
();
...
@@ -89,14 +90,15 @@ export default class GameView extends engine.Container {
...
@@ -89,14 +90,15 @@ export default class GameView extends engine.Container {
}
}
private
configConveyors
()
{
private
configConveyors
()
{
const
conveyor0
=
new
Conveyor
();
conveyor0
.
x
=
0
;
const
conveyor1
=
new
Conveyor
();
const
conveyor1
=
new
Conveyor
();
conveyor1
.
x
=
0
;
this
.
addChild
(
conveyor0
);
conveyor1
.
y
=
904.21
;
const
conveyor2
=
new
Conveyor
();
this
.
addChild
(
conveyor1
);
this
.
addChild
(
conveyor1
);
this
.
addChild
(
conveyor2
)
;
conveyor1
.
x
=
764
;
conveyor2
.
x
=
764
;
this
.
conveyors
=
new
Conveyors
(
this
)
;
conveyor2
.
y
=
904.21
;
this
.
conveyors
.
initData
(
conveyor0
,
conveyor1
)
}
}
playAni
()
{
playAni
()
{
...
@@ -118,13 +120,12 @@ export default class GameView extends engine.Container {
...
@@ -118,13 +120,12 @@ export default class GameView extends engine.Container {
async
start
()
{
async
start
()
{
console
.
log
(
'on start'
)
console
.
log
(
'on start'
)
this
.
_timeCounter
=
0
;
this
.
_timeCounter
=
0
;
this
.
score
=
0
;
if
(
!
getGuideInfo
())
{
if
(
!
getGuideInfo
())
{
await
this
.
guide
.
startGuide
();
await
this
.
guide
.
startGuide
();
setGuide
();
setGuide
();
}
}
await
this
.
countdown
.
startCountDown
();
await
this
.
countdown
.
startCountDown
();
this
.
startGame
();
this
.
startGame
();
...
@@ -135,23 +136,15 @@ export default class GameView extends engine.Container {
...
@@ -135,23 +136,15 @@ export default class GameView extends engine.Container {
this
.
_timer
=
setInterval
(()
=>
{
this
.
_timer
=
setInterval
(()
=>
{
this
.
onTimer
();
this
.
onTimer
();
},
1000
)
},
1000
)
;
}
}
private
startGame
()
{
private
startGame
()
{
this
.
playAni
();
this
.
playAni
();
this
.
stage
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
);
this
.
conveyors
.
startConveyors
();
}
private
xxx
()
{
this
.
score
++
;
engine
.
globalEvent
.
dispatchEvent
(
'recycling-score-update'
,
{
score
:
this
.
score
});
}
}
private
stopGame
()
{
private
stopGame
()
{
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
xxx
,
this
);
this
.
stopAni
();
this
.
stopAni
();
}
}
...
@@ -168,6 +161,7 @@ export default class GameView extends engine.Container {
...
@@ -168,6 +161,7 @@ export default class GameView extends engine.Container {
if
(
this
.
getSecond
()
==
0
)
{
if
(
this
.
getSecond
()
==
0
)
{
this
.
stop
();
this
.
stop
();
this
.
conveyors
.
timeout
();
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-end'
,
{});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-end'
,
{});
}
}
}
}
...
...
src/custom/recycling/src/game/datas/Garbage.ts
0 → 100644
View file @
63f061c8
import
{
GarbageTypes
}
from
'./GarbageTypes'
;
export
default
class
Garbage
extends
engine
.
Sprite
{
constructor
(
texture
)
{
super
(
texture
);
}
public
type
:
GarbageTypes
;
public
isWrong
:
boolean
=
false
;
public
isRight
:
boolean
=
false
;
public
}
\ No newline at end of file
src/custom/recycling/src/game/datas/GarbageConfig.ts
0 → 100644
View file @
63f061c8
import
{
GarbageTypes
}
from
'./GarbageTypes'
;
export
default
class
GarbageConfig
{
public
static
config
:
any
[]
=
[
{
name
:
"电池"
,
source
:
"g00"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
51
,
height
:
123
},
{
name
:
"温度计"
,
source
:
"g01"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
65
,
height
:
130
},
{
name
:
"鱼刺"
,
source
:
"g02"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
104
,
height
:
82
},
{
name
:
"龙虾"
,
source
:
"g03"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
129
,
height
:
122
},
{
name
:
"西瓜"
,
source
:
"g04"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
134
,
height
:
111
},
{
name
:
"旧玩具"
,
source
:
"g05"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
72
,
height
:
135
},
{
name
:
"口红"
,
source
:
"g06"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
49
,
height
:
134
},
{
name
:
"面包"
,
source
:
"g07"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
96
,
height
:
128
},
{
name
:
"绿植"
,
source
:
"g08"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
81
,
height
:
131
},
{
name
:
"保温瓶"
,
source
:
"g09"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
66
,
height
:
137
},
{
name
:
"破衣服"
,
source
:
"g10"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
91
,
height
:
121
},
{
name
:
"茶叶渣"
,
source
:
"g11"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
108
,
height
:
125
},
{
name
:
"湿巾"
,
source
:
"g12"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
106
,
height
:
109
},
{
name
:
"过期药膏"
,
source
:
"g13"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
107
,
height
:
130
},
{
name
:
"用完的洗发水瓶"
,
source
:
"g14"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
153
,
height
:
148
},
{
name
:
"婴儿纸尿裤"
,
source
:
"g15"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
108
,
height
:
123
},
{
name
:
"香水瓶"
,
source
:
"g16"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
65
,
height
:
127
},
{
name
:
"花甲壳"
,
source
:
"g17"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
99
,
height
:
115
},
{
name
:
"过期调味料"
,
source
:
"g18"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
109
,
height
:
130
},
{
name
:
"地毯"
,
source
:
"g19"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
145
,
height
:
119
},
{
name
:
"甘蔗渣"
,
source
:
"g20"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
100
,
height
:
116
},
{
name
:
"玻璃渣"
,
source
:
"g21"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
95
,
height
:
122
},
{
name
:
"番茄酱"
,
source
:
"g22"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
82
,
height
:
125
},
{
name
:
"酒精棉"
,
source
:
"g23"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
64
,
height
:
124
},
{
name
:
"指甲油瓶子"
,
source
:
"g24"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
109
,
height
:
125
},
{
name
:
"肉骨头"
,
source
:
"g25"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
67
,
height
:
123
},
{
name
:
"嚼过的口香糖"
,
source
:
"g26"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
135
,
height
:
116
},
{
name
:
"充电插头"
,
source
:
"g27"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
86
,
height
:
128
},
{
name
:
"旧报纸"
,
source
:
"g28"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
68
,
height
:
124
},
{
name
:
"烟头"
,
source
:
"g29"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
108
,
height
:
145
},
{
name
:
"奶茶塑料杯"
,
source
:
"g30"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
109
,
height
:
143
},
{
name
:
"瓜子壳"
,
source
:
"g31"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
87
,
height
:
121
},
{
name
:
"橘子皮"
,
source
:
"g32"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
78
,
height
:
120
},
{
name
:
"气球"
,
source
:
"g33"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
78
,
height
:
121
},
{
name
:
"树叶"
,
source
:
"g34"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
75
,
height
:
117
},
{
name
:
"感冒药"
,
source
:
"g35"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
92
,
height
:
121
},
{
name
:
"电话机"
,
source
:
"g36"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
63
,
height
:
121
},
{
name
:
"奶酪"
,
source
:
"g37"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
90
,
height
:
116
},
{
name
:
"啤酒瓶"
,
source
:
"g38"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
64
,
height
:
123
},
{
name
:
"薯片包装"
,
source
:
"g39"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
134
,
height
:
123
},
{
name
:
"过期保健品"
,
source
:
"g40"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
108
,
height
:
125
},
{
name
:
"雪糕包装袋"
,
source
:
"g41"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
109
,
height
:
128
},
{
name
:
"废油漆"
,
source
:
"g42"
,
type
:
GarbageTypes
.
harmfulWaste
,
width
:
98
,
height
:
122
},
{
name
:
"食品罐头"
,
source
:
"g43"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
94
,
height
:
117
},
{
name
:
"陶瓷碗"
,
source
:
"g44"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
105
,
height
:
122
},
{
name
:
"蚊香"
,
source
:
"g45"
,
type
:
GarbageTypes
.
dryWaste
,
width
:
69
,
height
:
146
},
{
name
:
"电脑机箱"
,
source
:
"g46"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
84
,
height
:
124
},
{
name
:
"鲜花"
,
source
:
"g47"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
62
,
height
:
122
},
{
name
:
"宠物粮食"
,
source
:
"g48"
,
type
:
GarbageTypes
.
wetWaste
,
width
:
87
,
height
:
121
},
{
name
:
"银行卡"
,
source
:
"g49"
,
type
:
GarbageTypes
.
recoverableWaste
,
width
:
115
,
height
:
123
},
];
}
\ No newline at end of file
src/custom/recycling/src/game/datas/GarbageTypes.ts
0 → 100644
View file @
63f061c8
export
enum
GarbageTypes
{
recoverableWaste
,
harmfulWaste
,
wetWaste
,
dryWaste
}
\ No newline at end of file
src/custom/recycling/src/game/utils/removeEle.ts
0 → 100644
View file @
63f061c8
export
default
(
e
,
arr
)
=>
{
let
index
=
arr
.
indexOf
(
e
);
if
(
index
>=
0
)
{
arr
.
splice
(
index
,
1
)
}
}
\ No newline at end of file
src/custom/recycling/src/game/utils/shuffle.ts
0 → 100644
View file @
63f061c8
export
default
(
arr
):
any
=>
{
let
i
=
arr
.
length
;
while
(
i
)
{
let
j
=
Math
.
floor
(
Math
.
random
()
*
i
--
);
//5555
[
arr
[
j
],
arr
[
i
]]
=
[
arr
[
i
],
arr
[
j
]];
}
return
arr
;
}
\ 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