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
716c4811
Commit
716c4811
authored
Jun 12, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
34d1bd4a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
486 deletions
+48
-486
recycling.json
dist/customs/recycling.json
+6
-3
app.js
src/custom/recycling/debug/app.js
+9
-3
index.html
src/custom/recycling/debug/index.html
+1
-1
main.js
src/custom/recycling/debug/main.js
+1
-457
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
meta.json
src/custom/recycling/meta.json
+12
-5
GameView.ts
src/custom/recycling/src/game/GameView.ts
+16
-14
CountDownGroup.ts
src/custom/recycling/src/game/views/CountDownGroup.ts
+2
-2
No files found.
dist/customs/recycling.json
View file @
716c4811
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/app.js
View file @
716c4811
...
@@ -46,15 +46,21 @@ function launchWithCustomModule(customModule) {
...
@@ -46,15 +46,21 @@ function launchWithCustomModule(customModule) {
},
100
);
},
100
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
200
);
},
200
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
1000
*
10
);
});
});
engine
.
globalEvent
.
addEventListener
(
'recycling-time-update'
,
(
e
)
=>
{
engine
.
globalEvent
.
addEventListener
(
'recycling-time-update'
,
(
e
)
=>
{
//
console.log(e.type, e.data);
console
.
log
(
e
.
type
,
e
.
data
);
});
});
engine
.
globalEvent
.
addEventListener
(
'recycling-game-
fail
'
,
(
e
)
=>
{
engine
.
globalEvent
.
addEventListener
(
'recycling-game-
end
'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
console
.
log
(
e
.
type
,
e
.
data
);
});
});
engine
.
globalEvent
.
addEventListener
(
'recycling-game-success'
,
(
e
)
=>
{
engine
.
globalEvent
.
addEventListener
(
'recycling-game-success'
,
(
e
)
=>
{
...
...
src/custom/recycling/debug/index.html
View file @
716c4811
...
@@ -45,6 +45,6 @@
...
@@ -45,6 +45,6 @@
<script
src=
"load-assets.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script
src=
"main.js"
></script>
<script>
<script>
localStorage
.
clear
()
//
localStorage.clear()
</script>
</script>
</body>
</body>
\ No newline at end of file
src/custom/recycling/debug/main.js
View file @
716c4811
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/main.js.map
View file @
716c4811
This diff is collapsed.
Click to expand it.
src/custom/recycling/meta.json
View file @
716c4811
...
@@ -74,10 +74,13 @@
...
@@ -74,10 +74,13 @@
"recycling-start"
:
{
"recycling-start"
:
{
"alias"
:
"开始"
,
"alias"
:
"开始"
,
"data"
:
{
"data"
:
{
"picUrl"
:
"图片路径"
,
"time"
:
"游戏时间"
"blockUrl"
:
"blockUrl"
}
}
},
},
"recycling-end"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{}
},
"recycling-stop"
:
{
"recycling-stop"
:
{
"alias"
:
"停止"
"alias"
:
"停止"
}
}
...
@@ -89,12 +92,16 @@
...
@@ -89,12 +92,16 @@
"time"
:
"剩余时间"
"time"
:
"剩余时间"
}
}
},
},
"recycling-
game-fail
"
:
{
"recycling-
score-update
"
:
{
"alias"
:
"
游戏结束
"
,
"alias"
:
"
分数更新
"
,
"data"
:
{
"data"
:
{
"
reason"
:
"结束原因(1:时间到了)
"
"
score"
:
"分数
"
}
}
},
},
"recycling-game-end"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{}
},
"recycling-game-success"
:
{
"recycling-game-success"
:
{
"alias"
:
"游戏成功"
,
"alias"
:
"游戏成功"
,
"data"
:
{
"data"
:
{
...
...
src/custom/recycling/src/game/GameView.ts
View file @
716c4811
...
@@ -4,15 +4,16 @@
...
@@ -4,15 +4,16 @@
import
{
getTextureByName
}
from
"../../../recycling/src/game/utils"
;
import
{
getTextureByName
}
from
"../../../recycling/src/game/utils"
;
import
{
props
}
from
"../props"
;
import
{
props
}
from
"../props"
;
import
uiConfig
from
"./uiConfig"
;
import
Conveyor
from
"./Conveyor"
;
import
Conveyor
from
"./Conveyor"
;
import
CountDownGroup
from
"./views/CountDownGroup
"
;
import
uiConfig
from
"./uiConfig
"
;
import
getGuideInfo
,
{
setGuide
}
from
"./utils/getGuideInfo"
;
import
getGuideInfo
,
{
setGuide
}
from
"./utils/getGuideInfo"
;
import
CountDownGroup
from
"./views/CountDownGroup"
;
import
GuideView
from
"./views/guideView"
;
import
GuideView
from
"./views/guideView"
;
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
;
...
@@ -69,7 +70,7 @@ export default class GameView extends engine.Container {
...
@@ -69,7 +70,7 @@ export default class GameView extends engine.Container {
this
.
recoverableWaste
=
this
.
createRect
(
389
,
551
,
287
,
292
,
0x0000ff
);
this
.
recoverableWaste
=
this
.
createRect
(
389
,
551
,
287
,
292
,
0x0000ff
);
}
}
createRect
(
x
,
y
,
w
,
h
,
c
)
{
createRect
(
x
,
y
,
w
,
h
,
c
)
{
const
rect
=
new
engine
.
Rectangle
(
x
,
y
,
w
,
h
);
const
rect
=
new
engine
.
Rectangle
(
x
,
y
,
w
,
h
);
const
sp
=
new
engine
.
Sprite
();
const
sp
=
new
engine
.
Sprite
();
...
@@ -78,7 +79,7 @@ export default class GameView extends engine.Container {
...
@@ -78,7 +79,7 @@ export default class GameView extends engine.Container {
sp
.
y
=
y
;
sp
.
y
=
y
;
const
g
=
new
engine
.
Graphics
;
const
g
=
new
engine
.
Graphics
;
g
.
alpha
=
0.0
;
g
.
alpha
=
0.0
;
g
.
beginFill
(
c
);
g
.
beginFill
(
c
);
g
.
drawRect
(
0
,
0
,
w
,
h
);
g
.
drawRect
(
0
,
0
,
w
,
h
);
g
.
endFill
();
g
.
endFill
();
...
@@ -111,8 +112,10 @@ export default class GameView extends engine.Container {
...
@@ -111,8 +112,10 @@ export default class GameView extends engine.Container {
}
}
async
start
()
{
async
start
()
{
console
.
log
(
'on start'
)
this
.
_timeCounter
=
0
;
if
(
!
getGuideInfo
())
{
if
(
!
getGuideInfo
())
{
await
this
.
guide
.
startGuide
();
await
this
.
guide
.
startGuide
();
setGuide
();
setGuide
();
}
}
...
@@ -121,7 +124,6 @@ export default class GameView extends engine.Container {
...
@@ -121,7 +124,6 @@ export default class GameView extends engine.Container {
this
.
playAni
();
this
.
playAni
();
console
.
log
(
'on start'
)
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
second
:
this
.
getSecond
(),
second
:
this
.
getSecond
(),
...
@@ -132,25 +134,25 @@ export default class GameView extends engine.Container {
...
@@ -132,25 +134,25 @@ export default class GameView extends engine.Container {
},
1000
)
},
1000
)
}
}
getSecond
()
{
return
0
}
getSecond
()
{
return
props
.
time
-
this
.
_timeCounter
}
onTimer
()
{
onTimer
()
{
this
.
_timeCounter
++
;
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
second
:
this
.
getSecond
(),
second
:
this
.
getSecond
(),
});
});
if
(
this
.
getSecond
()
==
0
)
{
if
(
this
.
getSecond
()
==
0
)
{
// GAME_TIME = props.GAME_TIME
this
.
stop
();
this
.
stop
();
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-fail'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-game-end'
,
{
});
reason
:
1
});
}
}
}
}
stop
()
{
stop
()
{
clearInterval
(
this
.
_timer
);
}
}
setup
()
{
setup
()
{
...
...
src/custom/recycling/src/game/views/CountDownGroup.ts
View file @
716c4811
...
@@ -36,11 +36,11 @@ export default class CountDownGroup extends engine.Sprite {
...
@@ -36,11 +36,11 @@ export default class CountDownGroup extends engine.Sprite {
this
.
addChild
(
this
.
num3
)
this
.
addChild
(
this
.
num3
)
this
.
addChild
(
this
.
go
)
this
.
addChild
(
this
.
go
)
this
.
visible
=
false
;
this
.
reset
();
this
.
reset
();
}
}
private
reset
()
{
private
reset
()
{
this
.
visible
=
false
;
this
.
go
.
alpha
=
this
.
num1
.
alpha
=
this
.
num2
.
alpha
=
this
.
num3
.
alpha
=
0
;
this
.
go
.
alpha
=
this
.
num1
.
alpha
=
this
.
num2
.
alpha
=
this
.
num3
.
alpha
=
0
;
this
.
go
.
scaleX
=
this
.
num1
.
scaleX
=
this
.
num2
.
scaleX
=
this
.
num3
.
scaleX
=
3
;
this
.
go
.
scaleX
=
this
.
num1
.
scaleX
=
this
.
num2
.
scaleX
=
this
.
num3
.
scaleX
=
3
;
this
.
go
.
scaleY
=
this
.
num1
.
scaleY
=
this
.
num2
.
scaleY
=
this
.
num3
.
scaleY
=
3
;
this
.
go
.
scaleY
=
this
.
num1
.
scaleY
=
this
.
num2
.
scaleY
=
this
.
num3
.
scaleY
=
3
;
...
@@ -48,7 +48,7 @@ export default class CountDownGroup extends engine.Sprite {
...
@@ -48,7 +48,7 @@ export default class CountDownGroup extends engine.Sprite {
async
startCountDown
()
{
async
startCountDown
()
{
return
new
Promise
((
r
)
=>
{
return
new
Promise
((
r
)
=>
{
this
.
reset
();
this
.
visible
=
true
;
this
.
visible
=
true
;
this
.
num3
.
alpha
=
1
;
this
.
num3
.
alpha
=
1
;
...
...
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