var Ads = { preload: function() { game.load.image('ads_image', '../../../resources/image/ads/mental_abacus_banner.png'); }, create: function() { this.counter = 3; this.game.stage.backgroundColor = '#4d4d4d'; // top ui var screenTopUI = new ScreenTopUI(); // contents var titleText = game.add.text(game.world.centerX, game.world.centerY - 250, "광고", this.getFontStyle(64, "#88bbff")); titleText.anchor.set(0.5); titleText.fontWeight = "bold"; titleText.stroke = "#338"; titleText.strokeThickness = 4; game.add.text(game.world.centerX, game.world.centerY - 200, "Sponsored by", this.getFontStyle(32, "#888")) .anchor.set(0.5); var sprite = game.add.sprite(game.world.centerX, game.world.centerY, "ads_image"); sprite.anchor.set(0.5); var width = sprite.width; var height = sprite.height; if(width > 800) { var ratio = 300 / width; sprite.scale.set(ratio); } else if(height > 300) { var ratio = 300 / height; sprite.scale.set(ratio); } this.skipText = game.add.text(game.world.centerX, game.world.centerY + 200, "3초 후에 게임 화면으로 넘어갑니다.", this.getFontStyle(32, "#888")); this.skipText.anchor.set(0.5); game.add.text(game.world.centerX, game.world.centerY + 250, "유료 마에스트로 계정으로 등록하면 광고 화면이 생략됩니다.", this.getFontStyle(32, "#ffce54")) .anchor.set(0.5); // bottom ui var screenBottomUI = new ScreenBottomUI(); game.time.events.loop(Phaser.Timer.SECOND, this.updateCounter, this); }, updateCounter: function() { this.counter--; if(this.counter == 0) location.href = '../../web/client/start.html'; else this.skipText.text = this.counter + "초 후에 게임 화면으로 넘어갑니다."; }, getFontStyle: function(fontSize, fillColor) { return { font: fontSize + "px Arial", fill: fillColor, align: "left", boundsAlignH: "left", boundsAlignV: "bottom" }; } }