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
1da8f366
Commit
1da8f366
authored
Nov 11, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化性能
parent
4f54b5f4
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1878 additions
and
1984 deletions
+1878
-1984
.DS_Store
.DS_Store
+0
-0
anim.meta
assets/middleLayer_for_kyxq/anim.meta
+0
-12
loading.anim
assets/middleLayer_for_kyxq/anim/loading.anim
+0
-55
loading.anim.meta
assets/middleLayer_for_kyxq/anim/loading.anim.meta
+0
-5
loading.meta
assets/middleLayer_for_kyxq/anim/loading.meta
+0
-12
icon_tiger1.png
assets/middleLayer_for_kyxq/anim/loading/icon_tiger1.png
+0
-0
icon_tiger1.png.meta
...ts/middleLayer_for_kyxq/anim/loading/icon_tiger1.png.meta
+0
-36
icon_tiger2.png
assets/middleLayer_for_kyxq/anim/loading/icon_tiger2.png
+0
-0
icon_tiger2.png.meta
...ts/middleLayer_for_kyxq/anim/loading/icon_tiger2.png.meta
+0
-36
icon_tiger3.png
assets/middleLayer_for_kyxq/anim/loading/icon_tiger3.png
+0
-0
icon_tiger3.png.meta
...ts/middleLayer_for_kyxq/anim/loading/icon_tiger3.png.meta
+0
-36
icon_tiger4.png
assets/middleLayer_for_kyxq/anim/loading/icon_tiger4.png
+0
-0
icon_tiger4.png.meta
...ts/middleLayer_for_kyxq/anim/loading/icon_tiger4.png.meta
+0
-36
icon_tiger5.png
assets/middleLayer_for_kyxq/anim/loading/icon_tiger5.png
+0
-0
icon_tiger5.png.meta
...ts/middleLayer_for_kyxq/anim/loading/icon_tiger5.png.meta
+0
-36
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+1839
-1672
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+39
-48
No files found.
.DS_Store
View file @
1da8f366
No preview for this file type
assets/middleLayer_for_kyxq/anim.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "1.1.2",
"uuid": "e0ae4184-41ff-46b0-9091-3eb0ce6568d1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading.anim
deleted
100644 → 0
View file @
4f54b5f4
{
"__type__": "cc.AnimationClip",
"_name": "loading",
"_objFlags": 0,
"_native": "",
"_duration": 2.533333333333333,
"sample": 60,
"speed": 0.5,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "29713062-e52e-4112-aff5-c99188ce5c52"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "7ba58a09-dd77-42cd-8bcc-81d5f2118eea"
}
},
{
"frame": 1,
"value": {
"__uuid__": "002175d8-9eb1-429b-aea6-04b30d0df15a"
}
},
{
"frame": 1.5166666666666666,
"value": {
"__uuid__": "81fd7e93-5f7f-4b8e-a5cf-8a37983df449"
}
},
{
"frame": 2,
"value": {
"__uuid__": "d472b32c-4a08-4dab-a77b-e6ea36e98084"
}
},
{
"frame": 2.5166666666666666,
"value": {
"__uuid__": "29713062-e52e-4112-aff5-c99188ce5c52"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading.anim.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.1.0",
"uuid": "c01fcefa-a80e-43a2-8b03-cce500eba63d",
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "1.1.2",
"uuid": "ac7e840c-596c-4d10-80e2-8c44f3cce9b7",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading/icon_tiger1.png
deleted
100644 → 0
View file @
4f54b5f4
5.06 KB
assets/middleLayer_for_kyxq/anim/loading/icon_tiger1.png.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.3.5",
"uuid": "f939b385-39f4-4fee-8944-164ae765e08e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 124,
"height": 129,
"platformSettings": {},
"subMetas": {
"icon_tiger1": {
"ver": "1.0.4",
"uuid": "29713062-e52e-4112-aff5-c99188ce5c52",
"rawTextureUuid": "f939b385-39f4-4fee-8944-164ae765e08e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 3,
"offsetY": 2.5,
"trimX": 20,
"trimY": 0,
"width": 90,
"height": 124,
"rawWidth": 124,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading/icon_tiger2.png
deleted
100644 → 0
View file @
4f54b5f4
4.87 KB
assets/middleLayer_for_kyxq/anim/loading/icon_tiger2.png.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.3.5",
"uuid": "57a512a2-507b-4fda-b0b7-d9bdcff3884a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 124,
"height": 129,
"platformSettings": {},
"subMetas": {
"icon_tiger2": {
"ver": "1.0.4",
"uuid": "7ba58a09-dd77-42cd-8bcc-81d5f2118eea",
"rawTextureUuid": "57a512a2-507b-4fda-b0b7-d9bdcff3884a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": 3,
"trimX": 24,
"trimY": 1,
"width": 86,
"height": 121,
"rawWidth": 124,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading/icon_tiger3.png
deleted
100644 → 0
View file @
4f54b5f4
4.78 KB
assets/middleLayer_for_kyxq/anim/loading/icon_tiger3.png.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.3.5",
"uuid": "80af74de-7a17-49a9-9f06-dc24d0177e3d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 124,
"height": 129,
"platformSettings": {},
"subMetas": {
"icon_tiger3": {
"ver": "1.0.4",
"uuid": "002175d8-9eb1-429b-aea6-04b30d0df15a",
"rawTextureUuid": "80af74de-7a17-49a9-9f06-dc24d0177e3d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 5,
"offsetY": 1.5,
"trimX": 25,
"trimY": 1,
"width": 84,
"height": 124,
"rawWidth": 124,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading/icon_tiger4.png
deleted
100644 → 0
View file @
4f54b5f4
5.17 KB
assets/middleLayer_for_kyxq/anim/loading/icon_tiger4.png.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.3.5",
"uuid": "4bb78fd6-0368-4928-93eb-f3ef20978589",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 124,
"height": 129,
"platformSettings": {},
"subMetas": {
"icon_tiger4": {
"ver": "1.0.4",
"uuid": "81fd7e93-5f7f-4b8e-a5cf-8a37983df449",
"rawTextureUuid": "4bb78fd6-0368-4928-93eb-f3ef20978589",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 2,
"offsetY": 0,
"trimX": 22,
"trimY": 1,
"width": 84,
"height": 127,
"rawWidth": 124,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/anim/loading/icon_tiger5.png
deleted
100644 → 0
View file @
4f54b5f4
5.66 KB
assets/middleLayer_for_kyxq/anim/loading/icon_tiger5.png.meta
deleted
100644 → 0
View file @
4f54b5f4
{
"ver": "2.3.5",
"uuid": "e14b77e2-93f0-444e-bd38-5f9bb7d56717",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 124,
"height": 129,
"platformSettings": {},
"subMetas": {
"icon_tiger5": {
"ver": "1.0.4",
"uuid": "d472b32c-4a08-4dab-a77b-e6ea36e98084",
"rawTextureUuid": "e14b77e2-93f0-444e-bd38-5f9bb7d56717",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 124,
"height": 129,
"rawWidth": 124,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
1da8f366
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
1da8f366
...
...
@@ -73,6 +73,8 @@ export default class UnitPageClass extends cc.Component {
const
sv
=
cc
.
find
(
"
middleLayer/Views/UnitPage/unit_list_node/scrollView
"
)
sv
.
off
(
"
scrolling
"
)
this
.
isDestory
=
true
;
this
.
lastUpdate
=
0
;
this
.
allListItemNodes
=
[];
}
async
initView
()
{
...
...
@@ -90,12 +92,14 @@ export default class UnitPageClass extends cc.Component {
sv
.
off
(
"
scrolling
"
)
sv
.
on
(
"
scrolling
"
,
(
e
)
=>
{
this
.
allListItemNodes
.
forEach
((
node
)
=>
{
if
(
node
.
parent
)
{
const
worldPos
=
node
.
parent
.
convertToWorldSpaceAR
(
cc
.
v2
(
node
.
x
,
node
.
y
));
if
(
worldPos
.
x
>=
-
node
.
width
&&
worldPos
.
x
<=
canvas
.
width
)
{
node
.
opacity
=
255
;
}
else
{
node
.
opacity
=
0
;
}
}
})
})
}
...
...
@@ -241,8 +245,9 @@ export default class UnitPageClass extends cc.Component {
}
listItem
;
g_content
=
null
;
async
getUnitItemDataArr
(
dataArr
,
sv
)
{
const
content
=
sv
.
content
;
const
content
=
this
.
g_content
=
sv
.
content
;
content
.
removeAllChildren
();
sv
.
scrollToTop
();
...
...
@@ -251,10 +256,8 @@ export default class UnitPageClass extends cc.Component {
content
.
removeAllChildren
();
let
listItem
=
this
.
listItem
;
let
subItem
=
cc
.
find
(
"
sub_item
"
,
listItem
);
let
listLabel
=
cc
.
find
(
"
label
"
,
listItem
);
let
subItem
=
cc
.
find
(
"
/sub_item
"
,
listItem
);
const
itemArr
=
[];
for
(
let
i
=
0
;
i
<
dataArr
.
length
;
i
++
)
{
// 此方法为异步方法,防止页面切换走以后仍然执行,在这里判断一下是否页面已经切换走
if
(
this
.
isDestory
)
{
...
...
@@ -262,23 +265,18 @@ export default class UnitPageClass extends cc.Component {
}
const
data
=
dataArr
[
i
];
const
itemNode
=
cc
.
instantiate
(
listItem
);
const
cardsContainer
=
cc
.
find
(
"
/cards
"
,
itemNode
)
let
listLabel
=
cc
.
find
(
"
/label
"
,
itemNode
);
itemNode
[
'
data
'
]
=
data
;
itemNode
.
removeAllChildren
();
const
subArr
=
data
.
children
;
const
baseX
=
subItem
.
x
;
const
baseY
=
subItem
.
y
;
const
disX
=
530
;
let
lastX
=
0
;
for
(
let
j
=
0
;
j
<
subArr
.
length
;
j
++
)
{
const
subNode
=
cc
.
instantiate
(
subItem
)
subNode
.
x
=
baseX
+
j
*
disX
;
subNode
.
y
=
baseY
;
itemNode
.
addChild
(
subNode
);
lastX
=
subNode
.
x
;
subNode
.
active
=
true
cardsContainer
.
addChild
(
subNode
);
const
subData
=
subArr
[
j
];
// 课程封皮
getSprNodeByUrl
(
subData
.
cover
,
(
spr
)
=>
{
const
sprNode
=
spr
.
node
;
const
picLayer
=
cc
.
find
(
"
mask/pic_frame
"
,
subNode
);
...
...
@@ -286,11 +284,11 @@ export default class UnitPageClass extends cc.Component {
setSprNodeMaxLen
(
sprNode
,
picLayer
.
width
,
picLayer
.
height
,
true
);
})
// 课程完成状态指示
const
pointBase
=
cc
.
find
(
"
point
"
,
subNode
);
const
pointLayer
=
cc
.
find
(
"
pint_layer
"
,
subNode
);
const
pointDisX
=
57
;
pointBase
.
opacity
=
0
;
for
(
let
k
=
0
;
k
<
8
;
k
++
)
{
const
clsData
=
subData
.
children
[
k
];
const
pointNode
=
cc
.
instantiate
(
pointBase
);
...
...
@@ -309,20 +307,16 @@ export default class UnitPageClass extends cc.Component {
pointNode
.
x
=
pointBase
.
x
+
k
*
pointDisX
;
}
//
为方便测试,先全部
解锁
// 解锁
const
lockCover
=
cc
.
find
(
"
bg_cover_mask
"
,
subNode
);
lockCover
.
active
=
false
;
// 下面是正常解锁逻辑
// const unLock = this.syllabusLockStatusStore[subData.id]==='unlock';
// lockCover.active = !unLock;
// if (i==0&&j==0) {
// // 说明是第一个
// lockCover.active = false;
// }
// 课程标题
const
labelNode
=
cc
.
find
(
"
label
"
,
subNode
);
const
label
=
labelNode
.
getComponent
(
cc
.
Label
);
label
.
string
=
subData
.
name
;
// 点击事件
subNode
.
addComponent
(
cc
.
Button
);
subNode
.
on
(
"
click
"
,
()
=>
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
...
...
@@ -335,27 +329,18 @@ export default class UnitPageClass extends cc.Component {
})
}
const
labelNode
=
cc
.
instantiate
(
listLabel
);
const
label
=
labelNode
.
getComponent
(
cc
.
Label
);
label
.
string
=
data
.
name
//"Unit " + (i + 1);
itemNode
.
addChild
(
labelNode
);
// if (subArr.length > 2) {
itemNode
.
width
=
lastX
+
360
;
setTimeout
(()
=>
{
itemNode
.
width
=
lastX
+
360
;
},
1
);
// }
itemArr
.
push
(
itemNode
);
// 单元标题
const
label
=
listLabel
.
getComponent
(
cc
.
Label
);
label
.
string
=
data
.
name
;
// 保存节点到数组 在update中逐个渲染
this
.
allListItemNodes
.
push
(
itemNode
);
itemNode
.
parent
=
content
;
// 默认显示前3个节点
// 默认显示前3个节点 - 优化性能
if
(
i
<
3
)
{
item
Arr
[
i
]
.
opacity
=
255
;
item
Node
.
opacity
=
255
;
}
await
asyncDelay
(
0.05
)
}
return
itemArr
;
}
onClickPreview
()
{
...
...
@@ -378,6 +363,12 @@ export default class UnitPageClass extends cc.Component {
animation
:
"
rightIn
"
})
}
// update (dt) {}
lastUpdate
=
0
;
update
(
dt
)
{
if
(
this
.
lastUpdate
<
this
.
allListItemNodes
.
length
)
{
this
.
allListItemNodes
[
this
.
lastUpdate
++
].
parent
=
this
.
g_content
}
}
}
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