Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-23
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
YM5-23
Commits
c6d88bcc
Commit
c6d88bcc
authored
Jun 15, 2021
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复超过界缩入问题;增加横线消失音频
parent
3157ab84
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
13 deletions
+63
-13
Exercises.ts
src/app/play/Exercises.ts
+43
-12
play.component.ts
src/app/play/play.component.ts
+19
-0
resources.js
src/app/play/resources.js
+1
-1
accompany.mp3
src/assets/play/music/accompany.mp3
+0
-0
No files found.
src/app/play/Exercises.ts
View file @
c6d88bcc
...
@@ -25,6 +25,8 @@ class Eexercises {
...
@@ -25,6 +25,8 @@ class Eexercises {
titleColor
=
"
#5f1782
"
;
titleColor
=
"
#5f1782
"
;
wordBg
;
init
(
data
,
images
,
scaleX
=
1
,
scaleY
=
1
)
{
init
(
data
,
images
,
scaleX
=
1
,
scaleY
=
1
)
{
...
@@ -83,11 +85,12 @@ class Eexercises {
...
@@ -83,11 +85,12 @@ class Eexercises {
const
title
=
new
Label
();
const
title
=
new
Label
();
title
.
text
=
this
.
data
.
val
;
title
.
text
=
this
.
data
.
val
;
title
.
textAlign
=
'
center
'
;
title
.
textAlign
=
'
center
'
;
title
.
fontSize
=
3
6
;
title
.
fontSize
=
5
6
;
title
.
fontName
=
"
ahronbd-1
"
;
title
.
fontName
=
"
ahronbd-1
"
;
title
.
fontColor
=
this
.
titleColor
;
title
.
fontColor
=
this
.
titleColor
;
title
.
setScaleXY
(
this
.
scaleX
);
title
.
setScaleXY
(
this
.
scaleX
);
title
.
refreshSize
();
title
.
refreshSize
();
title
.
setMaxSize
(
300
*
this
.
scaleX
);
title
.
x
=
this
.
bg
.
width
/
2
;
title
.
x
=
this
.
bg
.
width
/
2
;
title
.
y
=
this
.
titleBg
.
getBoundingBox
().
height
/
2
+
5
*
this
.
scaleY
;
title
.
y
=
this
.
titleBg
.
getBoundingBox
().
height
/
2
+
5
*
this
.
scaleY
;
...
@@ -99,18 +102,35 @@ class Eexercises {
...
@@ -99,18 +102,35 @@ class Eexercises {
initWord
()
{
initWord
()
{
let
tw
=
0
;
let
tw
=
0
;
let
h
=
0
for
(
let
i
=
0
;
i
<
this
.
data
.
wordArr
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
data
.
wordArr
.
length
;
++
i
)
{
let
word
=
this
.
data
.
wordArr
[
i
];
let
word
=
this
.
data
.
wordArr
[
i
];
let
text
=
this
.
getWord
(
word
);
let
text
=
this
.
getWord
(
word
);
tw
+=
text
.
getBoundingBox
().
width
;
tw
+=
text
.
getBoundingBox
().
width
;
h
=
text
.
getBoundingBox
().
height
;
}
}
let
dw
=
28
*
this
.
scaleX
;
//let dw = 28 * this.scaleX;
let
dw
=
28
;
tw
+=
(
this
.
data
.
wordArr
.
length
-
1
)
*
dw
;
tw
+=
(
this
.
data
.
wordArr
.
length
-
1
)
*
dw
;
let
x
=
(
this
.
bg
.
width
-
tw
)
/
2
;
let
scale
=
this
.
scaleX
;
if
(
tw
>=
this
.
bg
.
width
-
20
*
this
.
scaleX
)
{
scale
=
this
.
bg
.
width
/
tw
;
}
let
wordBg
=
new
ShapeRect
();
wordBg
.
setSize
(
tw
,
h
);
wordBg
.
setScaleXY
(
scale
);
wordBg
.
alpha
=
0
;
wordBg
.
x
=
(
this
.
bg
.
width
-
wordBg
.
getBoundingBox
().
width
)
/
2
;
wordBg
.
y
=
this
.
bg
.
height
-
30
*
this
.
scaleY
-
wordBg
.
getBoundingBox
().
height
;
this
.
bg
.
addChild
(
wordBg
);
this
.
wordBg
=
wordBg
;
//let x = (this.bg.width - tw) / 2;
let
x
=
0
;
for
(
let
i
=
0
;
i
<
this
.
wordArr
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
wordArr
.
length
;
++
i
)
{
...
@@ -121,30 +141,32 @@ class Eexercises {
...
@@ -121,30 +141,32 @@ class Eexercises {
text
.
x
=
x
+
dw
*
i
;
text
.
x
=
x
+
dw
*
i
;
x
+=
box
.
width
;
x
+=
box
.
width
;
text
.
y
=
this
.
bg
.
height
-
30
*
this
.
scaleY
-
box
.
height
/
2
;
text
.
y
=
box
.
height
/
2
;
const
textBg
=
new
ShapeRect
();
const
textBg
=
new
ShapeRect
();
textBg
.
setSize
(
box
.
width
,
box
.
height
);
textBg
.
setSize
(
box
.
width
,
box
.
height
);
textBg
.
x
=
text
.
x
;
textBg
.
x
=
text
.
x
;
textBg
.
y
=
text
.
y
-
box
.
height
/
2
;
textBg
.
y
=
text
.
y
-
box
.
height
/
2
;
textBg
.
alpha
=
0
;
textBg
.
alpha
=
0
;
this
.
bg
.
addChild
(
textBg
);
//this.bg.addChild(textBg);
wordBg
.
addChild
(
textBg
);
text
.
textBg
=
textBg
;
text
.
textBg
=
textBg
;
if
(
text
.
data
.
isFill
==
'
1
'
){
if
(
text
.
data
.
isFill
==
'
1
'
){
let
underLine
=
new
Line
();
let
underLine
=
new
Line
();
underLine
.
lineColor
=
"
#949494
"
;
underLine
.
lineColor
=
"
#949494
"
;
underLine
.
lineWidth
=
3
*
this
.
scaleX
;
underLine
.
lineWidth
=
3
;
underLine
.
y
=
text
.
y
+
box
.
height
/
2
;
underLine
.
y
=
text
.
y
+
box
.
height
/
2
;
underLine
.
x
=
text
.
x
;
underLine
.
x
=
text
.
x
;
underLine
.
setLine
(
box
.
width
);
underLine
.
setLine
(
box
.
width
);
text
.
underLine
=
underLine
;
text
.
underLine
=
underLine
;
this
.
bg
.
addChild
(
underLine
);
//
this.bg.addChild(underLine);
wordBg
.
addChild
(
underLine
);
text
.
alpha
=
0
;
text
.
alpha
=
0
;
}
}
this
.
bg
.
addChild
(
text
);
//this.bg.addChild(text);
wordBg
.
addChild
(
text
);
}
}
}
}
...
@@ -170,8 +192,8 @@ class Eexercises {
...
@@ -170,8 +192,8 @@ class Eexercises {
textArr
.
push
(
labelText
);
textArr
.
push
(
labelText
);
}
}
text
.
scaleX
=
this
.
scaleX
;
//
text.scaleX = this.scaleX;
text
.
scaleY
=
this
.
scaleY
;
//
text.scaleY = this.scaleY;
text
.
refreshSize
();
text
.
refreshSize
();
this
.
wordArr
.
push
(
text
);
this
.
wordArr
.
push
(
text
);
...
@@ -182,6 +204,15 @@ class Eexercises {
...
@@ -182,6 +204,15 @@ class Eexercises {
getImageObj
(
key
)
{
getImageObj
(
key
)
{
return
this
.
images
.
get
(
key
);
return
this
.
images
.
get
(
key
);
}
}
resetScale
(
titleScale
,
wordScale
){
this
.
title
.
setScaleXY
(
titleScale
);
this
.
wordBg
.
setScaleXY
(
wordScale
);
this
.
wordBg
.
y
=
this
.
bg
.
height
-
30
*
this
.
scaleY
-
this
.
wordBg
.
getBoundingBox
().
height
;
this
.
wordBg
.
x
=
(
this
.
bg
.
width
-
this
.
wordBg
.
getBoundingBox
().
width
)
/
2
;
}
}
}
export
class
EexercisesA
extends
Eexercises
{
export
class
EexercisesA
extends
Eexercises
{
...
...
src/app/play/play.component.ts
View file @
c6d88bcc
...
@@ -311,6 +311,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -311,6 +311,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
audio
.
play
();
audio
.
play
();
this
.
curAudio
=
audio
;
}
}
return
audio
;
return
audio
;
...
@@ -642,6 +643,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -642,6 +643,10 @@ export class PlayComponent implements OnInit, OnDestroy {
let
bgArr
=
[];
let
bgArr
=
[];
let
maxTitleScale
=
this
.
mapScale
;
let
wordScale
=
this
.
mapScale
;
for
(
let
i
=
0
;
i
<
this
.
data
.
exercisesArr
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
data
.
exercisesArr
.
length
;
++
i
)
{
let
data
=
this
.
data
.
exercisesArr
[
i
];
let
data
=
this
.
data
.
exercisesArr
[
i
];
...
@@ -658,6 +663,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -658,6 +663,14 @@ export class PlayComponent implements OnInit, OnDestroy {
exercises
.
init
(
data
,
this
.
images
,
this
.
mapScale
,
this
.
mapScale
);
exercises
.
init
(
data
,
this
.
images
,
this
.
mapScale
,
this
.
mapScale
);
if
(
maxTitleScale
>
exercises
.
title
.
scaleX
){
maxTitleScale
=
exercises
.
title
.
scaleX
;
}
if
(
wordScale
>
exercises
.
wordBg
.
scaleX
){
wordScale
=
exercises
.
wordBg
.
scaleX
;
}
h
=
exercises
.
bg
.
height
;
h
=
exercises
.
bg
.
height
;
this
.
exercisesArr
.
push
(
exercises
);
this
.
exercisesArr
.
push
(
exercises
);
...
@@ -667,6 +680,11 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -667,6 +680,11 @@ export class PlayComponent implements OnInit, OnDestroy {
bgArr
.
push
(
exercises
.
bg
);
bgArr
.
push
(
exercises
.
bg
);
}
}
//重新设置字体大小
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
){
this
.
exercisesArr
[
i
].
resetScale
(
maxTitleScale
,
wordScale
);
}
//进行排版操作
//进行排版操作
typesetting
(
bgArr
,
3
,
this
.
canvasWidth
,
this
.
canvasHeight
,
h
,
14
*
this
.
mapScale
,
78
*
this
.
mapScale
);
typesetting
(
bgArr
,
3
,
this
.
canvasWidth
,
this
.
canvasHeight
,
h
,
14
*
this
.
mapScale
,
78
*
this
.
mapScale
);
}
}
...
@@ -773,6 +791,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -773,6 +791,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
word
.
data
.
isFill
==
'
1
'
){
if
(
word
.
data
.
isFill
==
'
1
'
){
this
.
playAudio
(
'
accompany
'
,
true
);
if
(
word
.
alpha
==
0
){
if
(
word
.
alpha
==
0
){
word
.
alpha
=
1
;
word
.
alpha
=
1
;
word
.
underLine
.
alpha
=
0
;
word
.
underLine
.
alpha
=
0
;
...
...
src/app/play/resources.js
View file @
c6d88bcc
...
@@ -15,7 +15,7 @@ const res = [
...
@@ -15,7 +15,7 @@ const res = [
const
resAudio
=
[
const
resAudio
=
[
[
'
click
'
,
"
assets/play/music/click.mp3
"
],
[
'
click
'
,
"
assets/play/music/click.mp3
"
],
[
'
accompany
'
,
"
assets/play/music/accompany.mp3
"
]
];
];
export
{
res
,
resAudio
};
export
{
res
,
resAudio
};
src/assets/play/music/accompany.mp3
0 → 100644
View file @
c6d88bcc
File added
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