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
1c89e887
Commit
1c89e887
authored
Jun 15, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
86132dab
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
20 deletions
+43
-20
recycling.json
dist/customs/recycling.json
+1
-1
app.js
src/custom/recycling/debug/app.js
+6
-6
main.js
src/custom/recycling/debug/main.js
+17
-4
main.js.map
src/custom/recycling/debug/main.js.map
+1
-1
Conveyors.ts
src/custom/recycling/src/game/Conveyors.ts
+14
-5
GameView.ts
src/custom/recycling/src/game/GameView.ts
+4
-3
No files found.
dist/customs/recycling.json
View file @
1c89e887
This diff is collapsed.
Click to expand it.
src/custom/recycling/debug/app.js
View file @
1c89e887
...
@@ -46,19 +46,19 @@ function launchWithCustomModule(customModule) {
...
@@ -46,19 +46,19 @@ function launchWithCustomModule(customModule) {
},
100
);
},
100
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
1000
,
maxScore
:
200
});
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
2
,
maxScore
:
2
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
},
200
);
},
200
);
//
setTimeout(() => {
setTimeout
(()
=>
{
// engine.globalEvent.dispatchEvent('recycling-start', { tim
e: 2 });
engine
.
globalEvent
.
dispatchEvent
(
'recycling-start'
,
{
time
:
8
,
maxScor
e
:
2
});
//
const d = engine.gameStage.sceneContainer.getChildAt(0);
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
//
}, 1000 * 10);
},
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-score-update'
,
(
e
)
=>
{
engine
.
globalEvent
.
addEventListener
(
'recycling-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
console
.
log
(
e
.
type
,
e
.
data
);
...
...
src/custom/recycling/debug/main.js
View file @
1c89e887
...
@@ -241,11 +241,10 @@
...
@@ -241,11 +241,10 @@
this
.
conveyor1
=
conveyor1
;
this
.
conveyor1
=
conveyor1
;
};
};
Conveyors
.
prototype
.
setDefault
=
function
()
{
Conveyors
.
prototype
.
setDefault
=
function
()
{
this
.
clear
();
this
.
score
=
0
;
this
.
score
=
0
;
this
.
conveyorsPool
.
push
(
this
.
conveyor0
);
this
.
conveyorsPool
.
push
(
this
.
conveyor0
);
this
.
conveyorsPool
.
push
(
this
.
conveyor1
);
this
.
conveyorsPool
.
push
(
this
.
conveyor1
);
var
allConfigs
=
shuffle
(
this
.
GarbageConfig
);
var
allConfigs
=
shuffle
(
this
.
GarbageConfig
.
concat
([])
);
for
(
var
i
=
0
;
i
<
GarbageConfig
.
config
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
GarbageConfig
.
config
.
length
;
i
++
)
{
allConfigs
[
i
].
idx
=
i
;
allConfigs
[
i
].
idx
=
i
;
allConfigs
[
i
].
isRight
=
false
;
allConfigs
[
i
].
isRight
=
false
;
...
@@ -420,16 +419,19 @@
...
@@ -420,16 +419,19 @@
view
.
y
=
e
.
stageY
-
target
.
texture
.
height
/
2
;
view
.
y
=
e
.
stageY
-
target
.
texture
.
height
/
2
;
view
.
type
=
target
[
'type'
];
view
.
type
=
target
[
'type'
];
view
.
name
=
target
[
'name'
];
view
.
name
=
target
[
'name'
];
this
.
wrapper
.
once
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
);
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
);
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
);
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
);
};
};
Conveyors
.
prototype
.
onStageMouseMove
=
function
(
e
)
{
Conveyors
.
prototype
.
onStageMouseMove
=
function
(
e
)
{
console
.
log
(
'onStageMouseMove'
);
var
view
=
this
.
_currentDragView
;
var
view
=
this
.
_currentDragView
;
view
.
x
=
e
.
stageX
-
view
.
texture
.
width
/
2
;
view
.
x
=
e
.
stageX
-
view
.
texture
.
width
/
2
;
view
.
y
=
e
.
stageY
-
view
.
texture
.
height
/
2
;
view
.
y
=
e
.
stageY
-
view
.
texture
.
height
/
2
;
};
};
Conveyors
.
prototype
.
onStageMouseUp
=
function
(
e
)
{
Conveyors
.
prototype
.
onStageMouseUp
=
function
(
e
)
{
var
_this
=
this
;
var
_this
=
this
;
console
.
log
(
'onStageMouseUp'
);
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
);
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
);
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
);
if
(
!
this
.
_currentDragView
)
if
(
!
this
.
_currentDragView
)
return
;
return
;
...
@@ -453,6 +455,8 @@
...
@@ -453,6 +455,8 @@
});
});
};
};
Conveyors
.
prototype
.
clear
=
function
()
{
Conveyors
.
prototype
.
clear
=
function
()
{
this
.
conveyor0
.
x
=
0
;
this
.
conveyor1
.
x
=
764
;
this
.
conveyorsPool
.
forEach
(
function
(
i
)
{
this
.
conveyorsPool
.
forEach
(
function
(
i
)
{
i
.
clear
();
i
.
clear
();
});
});
...
@@ -461,6 +465,11 @@
...
@@ -461,6 +465,11 @@
this
.
stores
=
[];
this
.
stores
=
[];
};
};
Conveyors
.
prototype
.
timeout
=
function
()
{
Conveyors
.
prototype
.
timeout
=
function
()
{
if
(
this
.
_currentDragView
)
{
removeChild
(
this
.
_currentDragView
);
}
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
);
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
);
this
.
gameOver
();
this
.
gameOver
();
};
};
Conveyors
.
prototype
.
checkHitRect
=
function
()
{
Conveyors
.
prototype
.
checkHitRect
=
function
()
{
...
@@ -772,10 +781,10 @@
...
@@ -772,10 +781,10 @@
};
};
GameView
.
prototype
.
configConveyors
=
function
()
{
GameView
.
prototype
.
configConveyors
=
function
()
{
var
conveyor0
=
new
Conveyor
();
var
conveyor0
=
new
Conveyor
();
conveyor0
.
x
=
0
;
var
conveyor1
=
new
Conveyor
();
var
conveyor1
=
new
Conveyor
();
this
.
addChild
(
conveyor0
);
this
.
addChild
(
conveyor0
);
this
.
addChild
(
conveyor1
);
this
.
addChild
(
conveyor1
);
conveyor0
.
x
=
0
;
conveyor1
.
x
=
764
;
conveyor1
.
x
=
764
;
this
.
conveyors
=
new
Conveyors
(
this
);
this
.
conveyors
=
new
Conveyors
(
this
);
this
.
conveyors
.
initData
(
conveyor0
,
conveyor1
);
this
.
conveyors
.
initData
(
conveyor0
,
conveyor1
);
...
@@ -811,6 +820,10 @@
...
@@ -811,6 +820,10 @@
setGuide
();
setGuide
();
_a
.
label
=
2
;
_a
.
label
=
2
;
case
2
:
case
2
:
this
.
conveyors
.
clear
();
return
[
4
,
this
.
countdown
.
startCountDown
()];
case
3
:
_a
.
sent
();
this
.
startGame
();
this
.
startGame
();
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'recycling-time-update'
,
{
second
:
this
.
getSecond
(),
second
:
this
.
getSecond
(),
...
...
src/custom/recycling/debug/main.js.map
View file @
1c89e887
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/custom/recycling/src/game/Conveyors.ts
View file @
1c89e887
...
@@ -36,7 +36,6 @@ export default class Conveyors extends engine.Sprite {
...
@@ -36,7 +36,6 @@ export default class Conveyors extends engine.Sprite {
}
}
private
setDefault
()
{
private
setDefault
()
{
this
.
clear
();
this
.
score
=
0
;
this
.
score
=
0
;
...
@@ -44,7 +43,7 @@ export default class Conveyors extends engine.Sprite {
...
@@ -44,7 +43,7 @@ export default class Conveyors extends engine.Sprite {
this
.
conveyorsPool
.
push
(
this
.
conveyor1
);
this
.
conveyorsPool
.
push
(
this
.
conveyor1
);
// 本局游戏的20种垃圾
// 本局游戏的20种垃圾
const
allConfigs
=
shuffle
(
this
.
GarbageConfig
);
const
allConfigs
=
shuffle
(
this
.
GarbageConfig
.
concat
([])
);
for
(
let
i
=
0
;
i
<
GarbageConfig
.
config
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
GarbageConfig
.
config
.
length
;
i
++
)
{
allConfigs
[
i
].
idx
=
i
;
allConfigs
[
i
].
idx
=
i
;
...
@@ -233,7 +232,7 @@ export default class Conveyors extends engine.Sprite {
...
@@ -233,7 +232,7 @@ export default class Conveyors extends engine.Sprite {
private
_currentDragView
:
engine
.
Sprite
;
private
_currentDragView
:
engine
.
Sprite
;
private
_currentTarget
:
engine
.
Sprite
;
private
_currentTarget
:
engine
.
Sprite
;
onDown_garbage
(
e
:
engine
.
MouseEvent
)
{
onDown_garbage
(
e
:
engine
.
MouseEvent
)
{
if
(
this
.
_currentDragView
)
{
if
(
this
.
_currentDragView
)
{
removeChild
(
this
.
_currentDragView
)
removeChild
(
this
.
_currentDragView
)
}
}
const
target
:
engine
.
Sprite
=
e
.
target
;
const
target
:
engine
.
Sprite
=
e
.
target
;
...
@@ -246,17 +245,20 @@ export default class Conveyors extends engine.Sprite {
...
@@ -246,17 +245,20 @@ export default class Conveyors extends engine.Sprite {
view
.
y
=
e
.
stageY
-
target
.
texture
.
height
/
2
;
view
.
y
=
e
.
stageY
-
target
.
texture
.
height
/
2
;
view
.
type
=
target
[
'type'
];
view
.
type
=
target
[
'type'
];
view
.
name
=
target
[
'name'
];
view
.
name
=
target
[
'name'
];
this
.
wrapper
.
once
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
)
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
)
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
this
.
wrapper
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
}
}
onStageMouseMove
(
e
:
engine
.
MouseEvent
)
{
onStageMouseMove
(
e
:
engine
.
MouseEvent
)
{
console
.
log
(
'onStageMouseMove'
)
const
view
=
this
.
_currentDragView
;
const
view
=
this
.
_currentDragView
;
view
.
x
=
e
.
stageX
-
view
.
texture
.
width
/
2
;
view
.
x
=
e
.
stageX
-
view
.
texture
.
width
/
2
;
view
.
y
=
e
.
stageY
-
view
.
texture
.
height
/
2
;
view
.
y
=
e
.
stageY
-
view
.
texture
.
height
/
2
;
}
}
onStageMouseUp
(
e
:
engine
.
MouseEvent
)
{
onStageMouseUp
(
e
:
engine
.
MouseEvent
)
{
console
.
log
(
'onStageMouseUp'
)
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
)
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
if
(
!
this
.
_currentDragView
)
return
;
if
(
!
this
.
_currentDragView
)
return
;
const
result
:
GarbageTypes
=
this
.
checkHitRect
();
const
result
:
GarbageTypes
=
this
.
checkHitRect
();
...
@@ -281,7 +283,9 @@ export default class Conveyors extends engine.Sprite {
...
@@ -281,7 +283,9 @@ export default class Conveyors extends engine.Sprite {
});
});
}
}
private
clear
()
{
clear
()
{
this
.
conveyor0
.
x
=
0
;
this
.
conveyor1
.
x
=
764
;
this
.
conveyorsPool
.
forEach
(
i
=>
{
this
.
conveyorsPool
.
forEach
(
i
=>
{
i
.
clear
();
i
.
clear
();
});
});
...
@@ -291,6 +295,11 @@ export default class Conveyors extends engine.Sprite {
...
@@ -291,6 +295,11 @@ export default class Conveyors extends engine.Sprite {
}
}
timeout
()
{
timeout
()
{
if
(
this
.
_currentDragView
)
{
removeChild
(
this
.
_currentDragView
)
}
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onStageMouseUp
,
this
)
this
.
wrapper
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onStageMouseMove
,
this
)
this
.
gameOver
();
this
.
gameOver
();
}
}
...
...
src/custom/recycling/src/game/GameView.ts
View file @
1c89e887
...
@@ -91,11 +91,10 @@ export default class GameView extends engine.Container {
...
@@ -91,11 +91,10 @@ export default class GameView extends engine.Container {
private
configConveyors
()
{
private
configConveyors
()
{
const
conveyor0
=
new
Conveyor
();
const
conveyor0
=
new
Conveyor
();
conveyor0
.
x
=
0
;
const
conveyor1
=
new
Conveyor
();
const
conveyor1
=
new
Conveyor
();
this
.
addChild
(
conveyor0
);
this
.
addChild
(
conveyor0
);
this
.
addChild
(
conveyor1
);
this
.
addChild
(
conveyor1
);
conveyor0
.
x
=
0
;
conveyor1
.
x
=
764
;
conveyor1
.
x
=
764
;
this
.
conveyors
=
new
Conveyors
(
this
);
this
.
conveyors
=
new
Conveyors
(
this
);
this
.
conveyors
.
initData
(
conveyor0
,
conveyor1
)
this
.
conveyors
.
initData
(
conveyor0
,
conveyor1
)
...
@@ -126,7 +125,9 @@ export default class GameView extends engine.Container {
...
@@ -126,7 +125,9 @@ export default class GameView extends engine.Container {
setGuide
();
setGuide
();
}
}
// await this.countdown.startCountDown();
this
.
conveyors
.
clear
()
await
this
.
countdown
.
startCountDown
();
this
.
startGame
();
this
.
startGame
();
...
...
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