Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM-42
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
YM-42
Commits
1c024b1d
Commit
1c024b1d
authored
Sep 23, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复问题
parent
b9442cb9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
63 deletions
+35
-63
Exercises.ts
src/app/play/Exercises.ts
+17
-50
Listening.ts
src/app/play/Listening.ts
+7
-0
Title.ts
src/app/play/Title.ts
+4
-8
play.component.ts
src/app/play/play.component.ts
+7
-5
No files found.
src/app/play/Exercises.ts
View file @
1c024b1d
...
@@ -127,46 +127,6 @@ export class Exercises {
...
@@ -127,46 +127,6 @@ export class Exercises {
cardBg
.
setScaleXY
(
0
);
cardBg
.
setScaleXY
(
0
);
}
}
/**
* 设置最大的宽度,并返回新的最大宽度
* @param textLabelArr
* @param w
*/
private
setMaxScale
(
textLabelArr
,
w
){
let
scale
=
1
;
let
width
=
0
;
for
(
let
i
=
0
;
i
<
textLabelArr
.
length
;
++
i
){
var
textLabel
=
textLabelArr
[
i
];
width
+=
textLabel
.
getBoundingBox
().
width
;
scale
=
textLabel
.
scaleX
;
}
if
(
width
>=
w
){
scale
*=
w
/
width
;
}
else
{
return
width
;
}
width
=
0
;
//设置scale,并重新计算宽度
for
(
let
i
=
0
;
i
<
textLabelArr
.
length
;
++
i
){
var
textLabel
=
textLabelArr
[
i
];
textLabel
.
setScaleXY
(
scale
);
textLabel
.
refreshSize
();
width
+=
textLabel
.
getBoundingBox
().
width
;
}
return
width
;
}
/**
/**
* 设置x坐标
* 设置x坐标
* @param textLabel
* @param textLabel
...
@@ -206,6 +166,8 @@ export class Exercises {
...
@@ -206,6 +166,8 @@ export class Exercises {
let
textArr
=
new
Array
<
LableText
>
();
let
textArr
=
new
Array
<
LableText
>
();
text
.
textArr
=
textArr
;
text
.
textArr
=
textArr
;
let
maxWidth
=
0
;
for
(
let
i
=
0
;
i
<
this
.
exercisesData
.
letters
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
exercisesData
.
letters
.
length
;
++
i
)
{
var
letter
=
this
.
exercisesData
.
letters
[
i
];
var
letter
=
this
.
exercisesData
.
letters
[
i
];
...
@@ -223,6 +185,7 @@ export class Exercises {
...
@@ -223,6 +185,7 @@ export class Exercises {
fontColor
=
"
#cc2a2e
"
;
fontColor
=
"
#cc2a2e
"
;
}
}
maxWidth
=
bg
.
width
-
110
*
(
this
.
scaleX
>
1
?
1
:
this
.
scaleX
);
}
}
else
{
else
{
...
@@ -232,20 +195,24 @@ export class Exercises {
...
@@ -232,20 +195,24 @@ export class Exercises {
else
{
else
{
fontColor
=
"
#cc2a2e
"
;
fontColor
=
"
#cc2a2e
"
;
}
}
maxWidth
=
bg
.
width
-
190
*
(
this
.
scaleX
>
1
?
1
:
this
.
scaleX
);
}
}
labelText
.
fontColor
=
fontColor
;
labelText
.
fontColor
=
fontColor
;
textArr
.
push
(
labelText
);
textArr
.
push
(
labelText
);
}
}
text
.
setScaleXY
(
this
.
scaleX
);
text
.
scaleX
=
this
.
scaleX
;
text
.
refreshSize
();
text
.
scaleY
=
this
.
scaleY
;
text
.
y
=
bg
.
height
/
2
;
totalWidth
=
text
.
getBoundingBox
().
width
;
bg
.
addChild
(
text
);
text
.
setMaxSize
(
bg
.
width
-
110
*
this
.
scaleX
)
;
text
.
y
=
bg
.
height
/
2
;
bg
.
addChild
(
text
);
console
.
log
(
'
bg.width
'
,
bg
.
width
,
'
maxWidth
'
,
maxWidth
,
'
scaleX
'
,
this
.
scaleX
);
text
.
setMaxSize
(
maxWidth
);
text
.
refreshSize
();
totalWidth
=
text
.
getBoundingBox
().
width
;
this
.
textLabel
=
text
;
this
.
textLabel
=
text
;
this
.
resetX
(
text
,
totalWidth
,
this
.
skin
);
this
.
resetX
(
text
,
totalWidth
,
this
.
skin
);
...
@@ -291,7 +258,7 @@ export class Exercises {
...
@@ -291,7 +258,7 @@ export class Exercises {
index
.
scaleX
=
this
.
scaleX
;
index
.
scaleX
=
this
.
scaleX
;
index
.
scaleY
=
this
.
scaleY
;
index
.
scaleY
=
this
.
scaleY
;
index
.
setMaxSize
(
indexBg
.
width
);
index
.
setMaxSize
(
indexBg
.
width
);
index
.
x
=
-
index
.
width
/
2
;
index
.
x
=
-
index
.
getBoundingBox
().
width
/
2
;
indexBg
.
addChild
(
index
);
indexBg
.
addChild
(
index
);
//内容
//内容
...
@@ -335,7 +302,7 @@ export class Exercises {
...
@@ -335,7 +302,7 @@ export class Exercises {
index
.
fontColor
=
'
#ec6101
'
;
index
.
fontColor
=
'
#ec6101
'
;
index
.
setScaleXY
(
this
.
scaleX
);
index
.
setScaleXY
(
this
.
scaleX
);
index
.
setMaxSize
(
45
*
scaleX
);
index
.
setMaxSize
(
45
*
scaleX
);
index
.
x
=
indexBg
.
x
-
index
.
width
/
2
;
index
.
x
=
indexBg
.
x
-
index
.
getBoundingBox
().
width
/
2
;
index
.
y
=
height
/
2
;
index
.
y
=
height
/
2
;
bg
.
addChild
(
index
);
bg
.
addChild
(
index
);
...
@@ -471,7 +438,7 @@ export class Exercises {
...
@@ -471,7 +438,7 @@ export class Exercises {
text
.
setScaleXY
(
this
.
scaleX
);
text
.
setScaleXY
(
this
.
scaleX
);
text
.
setMaxSize
((
960
-
90
)
*
this
.
scaleX
);
text
.
setMaxSize
((
960
-
90
)
*
this
.
scaleX
);
text
.
refreshSize
();
text
.
refreshSize
();
text
.
y
=
bg
.
height
-
text
.
getBoundingBox
().
height
/
2
-
7
*
this
.
scaleY
;
text
.
y
=
bg
.
height
-
text
.
getBoundingBox
().
height
/
2
-
1
7
*
this
.
scaleY
;
let
totalWidth
=
text
.
getBoundingBox
().
width
;
let
totalWidth
=
text
.
getBoundingBox
().
width
;
text
.
x
=
(
bg
.
width
-
totalWidth
)
/
2
;
text
.
x
=
(
bg
.
width
-
totalWidth
)
/
2
;
...
@@ -661,7 +628,7 @@ export class Exercises {
...
@@ -661,7 +628,7 @@ export class Exercises {
resetText
(
scale
,
skin
=
'
A
'
)
{
resetText
(
scale
,
skin
=
'
A
'
)
{
var
totalWidth
=
0
var
totalWidth
=
0
this
.
textLabel
.
setScaleXY
(
1
);
this
.
textLabel
.
setScaleXY
(
scale
);
this
.
textLabel
.
setScaleXY
(
scale
);
this
.
textLabel
.
refreshSize
();
this
.
textLabel
.
refreshSize
();
...
...
src/app/play/Listening.ts
View file @
1c024b1d
...
@@ -74,6 +74,13 @@ export class Listening {
...
@@ -74,6 +74,13 @@ export class Listening {
return
null
;
return
null
;
}
}
reset
(){
this
.
btnPlay
.
alpha
=
1
;
this
.
btnStop
.
alpha
=
0
;
this
.
playing
=
false
;
}
playAudio
(
callback
=
null
){
playAudio
(
callback
=
null
){
this
.
btnPlay
.
alpha
=
0
;
this
.
btnPlay
.
alpha
=
0
;
...
...
src/app/play/Title.ts
View file @
1c024b1d
...
@@ -36,8 +36,8 @@ export class Title {
...
@@ -36,8 +36,8 @@ export class Title {
//初始化标题1背景
//初始化标题1背景
const
titePart1Bg
=
new
ShapeRect
();
const
titePart1Bg
=
new
ShapeRect
();
titePart1Bg
.
fillColor
=
"
#567790
"
;
titePart1Bg
.
fillColor
=
"
#567790
"
;
let
pWidth
=
1
21
*
mapScaleX
;
let
pWidth
=
1
17
*
mapScaleX
;
let
pHeight
=
6
9
*
mapScaleY
;
let
pHeight
=
6
5
*
mapScaleY
;
titePart1Bg
.
setSize
(
pWidth
,
pHeight
);
titePart1Bg
.
setSize
(
pWidth
,
pHeight
);
titePart1Bg
.
setShadow
(
4
,
4
,
0
,
'
rgba(0, 0, 0, 0.2)
'
);
titePart1Bg
.
setShadow
(
4
,
4
,
0
,
'
rgba(0, 0, 0, 0.2)
'
);
titePart1Bg
.
x
=
0
;
titePart1Bg
.
x
=
0
;
...
@@ -54,6 +54,7 @@ export class Title {
...
@@ -54,6 +54,7 @@ export class Title {
part1
.
setScaleXY
(
mapScaleX
);
part1
.
setScaleXY
(
mapScaleX
);
part1
.
refreshSize
();
part1
.
refreshSize
();
part1
.
x
=
pWidth
-
part1
.
getBoundingBox
().
width
-
13
*
mapScaleX
;
part1
.
x
=
pWidth
-
part1
.
getBoundingBox
().
width
-
13
*
mapScaleX
;
part1
.
y
=
5
*
mapScaleY
+
part1
.
getBoundingBox
().
height
/
2
;
titleBg
.
addChild
(
part1
);
titleBg
.
addChild
(
part1
);
//标题2内容
//标题2内容
...
@@ -65,21 +66,16 @@ export class Title {
...
@@ -65,21 +66,16 @@ export class Title {
part2
.
setScaleXY
(
mapScaleX
);
part2
.
setScaleXY
(
mapScaleX
);
part2
.
refreshSize
();
part2
.
refreshSize
();
part2
.
x
=
titePart1Bg
.
getBoundingBox
().
width
+
11
*
mapScaleX
;
part2
.
x
=
titePart1Bg
.
getBoundingBox
().
width
+
11
*
mapScaleX
;
part2
.
y
=
1
0
*
mapScaleY
+
part2
.
getBoundingBox
().
height
/
2
;
part2
.
y
=
1
6
*
mapScaleY
+
part2
.
getBoundingBox
().
height
/
2
;
let
height
=
Math
.
max
(
titePart1Bg
.
getBoundingBox
().
height
,
part2
.
getBoundingBox
().
height
);
let
height
=
Math
.
max
(
titePart1Bg
.
getBoundingBox
().
height
,
part2
.
getBoundingBox
().
height
);
let
width
=
titePart1Bg
.
getBoundingBox
().
width
+
part2
.
getBoundingBox
().
width
+
11
*
mapScaleX
;
let
width
=
titePart1Bg
.
getBoundingBox
().
width
+
part2
.
getBoundingBox
().
width
+
11
*
mapScaleX
;
titePart1Bg
.
y
=
(
height
-
pHeight
)
/
2
;
titePart1Bg
.
y
=
(
height
-
pHeight
)
/
2
;
part1
.
y
=
height
/
2
;
titleBg
.
setSize
(
width
,
height
);
titleBg
.
setSize
(
width
,
height
);
titleBg
.
alpha
=
0
;
titleBg
.
alpha
=
0
;
part2
.
y
=
height
/
2
;
titleBg
.
addChild
(
part2
);
titleBg
.
addChild
(
part2
);
this
.
titleBg
=
titleBg
;
this
.
titleBg
=
titleBg
;
...
...
src/app/play/play.component.ts
View file @
1c024b1d
...
@@ -641,7 +641,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -641,7 +641,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
initBg
()
{
initBg
()
{
console
.
log
(
this
.
images
);
const
getPic
=
(
key
,
anchorX
:
number
=
0.5
,
anchorY
:
number
=
0.5
)
=>
{
const
getPic
=
(
key
,
anchorX
:
number
=
0.5
,
anchorY
:
number
=
0.5
)
=>
{
const
pic
=
new
MySprite
();
const
pic
=
new
MySprite
();
pic
.
init
(
this
.
images
.
get
(
key
),
anchorX
,
anchorY
);
pic
.
init
(
this
.
images
.
get
(
key
),
anchorX
,
anchorY
);
...
@@ -651,7 +651,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -651,7 +651,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
const
initBg
=
(
skin
,
skinType
)
=>
{
const
initBg
=
(
skin
,
skinType
)
=>
{
console
.
log
(
skin
);
//左上
//左上
if
(
skin
.
lt_pic_url
)
{
if
(
skin
.
lt_pic_url
)
{
const
pic
=
getPic
(
skinType
+
'
_
'
+
skin
.
lt_pic_url
,
0
,
0
);
const
pic
=
getPic
(
skinType
+
'
_
'
+
skin
.
lt_pic_url
,
0
,
0
);
...
@@ -825,8 +825,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -825,8 +825,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
bigCardRenderArr
.
push
(
exercises
.
cardBg
);
this
.
bigCardRenderArr
.
push
(
exercises
.
cardBg
);
}
}
console
.
log
(
startYArr
);
for
(
let
i
=
0
;
i
<
lBgArr
.
length
;
++
i
){
for
(
let
i
=
0
;
i
<
lBgArr
.
length
;
++
i
){
lBgArr
[
i
].
y
=
startYArr
[
i
];
lBgArr
[
i
].
y
=
startYArr
[
i
];
lBgArr
[
i
].
height
=
hight
;
lBgArr
[
i
].
height
=
hight
;
...
@@ -845,6 +843,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -845,6 +843,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
console
.
log
(
minScale
);
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
)
{
this
.
exercisesArr
[
i
].
resetText
(
minScale
,
this
.
data
.
skin
);
this
.
exercisesArr
[
i
].
resetText
(
minScale
,
this
.
data
.
skin
);
...
@@ -873,7 +873,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -873,7 +873,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
checkClickTarget
(
this
.
listening
.
bg
))
{
if
(
this
.
checkClickTarget
(
this
.
listening
.
bg
))
{
this
.
curAudio
=
this
.
listening
.
play
();
this
.
curAudio
=
this
.
listening
.
play
(()
=>
{
this
.
listening
.
reset
();
});
return
;
return
;
}
}
...
...
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