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
6276e71f
Commit
6276e71f
authored
Apr 02, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: callMiddleLayerFunction - NS_login
parent
7d405dda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
19 deletions
+55
-19
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+55
-19
No files found.
assets/middleLayer_for_debug/script/middleLayer.js
View file @
6276e71f
...
...
@@ -83,22 +83,24 @@ cc.Class({
uiNode
.
scale
=
scale
;
initAir
(
this
);
// this.preloadAll();
this
.
role
=
'
student
'
;
},
getBaseUrl
(
callback
)
{
if
(
window
.
air
.
engineInfo
)
{
const
{
isDev
}
=
JSON
.
parse
(
window
.
air
.
engineInfo
);
if
(
isDev
==
1
)
{
if
(
window
.
air
.
engineInfo
)
{
const
{
isDev
}
=
JSON
.
parse
(
window
.
air
.
engineInfo
);
if
(
isDev
==
1
)
{
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
}
else
{
callback
(
'
https://iteachabc.com
'
);
}
}
else
{
window
.
courseware
.
getEngineInfo
(()
=>
{
const
{
isDev
}
=
JSON
.
parse
(
window
.
air
.
engineInfo
);
if
(
isDev
==
1
)
{
}
else
{
window
.
courseware
.
getEngineInfo
(()
=>
{
const
{
isDev
}
=
JSON
.
parse
(
window
.
air
.
engineInfo
);
if
(
isDev
==
1
)
{
callback
(
'
https://staging-teach.ireadabc.com
'
);
}
else
{
}
else
{
callback
(
'
https://iteachabc.com
'
);
}
});
...
...
@@ -264,6 +266,40 @@ cc.Class({
loadingProgress
.
getComponent
(
cc
.
ProgressBar
).
progress
=
this
.
loadedCount
/
this
.
preloadCount
;
},
onHomeworkFinish
(
callBack
,
data
=
null
)
{
console
.
log
(
'
this.courseIndex =
'
+
JSON
.
stringify
(
this
.
currentBundleInfo
));
if
(
this
.
currentBundleInfo
.
sceneName
==
'
ls_fly
'
)
{
const
rightCount
=
data
.
reduce
((
preValue
,
right
)
=>
{
if
(
right
)
{
return
preValue
+
1
;
}
else
{
return
preValue
;
}
},
0
);
console
.
log
(
'
rightCount =
'
+
rightCount
);
}
console
.
log
(
'
onHomeworkFinish:
'
+
JSON
.
stringify
(
data
));
},
callMiddleLayerFunction
(
apiName
,
data
,
callback
)
{
switch
(
apiName
)
{
case
'
NS_login
'
:
if
(
data
.
userName
==
'
admin
'
&&
data
.
password
==
'
123456
'
)
{
this
.
showLog
(
'
登陆成功!
'
);
callback
(
'
登陆成功!
'
);
// this.goNextPage();
// this.goPrePage();
}
else
{
this
.
showLog
(
'
密码错误!
'
);
callback
(
'
密码错误!
'
);
}
break
;
default
:
this
.
showLog
(
'
未定义接口:
'
+
apiName
);
break
;
}
},
asyncDelayLog
(
str
)
{
console
.
log
(
str
);
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -291,7 +327,7 @@ cc.Class({
window
.
courseware
.
freeAllOcMethod
();
const
flag
=
cc
.
director
.
loadScene
(
"
debug_shell
"
,
null
,
null
,
(
err
,
scene
)
=>
{
});
if
(
!
flag
)
{
if
(
!
flag
)
{
// 没有壳的情况下,直接加载中间层场景
cc
.
director
.
loadScene
(
"
middleLayer_for_debug
"
,
null
,
null
,
(
err
,
scene
)
=>
{
});
...
...
@@ -655,7 +691,7 @@ cc.Class({
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
bg
=
layout
.
addComponent
(
cc
.
Graphics
);
bg
.
fillRect
(
-
canvas
.
width
/
2
,
-
canvas
.
height
/
2
,
canvas
.
width
,
canvas
.
height
);
const
laodingLayer
=
cc
.
find
(
'
middleLayer/loadingLayer
'
);
laodingLayer
.
active
=
true
;
...
...
@@ -671,15 +707,15 @@ cc.Class({
script
.
setProgress
(
changeObj
.
value
);
},
1
);
const
changeObj
=
{
value
:
0
};
const
changeObj
=
{
value
:
0
};
cc
.
tween
(
changeObj
)
.
to
(
5
,
{
value
:
0.9
})
.
to
(
5
,
{
value
:
0.9
})
.
call
(()
=>
{
clearInterval
(
id
);
})
.
start
();
// const colorList = this.getRainbowColorList();
// const layout = cc.find('middleLayer/layout');
...
...
@@ -705,7 +741,7 @@ cc.Class({
// return width + node.width;
// }, 0);
// layout.width = totalWidth;
},
hideWaitingLetters
()
{
...
...
@@ -755,13 +791,13 @@ cc.Class({
this
.
showOneLog
();
},
1000
);
},
exit
()
{
cc
.
game
.
removePersistRootNode
(
this
.
node
);
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
});
},
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
});
},
getRainbowColorList
()
{
return
[
...
...
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