Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
NJ_game_select
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
NJ_game_select
Commits
ec014a3d
Commit
ec014a3d
authored
Jan 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改背景图的适配
以左上角为基准,高度铺满屏幕,横向保持相同比例
parent
5af51b9d
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
221 additions
and
87 deletions
+221
-87
NJ_game_select.fire
assets/NJ_game_select/scene/NJ_game_select.fire
+207
-82
NJ_game_select.ts
assets/NJ_game_select/scene/NJ_game_select.ts
+14
-5
No files found.
assets/NJ_game_select/scene/NJ_game_select.fire
View file @
ec014a3d
This diff is collapsed.
Click to expand it.
assets/NJ_game_select/scene/NJ_game_select.ts
View file @
ec014a3d
...
...
@@ -14,10 +14,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_imageResList
.
push
({
url
:
page
.
startBg
});
});
const
bgNode
=
cc
.
find
(
'
Canvas/bg
'
);
const
bgNode
=
cc
.
find
(
'
Canvas/bg
/startBg
'
);
bgNode
.
color
=
cc
.
color
(
255
,
255
,
255
);
const
startBg
=
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
startBg
;
this
.
setNodeSpirteFrameByUrl
(
startBg
,
bgNode
,
resolve
);
this
.
setNodeSpirteFrameByUrl
(
startBg
,
bgNode
,
(
frame
)
=>
{
bgNode
.
x
=
bgNode
.
parent
.
width
/
-
2
;
bgNode
.
y
=
bgNode
.
parent
.
height
/
2
;
bgNode
.
scale
=
bgNode
.
parent
.
height
/
frame
.
height
;
});
})
}
...
...
@@ -294,10 +299,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
book_right
.
active
=
true
;
}
const
bgNode
=
cc
.
find
(
'
Canvas/bg
'
);
const
bgNode
=
cc
.
find
(
'
Canvas/bg
/startBg
'
);
bgNode
.
color
=
cc
.
color
(
255
,
255
,
255
);
const
startBg
=
this
.
data
.
pageArr
[
this
.
currentPageIdx
].
startBg
;
this
.
setNodeSpirteFrameByUrl
(
startBg
,
bgNode
);
this
.
setNodeSpirteFrameByUrl
(
startBg
,
bgNode
,
(
frame
)
=>
{
bgNode
.
x
=
bgNode
.
parent
.
width
/
-
2
;
bgNode
.
y
=
bgNode
.
parent
.
height
/
2
;
bgNode
.
scale
=
bgNode
.
parent
.
height
/
frame
.
height
;
});
}
showTips
(
tips
)
{
...
...
@@ -332,7 +341,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
setNodeSpirteFrameByUrl
(
url
:
string
,
node
:
cc
.
Node
,
callBack
=
null
)
{
cc
.
assetManager
.
loadRemote
(
url
,
(
err
,
tex
)
=>
{
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
tex
);
callBack
&&
callBack
();
callBack
&&
callBack
(
tex
);
});
}
}
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