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
84f68537
Commit
84f68537
authored
Jun 04, 2020
by
汪欢
Browse files
Options
Browse Files
Download
Plain Diff
拼图计时器bug
parents
ac73e807
9663a003
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
31 deletions
+35
-31
.DS_Store
dist/.DS_Store
+0
-0
pictures.json
dist/customs/pictures.json
+4
-3
app.js
src/custom/pictures/debug/app.js
+5
-3
load-assets.js
src/custom/pictures/debug/load-assets.js
+1
-1
main.js
src/custom/pictures/debug/main.js
+5
-9
main.js.map
src/custom/pictures/debug/main.js.map
+1
-1
meta.json
src/custom/pictures/meta.json
+3
-2
GameView.ts
src/custom/pictures/src/game/GameView.ts
+16
-12
No files found.
dist/.DS_Store
View file @
84f68537
No preview for this file type
dist/customs/pictures.json
View file @
84f68537
This diff is collapsed.
Click to expand it.
src/custom/pictures/debug/app.js
View file @
84f68537
...
@@ -47,7 +47,8 @@ function launchWithCustomModule(customModule) {
...
@@ -47,7 +47,8 @@ function launchWithCustomModule(customModule) {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png"
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png"
,
blockUrl
:
"888"
,
});
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
...
@@ -57,11 +58,12 @@ function launchWithCustomModule(customModule) {
...
@@ -57,11 +58,12 @@ function launchWithCustomModule(customModule) {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png"
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png"
,
// picUrl: "http://yun.duiba.com.cn/aurora/assets/d23e73d37ec01931e48cbd0a4095367044c5675c.png"
// picUrl: "http://yun.duiba.com.cn/aurora/assets/d23e73d37ec01931e48cbd0a4095367044c5675c.png"
blockUrl
:
"888"
});
});
},
10
*
1000
);
},
5
*
1000
);
});
});
engine
.
globalEvent
.
addEventListener
(
'pictures-time-update'
,
(
e
)
=>
{
engine
.
globalEvent
.
addEventListener
(
'pictures-time-update'
,
(
e
)
=>
{
// console.log(e.type, e.data);
// console.log(e.type, e.data);
...
...
src/custom/pictures/debug/load-assets.js
View file @
84f68537
...
@@ -6,7 +6,7 @@ const assets = [
...
@@ -6,7 +6,7 @@ const assets = [
{
{
"name"
:
"玩家icon"
,
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png"
,
"uuid"
:
"
66f23d13-82a5-4cec-9496-301ec240d087
"
,
"uuid"
:
"
888
"
,
"ext"
:
".png"
"ext"
:
".png"
},
},
{
{
...
...
src/custom/pictures/debug/main.js
View file @
84f68537
...
@@ -67,12 +67,6 @@
...
@@ -67,12 +67,6 @@
});
});
//# sourceMappingURL=qietu.js.map
//# 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
;
var
index
;
index
=
row
*
maxCol
+
col
;
index
=
row
*
maxCol
+
col
;
...
@@ -104,6 +98,11 @@
...
@@ -104,6 +98,11 @@
}
}
GameView
.
prototype
.
start
=
function
()
{
GameView
.
prototype
.
start
=
function
()
{
var
_this
=
this
;
var
_this
=
this
;
if
(
!
this
.
guideHole
)
{
this
.
guideHole
=
new
engine
.
Image
();
this
.
guideHole
.
source
=
'asset://'
+
props
.
blockUrl
;
this
.
guideHole
.
mouseChildren
=
this
.
guideHole
.
mouseEnabled
=
false
;
}
if
(
this
.
pictures
)
{
if
(
this
.
pictures
)
{
for
(
var
_i
=
0
,
_a
=
this
.
pictures
;
_i
<
_a
.
length
;
_i
++
)
{
for
(
var
_i
=
0
,
_a
=
this
.
pictures
;
_i
<
_a
.
length
;
_i
++
)
{
var
pic
=
_a
[
_i
];
var
pic
=
_a
[
_i
];
...
@@ -143,7 +142,6 @@
...
@@ -143,7 +142,6 @@
if
(
GAME_TIME
<
10
)
{
if
(
GAME_TIME
<
10
)
{
GAME_TIME
=
'0'
+
GAME_TIME
;
GAME_TIME
=
'0'
+
GAME_TIME
;
}
}
console
.
log
(
GAME_TIME
);
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
second
:
this
.
getSecond
(),
second
:
this
.
getSecond
(),
});
});
...
@@ -171,8 +169,6 @@
...
@@ -171,8 +169,6 @@
};
};
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
;
...
...
src/custom/pictures/debug/main.js.map
View file @
84f68537
This diff is collapsed.
Click to expand it.
src/custom/pictures/meta.json
View file @
84f68537
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
{
{
"name"
:
"遮罩"
,
"name"
:
"遮罩"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png"
,
"uuid"
:
"
66f23d13-82a5-4cec-9496-301ec240d087
"
,
"uuid"
:
"
888
"
,
"ext"
:
".png"
"ext"
:
".png"
}
}
],
],
...
@@ -58,7 +58,8 @@
...
@@ -58,7 +58,8 @@
"pictures-start"
:
{
"pictures-start"
:
{
"alias"
:
"开始"
,
"alias"
:
"开始"
,
"data"
:
{
"data"
:
{
"picUrl"
:
"图片路径"
"picUrl"
:
"图片路径"
,
"blockUrl"
:
"blockUrl"
}
}
},
},
"pictures-stop"
:
{
"pictures-stop"
:
{
...
...
src/custom/pictures/src/game/GameView.ts
View file @
84f68537
...
@@ -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
,
getTexture
ByName
}
from
"./utils"
;
import
{
getIndexFromRC
,
getRandomArray
,
getTexture
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
ObjectPool
=
engine
.
ObjectPool
;
// let OFFSET_X;
// let OFFSET_X;
...
@@ -24,6 +24,12 @@ export default class GameView extends engine.Container {
...
@@ -24,6 +24,12 @@ export default class GameView extends engine.Container {
private
_timeCounter
=
0
;
private
_timeCounter
=
0
;
start
()
{
start
()
{
if
(
!
this
.
guideHole
)
{
this
.
guideHole
=
new
engine
.
Image
();
this
.
guideHole
.
source
=
'asset://'
+
props
.
blockUrl
;
this
.
guideHole
.
mouseChildren
=
this
.
guideHole
.
mouseEnabled
=
false
;
}
if
(
this
.
pictures
)
{
if
(
this
.
pictures
)
{
for
(
const
pic
of
this
.
pictures
)
{
for
(
const
pic
of
this
.
pictures
)
{
if
(
pic
&&
pic
.
parent
)
if
(
pic
&&
pic
.
parent
)
...
@@ -77,10 +83,10 @@ export default class GameView extends engine.Container {
...
@@ -77,10 +83,10 @@ export default class GameView extends engine.Container {
GAME_TIME
-=
0.01
GAME_TIME
-=
0.01
GAME_TIME
=
this
.
afterPointTwo
(
GAME_TIME
);
GAME_TIME
=
this
.
afterPointTwo
(
GAME_TIME
);
GAME_TIME
=
GAME_TIME
.
toFixed
(
2
)
GAME_TIME
=
GAME_TIME
.
toFixed
(
2
)
if
(
GAME_TIME
<
10
)
{
if
(
GAME_TIME
<
10
)
{
GAME_TIME
=
'0'
+
GAME_TIME
GAME_TIME
=
'0'
+
GAME_TIME
}
}
console
.
log
(
GAME_TIME
);
//
console.log(GAME_TIME);
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-time-update'
,
{
...
@@ -96,12 +102,12 @@ export default class GameView extends engine.Container {
...
@@ -96,12 +102,12 @@ export default class GameView extends engine.Container {
}
}
afterPointTwo
(
n
)
{
afterPointTwo
(
n
)
{
var
floatN
=
parseFloat
(
n
);
var
floatN
=
parseFloat
(
n
);
if
(
isNaN
(
floatN
))
{
if
(
isNaN
(
floatN
))
{
return
;
return
;
}
}
floatN
=
Math
.
round
(
floatN
*
100
)
/
100
;
floatN
=
Math
.
round
(
floatN
*
100
)
/
100
;
...
@@ -148,12 +154,10 @@ export default class GameView extends engine.Container {
...
@@ -148,12 +154,10 @@ export default class GameView extends engine.Container {
private
picturesWrapper
:
engine
.
Sprite
;
private
picturesWrapper
:
engine
.
Sprite
;
private
guideHole
:
engine
.
Sprit
e
;
private
guideHole
:
engine
.
Imag
e
;
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
;
...
@@ -237,10 +241,10 @@ export default class GameView extends engine.Container {
...
@@ -237,10 +241,10 @@ export default class GameView extends engine.Container {
}
}
listenStageOn
=
1
;
listenStageOn
=
1
;
stageOnUp
(
e
)
{
stageOnUp
(
e
)
{
this
.
stage
.
removeEventListener
(
this
.
stage
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_MOVE
,
engine
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onMove
,
this
.
onMove
,
...
@@ -318,7 +322,7 @@ export default class GameView extends engine.Container {
...
@@ -318,7 +322,7 @@ export default class GameView extends engine.Container {
this
.
dragPic
.
y
=
this
.
distanceY
this
.
dragPic
.
y
=
this
.
distanceY
}
}
}
}
private
onSuccess
()
{
private
onSuccess
()
{
...
@@ -329,7 +333,7 @@ export default class GameView extends engine.Container {
...
@@ -329,7 +333,7 @@ export default class GameView extends engine.Container {
onMove
(
e
:
engine
.
MouseEvent
)
{
onMove
(
e
:
engine
.
MouseEvent
)
{
// 当前图片的位置
// 当前图片的位置
this
.
dragPic
.
x
=
e
.
stageX
-
this
.
localPicX
-
(
750
-
props
.
W
)
/
2
;
this
.
dragPic
.
x
=
e
.
stageX
-
this
.
localPicX
-
(
750
-
props
.
W
)
/
2
;
this
.
dragPic
.
y
=
e
.
stageY
-
this
.
localPicY
-
(
this
.
stage
.
height
-
props
.
H
)
/
2
;
this
.
dragPic
.
y
=
e
.
stageY
-
this
.
localPicY
-
(
this
.
stage
.
height
-
props
.
H
)
/
2
;
console
.
log
(
'fuck on this.stage.height'
,
this
.
stage
.
height
)
console
.
log
(
'fuck on this.stage.height'
,
this
.
stage
.
height
)
// console.log(this.dragPic.x, this.dragPic.y)
// console.log(this.dragPic.x, this.dragPic.y)
...
...
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