Commit e4ae1d3c authored by 范雪寒's avatar 范雪寒

feat: 标题

parent f22e8a60
...@@ -69,7 +69,13 @@ export class MyGame extends Game { ...@@ -69,7 +69,13 @@ export class MyGame extends Game {
}); });
} }
mapScale;
initView() { initView() {
this.mapScale = this._parent.mapScale;
// 初始化背景
this.initBg();
// 初始化标题 // 初始化标题
this.initTittle(); this.initTittle();
...@@ -77,50 +83,50 @@ export class MyGame extends Game { ...@@ -77,50 +83,50 @@ export class MyGame extends Game {
this.initMiddle(); this.initMiddle();
} }
bg;
initBg() { 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() { initTittle() {
console.log('汪汪汪 ')
const titleBg = new TouchSprite(); const titleBg = new TouchSprite();
titleBg.init(this.images.get('img_title_bg')); 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); this.addChild(titleBg);
// titleBg.x = this.getFullScaleXY();
// titleBg.y = titleBg.height / 2 * this.mapScale; const titleLetter = new MyLabel();
// titleBg.setScaleXY(this.mapScale); titleLetter.x = titleBg.width * 1 / 8;
// this.renderArr.push(titleBg); titleLetter.y = 0;
titleLetter.fontSize = 48;
// const titleLetter = new Label(this.ctx); titleLetter.fontColor = "#facf46";
// titleLetter.x = titleBg.width * 1 / 8; titleLetter.fontName = 'BerlinSansFBDemi';
// titleLetter.y = 0; titleLetter.anchorX = 0;
// titleLetter.fontSize = 48; titleLetter.anchorY = 0.5;
// titleLetter.fontColor = "#facf46"; titleLetter.text = this.data.titleLetter;
// titleLetter.fontName = 'BerlinSansFBDemi'; titleBg.addChild(titleLetter);
// titleLetter.anchorX = 0;
// titleLetter.anchorY = 0.5; const titleLabel = new Label();
// titleLetter.text = this.data.titleLetter; titleLabel.x = titleBg.width * 5 / 8;
// titleBg.addChild(titleLetter); titleLabel.y = 0;
titleLabel.fontSize = 36;
// const titleLabel = new Label(this.ctx); titleLabel.fontColor = "#000000";
// titleLabel.x = titleBg.width * 5 / 8; titleLabel.fontName = 'FuturaStd';
// titleLabel.y = 0; titleLabel.anchorX = 0;
// titleLabel.fontSize = 36; titleLabel.anchorY = 0.5;
// titleLabel.fontColor = "#000000"; titleLabel.text = this.data.title;
// titleLabel.fontName = 'FuturaStd'; titleBg.addChild(titleLabel);
// titleLabel.anchorX = 0;
// titleLabel.anchorY = 0.5;
// titleLabel.text = this.data.title;
// titleBg.addChild(titleLabel);
} }
initMiddle() { 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;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment