From e4ae1d3cc0265e71b73d5617ee9dcb3e5a149f05 Mon Sep 17 00:00:00 2001 From: fanxuehan <fanxuehan@qq.com> Date: Tue, 15 Jun 2021 16:37:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/game/MyGame.ts | 74 ++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/src/app/play/game/MyGame.ts b/src/app/play/game/MyGame.ts index c385a6c..cca5829 100644 --- a/src/app/play/game/MyGame.ts +++ b/src/app/play/game/MyGame.ts @@ -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; } } -- 2.21.0