Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_09
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
op_09
Commits
5df57226
Commit
5df57226
authored
Sep 23, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 选项尺寸调整;猫猫语音可配置
parent
a2fea002
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
form.component.html
form/src/app/form/form.component.html
+20
-0
form.component.ts
form/src/app/form/form.component.ts
+2
-0
op_09.js
play/assets/op_09/scene/op_09.js
+7
-5
No files found.
form/src/app/form/form.component.html
View file @
5df57226
...
@@ -6,6 +6,26 @@
...
@@ -6,6 +6,26 @@
</div>
</div>
</div>
</div>
<div
style=
"padding: 10px;"
>
<div
style=
"width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;"
>
猫咪开头音频:
<app-audio-recorder
style=
"margin-left: 10px; "
[
audioUrl
]="
item
.
startAudio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
startAudio
',
item
)"
></app-audio-recorder>
</div>
<div
style=
"width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;"
>
猫咪结束音频:
<app-audio-recorder
style=
"margin-left: 10px; "
[
audioUrl
]="
item
.
endAudio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
endAudio
',
item
)"
></app-audio-recorder>
</div>
</div>
<div
style=
"padding: 10px;"
>
<div
style=
"padding: 10px;"
>
<div
*
ngFor=
"let q of questionArr; let i = index;"
style=
"width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;"
>
<div
*
ngFor=
"let q of questionArr; let i = index;"
style=
"width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;"
>
...
...
form/src/app/form/form.component.ts
View file @
5df57226
...
@@ -24,6 +24,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -24,6 +24,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
item
=
{
this
.
item
=
{
maxWrongNumber
:
4
,
maxWrongNumber
:
4
,
startAudio
:
''
,
endAudio
:
''
,
question_arr
:
[]
question_arr
:
[]
};
};
...
...
play/assets/op_09/scene/op_09.js
View file @
5df57226
...
@@ -104,6 +104,8 @@ cc.Class({
...
@@ -104,6 +104,8 @@ cc.Class({
},
},
addPreloadAudio
()
{
addPreloadAudio
()
{
this
.
_audioResList
.
push
(
this
.
data
.
startAudio
);
this
.
_audioResList
.
push
(
this
.
data
.
endAudio
);
this
.
_audioResList
.
push
(...
this
.
data
.
question_arr
.
map
(
question
=>
{
this
.
_audioResList
.
push
(...
this
.
data
.
question_arr
.
map
(
question
=>
{
return
question
.
option_arr
.
map
(
option
=>
{
return
question
.
option_arr
.
map
(
option
=>
{
return
{
url
:
option
.
audio_url
};
return
{
url
:
option
.
audio_url
};
...
@@ -172,19 +174,19 @@ cc.Class({
...
@@ -172,19 +174,19 @@ cc.Class({
const
canvasHeight
=
cc
.
find
(
'
Canvas
'
).
height
;
const
canvasHeight
=
cc
.
find
(
'
Canvas
'
).
height
;
const
optionNum
=
this
.
data
.
question_arr
[
questionIdx
].
option_arr
.
length
;
const
optionNum
=
this
.
data
.
question_arr
[
questionIdx
].
option_arr
.
length
;
const
maxOptionHeight
=
500
;
const
maxOptionHeight
=
500
;
const
maxOptionWidth
=
(
canvasWidth
-
20
)
/
optionNum
;
const
maxOptionWidth
=
(
canvasWidth
*
0.95
)
/
optionNum
;
const
arr
=
randomSortByArr
(
this
.
data
.
question_arr
[
questionIdx
].
option_arr
);
const
arr
=
randomSortByArr
(
this
.
data
.
question_arr
[
questionIdx
].
option_arr
);
arr
.
forEach
(
async
(
option
,
idx
)
=>
{
arr
.
forEach
(
async
(
option
,
idx
)
=>
{
const
optionNode
=
await
this
.
createOption
(
option
);
const
optionNode
=
await
this
.
createOption
(
option
);
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
x
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
optionNode
.
x
=
(
idx
-
(
arr
.
length
-
1
)
/
2
)
*
maxOptionWidth
-
box
.
x
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
scale
=
0
;
optionNode
.
scale
=
0
;
optionNode
.
parent
=
box
;
optionNode
.
parent
=
box
;
cc
.
tween
(
optionNode
)
cc
.
tween
(
optionNode
)
.
to
(
0.1
,
{
scale
:
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
)
})
.
to
(
0.1
,
{
scale
:
Math
.
min
(
1
,
(
maxOptionWidth
*
0.85
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
)
})
.
start
();
.
start
();
});
});
},
},
...
@@ -386,7 +388,7 @@ cc.Class({
...
@@ -386,7 +388,7 @@ cc.Class({
coolCatSpeakRight
(
cb
)
{
coolCatSpeakRight
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
right
'
,
-
1
);
playDragonBoneAnimation
(
cat
,
'
right
'
,
-
1
);
this
.
play
Effect
(
'
CoolCatRight
'
,
()
=>
{
this
.
play
AudioByUrl
(
this
.
data
.
startAudio
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
cb
();
cb
();
});
});
...
@@ -395,7 +397,7 @@ cc.Class({
...
@@ -395,7 +397,7 @@ cc.Class({
coolCatSpeakWrong
(
cb
)
{
coolCatSpeakWrong
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
wrong
'
,
-
1
);
playDragonBoneAnimation
(
cat
,
'
wrong
'
,
-
1
);
this
.
play
Effect
(
'
CoolCatWrong
'
,
()
=>
{
this
.
play
AudioByUrl
(
this
.
data
.
endAudio
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
cb
();
cb
();
});
});
...
...
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