Add: ChocoButton

This commit is contained in:
2019-07-22 11:09:27 +09:00
parent 72a8a39770
commit db2d920589
4 changed files with 385 additions and 12 deletions
+53 -8
View File
@@ -5,7 +5,7 @@ function MainMenu() {
}
MainMenu.prototype.preload = function() {
// game.load.image('tile_choco', '../../../resources/image/background/tile_choco.png');
game.load.image('tile_choco', '../../../resources/image/background/tile_choco.png');
game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
}
@@ -42,7 +42,21 @@ MainMenu.prototype.create = function() {
*/
MainMenu.prototype.create = function() {
game.stage.backgroundColor = '#4d4d4d';
console.log("create");
this.dbService = new DBService();
this.dbService.setMaestroID(sessionStorageManager.getMaestroID());
this.dbService.setPlayerID(sessionStorageManager.getPlayerID());
// bg
var graphics = game.add.graphics();
graphics.beginFill(MainColor.LIGHT_CHOCO_HEX, 1);
graphics.drawRect(0, 0,GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y);
graphics.beginFill(MainColor.CHOCO_HEX, 1);
graphics.drawRect(0, 0,GAME_SCREEN_SIZE.x, MainMenu.MAIN_MENU_HEIGHT);
this.appGroupButtons = {};
this.makeAppGroupButtons();
}
MainMenu.prototype.fontLoaded = function() {
@@ -56,25 +70,23 @@ MainMenu.prototype.fontLoaded = function() {
"menu_app" // callerClassName
);
// bg
game.add.graphics()
.beginFill(MainColor.LIGHT_CHOCO_HEX, 1)
.drawRect(0, 0,GAME_SCREEN_SIZE.x, GAME_SCREEN_SIZE.y);
// top ui
// var screenTopUI = new ScreenTopUI();
// screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
// screenTopUI.makeFullScreenButton();
// this.loadAllowEditEnterCode(screenTopUI);
console.log(this.appGroupButtons);
// bottom ui
/*
var screenBottomUI = new ScreenBottomUI();
// ScreenBottomUI.printLeftText("게임 진행 정보");
// var playingAppName = appInfoManager.getAppNameKorean(sessionStorageManager.playingAppName);
// ScreenBottomUI.printCenterText(playingAppName);
screenBottomUI.printCenterText("메뉴");
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
*/
new WelcomePlayerText(sessionStorageManager.getPlayerName());
if(isExperiencePlayerAccount()) {
@@ -94,6 +106,7 @@ MainMenu.prototype.back = function() {
}
MainMenu.prototype.loadAllowEditEnterCode = function(screenTopUI) {
/*
var dbConnectManager = new DBConnectManager();
dbConnectManager.requestAllowEditEnterCode(
sessionStorageManager.getMaestroID(),
@@ -111,9 +124,18 @@ MainMenu.prototype.loadAllowEditEnterCode = function(screenTopUI) {
this.loadFailed(replyJSON);
}).bind(this)
);
*/
}
MainMenu.prototype.loadAppData = function() {
// this.dbService.requestMainMenuAppData(
// (function(replyJSON) {
// this.updateAppGroupButton(replyJSON.appGroupData);
// this.updateAppButtons(replyJSON.appData);
// })
// );
/*
var dbConnectManager = new DBConnectManager();
dbConnectManager.requestMenuAppList(
sessionStorageManager.getMaestroID(),
@@ -124,6 +146,7 @@ MainMenu.prototype.loadAppData = function() {
this.loadFailed(replyJSON);
}).bind(this)
);
*/
}
MainMenu.prototype.loadSucceeded = function(replyJSON) {
@@ -150,6 +173,25 @@ MainMenu.prototype.hasApp = function(appID, appList) {
return false;
}
MainMenu.prototype.makeAppGroupButtons = function() {
this.makeQuitButton();
}
MainMenu.prototype.makeQuitButton = function() {
var setting = new ChocoButtonSetting(1000, 40, 60, 60, 5);
var quitButton = new ChocoButton(
setting, // choco button setting,
(function() {
this.back();
}).bind(this)
);
quitButton.addIcon("tile_choco");
quitButton.setIconSize(30);
console.log(quitButton);
this.appGroupButtons.quitButton = quitButton;
}
MainMenu.prototype.makeMouseAppButtons = function(appList, activeAppList) {
// console.log(appList);
@@ -282,4 +324,7 @@ MainMenu.prototype.getButtonPosY = function(index, buttonCount, startPosY) {
MainMenu.prototype.loadFailed = function(replyJSON) {
// console.log('login failed, jsonData : ' + JSON.stringify(replyJSON));
}
}
MainMenu.MAIN_MENU_HEIGHT = 80;