Add: 1to50 folder and basic files

This commit is contained in:
2019-05-09 19:46:19 +09:00
parent dc8ab9aa75
commit 9867cb9336
4 changed files with 309 additions and 0 deletions
+109
View File
@@ -0,0 +1,109 @@
var Game = {
create: function() {
this.dbConnectManager = new DBConnectManager();
sessionStorageManager.setRecord(0);
this.game.stage.backgroundColor = "#000000"; // '#4d4d4d';
sessionStorageManager.setIsNewAppHighestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.timeOver(); }).bind(this)
);
// keyboard shortcut
this.keyboardShortcut = new KeyboardShortcut();
this.keyboardShortcut.addCallback(
Phaser.KeyCode.ESC, // keyCode
null, // keyDownHandler
(function() { this.back(); }).bind(this), // keyUpHandler
"1 to 50" // callerClassName
);
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
screenTopUI.makeFullScreenButton();
this.scoreManager = new ScoreManager();
this.scoreBoard = new ScoreBoard();
this.scoreManager.addOnChangeScoreListener(
(function(score) {
sessionStorageManager.setRecord(score);
this.scoreBoard.printScore(NumberUtil.numberWithCommas(score));
}).bind(this)
);
this.scoreManager.addOnChangeHighScoreListener(
(function(highScore) {
// console.log(highScore);
// sessionStorageManager.setAppHighestRecord(highScore);
sessionStorageManager.setIsNewBestRecrd(true);
// this.screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
}).bind(this)
);
this.initVariables();
// game stage
game.stage.backgroundColor = '#4d4d4d';
graphics = game.add.graphics(0, 0);
// bottom ui
var screenBottomUI = new ScreenBottomUI();
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
this.startGame();
// // this.countDown();
},
initVariables: function() {
},
back: function() {
sessionStorageManager.resetPlayingAppData();
location.href = '../../web/client/menu_app.html';
},
startGame: function() {
this.startStage();
},
startStage: function() {
},
timeOver: function() {
var timeOverText = new TimeOverText();
if(!isExperienceMaestroAccount())
this.updateResultRecord();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
},
updateResultRecord: function() {
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
this.dbConnectManager.updateResultRecord(
sessionStorageManager.getMaestroID(),
sessionStorageManager.getPlayerID(),
sessionStorageManager.getPlayingAppID(),
sessionStorageManager.getRecord()
);
}
},
goResult: function() {
location.href = '../../web/client/result.html';
},
}
// Game.GAME_TIME_SEC = 60;
// Game.NEXT_STAGE_DELAY_MS = 500;
+93
View File
@@ -0,0 +1,93 @@
var Loading = {
preload: function() {
// game.load.image('loadingbar', './image/phaser.png');
},
create: function() {
// var userID = sessionStorage.getItem("UserID");
// console.log("userID : " + userID);
// game.stage.backgroundColor = '#4d4d4d';
// // Progress report
// this.textProgress = game.add.text(game.world.centerX, 100, '로딩중 . . .', textStyleBasic);
// this.textProgress.anchor.setTo(0.5, 0.4);
// this.textProgress.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
// // Preload bar
// this.preloadBar = this.add.sprite(game.world.centerX, game.world.centerY, 'loadingbar');
// this.preloadBar.anchor.setTo(0.5);
// this.preloadBar.alpha = 0;
game.load.onFileComplete.add(this.fileComplete, this);
game.load.onLoadComplete.add(this.loadComplete, this);
this.startLoading();
},
startLoading: function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
// card
game.load.image('card_back', '../../../resources/image/ui/card_back.png');
game.load.image('card_front', '../../../resources/image/ui/card_front.png');
game.load.image('card_edge', '../../../resources/image/ui/card_selected.png');
// game.load.image('a', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('b', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('c', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('d', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('a', './image/phaser.png');
// game.load.image('b', './image/phaser.png');
// game.load.image('c', './image/phaser.png');
// game.load.image('d', './image/phaser.png');
// game.load.image('e', './image/phaser.png');
// game.load.image('g', './image/phaser.png');
// game.load.image('e', './image/phaser.png');
// game.load.image('f', './image/phaser.png');
// game.load.image('g', './image/phaser.png');
// game.load.image('h', './image/phaser.png');
// game.load.image('phaser', './image/phaser.png');
// game.load.spritesheet('button', './image/button_basic.png', 200, 100);
// game.load.image('star', './image/star_particle.png');
// game.load.image('medal_gold', './image/medal_gold.png');
// game.load.image('medal_silver', './image/medal_silver.png');
// game.load.image('medal_bronze', './image/medal_bronze.png');
game.load.start();
},
fileComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) {
// this.preloadBar.alpha = progress / 100;
// console.log('progress : ' + progress);
// text.setText("File Complete: " + progress + "% - " + totalLoaded + " out of " + totalFiles);
// var newImage = game.add.image(x, y, cacheKey);
// newImage.scale.set(0.3);
// x += newImage.width + 20;
// if (x > 700)
// {
// x = 32;
// y += 332;
// }
},
loadComplete: function(progress, cacheKey, success, totalLoaded, totalFiles) {
// this.preloadBar.alpha = 1;
if(isDebugMode()) {
this.state.start('Game');
return;
}
this.state.start('Game');
// this.startMenu();
// this.startTypingTestStage();
// this.startTypingTestResult();
}
}
+16
View File
@@ -0,0 +1,16 @@
/////////////////////////////
// Main game
var CONTENT_ID = "1to50";
var game = new Phaser.Game(
GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y,
Phaser.CANVAS, CONTENT_ID,
this, false, false
);
game.state.add('Loading', Loading);
game.state.start('Loading');
game.state.add('Game', Game);
// game.state.add('Menu', Menu);