Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP_Boardgame_L3R4
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_Boardgame_L3R4
Commits
fbd8d630
Commit
fbd8d630
authored
Jul 28, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
f14dd5c9
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
776 additions
and
202 deletions
+776
-202
grow.mp3
assets/OP_Boardgame_L3R4/audios/grow.mp3
+0
-0
grow.mp3.meta
assets/OP_Boardgame_L3R4/audios/grow.mp3.meta
+7
-0
loss.wav
assets/OP_Boardgame_L3R4/audios/loss.wav
+0
-0
loss.wav.meta
assets/OP_Boardgame_L3R4/audios/loss.wav.meta
+7
-0
piece.mp3
assets/OP_Boardgame_L3R4/audios/piece.mp3
+0
-0
piece.mp3.meta
assets/OP_Boardgame_L3R4/audios/piece.mp3.meta
+7
-0
right.wav
assets/OP_Boardgame_L3R4/audios/right.wav
+0
-0
right.wav.meta
assets/OP_Boardgame_L3R4/audios/right.wav.meta
+7
-0
win.wav
assets/OP_Boardgame_L3R4/audios/win.wav
+0
-0
win.wav.meta
assets/OP_Boardgame_L3R4/audios/win.wav.meta
+7
-0
wrong.mp3
assets/OP_Boardgame_L3R4/audios/wrong.mp3
+0
-0
wrong.mp3.meta
assets/OP_Boardgame_L3R4/audios/wrong.mp3.meta
+7
-0
OP_Boardgame_L3R4.fire
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.fire
+566
-0
OP_Boardgame_L3R4.ts
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.ts
+11
-1
ComponentBase.ts
form_angular/src/app/form/ComponentBase.ts
+0
-89
form.component.css
form_angular/src/app/form/form.component.css
+4
-31
form.component.html
form_angular/src/app/form/form.component.html
+68
-58
form.component.ts
form_angular/src/app/form/form.component.ts
+85
-23
No files found.
assets/OP_Boardgame_L3R4/audios/grow.mp3
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/grow.mp3.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "cd66da6e-40cf-4972-8a9a-89699473d49e",
"downloadMode": 0,
"duration": 3.448163,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/audios/loss.wav
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/loss.wav.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "0731f98b-1e5f-4a24-b41e-7c8c3c90c7bc",
"downloadMode": 0,
"duration": 0.873878,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/audios/piece.mp3
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/piece.mp3.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "dc1b381f-a4e0-4624-a4a0-ad757397b984",
"downloadMode": 0,
"duration": 0.372875,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/audios/right.wav
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/right.wav.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "d09a171d-9e26-4029-97ae-692222ef32de",
"downloadMode": 0,
"duration": 0.45102,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/audios/win.wav
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/win.wav.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "2d0bc438-c8ca-4d5e-bbe4-bcbafce286a8",
"downloadMode": 0,
"duration": 1.808583,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/audios/wrong.mp3
0 → 100644
View file @
fbd8d630
File added
assets/OP_Boardgame_L3R4/audios/wrong.mp3.meta
0 → 100644
View file @
fbd8d630
{
"ver": "2.0.1",
"uuid": "8e9346e6-8b60-49c6-9ef3-904e4ae03327",
"downloadMode": 0,
"duration": 0.6818,
"subMetas": {}
}
\ No newline at end of file
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.fire
View file @
fbd8d630
This diff is collapsed.
Click to expand it.
assets/OP_Boardgame_L3R4/scene/OP_Boardgame_L3R4.ts
View file @
fbd8d630
...
...
@@ -364,7 +364,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
showGoodJob
()
{
return
new
Promise
((
resolve
)
=>
{
if
(
this
.
data
.
audioRight
)
{
this
.
playAudioByUrl
(
this
.
data
.
audioRight
);
}
else
{
}
const
result
=
cc
.
find
(
'
Canvas/testBg/result
'
);
result
.
active
=
true
;
const
goodjob
=
cc
.
find
(
'
Canvas/testBg/result/goodjob
'
);
...
...
@@ -723,4 +727,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
variant1
=
cc
.
MaterialVariant
.
create
(
material
,
sprite
);
sprite
.
setMaterial
(
0
,
variant1
);
}
playEffect
(
effectName
)
{
const
effectNode
=
cc
.
find
(
`res/
${
effectName
}
`
);
const
clip
=
effectNode
.
getComponent
(
cc
.
AudioSource
).
clip
;
cc
.
audioEngine
.
play
(
clip
,
false
,
0.8
);
}
}
form_angular/src/app/form/ComponentBase.ts
deleted
100644 → 0
View file @
f14dd5c9
import
{
ApplicationRef
,
ChangeDetectorRef
,
ElementRef
,
ViewChild
}
from
"
@angular/core
"
;
export
class
ComponentBase
{
// 储存数据用
saveKey
=
""
;
// 储存对象
item
:
any
=
{};
ngOnChanges
()
{
}
ngOnDestroy
()
{
}
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
}
ngOnInit
()
{
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
if
(
data
)
{
this
.
item
=
data
;
this
.
itemStr
=
JSON
.
stringify
(
this
.
item
,
null
,
4
).
trim
();
}
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
},
this
.
saveKey
);
}
@
ViewChild
(
"
itemTextarea
"
,
{
static
:
true
})
itemTextarea
:
ElementRef
;
copyData
()
{
this
.
itemTextarea
.
nativeElement
.
select
();
document
.
execCommand
(
"
copy
"
);
}
/**
* 储存图片数据
* @param e
*/
onAssetUploadSuccess
(
e
:
any
,
...
key
:
Array
<
string
>
)
{
let
item
=
this
.
item
;
for
(
let
i
=
0
;
i
<
key
.
length
;
i
++
)
{
if
(
i
+
1
==
key
.
length
)
{
item
[
key
[
i
]]
=
e
.
url
;
this
.
save
();
return
;
}
item
=
item
[
key
[
i
]];
}
}
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
this
.
itemStr
=
JSON
.
stringify
(
this
.
item
,
null
,
4
).
trim
();
this
.
refresh
();
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
}
itemStr
=
""
;
load
()
{
this
.
itemStr
=
this
.
itemTextarea
.
nativeElement
.
value
;
if
(
this
.
isJSON
(
this
.
itemStr
))
{
this
.
item
=
JSON
.
parse
(
this
.
itemStr
);
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
isJSON
(
str
)
{
if
(
typeof
str
==
'
string
'
)
{
try
{
var
obj
=
JSON
.
parse
(
str
);
if
(
typeof
obj
==
'
object
'
&&
obj
)
{
return
true
;
}
return
false
;
}
catch
(
e
)
{
return
false
;
}
}
return
false
;
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
},
1
);
}
init
()
{
}
}
form_angular/src/app/form/form.component.css
View file @
fbd8d630
...
...
@@ -20,10 +20,10 @@
border-style
:
dashed
;
padding
:
20px
;
margin
:
20px
;
/*width: 500px; */
/*//border-radius: 20px;*/
/*//border-width: 2px;*/
/*//border-color: #000000;*/
width
:
500px
;
border-radius
:
20px
;
border-width
:
2px
;
border-color
:
#000000
;
}
...
...
@@ -33,30 +33,3 @@
padding
:
10px
;
margin
:
10px
;
}
.button-right
{
border-style
:
dotted
;
border-color
:
rgb
(
42
,
142
,
72
);
width
:
100px
;
height
:
50px
;
color
:
rgb
(
42
,
142
,
72
);
background-color
:
white
;
}
.button-wrong
{
border-style
:
dotted
;
border-color
:
rgb
(
180
,
0
,
0
);
width
:
100px
;
height
:
50px
;
color
:
rgb
(
180
,
0
,
0
);
background-color
:
white
;
}
.button-disable
{
border-style
:
dotted
;
border-color
:
black
;
width
:
100px
;
height
:
50px
;
color
:
black
;
background-color
:
white
;
}
\ No newline at end of file
form_angular/src/app/form/form.component.html
View file @
fbd8d630
<div
class=
"model-content"
>
<div
style=
"padding: 10px;"
>
<div
class=
"border"
style=
"width: 1000px;"
>
<textarea
style=
"width: 955px; height: 300px;"
(
blur
)="
load
()"
#
itemTextarea
>
{{itemStr}}
</textarea>
<button
(
click
)="
copyData
();"
>
Copy
</button>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<span
style=
"font-size: 20px;"
>
标题:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
questionText
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
题目说明音频:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
[
_audioName
]="
item
.
audioFileName
"
(
audioName
)="
saveAudioFileName
($
event
)"
></app-audio-recorder>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
*
ngFor=
"let question of item.questions; let i = index"
>
<div
class=
"border"
style=
"width: 950px;"
>
<span
style=
"font-size: 20px;"
>
选项类型:
</span>
<div
*
ngIf=
"question.type=='img'"
>
<button
class=
"button-right"
>
图片
</button>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'txt'
;
save
();"
>
文字
</button>
</div>
<div
*
ngIf=
"question.type=='txt'"
>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'img'
;
save
();"
>
图片
</button>
<button
class=
"button-right"
>
文字
</button>
</div>
<div
*
ngIf=
"question.type=='img'"
>
图片:
<div
style=
"width: 300px;"
>
<app-upload-image-with-preview
[
picUrl
]="
question
.
image
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
image
')"
>
</app-upload-image-with-preview>
</div>
<div
class=
"border"
style=
"padding: 50px; width: 800px;"
>
<span
style=
"font-size: 20px;"
>
游戏时长(秒):
</span>
<input
type=
"number"
nz-input
[(
ngModel
)]="
item
.
roundTime
"
(
blur
)="
save
()"
>
<br>
<span
style=
"font-size: 20px;"
>
语音评测时长(秒):
</span>
<input
type=
"number"
nz-input
[(
ngModel
)]="
item
.
testDuration
"
(
blur
)="
save
()"
>
</div>
<span>
音频:
</span>
<app-audio-recorder
[
audioUrl
]="
question
.
audio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
audio
')"
>
<div
class=
"border"
style=
"padding: 50px; width: 800px;"
>
<div
style=
"margin-bottom: 20px;"
>
<span
style=
"font-size: 20px;"
>
匹配界面刚进去的时候:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioOnEnterMatch
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioOnEnterMatch
')"
>
</app-audio-recorder>
<div
*
ngIf=
"question.type=='txt'"
>
<span>
文本:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
question
.
text
"
(
blur
)="
save
()"
>
</div>
<br>
<button
style=
"width: 900px; height: 30px; color: red;"
(
click
)="
removeQuestion
(
i
)"
>
删除题目
</button>
</div>
</div>
<div
class=
"border"
style=
"width: 950px;"
>
<button
style=
"width: 900px; height: 100px;"
(
click
)="
addQuestion
()"
>
增加题目
</button>
</div>
<span
style=
"font-size: 20px;"
>
进入游戏:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioOnEnterGame
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioOnEnterGame
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
开始倒计时之后点击猫咪:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
auidoDuringGame
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
auidoDuringGame
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
点击录音按钮,第一次进入录音页面:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioOnFirstTest
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioOnFirstTest
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
在录音界面点击猫咪:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioDuringTest
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioDuringTest
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
正确:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioRight
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioRight
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
错误:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioWrong
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioWrong
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
时间内送走所有小船(较快):
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioWinInTime
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioWinInTime
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
时间内送走所有小船(较慢):
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioLossInTime
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioLossInTime
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
时间到,没有送走所有小船(对方送走更多):
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioLossOutTime
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioLossOutTime
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
时间到,没有送走所有小船(对方送走更少):
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioWinOutTime
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioWinOutTime
')"
>
</app-audio-recorder>
<br>
<span
style=
"font-size: 20px;"
>
游戏结束后点击猫咪:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
audioAfterGame
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audioAfterGame
')"
>
</app-audio-recorder>
</div>
</div>
</div>
\ No newline at end of file
form_angular/src/app/form/form.component.ts
View file @
fbd8d630
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
ComponentBase
}
from
'
./ComponentBase
'
;
@
Component
({
...
...
@@ -8,36 +7,99 @@ import { ComponentBase } from './ComponentBase';
templateUrl
:
'
./form.component.html
'
,
styleUrls
:
[
'
./form.component.css
'
]
})
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
card_machine
"
;
saveKey
=
"
OP_Boardgame_L3R4
"
;
// 储存对象
item
:
any
=
{
title
:
''
,
questionText
:
''
,
questionTextAudio
:
''
,
audioFileName
:
''
,
questions
:
[],
item
;
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
}
ngOnInit
()
{
this
.
item
=
{
roundTime
:
80
,
testDuration
:
5
,
audioOnEnterMatch
:
''
,
audioOnEnterGame
:
''
,
auidoDuringGame
:
''
,
// TODO:
audioOnFirstTest
:
''
,
audioDuringTest
:
''
,
// TODO:
audioRight
:
''
,
audioWrong
:
''
,
audioWinInTime
:
''
,
audioLossInTime
:
''
,
audioWinOutTime
:
''
,
audioLossOutTime
:
''
,
audioAfterGame
:
''
,
// TODO:
};
addQuestion
()
{
this
.
item
.
questions
.
push
({
type
:
'
img
'
,
audio
:
''
,
text
:
''
,
image
:
''
});
this
.
save
();
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
if
(
data
)
{
this
.
item
=
data
;
}
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
},
this
.
saveKey
);
}
ngOnChanges
()
{
}
removeQuestion
(
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
ngOnDestroy
()
{
}
init
()
{
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
saveAudioFileName
(
name
)
{
this
.
item
.
audioFileName
=
name
;
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
/**
* 储存数据
*/
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
this
.
refresh
();
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
},
1
);
}
}
\ No newline at end of file
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