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
1ef49150
Commit
1ef49150
authored
Dec 03, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 调用原生方法测试
parent
a6c4c931
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1017 additions
and
226 deletions
+1017
-226
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+971
-223
air.js
assets/middleLayer_for_debug/script/air.js
+38
-3
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+8
-0
No files found.
assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
1ef49150
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_debug/script/air.js
View file @
1ef49150
...
@@ -9,9 +9,16 @@ export function initAir(_this) {
...
@@ -9,9 +9,16 @@ export function initAir(_this) {
_this
.
log
(
"
***成功调用onCourseInScreen***
"
);
_this
.
log
(
"
***成功调用onCourseInScreen***
"
);
});
});
},
},
osmoCallback
:
null
,
osmoCallback
:
function
(
res
){
osmoHandwritingCallback
:
null
,
_this
.
log
(
`***成功调用osmoCallback***参数==
${
res
}
`
);
osmoFingerReadCallback
:
null
,
},
osmoHandwritingCallback
:
function
(
res
){
_this
.
log
(
`***成功调用osmoHandwritingCallback***参数==
${
res
}
`
);
},
osmoFingerReadCallback
:
function
(
res
){
_this
.
log
(
`***成功调用osmoFingerReadCallback***参数==
${
res
}
`
);
},
getEngineInfoCallback
:
null
,
onCourseInScreen
:
null
,
onCourseInScreen
:
null
,
}
}
window
.
courseware
=
{
window
.
courseware
=
{
...
@@ -73,23 +80,51 @@ export function initAir(_this) {
...
@@ -73,23 +80,51 @@ export function initAir(_this) {
_this
.
log
(
`===成功调用openRecognitionCamera===`
);
_this
.
log
(
`===成功调用openRecognitionCamera===`
);
callback
&&
callback
(
null
);
callback
&&
callback
(
null
);
},
},
getEngineInfo
(
callback
)
{
_this
.
log
(
`===成功调用getEngineInfo===`
);
// 调用原生获取机器信息
window
.
air
.
getEngineInfoCallback
=
(
res
)
=>
{
callback
&&
callback
(
res
);
window
.
air
.
getEngineInfoCallback
=
null
;
};
this
.
callOcMethod
(
"
getEngineInfo
"
,
{});
},
openOsmo
()
{
openOsmo
()
{
_this
.
log
(
`===成功调用openOsmo===`
);
_this
.
log
(
`===成功调用openOsmo===`
);
this
.
callOcMethod
(
"
openOsmo
"
,
{});
},
},
closeOsmo
()
{
closeOsmo
()
{
_this
.
log
(
`===成功调用closeOsmo===`
);
_this
.
log
(
`===成功调用closeOsmo===`
);
this
.
callOcMethod
(
"
closeOsmo
"
,
{});
},
},
openOsmoHandwriting
()
{
openOsmoHandwriting
()
{
_this
.
log
(
`===成功调用openOsmoHandwriting===`
);
_this
.
log
(
`===成功调用openOsmoHandwriting===`
);
this
.
callOcMethod
(
"
openOsmoHandwriting
"
,
{});
},
},
closeOsmoHandwriting
()
{
closeOsmoHandwriting
()
{
_this
.
log
(
`===成功调用closeOsmoHandwriting===`
);
_this
.
log
(
`===成功调用closeOsmoHandwriting===`
);
this
.
callOcMethod
(
"
closeOsmoHandwriting
"
,
{});
},
},
openOsmoFingerRead
()
{
openOsmoFingerRead
()
{
_this
.
log
(
`===成功调用openOsmoFingerRead===`
);
_this
.
log
(
`===成功调用openOsmoFingerRead===`
);
this
.
callOcMethod
(
"
openOsmoFingerRead
"
,
{});
},
},
closeOsmoFingerRead
()
{
closeOsmoFingerRead
()
{
_this
.
log
(
`===成功调用closeOsmoFingerRead===`
);
_this
.
log
(
`===成功调用closeOsmoFingerRead===`
);
this
.
callOcMethod
(
"
closeOsmoFingerRead
"
,
{});
},
callOcMethod
(
method
,
param
)
{
const
paramStr
=
JSON
.
stringify
(
param
);
_this
.
log
(
`===成功调用原生方法
${
method
}
===参数==
${
paramStr
}
`
);
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
CocosMng
'
,
`
${
method
}
:`
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
com/iplayabc/cocos/AppActivity
'
,
method
,
'
(Ljava/lang/String;)Ljava/lang/String;
'
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_WINDOWS
)
{
console
.
log
(
'
汪汪汪
'
)
}
else
{
throw
(
'
非源生环境
'
);
}
},
},
};
};
...
...
assets/middleLayer_for_debug/script/middleLayer.js
View file @
1ef49150
...
@@ -106,6 +106,14 @@ cc.Class({
...
@@ -106,6 +106,14 @@ cc.Class({
this
.
goPrePage
();
this
.
goPrePage
();
});
});
cc
.
find
(
'
middleLayer/ui/BtnOpenOsmo
'
).
on
(
'
click
'
,
()
=>
{
window
.
courseware
.
openOsmo
();
});
cc
.
find
(
'
middleLayer/ui/BtnCloseOsmo
'
).
on
(
'
click
'
,
()
=>
{
window
.
courseware
.
closeOsmo
();
});
const
BtnStartLocal
=
cc
.
find
(
'
middleLayer/ui/BtnStartLocal
'
);
const
BtnStartLocal
=
cc
.
find
(
'
middleLayer/ui/BtnStartLocal
'
);
BtnStartLocal
.
on
(
'
click
'
,
()
=>
{
BtnStartLocal
.
on
(
'
click
'
,
()
=>
{
const
addressText
=
cc
.
find
(
'
middleLayer/ui/address
'
);
const
addressText
=
cc
.
find
(
'
middleLayer/ui/address
'
);
...
...
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