Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM_L5_26
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
YM_L5_26
Commits
e4ae1d3c
Commit
e4ae1d3c
authored
Jun 15, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 标题
parent
f22e8a60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
34 deletions
+40
-34
MyGame.ts
src/app/play/game/MyGame.ts
+40
-34
No files found.
src/app/play/game/MyGame.ts
View file @
e4ae1d3c
...
...
@@ -69,7 +69,13 @@ export class MyGame extends Game {
});
}
mapScale
;
initView
()
{
this
.
mapScale
=
this
.
_parent
.
mapScale
;
// 初始化背景
this
.
initBg
();
// 初始化标题
this
.
initTittle
();
...
...
@@ -77,50 +83,50 @@ export class MyGame extends Game {
this
.
initMiddle
();
}
bg
;
initBg
()
{
const
bg
=
new
TouchSprite
();
bg
.
init
(
this
.
images
.
get
(
'
img_grey_bg
'
));
bg
.
x
=
this
.
_parent
.
canvasWidth
/
2
;
bg
.
y
=
this
.
_parent
.
canvasHeight
/
2
;
bg
.
setScaleXY
(
this
.
mapScale
);
bg
.
alpha
=
0.5
;
this
.
addChild
(
bg
);
this
.
bg
=
bg
;
}
initTittle
()
{
console
.
log
(
'
汪汪汪
'
)
const
titleBg
=
new
TouchSprite
();
titleBg
.
init
(
this
.
images
.
get
(
'
img_title_bg
'
));
titleBg
.
x
=
titleBg
.
width
/
2
*
this
.
mapScale
;
titleBg
.
y
=
titleBg
.
height
/
2
*
this
.
mapScale
;
titleBg
.
setScaleXY
(
this
.
mapScale
);
this
.
addChild
(
titleBg
);
// titleBg.x = this.getFullScaleXY();
// titleBg.y = titleBg.height / 2 * this.mapScale;
// titleBg.setScaleXY(this.mapScale);
// this.renderArr.push(titleBg);
// const titleLetter = new Label(this.ctx);
// titleLetter.x = titleBg.width * 1 / 8;
// titleLetter.y = 0;
// titleLetter.fontSize = 48;
// titleLetter.fontColor = "#facf46";
// titleLetter.fontName = 'BerlinSansFBDemi';
// titleLetter.anchorX = 0;
// titleLetter.anchorY = 0.5;
// titleLetter.text = this.data.titleLetter;
// titleBg.addChild(titleLetter);
// const titleLabel = new Label(this.ctx);
// titleLabel.x = titleBg.width * 5 / 8;
// titleLabel.y = 0;
// titleLabel.fontSize = 36;
// titleLabel.fontColor = "#000000";
// titleLabel.fontName = 'FuturaStd';
// titleLabel.anchorX = 0;
// titleLabel.anchorY = 0.5;
// titleLabel.text = this.data.title;
// titleBg.addChild(titleLabel);
const
titleLetter
=
new
MyLabel
();
titleLetter
.
x
=
titleBg
.
width
*
1
/
8
;
titleLetter
.
y
=
0
;
titleLetter
.
fontSize
=
48
;
titleLetter
.
fontColor
=
"
#facf46
"
;
titleLetter
.
fontName
=
'
BerlinSansFBDemi
'
;
titleLetter
.
anchorX
=
0
;
titleLetter
.
anchorY
=
0.5
;
titleLetter
.
text
=
this
.
data
.
titleLetter
;
titleBg
.
addChild
(
titleLetter
);
const
titleLabel
=
new
Label
();
titleLabel
.
x
=
titleBg
.
width
*
5
/
8
;
titleLabel
.
y
=
0
;
titleLabel
.
fontSize
=
36
;
titleLabel
.
fontColor
=
"
#000000
"
;
titleLabel
.
fontName
=
'
FuturaStd
'
;
titleLabel
.
anchorX
=
0
;
titleLabel
.
anchorY
=
0.5
;
titleLabel
.
text
=
this
.
data
.
title
;
titleBg
.
addChild
(
titleLabel
);
}
initMiddle
()
{
// const bg = new MySprite(this.ctx, this.images.get('img_grey_bg'));
// bg.x = this.canvasWidth / 2;
// bg.y = this.canvasHeight / 2;
// bg.setScaleXY(this.mapScale);
// bg.alpha = 0.5;
// this.renderArr.push(bg);
// this.bg = bg;
}
}
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