Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
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
middleLayer_for_debug
Commits
e9a32d1f
Commit
e9a32d1f
authored
Jul 07, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
7812fa56
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
675 additions
and
2099 deletions
+675
-2099
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+608
-2061
air.js
assets/middleLayer_for_debug/script/air.js
+51
-0
middleLayer.ts
assets/middleLayer_for_debug/script/middleLayer.ts
+16
-38
No files found.
assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
e9a32d1f
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_debug/script/air.js
View file @
e9a32d1f
...
...
@@ -43,6 +43,7 @@ export function initAir(_this) {
startBuyToAppStoreCallBack
:
null
,
recognitionCameraCallBack
:
null
,
testCallBack
:
null
,
testConvertCallBack
:
null
,
recordCallBack
:
null
,
onCourseInScreen
:
null
,
};
...
...
@@ -173,6 +174,53 @@ export function initAir(_this) {
window
.
courseware
.
callOcMethod
(
"
stopTest
"
,
{});
},
startTestConvert
(
testText
,
option
)
{
window
.
courseware
.
hasCalledStartTestConvert
=
true
;
_this
.
log
(
`===成功调用startTestConvert=== testText ==
${
testText
}
`
);
window
.
courseware
.
callOcMethod
(
"
startTestConvert
"
,
{
...
option
,
"
params
"
:
testText
});
},
stopTestConvert
(
testCallback
,
convertCallback
)
{
window
.
courseware
.
hasCalledStartTestConvert
=
false
;
_this
.
log
(
`===成功调用stopTestConvert===`
);
if
(
!
testCallback
)
{
// 不传回调函数就表示取消评测
_this
.
log
(
`===成功取消录音评测===`
);
window
.
courseware
.
callOcMethod
(
"
stopTestConvert
"
,
{
isBreak
:
1
});
return
;
}
// 结束录音
window
.
air
.
testCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testCallBack=== res ==
${
res
}
`
);
// 录音异常兼容处理
const
resObj
=
JSON
.
parse
(
res
);
if
(
resObj
.
errCode
)
{
resObj
.
result
=
{
overall
:
0
};
resObj
.
audioUrl
=
""
;
res
=
JSON
.
stringify
(
resObj
);
_this
.
showTips
(
`评测服务信号弱,可能会造成评分不准确,请稍后再来录音评测吧~`
);
}
testCallback
&&
testCallback
(
res
);
window
.
air
.
testCallBack
=
null
;
};
// 结束变声
window
.
air
.
testConvertCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testConvertCallBack=== res ==
${
res
}
`
);
// 录音异常兼容处理
const
resObj
=
JSON
.
parse
(
res
);
if
(
resObj
.
errCode
)
{
resObj
.
convertUrl
=
""
;
res
=
JSON
.
stringify
(
resObj
);
_this
.
showTips
(
`变声失败,请稍后再来尝试吧~`
);
}
convertCallback
&&
convertCallback
(
res
);
window
.
air
.
testConvertCallBack
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
stopTestConvert
"
,
{});
},
startRealtimeRecord
(
params
=
{})
{
window
.
courseware
.
hasCalledRealtimeRecord
=
true
;
_this
.
log
(
`===成功调用startRealtimeRecord===
${
JSON
.
stringify
(
params
)}
`
);
...
...
@@ -369,6 +417,9 @@ export function initAir(_this) {
if
(
window
.
courseware
.
hasCalledStartTest
)
{
window
.
courseware
.
stopTest
();
}
if
(
window
.
courseware
.
hasCalledStartTestConvert
)
{
window
.
courseware
.
stopTestConvert
();
}
if
(
window
.
courseware
.
hasCalledRealtimeRecord
)
{
window
.
courseware
.
stopRealtimeRecord
();
}
...
...
assets/middleLayer_for_debug/script/middleLayer.ts
View file @
e9a32d1f
import
{
middleLayerBase
}
from
"
./middleLayerBase
"
;
import
{
initAir
}
from
'
./air
'
;
import
{
playAudioByUrl
}
from
'
./util
'
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -481,44 +483,10 @@ export default class NewClass extends middleLayerBase {
});
}
jjDemo
()
{
cc
.
find
(
'
middleLayer/ui/jjdemo/goDebug
'
).
on
(
'
click
'
,
()
=>
{
cc
.
find
(
`middleLayer/ui/jjdemo`
).
active
=
false
;
});
cc
.
find
(
'
middleLayer/ui/jjdemo/ox
'
).
on
(
'
click
'
,
()
=>
{
this
.
hideUI
();
const
engineObj
=
JSON
.
parse
((
<
any
>
window
).
air
.
engineInfo
);
if
(
engineObj
.
isDev
==
1
)
{
this
.
loadOnlineCourseWare
(
27333
,
false
,
null
);
}
else
{
this
.
loadOnlineCourseWare
(
45892
,
false
,
null
);
}
});
cc
.
find
(
'
middleLayer/ui/jjdemo/pp
'
).
on
(
'
click
'
,
()
=>
{
cc
.
find
(
'
middleLayer/ui/jjdemo/web
'
).
active
=
true
;
cc
.
find
(
'
middleLayer/ui/jjdemo/webBar
'
).
active
=
true
;
});
cc
.
find
(
'
middleLayer/ui/jjdemo/webBar/btnLeft
'
).
on
(
'
click
'
,
()
=>
{
cc
.
find
(
'
middleLayer/ui/jjdemo/web
'
).
active
=
false
;
cc
.
find
(
'
middleLayer/ui/jjdemo/webBar
'
).
active
=
false
;
});
cc
.
find
(
'
middleLayer/ui/jjdemo/faf
'
).
on
(
'
click
'
,
()
=>
{
this
.
hideUI
();
const
engineObj
=
JSON
.
parse
((
<
any
>
window
).
air
.
engineInfo
);
if
(
engineObj
.
isDev
==
1
)
{
this
.
loadOnlineCourseWare
(
29235
,
false
,
null
);
}
else
{
this
.
loadOnlineCourseWare
(
55645
,
false
,
null
);
}
});
}
covertUrl
=
null
;
initListener
()
{
// 剑津DEMO
this
.
jjDemo
();
const
exitBtn
=
cc
.
find
(
'
middleLayer/ExitBtn
'
);
exitBtn
.
on
(
'
click
'
,
()
=>
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
...
...
@@ -635,7 +603,8 @@ export default class NewClass extends middleLayerBase {
});
cc
.
find
(
'
middleLayer/ui/BtnOpenTest
'
).
on
(
'
click
'
,
()
=>
{
(
<
any
>
window
).
courseware
.
startTest
(
'
apple
'
);
// (<any>window).courseware.startTest('apple');
(
<
any
>
window
).
courseware
.
startTestConvert
(
'
My name is Lucy
'
);
});
cc
.
find
(
'
middleLayer/ui/BtnCloseTest
'
).
on
(
'
click
'
,
()
=>
{
...
...
@@ -643,11 +612,20 @@ export default class NewClass extends middleLayerBase {
this
.
log
(
'
--------录音评测返回结果 stopTest ---------
'
);
this
.
log
(
res
)
this
.
log
(
'
------------------------------
'
);
this
.
log
(
`录音apple的评分是
${
JSON
.
parse
(
res
).
result
.
overall
}
`
);
this
.
log
(
`录音apple的音频URL是
${
JSON
.
parse
(
res
).
audioUrl
}
`
);
this
.
log
(
`录音的评分是
${
JSON
.
parse
(
res
).
result
.
overall
}
`
);
this
.
log
(
`录音的音频URL是
${
JSON
.
parse
(
res
).
audioUrl
}
`
);
},
covert
=>
{
this
.
log
(
'
--------变声返回结果 ---------
'
);
this
.
log
(
covert
)
this
.
covertUrl
=
JSON
.
parse
(
covert
).
convertUrl
;
this
.
log
(
`变声的URL:
${
JSON
.
parse
(
covert
).
convertUrl
}
`
);
this
.
log
(
'
------------------------------
'
);
});
});
cc
.
find
(
'
middleLayer/ui/BtnCovert
'
).
on
(
'
click
'
,
()
=>
{
playAudioByUrl
(
this
.
covertUrl
);
});
const
BtnStartLocal
=
cc
.
find
(
'
middleLayer/ui/BtnStartLocal
'
);
...
...
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