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
7b6e842f
Commit
7b6e842f
authored
Jun 03, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
95b95b2b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
+28
-14
pictures.json
dist/customs/pictures.json
+2
-2
main.js
src/custom/pictures/debug/main.js
+12
-2
main.js.map
src/custom/pictures/debug/main.js.map
+1
-1
GameView.ts
src/custom/pictures/src/game/GameView.ts
+13
-9
No files found.
dist/customs/pictures.json
View file @
7b6e842f
This diff is collapsed.
Click to expand it.
src/custom/pictures/debug/main.js
View file @
7b6e842f
...
...
@@ -12,6 +12,7 @@
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
var
picMap
=
{};
var
posMap
=
{};
...
...
@@ -59,6 +60,7 @@
posMap
[
url
]
=
pos
.
concat
([]);
return
[
spr
,
pos
];
});
//# sourceMappingURL=qietu.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
...
...
@@ -75,6 +77,7 @@
return
.
5
-
Math
.
random
();
});
}
//# sourceMappingURL=utils.js.map
var
MAX_COL
;
var
MAX_ROW
;
...
...
@@ -94,6 +97,11 @@
}
GameView
.
prototype
.
start
=
function
()
{
var
_this
=
this
;
for
(
var
_i
=
0
,
_a
=
this
.
pictures
;
_i
<
_a
.
length
;
_i
++
)
{
var
pic
=
_a
[
_i
];
if
(
pic
&&
pic
.
parent
)
pic
.
parent
.
removeChild
(
pic
);
}
console
.
log
(
'on start'
);
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
second
:
this
.
getSecond
(),
...
...
@@ -110,7 +118,7 @@
for
(;
i
<
len
;
i
++
)
{
this
.
dragPic
=
this
.
pictures
[
i
];
this
.
pictures
[
i
].
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDown
,
this
);
var
_
a
=
posList
[
i
],
x
=
_a
[
0
],
y
=
_a
[
1
];
var
_
b
=
posList
[
i
],
x
=
_b
[
0
],
y
=
_b
[
1
];
this
.
dragPic
.
x
=
x
;
this
.
dragPic
.
y
=
y
;
}
...
...
@@ -221,7 +229,7 @@
GameView
.
prototype
.
onSuccess
=
function
()
{
console
.
log
(
'拼图成功!'
);
this
.
stop
();
engine
.
globalEvent
.
dispatchEvent
(
'pictures-game-success'
,
{});
engine
.
globalEvent
.
dispatchEvent
(
'pictures-game-success'
,
{
time
:
this
.
_timeCounter
});
};
GameView
.
prototype
.
onMove
=
function
(
e
)
{
this
.
dragPic
.
x
=
e
.
stageX
-
this
.
localPicX
;
...
...
@@ -251,6 +259,7 @@
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
...
...
@@ -258,6 +267,7 @@
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
...
...
src/custom/pictures/debug/main.js.map
View file @
7b6e842f
This diff is collapsed.
Click to expand it.
src/custom/pictures/src/game/GameView.ts
View file @
7b6e842f
...
...
@@ -25,6 +25,10 @@ export default class GameView extends engine.Container {
// private countTime = 20;
start
()
{
for
(
const
pic
of
this
.
pictures
)
{
if
(
pic
&&
pic
.
parent
)
pic
.
parent
.
removeChild
(
pic
);
}
console
.
log
(
'on start'
)
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
second
:
this
.
getSecond
(),
...
...
@@ -80,12 +84,12 @@ export default class GameView extends engine.Container {
}
}
afterPointTwo
(
n
){
afterPointTwo
(
n
)
{
var
floatN
=
parseFloat
(
n
);
if
(
isNaN
(
floatN
))
{
return
;
if
(
isNaN
(
floatN
))
{
return
;
}
floatN
=
Math
.
round
(
floatN
*
100
)
/
100
;
floatN
=
Math
.
round
(
floatN
*
100
)
/
100
;
return
floatN
;
}
...
...
@@ -118,7 +122,7 @@ export default class GameView extends engine.Container {
centerX
:
number
;
centerY
:
number
;
pictures
;
pictures
:
engine
.
Sprite
[]
;
// 点击图片时的索引
index
;
...
...
@@ -235,7 +239,7 @@ export default class GameView extends engine.Container {
this
.
pictures
[
dragPicIndex
]
=
dropPic
;
// 图片还是在原来的位置
if
(
dragPicIndex
===
dropPicIndex
)
{
if
(
dragPicIndex
===
dropPicIndex
)
{
this
.
dragPic
.
x
=
this
.
distanceX
this
.
dragPic
.
y
=
this
.
distanceY
}
...
...
@@ -252,7 +256,7 @@ export default class GameView extends engine.Container {
this
.
onSuccess
();
}
}
else
{
}
else
{
this
.
dragPic
.
x
=
this
.
distanceX
this
.
dragPic
.
y
=
this
.
distanceY
}
...
...
@@ -267,7 +271,7 @@ export default class GameView extends engine.Container {
private
onSuccess
()
{
console
.
log
(
'拼图成功!'
);
this
.
stop
();
engine
.
globalEvent
.
dispatchEvent
(
'pictures-game-success'
,
{});
engine
.
globalEvent
.
dispatchEvent
(
'pictures-game-success'
,
{
time
:
this
.
_timeCounter
});
}
onMove
(
e
:
engine
.
MouseEvent
)
{
...
...
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