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
e0fcb941
Commit
e0fcb941
authored
Jul 10, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
bf6a5999
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1386 additions
and
37 deletions
+1386
-37
bjxd-game.json
dist/customs/bjxd-game.json
+5
-5
xiaoxiaole.json
dist/customs/xiaoxiaole.json
+93
-0
meta.json
src/custom/bjxd-game/meta.json
+5
-5
app.js
src/custom/xiaoxiaole/debug/app.js
+2
-16
index.html
src/custom/xiaoxiaole/debug/index.html
+2
-2
main.js
src/custom/xiaoxiaole/debug/main.js
+601
-1
main.js.map
src/custom/xiaoxiaole/debug/main.js.map
+1
-0
meta.json
src/custom/xiaoxiaole/meta.json
+52
-4
GameView.ts
src/custom/xiaoxiaole/src/game/GameView.ts
+446
-1
GameWrapper.ts
src/custom/xiaoxiaole/src/game/GameWrapper.ts
+16
-3
MapData.ts
src/custom/xiaoxiaole/src/game/MapData.ts
+104
-0
Element.ts
src/custom/xiaoxiaole/src/game/ele/Element.ts
+59
-0
No files found.
dist/customs/bjxd-game.json
View file @
e0fcb941
...
...
@@ -96,19 +96,19 @@
"assets"
:
[
{
"name"
:
"bg1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
b2c76b2a753317e5ea935bab22097a43a4c9f7cb
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
e6ab7c1e191d30a2b068fa4a0e867040b9396226
.png"
,
"uuid"
:
"bg1"
,
"ext"
:
".png"
},
{
"name"
:
"bg2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7f8261a9dd7b83cdc3b95b6f3f385e7a91e49682
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
a2d611fa5af2b26ffd57a24ff524d2a0a4fe1564
.png"
,
"uuid"
:
"bg2"
,
"ext"
:
".png"
},
{
"name"
:
"bg3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
72c688f9c2f495fe234277256923804df2ab75e
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
9258aed59e36471a4136ce7fbc4ca7e300caf07
.png"
,
"uuid"
:
"bg3"
,
"ext"
:
".png"
},
...
...
@@ -120,13 +120,13 @@
},
{
"name"
:
"yindao1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
f21d5429dbd947e66613bd6c5d864fdcfd104bd4
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
4449285320882460ae0dd0b59b3c73e0bb92def6
.png"
,
"uuid"
:
"yindao1"
,
"ext"
:
".png"
},
{
"name"
:
"yindao2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7ece2d8c438ec06004f7f40d9798ab72f0e6a244
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
1c914031834736b93e9b2a94a4e8a643871795f7
.png"
,
"uuid"
:
"yindao2"
,
"ext"
:
".png"
},
...
...
dist/customs/xiaoxiaole.json
0 → 100644
View file @
e0fcb941
This diff is collapsed.
Click to expand it.
src/custom/bjxd-game/meta.json
View file @
e0fcb941
...
...
@@ -97,19 +97,19 @@
"assets"
:
[
{
"name"
:
"bg1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
b2c76b2a753317e5ea935bab22097a43a4c9f7cb
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
e6ab7c1e191d30a2b068fa4a0e867040b9396226
.png"
,
"uuid"
:
"bg1"
,
"ext"
:
".png"
},
{
"name"
:
"bg2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7f8261a9dd7b83cdc3b95b6f3f385e7a91e49682
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
a2d611fa5af2b26ffd57a24ff524d2a0a4fe1564
.png"
,
"uuid"
:
"bg2"
,
"ext"
:
".png"
},
{
"name"
:
"bg3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
72c688f9c2f495fe234277256923804df2ab75e
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8
9258aed59e36471a4136ce7fbc4ca7e300caf07
.png"
,
"uuid"
:
"bg3"
,
"ext"
:
".png"
},
...
...
@@ -121,13 +121,13 @@
},
{
"name"
:
"yindao1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
f21d5429dbd947e66613bd6c5d864fdcfd104bd4
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
4449285320882460ae0dd0b59b3c73e0bb92def6
.png"
,
"uuid"
:
"yindao1"
,
"ext"
:
".png"
},
{
"name"
:
"yindao2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7ece2d8c438ec06004f7f40d9798ab72f0e6a244
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
1c914031834736b93e9b2a94a4e8a643871795f7
.png"
,
"uuid"
:
"yindao2"
,
"ext"
:
".png"
},
...
...
src/custom/xiaoxiaole/debug/app.js
View file @
e0fcb941
...
...
@@ -2,7 +2,7 @@
* Created by renjianfeng on 2020-03-13.
*/
const
customId
=
'
food-fell
'
;
const
customId
=
'
xiaoxiaole
'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
...
...
@@ -45,23 +45,9 @@ function launchWithCustomModule(customModule) {
},
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'
);
engine
.
globalEvent
.
dispatchEvent
(
'game-init'
);
},
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
)
{
...
...
src/custom/xiaoxiaole/debug/index.html
View file @
e0fcb941
...
...
@@ -3,7 +3,7 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
美食从天而降
</title>
<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"
/>
...
...
@@ -22,7 +22,7 @@
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
red
;
/* background-color: red; */
}
</style>
</head>
...
...
src/custom/xiaoxiaole/debug/main.js
View file @
e0fcb941
This diff is collapsed.
Click to expand it.
src/custom/xiaoxiaole/debug/main.js.map
0 → 100644
View file @
e0fcb941
This diff is collapsed.
Click to expand it.
src/custom/xiaoxiaole/meta.json
View file @
e0fcb941
...
...
@@ -6,16 +6,64 @@
},
"assets"
:
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"name"
:
"底图"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/109e30fa662276e0ee4f2e2c35b85bee6f300050.png"
,
"uuid"
:
"map"
,
"ext"
:
".png"
},
{
"name"
:
"房子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df155804a46c708a714365b7247141ba0add45e5.png"
,
"uuid"
:
"home"
,
"ext"
:
".png"
},
{
"name"
:
"白虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b486b4a72c58850bbd1930b994e08802e34fb3e3.png"
,
"uuid"
:
"btiger"
,
"ext"
:
".png"
},
{
"name"
:
"雌虎"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/c41afceb285432ed2c17c643df96efc20893adc8.png"
,
"uuid"
:
"gtiger"
,
"ext"
:
".png"
},
{
"name"
:
"猴子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/ef7bc5d1fc38267adba71e07d517330f249d23ba.png"
,
"uuid"
:
"monkey"
,
"ext"
:
".png"
},
{
"name"
:
"鸟"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/9ad18dfa34e1729e9893ac362975f9e062263f70.png"
,
"uuid"
:
"bird"
,
"ext"
:
".png"
},
{
"name"
:
"树熊"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/277aa43d9f1bf3dd7a18e627335a166f0509684c.png"
,
"uuid"
:
"koala"
,
"ext"
:
".png"
},
{
"name"
:
"选中框"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a3ce52a41ed53ccfa7ce404dbc10102961c4a805.png"
,
"uuid"
:
"selected"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"game-init"
:{
"alias"
:
"初始化第一关"
,
"data"
:
{
}
},
"game-reset"
:
{
"alias"
:
"
重置
"
,
"alias"
:
"
关卡通过重玩之类的重置关卡
"
,
"data"
:
{
}
...
...
src/custom/xiaoxiaole/src/game/GameView.ts
View file @
e0fcb941
This diff is collapsed.
Click to expand it.
src/custom/xiaoxiaole/src/game/GameWrapper.ts
View file @
e0fcb941
...
...
@@ -7,12 +7,25 @@ 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
);
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
this
.
_gameView
);
engine
.
globalEvent
.
addEventListener
(
'game-init'
,
this
.
init
,
this
);
engine
.
globalEvent
.
addEventListener
(
'game-reset'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'game-start'
,
this
.
start
,
this
);
}
init
(){
this
.
_gameView
.
init
();
}
reset
(){
this
.
_gameView
.
reset
();
}
start
(){
this
.
_gameView
.
start
();
}
}
src/custom/xiaoxiaole/src/game/MapData.ts
0 → 100644
View file @
e0fcb941
import
Element
from
"./ele/Element"
;
export
enum
ElementType
{
btiger
=
1
,
gtiger
,
monkey
,
bird
,
koala
}
export
enum
GameEvent
{
SelectEle
=
"SelectEle"
,
}
export
default
class
MapData
{
//单格大小
static
itemsize
=
129
;
//
static
paddingb
=
10
;
static
paddingi
=
5
;
//
static
row
=
5
;
static
col
=
5
;
//行-列,对应位置
static
posData
=
{
};
static
eleidx
=
1
;
static
elePool
=
[];
static
getRy
(
r
){
return
this
.
paddingb
+
r
*
(
this
.
itemsize
+
this
.
paddingi
);
}
static
getCx
(
c
){
return
this
.
paddingb
+
c
*
(
this
.
itemsize
+
this
.
paddingi
);
}
static
getRCPos
(
r
,
c
){
let
x
=
this
.
getCx
(
c
);
let
y
=
this
.
getRy
(
r
);
return
[
x
,
y
];
}
static
adaptElePos
(
pos
,
wid
,
hei
){
let
x
=
pos
[
0
]
+
(
this
.
itemsize
-
wid
)
/
2
;
let
y
=
pos
[
1
]
+
(
this
.
itemsize
-
hei
)
/
2
;
return
[
x
,
y
];
}
static
getEtypeImgName
(
type
:
ElementType
){
let
ename
:
string
;
switch
(
type
){
case
ElementType
.
btiger
:
ename
=
"白虎"
;
break
;
case
ElementType
.
gtiger
:
ename
=
"雌虎"
;
break
;
case
ElementType
.
monkey
:
ename
=
"猴子"
;
break
;
case
ElementType
.
bird
:
ename
=
"鸟"
;
break
;
case
ElementType
.
koala
:
ename
=
"树熊"
;
break
;
default
:
console
.
error
(
"未定义元素类型"
);
break
;
}
return
ename
;
}
static
getRandEtype
(){
let
eletypeArr
=
[
ElementType
.
btiger
,
ElementType
.
gtiger
,
ElementType
.
monkey
,
ElementType
.
bird
,
ElementType
.
koala
];
let
etype
=
eletypeArr
[
Math
.
floor
(
Math
.
random
()
*
eletypeArr
.
length
)];
return
etype
;
}
static
getOneEle
(
type
:
ElementType
):
Element
{
let
ele
:
Element
;
if
(
this
.
elePool
.
length
>
0
){
ele
=
this
.
elePool
.
shift
();
}
else
{
ele
=
new
Element
();
}
ele
.
name
=
"ele_"
+
this
.
eleidx
;
this
.
eleidx
+=
1
;
ele
.
init
(
type
)
return
ele
;
}
static
recoverEle
(
ele
:
Element
){
this
.
elePool
.
push
(
ele
);
}
static
getDistance
(
p1
,
p2
){
let
p1x
=
p1
[
0
];
let
p1y
=
p1
[
1
];
let
p2x
=
p2
[
0
];
let
p2y
=
p2
[
1
];
let
dis
=
Math
.
sqrt
(
Math
.
pow
(
p1x
-
p2x
,
2
)
+
Math
.
pow
(
p1y
-
p2y
,
2
));
return
dis
;
}
}
\ No newline at end of file
src/custom/xiaoxiaole/src/game/ele/Element.ts
0 → 100644
View file @
e0fcb941
import
MapData
,
{
ElementType
,
GameEvent
}
from
"../MapData"
;
import
{
getTextureByName
}
from
"../utils"
;
export
default
class
Element
extends
engine
.
Container
{
type
:
ElementType
;
eimage
:
engine
.
Image
;
inrow
;
incol
;
set
touch
(
touch
){
this
.
mouseEnabled
=
touch
;
this
.
mouseChildren
=
touch
;
}
constructor
(){
super
();
this
.
width
=
MapData
.
itemsize
;
this
.
height
=
MapData
.
itemsize
;
this
.
eimage
=
new
engine
.
Image
();
this
.
addChild
(
this
.
eimage
);
this
.
touch
=
true
;
this
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
selectele
,
this
);
}
init
(
type
:
ElementType
){
this
.
scaleX
=
1
;
this
.
scaleY
=
1
;
this
.
type
=
type
;
let
ename
=
MapData
.
getEtypeImgName
(
type
);
this
.
eimage
.
texture
=
getTextureByName
(
ename
);
let
imgwid
=
this
.
eimage
.
texture
.
width
;
let
imghei
=
this
.
eimage
.
texture
.
height
;
// console.log("大小",imgwid,imghei);
this
.
eimage
.
x
=
(
this
.
width
-
imgwid
)
/
2
;
this
.
eimage
.
y
=
(
this
.
height
-
imghei
)
/
2
;
}
setrc
(
r
,
c
){
this
.
inrow
=
r
;
this
.
incol
=
c
;
}
selectele
(
e
:
engine
.
MouseEvent
){
engine
.
globalEvent
.
dispatchEvent
(
GameEvent
.
SelectEle
,{
r
:
this
.
inrow
,
c
:
this
.
incol
})
}
//飞到小屋
flyToHome
(){
}
changePos
(){
}
}
\ 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