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
cae7f496
Commit
cae7f496
authored
Nov 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复切换时偶现的背景消失的问题
parent
c5d5ac15
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
302 additions
and
300 deletions
+302
-300
MissionPage.ts
assets/middleLayer_for_kyxq/script/MissionPage.ts
+3
-2
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+299
-298
No files found.
assets/middleLayer_for_kyxq/script/MissionPage.ts
View file @
cae7f496
...
@@ -198,7 +198,7 @@ export default class NewClass extends cc.Component {
...
@@ -198,7 +198,7 @@ export default class NewClass extends cc.Component {
initCustomBg
(
bg_image_url
)
{
initCustomBg
(
bg_image_url
)
{
console
.
log
(
"
Iniit
"
,
bg_image_url
)
console
.
log
(
"
Iniit
"
,
bg_image_url
)
if
(
!
bg_image_url
)
{
if
(
!
bg_image_url
)
{
// 没有背景图 还原默认图
// 没有背景图 还原默认图
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
active
=
true
;
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
active
=
true
;
cc
.
find
(
"
bg/bg
"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"
bg/bg
"
,
this
.
node
).
active
=
false
;
...
@@ -206,12 +206,13 @@ export default class NewClass extends cc.Component {
...
@@ -206,12 +206,13 @@ export default class NewClass extends cc.Component {
}
}
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
)
=>
{
getSprNodeByUrl
(
bg_image_url
,
(
sf
)
=>
{
const
sx
=
canvas
.
width
/
sf
.
node
.
width
;
const
sx
=
canvas
.
width
/
sf
.
node
.
width
;
const
sy
=
canvas
.
height
/
sf
.
node
.
height
;
const
sy
=
canvas
.
height
/
sf
.
node
.
height
;
bg
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
.
spriteFrame
;
bg
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
.
spriteFrame
;
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
bg
.
scale
=
Math
.
max
(
sx
,
sy
);
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"
bg/bg_default
"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"
bg/bg
"
,
this
.
node
).
active
=
true
;
})
})
}
}
...
...
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
cae7f496
This diff is collapsed.
Click to expand it.
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