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
3f49b0e4
Commit
3f49b0e4
authored
Jun 03, 2020
by
汪欢
Browse files
Options
Browse Files
Download
Plain Diff
拼图0.2
parents
6d9121cd
942737e1
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
69 deletions
+79
-69
.DS_Store
dist/.DS_Store
+0
-0
pictures.json
dist/customs/pictures.json
+13
-27
app.js
src/custom/pictures/debug/app.js
+1
-1
main.js
src/custom/pictures/debug/main.js
+20
-8
main.js.map
src/custom/pictures/debug/main.js.map
+5
-1
meta.json
src/custom/pictures/meta.json
+15
-24
GameView.ts
src/custom/pictures/src/game/GameView.ts
+9
-2
qietu.ts
src/custom/pictures/src/game/qietu.ts
+16
-6
No files found.
dist/.DS_Store
View file @
3f49b0e4
No preview for this file type
dist/customs/pictures.json
View file @
3f49b0e4
This diff is collapsed.
Click to expand it.
src/custom/pictures/debug/app.js
View file @
3f49b0e4
...
@@ -47,7 +47,7 @@ function launchWithCustomModule(customModule) {
...
@@ -47,7 +47,7 @@ function launchWithCustomModule(customModule) {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/
fb06e66c26f17b00f677367bd7571a1aa9b1ade4
.png"
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/
e1593b97c27077b85b92f7eaaeae1ed64a1eb79a
.png"
});
});
},
500
);
},
500
);
...
...
src/custom/pictures/debug/main.js
View file @
3f49b0e4
...
@@ -12,12 +12,16 @@
...
@@ -12,12 +12,16 @@
function
injectProps
(
p
)
{
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
engine
.
injectProp
(
props
,
p
);
}
}
//# sourceMappingURL=props.js.map
var
picMap
=
{};
var
posMap
=
{};
var
qietu
=
(
function
(
parent
,
url
,
MAX_COL
,
MAX_ROW
)
{
var
qietu
=
(
function
(
parent
,
url
,
MAX_COL
,
MAX_ROW
)
{
var
W
=
600
;
if
(
picMap
[
url
])
{
var
H
=
600
;
return
[
picMap
[
url
],
posMap
[
url
]];
var
GAP
=
10
;
}
var
W
=
props
.
W
;
var
H
=
props
.
H
;
var
GAP
=
props
.
GAP
;
var
spr
=
[];
var
spr
=
[];
var
pos
=
[];
var
pos
=
[];
var
_loop_1
=
function
(
row
)
{
var
_loop_1
=
function
(
row
)
{
...
@@ -51,10 +55,17 @@
...
@@ -51,10 +55,17 @@
for
(
var
row
=
0
;
row
<
MAX_ROW
;
row
++
)
{
for
(
var
row
=
0
;
row
<
MAX_ROW
;
row
++
)
{
_loop_1
(
row
);
_loop_1
(
row
);
}
}
picMap
[
url
]
=
spr
.
concat
([]);
posMap
[
url
]
=
pos
.
concat
([]);
return
[
spr
,
pos
];
return
[
spr
,
pos
];
});
});
//# sourceMappingURL=qietu.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
function
getIndexFromRC
(
row
,
col
,
maxCol
)
{
function
getIndexFromRC
(
row
,
col
,
maxCol
)
{
var
index
=
row
*
maxCol
+
col
;
var
index
=
row
*
maxCol
+
col
;
return
index
;
return
index
;
...
@@ -64,7 +75,6 @@
...
@@ -64,7 +75,6 @@
return
.
5
-
Math
.
random
();
return
.
5
-
Math
.
random
();
});
});
}
}
//# sourceMappingURL=utils.js.map
var
MAX_COL
;
var
MAX_COL
;
var
MAX_ROW
;
var
MAX_ROW
;
...
@@ -89,6 +99,7 @@
...
@@ -89,6 +99,7 @@
second
:
this
.
getSecond
(),
second
:
this
.
getSecond
(),
});
});
var
result
=
qietu
(
this
.
picturesWrapper
,
props
.
picUrl
,
MAX_COL
,
MAX_ROW
);
var
result
=
qietu
(
this
.
picturesWrapper
,
props
.
picUrl
,
MAX_COL
,
MAX_ROW
);
this
.
picturesWrapper
.
addChild
(
this
.
guideHole
);
this
.
pictures
=
result
[
0
];
this
.
pictures
=
result
[
0
];
this
.
rightList
=
this
.
pictures
.
concat
([]);
this
.
rightList
=
this
.
pictures
.
concat
([]);
var
posList
=
result
[
1
];
var
posList
=
result
[
1
];
...
@@ -138,6 +149,8 @@
...
@@ -138,6 +149,8 @@
};
};
GameView
.
prototype
.
createRects
=
function
()
{
};
GameView
.
prototype
.
createRects
=
function
()
{
};
GameView
.
prototype
.
setup
=
function
()
{
GameView
.
prototype
.
setup
=
function
()
{
this
.
guideHole
=
new
engine
.
Image
(
getTextureByName
(
'遮罩'
));
this
.
guideHole
.
mouseChildren
=
this
.
guideHole
.
mouseEnabled
=
false
;
MAX_COL
=
props
.
MAX_COL
;
MAX_COL
=
props
.
MAX_COL
;
MAX_ROW
=
props
.
MAX_ROW
;
MAX_ROW
=
props
.
MAX_ROW
;
GAME_TIME
=
props
.
GAME_TIME
;
GAME_TIME
=
props
.
GAME_TIME
;
...
@@ -168,6 +181,7 @@
...
@@ -168,6 +181,7 @@
};
};
GameView
.
prototype
.
stageOnUp
=
function
(
e
)
{
GameView
.
prototype
.
stageOnUp
=
function
(
e
)
{
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onMove
,
this
);
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onMove
,
this
);
this
.
picturesWrapper
.
addChild
(
this
.
guideHole
);
var
curJ
=
Math
.
floor
(
this
.
centerX
/
(
w
+
GAP
));
var
curJ
=
Math
.
floor
(
this
.
centerX
/
(
w
+
GAP
));
var
curI
=
Math
.
floor
(
this
.
centerY
/
(
h
+
GAP
));
var
curI
=
Math
.
floor
(
this
.
centerY
/
(
h
+
GAP
));
if
(
curJ
<
MAX_COL
&&
curI
<
MAX_ROW
)
{
if
(
curJ
<
MAX_COL
&&
curI
<
MAX_ROW
)
{
...
@@ -237,7 +251,6 @@
...
@@ -237,7 +251,6 @@
};
};
return
GameWrapper
;
return
GameWrapper
;
}(
engine
.
Container
));
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
function
index
(
props
)
{
prepareProps
();
prepareProps
();
...
@@ -245,7 +258,6 @@
...
@@ -245,7 +258,6 @@
var
instance
=
new
GameWrapper
();
var
instance
=
new
GameWrapper
();
return
instance
;
return
instance
;
}
}
//# sourceMappingURL=index.js.map
return
index
;
return
index
;
...
...
src/custom/pictures/debug/main.js.map
View file @
3f49b0e4
This diff is collapsed.
Click to expand it.
src/custom/pictures/meta.json
View file @
3f49b0e4
...
@@ -10,22 +10,26 @@
...
@@ -10,22 +10,26 @@
"MAX_ROW"
:
{
"MAX_ROW"
:
{
"alias"
:
"图片分成几行"
,
"alias"
:
"图片分成几行"
,
"type"
:
"number"
,
"type"
:
"number"
,
<<<<<<<
HEAD
"default"
:
3
"default"
:
3
=======
"default"
:
4
>>>>>>>
942737e103
f
614239
f
421
c
98
ab
5
a
0e18935
bc
709
},
},
"W"
:
{
"W"
:
{
"alias"
:
"图片的宽度"
,
"alias"
:
"图片的宽度"
,
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
6
00
"default"
:
6
18
},
},
"H"
:
{
"H"
:
{
"alias"
:
"图片的高度"
,
"alias"
:
"图片的高度"
,
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
600
"default"
:
827
},
},
"GAP"
:
{
"GAP"
:
{
"alias"
:
"图片间隙"
,
"alias"
:
"图片间隙"
,
"type"
:
"number"
,
"type"
:
"number"
,
"default"
:
1
0
"default"
:
0
},
},
"GAME_TIME"
:
{
"GAME_TIME"
:
{
"alias"
:
"游戏时间"
,
"alias"
:
"游戏时间"
,
...
@@ -36,36 +40,23 @@
...
@@ -36,36 +40,23 @@
},
},
"assets"
:
[
"assets"
:
[
{
{
"name"
:
"
测试资源
"
,
"name"
:
"
遮罩
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5
0a7212a113175fa18c866b005d98f07c558dc77
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5
b3e30496b2d9fdafb0cf3835fd6704ce10e45b4
.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
"ext"
:
".png"
}
}
],
],
"events"
:
{
"events"
:
{
"in"
:
{
"in"
:
{
"pictures-reset"
:
{
"alias"
:
"重置"
,
"pictures-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"data"
:
{
"goodsProbability"
:
"[0.2,0.5,0.3]道具概率(雨滴、石头、炸弹),所有概率相加为1"
,
"picUrl"
:
"图片路径"
"countDown"
:
"倒计时(s)"
,
"acceleratedSpeed"
:
"道具掉落加速度(单位:每秒)"
}
}
},
},
"pictures-start"
:
{
"pictures-stop"
:
{
"alias"
:
"开始"
"alias"
:
"停止"
},
"pictures-revive"
:
{
"alias"
:
"复活"
},
"pictures-pause"
:
{
"alias"
:
"暂停"
},
"pictures-resume"
:
{
"alias"
:
"恢复"
},
"pictures-clear"
:
{
"alias"
:
"清空,通过reset事件恢复"
}
}
},
},
"out"
:
{
"out"
:
{
...
...
src/custom/pictures/src/game/GameView.ts
View file @
3f49b0e4
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
{
props
}
from
"../props"
;
import
{
props
}
from
"../props"
;
import
qietu
from
"./qietu"
;
import
qietu
from
"./qietu"
;
import
{
getIndexFromRC
,
getRandomArray
}
from
"./utils"
;
import
{
getIndexFromRC
,
getRandomArray
,
getTextureByName
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
ObjectPool
=
engine
.
ObjectPool
;
let
MAX_COL
;
let
MAX_COL
;
...
@@ -32,6 +32,7 @@ export default class GameView extends engine.Container {
...
@@ -32,6 +32,7 @@ export default class GameView extends engine.Container {
// 图片一维数组
// 图片一维数组
const
result
=
qietu
(
this
.
picturesWrapper
,
props
.
picUrl
,
MAX_COL
,
MAX_ROW
);
const
result
=
qietu
(
this
.
picturesWrapper
,
props
.
picUrl
,
MAX_COL
,
MAX_ROW
);
this
.
picturesWrapper
.
addChild
(
this
.
guideHole
);
this
.
pictures
=
result
[
0
];
this
.
pictures
=
result
[
0
];
this
.
rightList
=
this
.
pictures
.
concat
([]);
this
.
rightList
=
this
.
pictures
.
concat
([]);
const
posList
=
result
[
1
];
const
posList
=
result
[
1
];
...
@@ -40,7 +41,7 @@ export default class GameView extends engine.Container {
...
@@ -40,7 +41,7 @@ export default class GameView extends engine.Container {
let
i
=
0
;
let
i
=
0
;
let
len
;
let
len
;
len
=
this
.
pictures
.
length
;
len
=
this
.
pictures
.
length
;
for
(;
i
<
len
;
i
++
)
{
for
(;
i
<
len
;
i
++
)
{
this
.
dragPic
=
this
.
pictures
[
i
];
this
.
dragPic
=
this
.
pictures
[
i
];
...
@@ -128,9 +129,13 @@ export default class GameView extends engine.Container {
...
@@ -128,9 +129,13 @@ export default class GameView extends engine.Container {
private
picturesWrapper
:
engine
.
Sprite
;
private
picturesWrapper
:
engine
.
Sprite
;
private
guideHole
:
engine
.
Sprite
;
createRects
()
{
}
createRects
()
{
}
setup
()
{
setup
()
{
this
.
guideHole
=
new
engine
.
Image
(
getTextureByName
(
'遮罩'
));
this
.
guideHole
.
mouseChildren
=
this
.
guideHole
.
mouseEnabled
=
false
;
MAX_COL
=
props
.
MAX_COL
;
MAX_COL
=
props
.
MAX_COL
;
MAX_ROW
=
props
.
MAX_ROW
;
MAX_ROW
=
props
.
MAX_ROW
;
GAME_TIME
=
props
.
GAME_TIME
;
GAME_TIME
=
props
.
GAME_TIME
;
...
@@ -193,6 +198,8 @@ export default class GameView extends engine.Container {
...
@@ -193,6 +198,8 @@ export default class GameView extends engine.Container {
this
this
);
);
this
.
picturesWrapper
.
addChild
(
this
.
guideHole
);
// 判断图片是否进入另一张图片的范围内
// 判断图片是否进入另一张图片的范围内
// 图片第几行第几列
// 图片第几行第几列
let
curJ
=
Math
.
floor
(
this
.
centerX
/
(
w
+
GAP
));
let
curJ
=
Math
.
floor
(
this
.
centerX
/
(
w
+
GAP
));
...
...
src/custom/pictures/src/game/qietu.ts
View file @
3f49b0e4
export
default
(
parent
,
url
,
MAX_COL
,
MAX_ROW
)
=>
{
import
{
props
}
from
"../props"
;
const
urls
=
[];
const
picMap
=
{};
const
posMap
=
{};
export
default
(
parent
,
url
,
MAX_COL
,
MAX_ROW
)
=>
{
if
(
picMap
[
url
])
{
return
[
picMap
[
url
],
posMap
[
url
]]
}
const
W
=
600
;
const
W
=
props
.
W
;
const
H
=
600
;
const
H
=
props
.
H
;
const
GAP
=
10
;
const
GAP
=
props
.
GAP
;
const
spr
=
[];
const
spr
=
[];
const
pos
=
[]
const
pos
=
[]
...
@@ -18,7 +25,8 @@ export default (parent, url,MAX_COL,MAX_ROW) => {
...
@@ -18,7 +25,8 @@ export default (parent, url,MAX_COL,MAX_ROW) => {
parent
.
addChild
(
child
);
parent
.
addChild
(
child
);
child
.
x
=
col
*
(
W
/
MAX_COL
+
GAP
);
child
.
x
=
col
*
(
W
/
MAX_COL
+
GAP
);
child
.
y
=
row
*
(
H
/
MAX_ROW
+
GAP
);
child
.
y
=
row
*
(
H
/
MAX_ROW
+
GAP
);
pos
.
push
([
child
.
x
,
child
.
y
]);
pos
.
push
([
child
.
x
,
child
.
y
]);
// child.texture.addEventListener('update', () => {
child
.
addEventListener
(
engine
.
Event
.
COMPLETE
,
()
=>
{
child
.
addEventListener
(
engine
.
Event
.
COMPLETE
,
()
=>
{
const
uvs
=
new
Float32Array
([
const
uvs
=
new
Float32Array
([
col
/
MAX_COL
,
col
/
MAX_COL
,
...
@@ -36,6 +44,8 @@ export default (parent, url,MAX_COL,MAX_ROW) => {
...
@@ -36,6 +44,8 @@ export default (parent, url,MAX_COL,MAX_ROW) => {
});
});
}
}
}
}
picMap
[
url
]
=
spr
.
concat
([]);
posMap
[
url
]
=
pos
.
concat
([]);;
// console.log(spr);
// console.log(spr);
return
[
spr
,
pos
];
return
[
spr
,
pos
];
};
};
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