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

feat: 标题

parent f22e8a60
......@@ -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;
}
}
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