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
02c07996
Commit
02c07996
authored
Jun 10, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
6e97651a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
350 additions
and
0 deletions
+350
-0
app.js
src/custom/xiaoxiaole/debug/app.js
+73
-0
index.html
src/custom/xiaoxiaole/debug/index.html
+45
-0
load-assets.js
src/custom/xiaoxiaole/debug/load-assets.js
+52
-0
main.js
src/custom/xiaoxiaole/debug/main.js
+1
-0
props.js
src/custom/xiaoxiaole/debug/props.js
+7
-0
meta.json
src/custom/xiaoxiaole/meta.json
+85
-0
GameView.ts
src/custom/xiaoxiaole/src/game/GameView.ts
+20
-0
GameWrapper.ts
src/custom/xiaoxiaole/src/game/GameWrapper.ts
+18
-0
utils.ts
src/custom/xiaoxiaole/src/game/utils.ts
+20
-0
index.ts
src/custom/xiaoxiaole/src/index.ts
+14
-0
props.ts
src/custom/xiaoxiaole/src/props.ts
+15
-0
No files found.
src/custom/xiaoxiaole/debug/app.js
0 → 100644
View file @
02c07996
/**
* Created by renjianfeng on 2020-03-13.
*/
const
customId
=
'food-fell'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-reset'
,
{
"goodsProbability"
:
[
0.8
,
0.1
,
0.1
],
"countDown"
:
30
,
"acceleratedSpeed"
:
0.1
});
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-start'
);
},
500
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-game-over'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/xiaoxiaole/debug/index.html
0 → 100644
View file @
02c07996
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
美食从天而降
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
red
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.50cdcef6ebe4e8c0fbc624f9d4fbf225102c5750.js"
></script>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/xiaoxiaole/debug/load-assets.js
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
},
{
"name"
:
"雨滴"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png"
,
"uuid"
:
"264a6192-d7bf-45e8-8f15-6ba2c439a532"
,
"ext"
:
".png"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png"
,
"uuid"
:
"eb88b42d-e151-4c1b-94b9-7c16f7bfac29"
,
"ext"
:
".png"
},
{
"name"
:
"石块"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/99b0af0c59fe79a415a3f032149cfacc27e3ac2c.png"
,
"uuid"
:
"ab1bdabc-21ba-46bf-9299-6c638f766c88"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/xiaoxiaole/debug/main.js
0 → 100644
View file @
02c07996
"use strict"
;
var
tslib
=
require
(
"tslib"
),
props
=
{};
function
prepareProps
(){
var
e
=
getProps
();
engine
.
injectProp
(
props
,
e
)}
function
injectProps
(
e
){
engine
.
injectProp
(
props
,
e
)}
function
getTexture
(
e
){
return
engine
.
Texture
.
from
(
getAssetByUUID
(
e
).
uuid
)}
function
getTextureByName
(
e
){
return
getTexture
(
engine
.
getAssetByName
(
e
).
uuid
)}
function
createSvga
(
e
,
t
){
var
o
=
new
svga
.
Svga
;
return
o
.
source
=
"asset://"
+
engine
.
getAssetByName
(
e
).
uuid
,
o
}
var
Goods
=
function
(
s
){
function
e
(){
var
e
,
t
=
s
.
call
(
this
)
||
this
;
e
=
t
.
_body
=
new
engine
.
Rect
;
var
o
=
new
engine
.
Sprite
(
getTextureByName
(
"雨滴"
));
o
.
npcType
=
"rain"
;
var
n
=
new
engine
.
Sprite
(
getTextureByName
(
"石块"
));
n
.
npcType
=
"stone"
;
var
i
=
new
engine
.
Sprite
(
getTextureByName
(
"炸弹"
));
return
i
.
npcType
=
"boom"
,
o
.
visible
=!
1
,
n
.
visible
=!
1
,
i
.
visible
=!
1
,
e
.
addChild
(
o
),
e
.
addChild
(
n
),
e
.
addChild
(
i
),
t
.
addChild
(
e
),
e
.
width
=
1
e
-
4
,
e
.
height
=
1
e
-
4
,
e
.
mouseEnabled
=!
1
,
t
}
return
tslib
.
__extends
(
e
,
s
),
e
.
prototype
.
getRandomNumberByRange
=
function
(
e
,
t
){
return
Math
.
floor
(
Math
.
random
()
*
(
t
-
e
)
+
e
)},
e
.
prototype
.
reset
=
function
(){
this
.
visible
=!
0
,
this
.
rotation
=
0
,
this
.
anchorOffsetY
=
0
,
this
.
y
=
0
,
this
.
x
=
630
*
Math
.
random
()
+
30
,
this
.
rotation
=
0
;
var
e
=
Math
.
random
();
e
<
props
.
goodsProbability
[
0
]?
this
.
showNpc
(
"rain"
):
e
>=
props
.
goodsProbability
[
0
]
&&
e
<=
props
.
goodsProbability
[
0
]
+
props
.
goodsProbability
[
1
]?
this
.
showNpc
(
"stone"
):
e
>
props
.
goodsProbability
[
0
]
+
props
.
goodsProbability
[
1
]
&&
this
.
showNpc
(
"boom"
)},
e
.
prototype
.
showNpc
=
function
(
e
){
for
(
var
t
=
0
;
t
<
this
.
_body
.
children
.
length
;
t
++
)
this
.
_body
.
children
[
t
].
visible
=!
1
,
this
.
_body
.
children
[
t
].
mouseEnabled
=!
1
;
for
(
t
=
0
;
t
<
this
.
_body
.
children
.
length
;
t
++
)
this
.
_body
.
children
[
t
].
npcType
==
e
&&
(
this
.
npcType
=
e
,
this
.
_body
.
children
[
t
].
visible
=!
0
,
this
.
_body
.
children
[
t
].
mouseEnabled
=!
1
)},
Object
.
defineProperty
(
e
.
prototype
,
"anchorOffsetY"
,{
set
:
function
(
e
){
this
.
_body
.
y
=
e
},
enumerable
:
!
0
,
configurable
:
!
0
}),
e
}(
engine
.
Container
),
ObjectPool
=
engine
.
ObjectPool
,
PoolName
=
"goods"
;
ObjectPool
.
registerPool
(
PoolName
,
function
(){
return
new
Goods
},
function
(
e
,
t
){
e
.
reset
()});
var
ObjectPool$1
=
engine
.
ObjectPool
,
GameView
=
function
(
e
){
function
t
(){
var
t
=
e
.
call
(
this
)
||
this
;
return
t
.
goodsItems
=
[],
t
.
moveCatchX
=
0
,
t
.
playerCatchX
=
0
,
t
.
onDownStage
=
function
(
e
){
t
.
moveCatchX
=
e
.
localX
,
t
.
playerCatchX
=
t
.
player
.
x
},
t
.
onMoveStage
=
function
(
e
){
t
.
gameIng
&&
(
t
.
player
.
x
=
t
.
playerCatchX
+
(
e
.
localX
-
t
.
moveCatchX
))},
t
.
onOutStage
=
function
(
e
){
t
.
moveCatchX
=
0
},
t
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
t
.
setup
,
t
),
t
}
return
tslib
.
__extends
(
t
,
e
),
t
.
prototype
.
setup
=
function
(){
var
e
=
this
;
this
.
_hasSetup
||
(
this
.
_hasSetup
=!
0
,
this
.
NpcBg
=
new
engine
.
Container
,
this
.
NpcBg
.
alpha
=
1
,
this
.
NpcBg
.
width
=
0
,
this
.
NpcBg
.
height
=
0
,
this
.
addChild
(
this
.
NpcBg
),
this
.
player
=
new
engine
.
Container
,
this
.
player
.
mouseEnabled
=!
1
,
this
.
addChild
(
this
.
player
),
this
.
waterSvga
=
createSvga
(
"水花"
),
this
.
playerSvga
=
createSvga
(
"玩家"
),
this
.
boomSvga
=
createSvga
(
"炸弹svga"
),
this
.
player
.
addChild
(
this
.
playerSvga
),
this
.
player
.
addChild
(
this
.
waterSvga
),
this
.
player
.
addChild
(
this
.
boomSvga
),
this
.
playerSvga
.
gotoAndPlay
(
1
),
this
.
visible
=!
1
,
setTimeout
(
function
(){
e
.
visible
=!
0
,
e
.
player
.
anchorY
=
e
.
player
.
height
/
2
,
e
.
player
.
anchorX
=
e
.
player
.
width
/
2
,
console
.
log
(
e
.
player
.
width
),
console
.
log
(
e
.
playerSvga
.
width
),
e
.
player
.
x
=
375
-
e
.
player
.
width
/
2
,
e
.
player
.
y
=
props
.
playerPositionY
},
300
),
this
.
rectBg
=
new
engine
.
Rect
,
this
.
rectBg
.
alpha
=
0
,
this
.
rectBg
.
width
=
750
,
this
.
rectBg
.
height
=
1624
,
this
.
addChild
(
this
.
rectBg
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDownStage
,
this
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onMoveStage
,
this
),
this
.
rectBg
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_OUT
,
this
.
onOutStage
,
this
))},
t
.
prototype
.
reset
=
function
(){
this
.
recycleGoods
()},
t
.
prototype
.
start
=
function
(){
var
e
=
this
;
this
.
score
=
0
,
this
.
speed
=
1
,
this
.
gameIng
=!
0
,
this
.
creatNpc
(),
this
.
beginNpc
(),
this
.
countdown
=
props
.
countDown
,
this
.
countdownTimer
=
setInterval
(
function
(){
e
.
gameIng
&&
(
0
<
e
.
countdown
?(
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-time-update"
,{
time
:
e
.
countdown
}),
e
.
countdown
-=
1
):(
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-game-over"
,{
score
:
e
.
score
,
reason
:
1
}),
e
.
died
()))},
1
e3
)},
t
.
prototype
.
beginNpc
=
function
(){
var
e
=
this
;
this
.
timer
=
setTimeout
(
function
(){
e
.
gameIng
&&
(
e
.
speed
+=
props
.
acceleratedSpeed
,
e
.
creatNpc
()),
e
.
beginNpc
()},
2
e3
/
this
.
speed
)},
t
.
prototype
.
pause
=
function
(){
this
.
gameIng
=!
1
},
t
.
prototype
.
revive
=
function
(){
this
.
gameIng
=!
0
},
t
.
prototype
.
resume
=
function
(){
this
.
reset
(),
this
.
start
()},
t
.
prototype
.
creatNpc
=
function
(){
var
e
=
this
,
t
=
this
.
_goods
=
ObjectPool$1
.
getObject
(
PoolName
);
this
.
goodsItems
.
push
(
t
),
this
.
NpcBg
.
addChild
(
t
),
t
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
t
.
onGoodsEnter
=
function
(){
1624
<
t
.
y
?
e
.
removeNpc
(
t
):
e
.
gameIng
&&
(
t
.
y
+=
4
*
e
.
speed
,
e
.
hasHit
(
e
.
player
,
t
)
&&
(
"rain"
==
t
.
npcType
?(
console
.
log
(
"碰到雨滴"
),
e
.
score
+=
props
.
rainScore
,
e
.
waterSvga
.
visible
=!
0
,
e
.
waterSvga
.
play
(
!
1
,
!
1
),
e
.
waterSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
waterSvga
.
visible
=!
1
},
e
)):
"stone"
==
t
.
npcType
?(
console
.
log
(
"碰到石头"
),
e
.
score
+=
props
.
stoneScore
):
"boom"
==
t
.
npcType
&&
(
console
.
log
(
"碰到炸弹"
),
e
.
boomSvga
.
visible
=!
0
,
e
.
boomSvga
.
play
(
!
1
,
!
1
),
e
.
boomSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
(){
e
.
boomSvga
.
visible
=!
1
},
e
),
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-game-over"
,{
score
:
e
.
score
,
reason
:
2
}),
e
.
died
()),
engine
.
globalEvent
.
dispatchEvent
(
"food-fell-score-update"
,{
score
:
e
.
score
}),
e
.
removeNpc
(
t
)))},
this
)},
t
.
prototype
.
died
=
function
(){
this
.
score
=
0
,
this
.
pause
()},
t
.
prototype
.
removeNpc
=
function
(
e
){
this
.
NpcBg
.
removeChild
(
e
),
ObjectPool$1
.
recycleObject
(
PoolName
,
e
),
e
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
e
.
onGoodsEnter
,
this
);
var
t
=
this
.
goodsItems
.
indexOf
(
e
);
-
1
<
t
&&
this
.
goodsItems
.
splice
(
t
,
1
)},
t
.
prototype
.
recycleGoods
=
function
(){
clearTimeout
(
this
.
timer
),
clearInterval
(
this
.
countdownTimer
);
for
(
var
e
=
0
,
t
=
this
.
goodsItems
;
e
<
t
.
length
;
e
++
){
var
o
=
t
[
e
];
o
&&
(
this
.
removeChild
(
o
),
ObjectPool$1
.
recycleObject
(
PoolName
,
o
),
o
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
o
.
onGoodsEnter
,
this
))}
this
.
goodsItems
=
[]},
t
.
prototype
.
hasHit
=
function
(
e
,
t
){
return
Math
.
abs
(
e
.
x
+
e
.
width
/
2
-
(
t
.
x
+
t
.
width
/
2
))
<
e
.
width
/
2
+
t
.
width
/
2
&&
Math
.
abs
(
e
.
y
+
e
.
height
/
2
-
(
t
.
y
+
t
.
height
/
2
))
<
e
.
height
/
2
+
t
.
height
/
2
},
t
}(
engine
.
Container
),
GameWrapper
=
function
(
o
){
function
e
(){
var
e
=
o
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
"food-fell-reset"
,
e
.
reset
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-start"
,
e
.
start
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-pause"
,
e
.
pause
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-resume"
,
e
.
resume
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-revive"
,
e
.
revive
,
e
),
engine
.
globalEvent
.
addEventListener
(
"food-fell-clear"
,
e
.
clear
,
e
),
e
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
e
.
onTap
,
e
);
var
t
=
e
.
_gameView
=
new
GameView
;
return
e
.
addChild
(
t
),
e
}
return
tslib
.
__extends
(
e
,
o
),
e
.
prototype
.
reset
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_gameView
.
visible
=!
0
,
this
.
_gameView
.
reset
()},
e
.
prototype
.
start
=
function
(
e
){
injectProps
(
e
.
data
),
this
.
_status
=
1
,
this
.
_gameView
.
start
()},
e
.
prototype
.
pause
=
function
(){
this
.
_gameView
.
pause
()},
e
.
prototype
.
resume
=
function
(){
this
.
_gameView
.
resume
()},
e
.
prototype
.
revive
=
function
(){
this
.
_gameView
.
revive
()},
e
.
prototype
.
clear
=
function
(){
this
.
_gameView
.
visible
=!
1
},
e
.
prototype
.
onTap
=
function
(
e
){},
e
}(
engine
.
Container
);
function
index
(
e
){
return
prepareProps
(),
injectProps
(
e
),
new
GameWrapper
}
module
.
exports
=
index
;
src/custom/xiaoxiaole/debug/props.js
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/xiaoxiaole/meta.json
0 → 100644
View file @
02c07996
{
"name"
:
"消消乐"
,
"desc"
:
"消消乐模块"
,
"props"
:
{
},
"assets"
:
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
},
{
"name"
:
"雨滴"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png"
,
"uuid"
:
"264a6192-d7bf-45e8-8f15-6ba2c439a532"
,
"ext"
:
".png"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png"
,
"uuid"
:
"eb88b42d-e151-4c1b-94b9-7c16f7bfac29"
,
"ext"
:
".png"
},
{
"name"
:
"石块"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/99b0af0c59fe79a415a3f032149cfacc27e3ac2c.png"
,
"uuid"
:
"ab1bdabc-21ba-46bf-9299-6c638f766c88"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹svga"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"game-reset"
:
{
"alias"
:
"重置"
,
"data"
:
{
}
},
"game-start"
:
{
"alias"
:
"开始"
}
},
"out"
:
{
"game-score-update"
:
{
"alias"
:
"分数更新"
,
"data"
:
{
"score"
:
"分数"
}
},
"game-time-update"
:
{
"alias"
:
"倒计时更新"
,
"data"
:
{
"time"
:
"剩余时间"
}
},
"game-over"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{
"score"
:
"分数"
,
"reason"
:
"结束原因(1:时间到了,2:玩家死亡)"
}
}
}
}
}
\ No newline at end of file
src/custom/xiaoxiaole/src/game/GameView.ts
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
{
playSound
,
createSvga
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
{
getTextureByName
}
from
"./utils"
;
export
default
class
GameView
extends
engine
.
Container
{
constructor
()
{
super
();
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
setup
()
{
}
}
src/custom/xiaoxiaole/src/game/GameWrapper.ts
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
import
{
injectProps
}
from
"../props"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_status
;
private
_gameView
:
GameView
;
constructor
()
{
super
();
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
}
}
src/custom/xiaoxiaole/src/game/utils.ts
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
createSvga
(
name
,
anchorName
?)
{
let
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
\ No newline at end of file
src/custom/xiaoxiaole/src/index.ts
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/xiaoxiaole/src/props.ts
0 → 100644
View file @
02c07996
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
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