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
e74ed763
Commit
e74ed763
authored
Nov 10, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化单元Item加载卡顿的问题
parent
5a57b63f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
81 deletions
+37
-81
AlibabaPuHuiTiBold.ttf
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBold.ttf
+0
-0
AlibabaPuHuiTiBold.ttf.meta
...ts/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBold.ttf.meta
+0
-5
AlibabaPuHuiTiBoldFull.ttf
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBoldFull.ttf
+0
-0
AlibabaPuHuiTiBoldFull.ttf.meta
...iddleLayer_for_kyxq/fonts/AlibabaPuHuiTiBoldFull.ttf.meta
+0
-5
AlibabaPuHuiTiMedium.ttf
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiMedium.ttf
+0
-0
AlibabaPuHuiTiMedium.ttf.meta
.../middleLayer_for_kyxq/fonts/AlibabaPuHuiTiMedium.ttf.meta
+0
-5
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+2
-2
PageViewer.ts
assets/middleLayer_for_kyxq/script/PageViewer.ts
+7
-13
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+28
-51
No files found.
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBold.ttf
deleted
100644 → 0
View file @
5a57b63f
File deleted
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBold.ttf.meta
deleted
100644 → 0
View file @
5a57b63f
{
"ver": "1.1.0",
"uuid": "0f8f392f-32f6-44d4-a812-2c422c86f4df",
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBoldFull.ttf
deleted
100644 → 0
View file @
5a57b63f
File deleted
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiBoldFull.ttf.meta
deleted
100644 → 0
View file @
5a57b63f
{
"ver": "1.1.0",
"uuid": "70909523-db85-4efd-b77d-bbc2cfb2ca88",
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiMedium.ttf
deleted
100755 → 0
View file @
5a57b63f
File deleted
assets/middleLayer_for_kyxq/fonts/AlibabaPuHuiTiMedium.ttf.meta
deleted
100644 → 0
View file @
5a57b63f
{
"ver": "1.1.0",
"uuid": "b5e998fd-17de-4c57-8da6-9d61b68ad0e9",
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
e74ed763
...
...
@@ -14819,7 +14819,7 @@
{
"__type__": "cc.Node",
"_name": "content",
"_objFlags":
512
,
"_objFlags":
0
,
"_parent": {
"__id__": 326
},
...
...
@@ -14857,7 +14857,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-96
0,
0,
0,
0,
...
...
assets/middleLayer_for_kyxq/script/PageViewer.ts
View file @
e74ed763
...
...
@@ -182,6 +182,7 @@ export default class PageViewerClass extends cc.Component {
})
.
call
(()
=>
{
outPage
.
active
=
false
;
outPage
.
emit
(
"
unmounted
"
)
resovle
(
true
)
})
.
start
();
...
...
@@ -206,6 +207,7 @@ export default class PageViewerClass extends cc.Component {
})
.
call
(()
=>
{
outPage
.
active
=
false
;
outPage
.
emit
(
"
unmounted
"
)
resovle
(
true
)
})
.
start
();
...
...
@@ -213,9 +215,13 @@ export default class PageViewerClass extends cc.Component {
}
else
{
if
(
outPage
)
{
outPage
.
active
=
false
;
outPage
.
emit
(
"
unmounted
"
)
}
else
{
// 未传移除页面 则全部移除
this
.
justShowView
(
""
)
for
(
let
key
in
PageMap
)
{
this
[
PageMap
[
key
]].
active
=
false
;
this
[
PageMap
[
key
]].
emit
(
"
unmounted
"
);
}
}
inPage
.
active
=
true
;
inPage
.
x
=
0
;
...
...
@@ -227,17 +233,5 @@ export default class PageViewerClass extends cc.Component {
})
}
}
justShowView
(
viewName
)
{
this
.
loginPage
.
active
=
viewName
==
"
loginPage
"
this
.
homePage
.
active
=
viewName
==
"
homePage
"
this
.
libraryPage
.
active
=
viewName
==
"
libraryPage
"
this
.
libraryReadPage
.
active
=
viewName
==
"
libraryReadPage
"
this
.
libraryAudioPage
.
active
=
viewName
==
"
libraryAudioPage
"
this
.
libraryVideoPage
.
active
=
viewName
==
"
libraryVideoPage
"
this
.
libraryReadDetailPage
.
active
=
viewName
==
"
libraryReadDetailPage
"
this
.
unitPage
.
active
=
viewName
==
"
unitPage
"
this
.
missionPage
.
active
=
viewName
==
"
missionPage
"
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
e74ed763
...
...
@@ -50,9 +50,12 @@ export default class UnitPageClass extends cc.Component {
this
.
node
.
on
(
"
beforeMounted
"
,
this
.
beforeMounted
.
bind
(
this
));
// 注册PageViwer发来的mounted事件 [页面已经切换完毕]
this
.
node
.
on
(
"
mounted
"
,
this
.
mounted
.
bind
(
this
));
// 注册PageViwer发来的unmounted事件 [页面已经切换完毕]
this
.
node
.
on
(
"
unmounted
"
,
this
.
unmounted
.
bind
(
this
));
}
async
beforeMounted
()
{
this
.
isDestory
=
false
;
const
svNode
=
this
.
unitScrollView
;
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
const
content
=
sv
.
content
;
...
...
@@ -64,6 +67,12 @@ export default class UnitPageClass extends cc.Component {
await
this
.
initView
();
}
// 页面切换走
isDestory
=
false
;
async
unmounted
()
{
this
.
isDestory
=
true
;
}
async
initView
()
{
this
.
loading
.
active
=
true
;
this
.
initTitle
();
...
...
@@ -168,9 +177,10 @@ export default class UnitPageClass extends cc.Component {
}
configData
=
[]
configData
=
[]
;
allListItemNodes
=
[];
async
initUnitListView
()
{
this
.
allListItemNodes
=
[];
const
svNode
=
this
.
unitScrollView
;
svNode
.
opacity
=
0
;
const
n1Date
=
new
Date
()
...
...
@@ -210,20 +220,18 @@ export default class UnitPageClass extends cc.Component {
const
nowDate
=
new
Date
();
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
const
itemArr
=
this
.
getUnitItemDataArr
(
rows
,
sv
);
this
.
allListItemNodes
=
itemArr
;
// this.initScrollViewItem(sv, itemArr, 1);
this
.
getUnitItemDataArr
(
rows
,
sv
);
const
time
=
new
Date
()
-
nowDate
console
.
log
(
"
创建节点时间:
"
,
time
)
const
content
=
sv
.
content
;
const
canvas
=
cc
.
find
(
"
Canvas
"
);
if
(
content
.
width
>
canvas
.
width
)
{
content
.
x
=
-
canvas
.
width
/
2
;
}
else
{
content
.
x
=
-
content
.
width
/
2
;
}
//
const content = sv.content;
//
const canvas = cc.find("Canvas");
//
if (content.width > canvas.width) {
//
content.x = -canvas.width / 2;
//
} else {
//
content.x = -content.width / 2;
//
}
svNode
.
opacity
=
255
;
this
.
refreshConfig
()
}
...
...
@@ -238,7 +246,7 @@ export default class UnitPageClass extends cc.Component {
}
listItem
;
getUnitItemDataArr
(
dataArr
,
sv
)
{
async
getUnitItemDataArr
(
dataArr
,
sv
)
{
const
content
=
sv
.
content
;
content
.
removeAllChildren
();
...
...
@@ -259,20 +267,21 @@ export default class UnitPageClass extends cc.Component {
const
disX
=
530
;
let
lastX
=
0
;
for
(
let
j
=
0
;
j
<
subArr
.
length
;
j
++
)
{
// 此方法为异步方法,防止页面切换走以后仍然执行,在这里判断一下是否页面已经切换走
if
(
this
.
isDestory
)
{
break
}
const
subNode
=
cc
.
instantiate
(
subItem
)
subNode
.
x
=
baseX
+
j
*
disX
;
subNode
.
y
=
baseY
;
itemNode
.
addChild
(
subNode
);
lastX
=
subNode
.
x
;
const
subData
=
subArr
[
j
];
getSprNodeByUrl
(
subData
.
cover
,
(
spr
)
=>
{
const
sprNode
=
spr
.
node
;
const
picLayer
=
cc
.
find
(
"
mask/pic_frame
"
,
subNode
);
picLayer
.
addChild
(
sprNode
);
setSprNodeMaxLen
(
sprNode
,
picLayer
.
width
,
picLayer
.
height
,
true
);
})
...
...
@@ -336,50 +345,18 @@ export default class UnitPageClass extends cc.Component {
},
1
);
// }
itemArr
.
push
(
itemNode
);
itemNode
.
parent
=
content
this
.
allListItemNodes
.
push
(
itemNode
);
itemNode
.
parent
=
content
;
// 默认显示前3个节点
if
(
i
<
3
)
{
itemArr
[
i
].
opacity
=
255
;
}
await
asyncDelay
(
0.1
)
}
return
itemArr
;
}
initScrollViewItem
(
sv
,
itemArr
,
row
=
1
)
{
sv
.
scrollToTop
();
const
content
=
sv
.
content
;
content
.
width
=
sv
.
node
.
width
;
content
.
height
=
sv
.
node
.
height
;
content
.
removeAllChildren
();
const
tempH
=
content
.
height
/
row
;
const
disY
=
tempH
*
0.95
;
const
baseY
=
(
row
-
1
)
*
0.5
*
disY
;
let
rowCount
=
0
;
const
disX
=
40
;
let
colCount
=
0
;
let
lastX
=
0
;
for
(
let
i
=
0
;
i
<
itemArr
.
length
;
i
++
)
{
const
item
=
itemArr
[
i
];
// 默认显示前3个节点
if
(
i
<
3
)
{
itemArr
[
i
].
opacity
=
255
;
}
item
.
x
=
lastX
+
disX
;
item
.
y
=
baseY
-
rowCount
*
disY
;
lastX
=
item
.
x
+
item
.
width
*
item
.
scale
;
content
.
addChild
(
itemArr
[
i
]);
itemArr
[
i
].
parent
=
content
const
tempW
=
Math
.
abs
(
item
.
x
+
disX
+
item
.
width
/
2
*
item
.
scale
);
content
.
width
=
lastX
+
disX
;
rowCount
++
;
if
(
rowCount
>=
row
)
{
rowCount
=
0
;
colCount
++
;
}
}
}
onClickPreview
()
{
this
.
LessonBrief
.
active
=
true
this
.
LessonBrief
.
getComponent
(
"
LessonBrief
"
).
setData
(
this
.
configData
.
introduces
)
...
...
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