Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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_kyxq
Commits
5ab0ff43
Commit
5ab0ff43
authored
Nov 03, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
73732df5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
8 deletions
+59
-8
MissionPage.ts
assets/middleLayer_for_kyxq/script/MissionPage.ts
+7
-2
middleLayer.ts
assets/middleLayer_for_kyxq/script/middleLayer.ts
+52
-6
No files found.
assets/middleLayer_for_kyxq/script/MissionPage.ts
View file @
5ab0ff43
import
{
BlendFactor
}
from
'
./../../../creator.d
'
;
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
...
...
@@ -58,6 +56,13 @@ export default class NewClass extends cc.Component {
this
.
scrollView
.
opacity
=
255
;
this
.
loading
.
active
=
false
;
// 保存关卡数据用于解锁和跳下一关
global
.
middleLayer
.
crossArray
=
this
.
data
;
}
async
onDisable
()
{
global
.
middleLayer
.
crossArray
=
[];
}
async
initData
()
{
...
...
assets/middleLayer_for_kyxq/script/middleLayer.ts
View file @
5ab0ff43
...
...
@@ -84,6 +84,52 @@ export default class NewClass extends middleLayerBase {
// }, 2000);
}
saveAnswer
(
data
,
callback
=
null
)
{
this
.
callNetworkApiPost
(
`/api/kyxq/v1/user/saveanswer`
,
{
syllabus_id
:
this
.
courseItem
.
course_id
,
courseware_id
:
this
.
courseItem
.
id
,
template_name
:
this
.
courseItem
.
template_name
,
score
:
data
?
data
.
score
:
0
,
total_count
:
data
?
data
.
total_count
:
0
,
right_count
:
data
?
data
.
right_count
:
0
,
wrong_count
:
data
?
data
.
wrong_count
:
0
,
result
:
JSON
.
stringify
(
data
),
study_duration
:
Date
.
now
()
-
this
.
courseOpenTimeStamp
},
(
res
)
=>
{
if
(
res
.
code
!=
200
)
{
this
.
showTips
(
`保存学情数据失败 [
${
res
.
msg
}
]`
);
return
;
}
this
.
saveEnd
(
callback
);
});
}
saveEnd
(
callback
){
if
(
this
.
courseIndex
<
this
.
courses
.
length
-
1
)
{
return
;
}
this
.
callNetworkApiPost
(
`/api/kyxq/v1/user/saveend`
,
{
syllabus_id
:
this
.
courseItem
.
course_id
,
},
(
res
)
=>
{
if
(
res
.
code
!=
200
)
{
this
.
showTips
(
`保存结束状态失败 [
${
res
.
msg
}
]`
);
return
;
}
callback
&&
callback
();
});
}
unlockNext
(
nextSyllabusId
)
{
this
.
callNetworkApiPost
(
`/api/kyxq/v1/user/unlock`
,
{
syllabus_id
:
nextSyllabusId
,
},
(
res
)
=>
{
if
(
res
.
code
!=
200
)
{
this
.
showTips
(
`解锁下一关卡失败 [
${
res
.
msg
}
]`
);
return
;
}
});
}
onHomeworkFinish
(
d1
=
null
,
d2
=
null
)
{
let
data
=
null
;
let
callback
=
null
;
...
...
@@ -95,7 +141,7 @@ export default class NewClass extends middleLayerBase {
callback
=
d2
;
}
console
.
log
(
'
onHomeworkFinish:
'
+
JSON
.
stringify
(
data
));
callback
&&
callback
(
);
this
.
saveAnswer
(
data
,
callback
);
}
_designSize
=
null
;
// 设计分辨率
...
...
@@ -204,19 +250,19 @@ export default class NewClass extends middleLayerBase {
}
}
academy
Array
=
[];
// 关卡数组
cross
Array
=
[];
// 关卡数组
goNextCross
()
{
const
currentid
=
this
.
courseItem
.
course_id
;
let
currentIndex
=
null
;
for
(
let
i
=
0
;
i
<
this
.
academy
Array
.
length
;
i
++
)
{
const
item
=
this
.
academy
Array
[
i
];
for
(
let
i
=
0
;
i
<
this
.
cross
Array
.
length
;
i
++
)
{
const
item
=
this
.
cross
Array
[
i
];
if
(
item
.
id
==
currentid
)
{
currentIndex
=
i
;
break
;
}
}
if
(
currentIndex
!=
null
&&
this
.
academy
Array
[
currentIndex
+
1
])
{
this
.
loadOnlineCourseWare
(
this
.
academy
Array
[
currentIndex
+
1
].
id
,
null
,
null
);
if
(
currentIndex
!=
null
&&
this
.
cross
Array
[
currentIndex
+
1
])
{
this
.
loadOnlineCourseWare
(
this
.
cross
Array
[
currentIndex
+
1
].
id
,
null
,
null
);
}
else
{
this
.
showTips
(
`已经是最后一关了`
);
}
...
...
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