Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PicturePuzzle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
PicturePuzzle
Commits
a43a8344
Commit
a43a8344
authored
Mar 11, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
c1ea66b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
10 deletions
+81
-10
custom-hot-zone.component.html
...app/common/custom-hot-zone/custom-hot-zone.component.html
+2
-2
Unit.ts
src/app/play/Unit.ts
+42
-0
play.component.ts
src/app/play/play.component.ts
+35
-7
resources.js
src/app/play/resources.js
+2
-1
star.mp3
src/assets/audio/star.mp3
+0
-0
star.png
src/assets/play/star.png
+0
-0
No files found.
src/app/common/custom-hot-zone/custom-hot-zone.component.html
View file @
a43a8344
<div
class=
"p-image-children-editor"
>
<div
class=
"p-image-children-editor"
>
<div
style=
"float: left; width:
30
%;border-right: 2px solid #ddd; border-bottom: 2px solid #ddd;"
>
<div
style=
"float: left; width:
25
%;border-right: 2px solid #ddd; border-bottom: 2px solid #ddd;"
>
<h5
style=
"margin-left: 2.5%;"
>
预览:
</h5>
<h5
style=
"margin-left: 2.5%;"
>
预览:
</h5>
<div
class=
"preview-box"
#
wrap
style=
"width: 200px; height: 300px;"
>
<div
class=
"preview-box"
#
wrap
style=
"width: 200px; height: 300px;"
>
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</div>
</div>
</div>
</div>
<div
style=
"float: left; width: 7
0
%"
>
<div
style=
"float: left; width: 7
5
%"
>
<div
nzAlign=
"middle"
>
<div
nzAlign=
"middle"
>
<div
class=
"img-box clearfix"
*
ngFor=
"let it of hotZoneArr; let i = index"
style=
"border-bottom: 1px solid #DDD; padding-bottom: 10px;"
>
<div
class=
"img-box clearfix"
*
ngFor=
"let it of hotZoneArr; let i = index"
style=
"border-bottom: 1px solid #DDD; padding-bottom: 10px;"
>
<div
style=
"float: left; height: 115px; position: relative; width: 250px; "
>
<div
style=
"float: left; height: 115px; position: relative; width: 250px; "
>
...
...
src/app/play/Unit.ts
View file @
a43a8344
...
@@ -1458,3 +1458,45 @@ export function shake(item, time = 0.5, callback = null, rate = 1) {
...
@@ -1458,3 +1458,45 @@ export function shake(item, time = 0.5, callback = null, rate = 1) {
}
}
// --------------- custom class --------------------
// --------------- custom class --------------------
export
function
showBlingBling
(
starImg
,
rectArea
,
parent
,
mapScale
=
1
,
num
=
30
,
disTime
=
0.1
,
showTime
=
3
)
{
const
timeId
=
setInterval
(()
=>
{
showBlingStar
(
starImg
,
num
,
rectArea
,
parent
,
mapScale
);
},
disTime
*
1000
);
setTimeout
(()
=>
{
clearInterval
(
timeId
);
},
showTime
*
1000
);
}
function
showBlingStar
(
starImg
,
num
,
rectArea
,
parent
,
mapScale
)
{
for
(
let
i
=
0
;
i
<
num
;
i
++
)
{
const
star
=
new
MySprite
();
star
.
init
(
starImg
);
const
px
=
-
parent
.
width
/
2
+
Math
.
random
()
*
parent
.
width
;
const
py
=
-
parent
.
height
/
2
+
Math
.
random
()
*
parent
.
height
;
star
.
x
=
px
;
star
.
y
=
py
;
const
randomS
=
(
0.1
+
Math
.
random
()
*
0.8
)
*
mapScale
;
star
.
setScaleXY
(
4
);
parent
.
addChild
(
star
);
scaleItem
(
star
,
randomS
,
0.3
,
()
=>
{
setTimeout
(()
=>
{
scaleItem
(
star
,
0
,
0.3
,
()
=>
{
parent
.
removeChild
(
star
);
});
},
100
+
Math
.
random
()
*
200
);
});
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
a43a8344
...
@@ -22,7 +22,9 @@ import {
...
@@ -22,7 +22,9 @@ import {
rotateItem
,
rotateItem
,
hideItem
,
hideItem
,
showItem
,
showItem
,
ShapeRectNew
ShapeRectNew
,
scaleItem
,
showBlingBling
}
from
"
./Unit
"
;
}
from
"
./Unit
"
;
import
{
localImages
,
localAudios
}
from
"
./resources
"
;
import
{
localImages
,
localAudios
}
from
"
./resources
"
;
...
@@ -104,6 +106,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -104,6 +106,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
// ------------ 游戏逻辑数据 ------------
m_puzzleCards_id
=
[]
m_puzzleCards_id
=
[]
m_puzzleAnswerCards_id
=
[]
m_currentQuestionIndex
=
0
;
m_currentQuestionIndex
=
0
;
m_currentMovedCardIndex
=
-
1
;
m_currentMovedCardIndex
=
-
1
;
m_totalQusetion
=
0
;
m_totalQusetion
=
0
;
...
@@ -442,6 +445,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -442,6 +445,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
parent
=
this
.
g_cartoon
.
getCartoonElement
(
"
quertion-image-container
"
)
let
parent
=
this
.
g_cartoon
.
getCartoonElement
(
"
quertion-image-container
"
)
hotZoneItemArr
.
forEach
(
(
item
,
index
)
=>
{
hotZoneItemArr
.
forEach
(
(
item
,
index
)
=>
{
let
element
=
this
.
g_cartoon
.
createCartoonElement
(
"
quertion-image-puzzle-
"
+
index
,
"
MySprite
"
)
let
element
=
this
.
g_cartoon
.
createCartoonElement
(
"
quertion-image-puzzle-
"
+
index
,
"
MySprite
"
)
this
.
addToAnswerCardList
(
"
quertion-image-puzzle-
"
+
index
)
element
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
item
.
media
.
image_url
))
element
.
ref
.
init
(
this
.
g_cartoon
.
images
.
get
(
item
.
media
.
image_url
))
element
.
ref
.
scaleX
=
item
.
rect
.
width
/
(
element
.
ref
.
width
*
parent
.
contentScale
)
element
.
ref
.
scaleX
=
item
.
rect
.
width
/
(
element
.
ref
.
width
*
parent
.
contentScale
)
element
.
ref
.
scaleY
=
item
.
rect
.
height
/
(
element
.
ref
.
height
*
parent
.
contentScale
)
element
.
ref
.
scaleY
=
item
.
rect
.
height
/
(
element
.
ref
.
height
*
parent
.
contentScale
)
...
@@ -452,12 +456,13 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -452,12 +456,13 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
ref
.
alpha
=
0
;
element
.
ref
.
alpha
=
0
;
element
.
card_audio
=
item
.
media
.
card_audio_url
element
.
card_audio
=
item
.
media
.
card_audio_url
element
.
currentClick
=
false
;
element
.
currentClick
=
false
;
element
.
isPlaced
=
false
;
element
.
show
=
()
=>
{
element
.
show
=
()
=>
{
tweenChange
(
element
.
ref
,
{
alpha
:
1
}
,
0.1
)
tweenChange
(
element
.
ref
,
{
alpha
:
1
}
,
0.1
)
}
}
element
.
click
=
()
=>
{
element
.
click
=
()
=>
{
if
(
element
.
card_audio
){
if
(
element
.
card_audio
&&
element
.
isPlaced
){
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
playAudio
(
element
.
card_audio
)
this
.
g_cartoon
.
playAudio
(
element
.
card_audio
)
}
}
...
@@ -492,10 +497,12 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -492,10 +497,12 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
enableMoveL1
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
enableMoveL1
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
enableMoveL2
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
enableMoveL2
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
isPlaced
=
true
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
isPlaced
=
true
;
element
.
isPlaced
=
true
;
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
moveTo
(
rect
.
x
+
rect
.
width
/
2
,
rect
.
y
+
rect
.
height
/
2
)
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
moveTo
(
rect
.
x
+
rect
.
width
/
2
,
rect
.
y
+
rect
.
height
/
2
)
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
hide
()
this
.
g_cartoon
.
getCartoonElement
(
`puzzle-card-
${
index
}
-container`
).
hide
()
this
.
nextQusetion
()
this
.
nextQusetion
()
this
.
g_enableMapUp
=
true
;
this
.
g_enableMapUp
=
true
;
this
.
showBlingStar
(
element
.
ref
)
}
else
{
}
else
{
this
.
g_cartoon
.
playAudio
(
"
sm-choice-incorrect
"
)
this
.
g_cartoon
.
playAudio
(
"
sm-choice-incorrect
"
)
let
index
=
this
.
m_currentMovedCardIndex
let
index
=
this
.
m_currentMovedCardIndex
...
@@ -540,14 +547,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -540,14 +547,14 @@ export class PlayComponent implements OnInit, OnDestroy {
case
"
large
"
:
case
"
large
"
:
containerSize_Width
=
193
;
containerSize_Width
=
193
;
containerSize_Height
=
193
;
containerSize_Height
=
193
;
cardSize_Width
=
1
4
0
;
cardSize_Width
=
1
2
0
;
cardSize_Height
=
1
4
0
;
cardSize_Height
=
1
2
0
;
break
;
break
;
case
"
middle
"
:
case
"
middle
"
:
containerSize_Width
=
148
;
containerSize_Width
=
148
;
containerSize_Height
=
148
;
containerSize_Height
=
148
;
cardSize_Width
=
12
5
;
cardSize_Width
=
12
0
;
cardSize_Height
=
12
5
;
cardSize_Height
=
12
0
;
break
;
break
;
case
"
small
"
:
case
"
small
"
:
containerSize_Width
=
133
;
containerSize_Width
=
133
;
...
@@ -633,7 +640,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -633,7 +640,6 @@ export class PlayComponent implements OnInit, OnDestroy {
return
return
}
}
this
.
m_currentMovedCardIndex
=
container
.
cardIndex
this
.
m_currentMovedCardIndex
=
container
.
cardIndex
// this.g_cartoon.playAudio("sm-click")
container
.
enableMoveL1
=
true
;
container
.
enableMoveL1
=
true
;
container
.
activite
()
container
.
activite
()
container
.
click
()
container
.
click
()
...
@@ -682,15 +688,27 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -682,15 +688,27 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_puzzleCards_id
.
push
(
id
)
this
.
m_puzzleCards_id
.
push
(
id
)
}
}
addToAnswerCardList
(
id
){
this
.
m_puzzleAnswerCards_id
.
push
(
id
)
}
cleanCardList
(){
cleanCardList
(){
this
.
m_puzzleCards_id
.
length
=
0
;
this
.
m_puzzleCards_id
.
length
=
0
;
}
}
cleanAnswerCardList
(){
this
.
m_puzzleAnswerCards_id
.
length
=
0
;
}
cleanGameVar
(){
cleanGameVar
(){
this
.
m_puzzleCards_id
.
forEach
(
card
=>
{
this
.
m_puzzleCards_id
.
forEach
(
card
=>
{
this
.
g_cartoon
.
getCartoonElement
(
card
).
isPlaced
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
card
).
isPlaced
=
false
;
});
});
this
.
m_puzzleAnswerCards_id
.
forEach
(
card
=>
{
this
.
g_cartoon
.
getCartoonElement
(
card
).
isPlaced
=
false
;
});
this
.
cleanCardList
()
this
.
cleanCardList
()
this
.
cleanAnswerCardList
()
this
.
m_totalQusetion
=
0
;
this
.
m_totalQusetion
=
0
;
this
.
m_currentQuestionIndex
=
0
;
this
.
m_currentQuestionIndex
=
0
;
this
.
g_cartoon
.
getCartoonElement
(
"
speaker
"
).
audio_url
=
""
;
this
.
g_cartoon
.
getCartoonElement
(
"
speaker
"
).
audio_url
=
""
;
...
@@ -1432,4 +1450,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1432,4 +1450,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
return
(
radian
*
Math
.
PI
)
/
180
;
return
(
radian
*
Math
.
PI
)
/
180
;
}
}
showBlingStar
(
element
){
let
rect
=
element
.
getBoundingBox
()
showBlingBling
(
this
.
g_cartoon
.
images
.
get
(
'
star
'
),
rect
,
element
,
this
.
g_mapScale
,
1
,
0.05
,
1.5
);
}
}
}
\ No newline at end of file
src/app/play/resources.js
View file @
a43a8344
...
@@ -7,7 +7,7 @@ const localImages = {
...
@@ -7,7 +7,7 @@ const localImages = {
'
petal_1
'
:
"
assets/play/scrap-pic-1.png
"
,
'
petal_1
'
:
"
assets/play/scrap-pic-1.png
"
,
'
petal_2
'
:
"
assets/play/scrap-pic-2.png
"
,
'
petal_2
'
:
"
assets/play/scrap-pic-2.png
"
,
'
petal_3
'
:
"
assets/play/scrap-pic-3.png
"
,
'
petal_3
'
:
"
assets/play/scrap-pic-3.png
"
,
'
star
'
:
"
assets/play/star.png
"
,
'
answer-sheet
'
:
"
assets/play/AnswerSheet.png
"
,
'
answer-sheet
'
:
"
assets/play/AnswerSheet.png
"
,
'
baiquan
'
:
"
assets/play/baiquan.png
"
,
'
baiquan
'
:
"
assets/play/baiquan.png
"
,
...
@@ -33,6 +33,7 @@ const localAudios = {
...
@@ -33,6 +33,7 @@ const localAudios = {
'
sm-click
'
:
"
assets/audio/sm-click.mp3
"
,
'
sm-click
'
:
"
assets/audio/sm-click.mp3
"
,
'
sm-start
'
:
"
assets/audio/sm-start.mp3
"
,
'
sm-start
'
:
"
assets/audio/sm-start.mp3
"
,
'
sm-correct
'
:
'
assets/audio/sm-correct.mp3
'
,
'
sm-correct
'
:
'
assets/audio/sm-correct.mp3
'
,
'
star
'
:
"
assets/audio/star.mp3
"
,
'
sm-choice-complete
'
:
'
assets/audio/sm-choice-complete.mp3
'
,
'
sm-choice-complete
'
:
'
assets/audio/sm-choice-complete.mp3
'
,
'
sm-choice-correct
'
:
'
assets/audio/sm-choice-correct.mp3
'
,
'
sm-choice-correct
'
:
'
assets/audio/sm-choice-correct.mp3
'
,
...
...
src/assets/audio/star.mp3
0 → 100644
View file @
a43a8344
File added
src/assets/play/star.png
View replaced file @
c1ea66b7
View file @
a43a8344
1.44 KB
|
W:
|
H:
1.38 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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