Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
T_FT_01
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
T_FT_01
Commits
532952f4
Commit
532952f4
authored
Dec 03, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf:每个练习题增加背景图片
parent
7bced400
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
32 deletions
+54
-32
ObjBean.ts
form/src/app/bean/ObjBean.ts
+6
-2
custom-hot-zone.component.html
...app/common/custom-hot-zone/custom-hot-zone.component.html
+2
-2
custom-hot-zone.component.ts
...c/app/common/custom-hot-zone/custom-hot-zone.component.ts
+15
-15
form.component.html
form/src/app/form/form.component.html
+3
-1
form.component.ts
form/src/app/form/form.component.ts
+10
-2
Scene.js
play/assets/tmpGame/script/Scene.js
+18
-10
No files found.
form/src/app/bean/ObjBean.ts
View file @
532952f4
...
@@ -25,6 +25,8 @@ export class Exercises extends Obj{
...
@@ -25,6 +25,8 @@ export class Exercises extends Obj{
frames
:
Array
<
Frame
>
=
[];
frames
:
Array
<
Frame
>
=
[];
hotZoneItemArr
=
[];
hotZoneItemArr
=
[];
bg
:
Backgroud
;
}
}
export
class
Frame
extends
Obj
{
export
class
Frame
extends
Obj
{
...
@@ -40,7 +42,7 @@ export class Title extends Obj{
...
@@ -40,7 +42,7 @@ export class Title extends Obj{
}
}
export
class
Item
{
export
class
Item
{
bg
:
Backgroud
;
title
:
Title
;
title
:
Title
;
...
@@ -52,7 +54,7 @@ export function getDefaultItem(){
...
@@ -52,7 +54,7 @@ export function getDefaultItem(){
const
item
=
new
Item
();
const
item
=
new
Item
();
item
.
bg
=
new
Backgroud
();
item
.
title
=
new
Title
();
item
.
title
=
new
Title
();
...
@@ -65,6 +67,8 @@ export function getDefaultExercises(){
...
@@ -65,6 +67,8 @@ export function getDefaultExercises(){
const
exercises
=
new
Exercises
();
const
exercises
=
new
Exercises
();
exercises
.
bg
=
new
Backgroud
();
for
(
let
i
=
0
;
i
<
3
;
++
i
){
for
(
let
i
=
0
;
i
<
3
;
++
i
){
const
answer
=
new
Answer
();
const
answer
=
new
Answer
();
answer
.
isRight
=
'
0
'
;
answer
.
isRight
=
'
0
'
;
...
...
form/src/app/common/custom-hot-zone/custom-hot-zone.component.html
View file @
532952f4
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
</div>
</div>
<div
nz-row
nzType=
"flex"
nzAlign=
"middle"
>
<div
nz-row
nzType=
"flex"
nzAlign=
"middle"
>
<!--
<div
nz-col
nzSpan=
"5"
nzOffset=
"1"
>
<div
nz-col
nzSpan=
"5"
nzOffset=
"1"
>
<h5>
add background:
</h5>
<h5>
add background:
</h5>
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</app-upload-image-with-preview>
</app-upload-image-with-preview>
</div>
</div>
</div>
</div>
-->
<div
nz-col
nzSpan=
"5"
nzOffset=
"1"
class=
"img-box"
<div
nz-col
nzSpan=
"5"
nzOffset=
"1"
class=
"img-box"
*
ngFor=
"let it of hotZoneArr; let i = index"
>
*
ngFor=
"let it of hotZoneArr; let i = index"
>
...
...
form/src/app/common/custom-hot-zone/custom-hot-zone.component.ts
View file @
532952f4
...
@@ -145,15 +145,17 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
...
@@ -145,15 +145,17 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
refreshBackground
(
callBack
=
null
)
{
refreshBackground
(
callBack
=
null
)
{
if
(
!
this
.
bg
)
{
this
.
bg
=
new
MySprite
(
this
.
ctx
);
this
.
renderArr
.
push
(
this
.
bg
);
}
const
bg
=
this
.
bg
;
if
(
this
.
bgItem
.
picUrl
)
{
if
(
this
.
bgItem
.
picUrl
)
{
if
(
!
this
.
bg
)
{
this
.
bg
=
new
MySprite
(
this
.
ctx
);
this
.
renderArr
.
push
(
this
.
bg
);
}
const
bg
=
this
.
bg
;
bg
.
load
(
this
.
bgItem
.
picUrl
).
then
(()
=>
{
bg
.
load
(
this
.
bgItem
.
picUrl
).
then
(()
=>
{
const
rate1
=
this
.
canvasWidth
/
bg
.
width
;
const
rate1
=
this
.
canvasWidth
/
bg
.
width
;
const
rate2
=
this
.
canvasHeight
/
bg
.
height
;
const
rate2
=
this
.
canvasHeight
/
bg
.
height
;
...
@@ -170,6 +172,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
...
@@ -170,6 +172,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
}
});
});
}
}
else
{
if
(
callBack
)
{
callBack
();
}
}
}
}
...
@@ -383,12 +390,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
...
@@ -383,12 +390,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
initItem
()
{
initItem
()
{
//定时刷新背景图片
const
refreshBg
=
()
=>
{
setInterval
(()
=>
{
this
.
refreshBackground
();
},
2000
);
}
if
(
!
this
.
bgItem
)
{
if
(
!
this
.
bgItem
)
{
this
.
bgItem
=
{};
this
.
bgItem
=
{};
...
@@ -401,8 +403,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
...
@@ -401,8 +403,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this
.
initHotZoneArr
();
this
.
initHotZoneArr
();
}
}
refreshBg
();
});
});
}
}
...
...
form/src/app/form/form.component.html
View file @
532952f4
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
</app-audio-recorder>
</app-audio-recorder>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
<!--
<nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="3">背景图片</nz-form-label>
<nz-form-label [nzSpan]="3">背景图片</nz-form-label>
<nz-form-control [nzSpan]="6">
<nz-form-control [nzSpan]="6">
...
@@ -33,6 +34,7 @@
...
@@ -33,6 +34,7 @@
</app-upload-image-with-preview>
</app-upload-image-with-preview>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
-->
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -56,7 +58,7 @@
...
@@ -56,7 +58,7 @@
<span>
删除
</span>
<span>
删除
</span>
</button>
</button>
</div>
</div>
<app-custom-hot-zone
[
bgItem
]="
item
.
bg
"
[
hotZoneItemArr
]="
data
.
hotZoneItemArr
"
<app-custom-hot-zone
[
bgItem
]="
data
.
bg
"
[
hotZoneItemArr
]="
data
.
hotZoneItemArr
"
(
save
)="
saveData
($
event
,
i
)"
></app-custom-hot-zone>
(
save
)="
saveData
($
event
,
i
)"
></app-custom-hot-zone>
<nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
6
"
>
动画
</nz-form-label>
<nz-form-label
[
nzSpan
]="
6
"
>
动画
</nz-form-label>
...
...
form/src/app/form/form.component.ts
View file @
532952f4
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
Answer
,
Frame
,
getDefaultExercises
,
getDefaultItem
}
from
'
../bean/ObjBean
'
;
import
{
Answer
,
Backgroud
,
Frame
,
getDefaultExercises
,
getDefaultItem
}
from
'
../bean/ObjBean
'
;
import
{
NzMessageService
}
from
'
ng-zorro-antd
'
;
import
{
NzMessageService
}
from
'
ng-zorro-antd
'
;
@
Component
({
@
Component
({
...
@@ -64,6 +64,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -64,6 +64,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init
()
{
init
()
{
console
.
log
(
JSON
.
stringify
(
this
.
item
));
console
.
log
(
JSON
.
stringify
(
this
.
item
));
for
(
let
i
=
0
;
i
<
this
.
item
.
exercisesArr
.
length
;
++
i
){
let
exercises
=
this
.
item
.
exercisesArr
[
i
];
if
(
!
exercises
.
bg
){
exercises
.
bg
=
new
Backgroud
();
}
}
}
}
...
@@ -176,7 +184,7 @@ onAudioUploadSuccess(e, item, key) {
...
@@ -176,7 +184,7 @@ onAudioUploadSuccess(e, item, key) {
saveData
(
e
,
i
)
{
saveData
(
e
,
i
)
{
console
.
log
(
'
savedata e:
'
,
e
);
console
.
log
(
'
savedata e:
'
,
e
);
this
.
item
.
bg
=
e
.
bgItem
;
this
.
item
.
exercisesArr
[
i
].
bg
=
e
.
bgItem
;
this
.
item
.
exercisesArr
[
i
].
hotZoneItemArr
=
e
.
hotZoneItemArr
;
this
.
item
.
exercisesArr
[
i
].
hotZoneItemArr
=
e
.
hotZoneItemArr
;
this
.
save
();
this
.
save
();
}
}
...
...
play/assets/tmpGame/script/Scene.js
View file @
532952f4
This diff is collapsed.
Click to expand it.
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