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
9632f862
Commit
9632f862
authored
Nov 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加背景图配置功能
parent
5aa43e26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2819 additions
and
1968 deletions
+2819
-1968
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+2779
-1950
MissionPage.ts
assets/middleLayer_for_kyxq/script/MissionPage.ts
+22
-11
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+18
-7
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
9632f862
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/middleLayer_for_kyxq/script/MissionPage.ts
View file @
9632f862
...
@@ -54,7 +54,7 @@ export default class NewClass extends cc.Component {
...
@@ -54,7 +54,7 @@ export default class NewClass extends cc.Component {
// onLoad () {}
// onLoad () {}
async
start
()
{
async
start
()
{
this
.
initBg
()
;
this
.
initBg
()
this
.
userInfo
=
await
this
.
Viewer
.
getComponent
(
"
PageViewer
"
).
getUserInfo
();
this
.
userInfo
=
await
this
.
Viewer
.
getComponent
(
"
PageViewer
"
).
getUserInfo
();
}
}
...
@@ -79,6 +79,15 @@ export default class NewClass extends cc.Component {
...
@@ -79,6 +79,15 @@ export default class NewClass extends cc.Component {
global
.
middleLayer
.
crossArray
=
[];
global
.
middleLayer
.
crossArray
=
[];
}
}
initBg
()
{
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
bg
=
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
);
const
sx
=
canvas
.
width
/
bg
.
width
;
const
sy
=
canvas
.
height
/
bg
.
height
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
}
async
initData
()
{
async
initData
()
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
],
deep
:
2
});
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
],
deep
:
2
});
this
.
data
=
[]
this
.
data
=
[]
...
@@ -98,6 +107,7 @@ export default class NewClass extends cc.Component {
...
@@ -98,6 +107,7 @@ export default class NewClass extends cc.Component {
this
.
configData
=
_data
.
pages
this
.
configData
=
_data
.
pages
this
.
nameLblStr
=
_data
.
title
this
.
nameLblStr
=
_data
.
title
this
.
headSprStr
=
_data
.
teacher_avatar
this
.
headSprStr
=
_data
.
teacher_avatar
this
.
initCustomBg
(
_data
.
bg_image_url
);
}
}
}
}
this
.
refreshConfig
()
this
.
refreshConfig
()
...
@@ -183,13 +193,19 @@ export default class NewClass extends cc.Component {
...
@@ -183,13 +193,19 @@ export default class NewClass extends cc.Component {
}
}
}
}
initBg
()
{
initCustomBg
(
bg_image_url
)
{
if
(
!
bg_image_url
)
{
return
}
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
bg
=
cc
.
find
(
"
bg/bg
"
,
this
.
node
);
const
bg
=
cc
.
find
(
"
bg/bg
"
,
this
.
node
);
getSprNodeByUrl
(
bg_image_url
,
(
sf
)
=>
{
const
sx
=
canvas
.
width
/
bg
.
width
;
const
sx
=
canvas
.
width
/
sf
.
node
.
width
;
const
sy
=
canvas
.
height
/
bg
.
height
;
const
sy
=
canvas
.
height
/
sf
.
node
.
height
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
bg
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
.
spriteFrame
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
destroy
();
})
}
}
initListView
()
{
initListView
()
{
...
@@ -209,7 +225,6 @@ export default class NewClass extends cc.Component {
...
@@ -209,7 +225,6 @@ export default class NewClass extends cc.Component {
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
this
.
initScrollViewItem
(
sv
,
itemArr
,
1
);
this
.
initScrollViewItem
(
sv
,
itemArr
,
1
);
const
content
=
sv
.
content
;
const
content
=
sv
.
content
;
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
canvas
=
cc
.
find
(
"
Canvas
"
);
if
(
content
.
width
>
canvas
.
width
)
{
if
(
content
.
width
>
canvas
.
width
)
{
...
@@ -217,17 +232,13 @@ export default class NewClass extends cc.Component {
...
@@ -217,17 +232,13 @@ export default class NewClass extends cc.Component {
}
else
{
}
else
{
content
.
x
=
-
content
.
width
/
2
;
content
.
x
=
-
content
.
width
/
2
;
}
}
}
}
getItemArr
(
dataArr
)
{
getItemArr
(
dataArr
)
{
const
itemArr
=
[];
const
itemArr
=
[];
for
(
let
i
=
0
;
i
<
dataArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataArr
.
length
;
i
++
)
{
const
data
=
dataArr
[
i
];
const
data
=
dataArr
[
i
];
const
itemNode
=
cc
.
instantiate
(
this
.
listItem
);
const
itemNode
=
cc
.
instantiate
(
this
.
listItem
);
let
unLock
=
this
.
userInfo
.
detail
.
cross_status
==
1
?
true
:
this
.
syllabusLockStatusStore
[
data
.
id
]
===
'
unlock
'
;
let
unLock
=
this
.
userInfo
.
detail
.
cross_status
==
1
?
true
:
this
.
syllabusLockStatusStore
[
data
.
id
]
===
'
unlock
'
;
if
(
i
==
0
&&
!
unLock
)
{
if
(
i
==
0
&&
!
unLock
)
{
// 如果第一个是未解锁的状态,需要上报一个解锁并且渲染成解锁的状态
// 如果第一个是未解锁的状态,需要上报一个解锁并且渲染成解锁的状态
...
...
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
9632f862
...
@@ -40,7 +40,6 @@ export default class NewClass extends cc.Component {
...
@@ -40,7 +40,6 @@ export default class NewClass extends cc.Component {
// onLoad () {}
// onLoad () {}
async
start
()
{
async
start
()
{
this
.
initBg
();
this
.
initBg
();
this
.
listItem
=
cc
.
find
(
"
view/content/item
"
,
this
.
unitScrollView
);
this
.
listItem
=
cc
.
find
(
"
view/content/item
"
,
this
.
unitScrollView
);
}
}
...
@@ -50,23 +49,34 @@ export default class NewClass extends cc.Component {
...
@@ -50,23 +49,34 @@ export default class NewClass extends cc.Component {
}
}
async
initView
()
{
async
initView
()
{
this
.
loading
.
active
=
true
;
this
.
loading
.
active
=
true
;
this
.
initTitle
();
this
.
initTitle
();
await
this
.
initUnitListView
();
await
this
.
initUnitListView
();
this
.
loading
.
active
=
false
;
this
.
loading
.
active
=
false
;
}
}
initBg
()
{
initBg
()
{
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
bg
=
cc
.
find
(
"
bg/bg
"
,
this
.
node
);
const
bg
=
cc
.
find
(
"
bg/bg
_default
"
,
this
.
node
);
const
sx
=
canvas
.
width
/
bg
.
width
;
const
sx
=
canvas
.
width
/
bg
.
width
;
const
sy
=
canvas
.
height
/
bg
.
height
;
const
sy
=
canvas
.
height
/
bg
.
height
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
}
initCustomBg
(
bg_image_url
)
{
if
(
!
bg_image_url
)
{
return
}
const
canvas
=
cc
.
find
(
"
Canvas
"
);
const
bg
=
cc
.
find
(
"
bg/bg
"
,
this
.
node
);
getSprNodeByUrl
(
bg_image_url
,
(
sf
)
=>
{
const
sx
=
canvas
.
width
/
sf
.
node
.
width
;
const
sy
=
canvas
.
height
/
sf
.
node
.
height
;
bg
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
.
spriteFrame
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
destroy
();
})
}
}
...
@@ -130,6 +140,7 @@ export default class NewClass extends cc.Component {
...
@@ -130,6 +140,7 @@ export default class NewClass extends cc.Component {
// 课程配置文件
// 课程配置文件
const
_strData
=
(
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
template_name
==
"
sn_config
"
&&
v
.
children
[
0
].
data
)
?
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
data
:
"
{}
"
const
_strData
=
(
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
template_name
==
"
sn_config
"
&&
v
.
children
[
0
].
data
)
?
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
data
:
"
{}
"
this
.
configData
=
JSON
.
parse
(
_strData
)
this
.
configData
=
JSON
.
parse
(
_strData
)
this
.
initCustomBg
(
this
.
configData
.
bg_image_url
);
}
else
{
}
else
{
// 课程数据
// 课程数据
rows
.
push
(
v
)
rows
.
push
(
v
)
...
...
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