Add: Ads screen in the start page

This commit is contained in:
2018-09-22 16:03:49 +09:00
parent 7780bd534f
commit 58de28d781
6 changed files with 93 additions and 3 deletions
+15 -1
View File
@@ -3,7 +3,7 @@ var LANGUAGE_ENGLISH = "english";
var MODE_RELEASE = "release";
var MODE_DEBUG = "debug";
var runMode = MODE_RELEASE;
var runMode = MODE_DEBUG;
function isDebugMode() {
// console.log("debug mode ? " + runMode);
@@ -117,5 +117,19 @@ function isTypingSentenceStage() {
return false;
}
function isExperiencePlayerAccount() {
if(sessionStorageManager.getMaestroAccountType() == 100)
return true;
return false;
}
function isExperienceMaestroAccount() {
if(sessionStorageManager.getMaestroAccountType() == 101)
return true;
return false;
}
let textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
+68
View File
@@ -0,0 +1,68 @@
var Ads = {
preload: function() {
game.load.image('ads_image', '../../../resources/image/ads/shinssaem.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 > height)
sprite.scale.set(300 / width);
else
sprite.scale.set(300 / height);
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)
game.state.start('Start');
else
this.skipText.text = this.counter + "초 후에 게임 화면으로 넘어갑니다.";
},
getFontStyle: function(fontSize, fillColor) {
return { font: fontSize + "px Arial", fill: fillColor, align: "left", boundsAlignH: "left", boundsAlignV: "bottom" };
}
}
+7 -1
View File
@@ -8,5 +8,11 @@ let game = new Phaser.Game(
Phaser.CANVAS, CONTENT_ID
);
game.state.add('Start', Start);
game.state.start('Start');
game.state.add('Ads', Ads);
if(isExperiencePlayerAccount())
game.state.start('Ads');
else
game.state.start('Start');
+2 -1
View File
@@ -32,7 +32,8 @@ var Start = {
this.makeStartButton();
this.makeRankingButton();
if(sessionStorageManager.getMaestroAccountType() >= 100) { // experience account
// if(sessionStorageManager.getMaestroAccountType() >= 100) { // experience account
if(isExperiencePlayerAccount() || isExperienceMaestroAccount()) { // experience account
this.printSampleChart();
this.announceBox = new AnnounceBox(50, 648);
this.announceBox.drawBox("체험 계정에서는 기록이 저장되지 않습니다.");
+1
View File
@@ -30,6 +30,7 @@
<script src="../../game/lib/announce_box.js"></script>
<!-- source files -->
<script src="../../game/start/Ads.js"></script>
<script src="../../game/start/start.js"></script>
<script src="../../game/start/main.js"></script>