Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM-28
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-28
Commits
9c455268
Commit
9c455268
authored
May 18, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化排版及音频播放问题
parent
631f7f50
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
22 deletions
+32
-22
Exercises.ts
src/app/play/Exercises.ts
+19
-19
Skin.ts
src/app/play/Skin.ts
+10
-1
play.component.ts
src/app/play/play.component.ts
+3
-2
No files found.
src/app/play/Exercises.ts
View file @
9c455268
...
@@ -12,7 +12,7 @@ import {
...
@@ -12,7 +12,7 @@ import {
}
from
'
./AudioUtil
'
;
}
from
'
./AudioUtil
'
;
import
{
import
{
Skin
Skin
}
from
'
./Skin
'
}
from
'
./Skin
'
...
@@ -53,14 +53,14 @@ export class Exercises {
...
@@ -53,14 +53,14 @@ export class Exercises {
this
.
index
=
exercisesData
.
index
;
this
.
index
=
exercisesData
.
index
;
}
}
init
(
skin
:
Skin
,
i
)
{
init
(
skin
:
Skin
,
i
)
{
skin
.
initExercises
(
this
,
i
);
skin
.
initExercises
(
this
,
i
);
}
}
initBg2
(
width
,
height
){
initBg2
(
width
,
height
)
{
//最底部背景
//最底部背景
const
bg2
=
new
ShapeRect
();
const
bg2
=
new
ShapeRect
();
...
@@ -68,11 +68,11 @@ export class Exercises {
...
@@ -68,11 +68,11 @@ export class Exercises {
bg2
.
addChild
(
this
.
bg
);
bg2
.
addChild
(
this
.
bg
);
bg2
.
setSize
(
width
,
height
);
bg2
.
setSize
(
width
,
height
);
if
(
this
.
bg
instanceof
ShapeRect
)
{
if
(
this
.
bg
instanceof
ShapeRect
)
{
this
.
bg
.
x
=
0
;
this
.
bg
.
x
=
(
width
-
this
.
bg
.
width
)
/
2
;
this
.
bg
.
y
=
0
;
this
.
bg
.
y
=
0
;
}
}
else
{
else
{
this
.
bg
.
x
=
width
/
2
;
this
.
bg
.
x
=
width
/
2
;
this
.
bg
.
y
=
height
-
this
.
bg
.
getBoundingBox
().
height
/
2
;
this
.
bg
.
y
=
height
-
this
.
bg
.
getBoundingBox
().
height
/
2
;
}
}
...
@@ -81,39 +81,39 @@ export class Exercises {
...
@@ -81,39 +81,39 @@ export class Exercises {
this
.
bg2
=
bg2
;
this
.
bg2
=
bg2
;
}
}
checkRight
(
curIndex
){
checkRight
(
curIndex
)
{
if
(
!
curIndex
)
{
if
(
!
curIndex
)
{
return
;
return
;
}
}
if
(
curIndex
==
this
.
index
)
{
if
(
curIndex
==
this
.
index
)
{
this
.
indexLabel
.
alpha
=
1
;
this
.
indexLabel
.
alpha
=
1
;
this
.
indexShowed
=
true
;
this
.
indexShowed
=
true
;
return
true
;
return
true
;
}
}
else
{
else
{
return
false
;
return
false
;
}
}
}
}
playAudio
(
type
,
callback
=
null
){
playAudio
(
type
,
callback
=
null
)
{
if
(
type
==
'
T
'
)
{
if
(
type
==
'
T
'
)
{
playAudio
(
this
.
audio
,
true
);
playAudio
(
this
.
audio
,
true
);
return
this
.
audio
;
return
this
.
audio
;
}
}
else
if
(
type
==
'
I
'
)
{
else
if
(
type
==
'
I
'
)
{
playAudio
(
this
.
indexAudio
);
playAudio
(
this
.
indexAudio
,
true
);
return
this
.
indexAudio
;
return
this
.
indexAudio
;
}
}
}
}
getHeight
(){
getHeight
()
{
return
this
.
bg
.
getBoundingBox
().
height
;
return
this
.
bg
.
getBoundingBox
().
height
;
}
}
getWidth
(){
getWidth
()
{
return
this
.
bg
.
getBoundingBox
().
width
;
return
this
.
bg
.
getBoundingBox
().
width
;
}
}
}
}
\ No newline at end of file
src/app/play/Skin.ts
View file @
9c455268
...
@@ -28,6 +28,7 @@ export class Skin {
...
@@ -28,6 +28,7 @@ export class Skin {
contentBgWidth
=
0
;
contentBgWidth
=
0
;
minMarginTop
=
0
;
constructor
(
skinType
,
images
)
{
constructor
(
skinType
,
images
)
{
...
@@ -47,13 +48,17 @@ export class Skin {
...
@@ -47,13 +48,17 @@ export class Skin {
this
.
intervalWidth
=
28
*
this
.
scaleX
;
this
.
intervalWidth
=
28
*
this
.
scaleX
;
this
.
contentBgWidth
=
348
*
this
.
scaleX
;
this
.
contentBgWidth
=
348
*
this
.
scaleX
;
this
.
minMarginTop
=
160
*
this
.
scaleY
;
}
}
else
{
else
{
this
.
intervalHeight
=
110
*
this
.
scaleY
;
this
.
intervalHeight
=
56
*
this
.
scaleY
;
this
.
intervalWidth
=
63
*
this
.
scaleX
;
this
.
intervalWidth
=
63
*
this
.
scaleX
;
this
.
contentBgWidth
=
320
*
this
.
scaleX
;
this
.
contentBgWidth
=
320
*
this
.
scaleX
;
this
.
minMarginTop
=
77
*
this
.
scaleY
;
}
}
}
}
...
@@ -272,4 +277,8 @@ export class Skin {
...
@@ -272,4 +277,8 @@ export class Skin {
getContentBgWidth
()
{
getContentBgWidth
()
{
return
this
.
contentBgWidth
;
return
this
.
contentBgWidth
;
}
}
getMinMarginTop
(){
return
this
.
minMarginTop
;
}
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
9c455268
...
@@ -655,7 +655,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -655,7 +655,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
this
.
exercisesArr
.
length
;
++
i
)
{
let
j
=
Math
.
floor
(
i
/
col
);
let
j
=
Math
.
floor
(
i
/
col
);
...
@@ -678,7 +677,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -678,7 +677,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
//起始y坐标
//起始y坐标
let
startY
=
(
this
.
canvasHeight
-
totalHeight
)
/
2
+
this
.
title
.
titleBg
.
height
;
let
startY
=
(
this
.
canvasHeight
-
totalHeight
)
/
2
;
startY
=
startY
>
this
.
skin
.
getMinMarginTop
()
?
startY
:
this
.
skin
.
getMinMarginTop
();
let
tempStartX
=
startX
;
let
tempStartX
=
startX
;
...
...
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