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
8b2320d5
Commit
8b2320d5
authored
Dec 31, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 测试中间层
parent
8f5dd213
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
26 deletions
+53
-26
air.js
assets/middleLayer_for_debug/script/air.js
+5
-0
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+48
-26
No files found.
assets/middleLayer_for_debug/script/air.js
View file @
8b2320d5
...
@@ -4,6 +4,7 @@ export function initAir(_this) {
...
@@ -4,6 +4,7 @@ export function initAir(_this) {
const
realAir
=
{
const
realAir
=
{
uploadUrl
:
""
,
uploadUrl
:
""
,
uploadData
:
null
,
uploadData
:
null
,
engineInfo
:
null
,
hideAirClassLoading
(
templateName
,
loadData
)
{
hideAirClassLoading
(
templateName
,
loadData
)
{
_this
.
log
(
"
***成功调用hideAirClassLoading***
"
);
_this
.
log
(
"
***成功调用hideAirClassLoading***
"
);
window
.
air
.
onCourseInScreen
&&
window
.
air
.
onCourseInScreen
(()
=>
{
window
.
air
.
onCourseInScreen
&&
window
.
air
.
onCourseInScreen
(()
=>
{
...
@@ -156,6 +157,7 @@ export function initAir(_this) {
...
@@ -156,6 +157,7 @@ export function initAir(_this) {
_this
.
log
(
`===成功调用getEngineInfo===`
);
_this
.
log
(
`===成功调用getEngineInfo===`
);
// 调用原生获取机器信息
// 调用原生获取机器信息
window
.
air
.
getEngineInfoCallback
=
(
res
)
=>
{
window
.
air
.
getEngineInfoCallback
=
(
res
)
=>
{
window
.
air
.
engineInfo
=
res
;
callback
&&
callback
(
JSON
.
stringify
(
res
));
callback
&&
callback
(
JSON
.
stringify
(
res
));
window
.
air
.
getEngineInfoCallback
=
null
;
window
.
air
.
getEngineInfoCallback
=
null
;
};
};
...
@@ -202,6 +204,9 @@ export function initAir(_this) {
...
@@ -202,6 +204,9 @@ export function initAir(_this) {
console
.
log
(
'
汪汪汪
'
)
console
.
log
(
'
汪汪汪
'
)
}
else
{
}
else
{
console
.
error
(
'
非源生环境
'
);
console
.
error
(
'
非源生环境
'
);
if
(
method
==
'
getEngineInfo
'
){
window
.
air
.
getEngineInfoCallback
({
isDev
:
1
});
}
}
}
},
},
freeAllOcMethod
()
{
freeAllOcMethod
()
{
...
...
assets/middleLayer_for_debug/script/middleLayer.js
View file @
8b2320d5
...
@@ -6,6 +6,7 @@ cc.Class({
...
@@ -6,6 +6,7 @@ cc.Class({
},
},
callNetworkApiPost
(
baseUrl
,
uri
,
data
,
callBack
)
{
callNetworkApiPost
(
baseUrl
,
uri
,
data
,
callBack
)
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
const
url
=
`
${
baseUrl
}${
uri
}
`
;
const
url
=
`
${
baseUrl
}${
uri
}
`
;
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
open
(
"
POST
"
,
url
,
true
);
...
@@ -16,9 +17,11 @@ cc.Class({
...
@@ -16,9 +17,11 @@ cc.Class({
}
}
}
}
xhr
.
send
(
JSON
.
stringify
(
data
));
xhr
.
send
(
JSON
.
stringify
(
data
));
});
},
},
callNetworkApiGet
(
baseUrl
,
uri
,
data
,
callBack
)
{
callNetworkApiGet
(
baseUrl
,
uri
,
data
,
callBack
)
{
this
.
getBaseUrl
((
baseUrl
)
=>
{
let
queryStr
=
'
?
'
;
let
queryStr
=
'
?
'
;
const
params
=
[];
const
params
=
[];
for
(
const
key
in
data
)
{
for
(
const
key
in
data
)
{
...
@@ -37,6 +40,7 @@ cc.Class({
...
@@ -37,6 +40,7 @@ cc.Class({
console
.
log
(
'
url =
'
+
url
);
console
.
log
(
'
url =
'
+
url
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
open
(
'
GET
'
,
url
,
true
);
xhr
.
send
();
xhr
.
send
();
});
},
},
// 需要预加载的数量
// 需要预加载的数量
...
@@ -52,6 +56,24 @@ cc.Class({
...
@@ -52,6 +56,24 @@ cc.Class({
// this.preloadAll();
// this.preloadAll();
},
},
getBaseUrl
(
callback
)
{
if
(
window
.
air
.
engineInfo
){
if
(
window
.
air
.
engineInfo
.
isDev
==
1
){
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
callback
(
'
https://iteachabc.com
'
);
}
}
else
{
window
.
air
.
getEngineInfo
(()
=>
{
if
(
window
.
air
.
engineInfo
.
isDev
==
1
){
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
callback
(
'
https://iteachabc.com
'
);
}
});
}
},
start
()
{
start
()
{
this
.
node
.
zIndex
=
9999
;
this
.
node
.
zIndex
=
9999
;
cc
.
game
.
addPersistRootNode
(
this
.
node
);
cc
.
game
.
addPersistRootNode
(
this
.
node
);
...
...
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