Add: home button
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
HomeButton.prototype = Object.create(RoundRectButton);
|
||||
HomeButton.constructor = HomeButton;
|
||||
|
||||
function HomeButton(clickEvent) {
|
||||
let setting = new RoundRectButtonSetting(30, 30, 50, 50);
|
||||
setting.fontStyle.boundsAlignH = "center"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 3;
|
||||
setting.setStrokeColor(
|
||||
0xaa6022,
|
||||
0x994422,
|
||||
0x994422,
|
||||
0x333333
|
||||
);
|
||||
setting.setButtonColor(
|
||||
0x994c00,
|
||||
0x772c00,
|
||||
0x772c00,
|
||||
0x666666
|
||||
);
|
||||
setting.setTextColor(
|
||||
"#fec",
|
||||
"#dca",
|
||||
"#dca",
|
||||
"#333"
|
||||
);
|
||||
|
||||
var homeButton = new RoundRectButton(setting, RoundRectButton.NONE_ICON, "", clickEvent);
|
||||
var icon_fullscreen = game.add.sprite(0, 0, "icon_home");
|
||||
icon_fullscreen.width = 26;
|
||||
icon_fullscreen.height = 26;
|
||||
homeButton.setIcon(icon_fullscreen);
|
||||
homeButton.buttonIcon.y -= 5;
|
||||
|
||||
homeButton.addShortcutText("ESC");
|
||||
}
|
||||
|
||||
HomeButton.prototype.startState = function(stateName) {
|
||||
var game = this.homeButton.parent.game;
|
||||
game.state.start(stateName);
|
||||
}
|
||||
@@ -15,6 +15,10 @@ ScreenTopUI.prototype.makeBackButton = function(eventHandler) {
|
||||
this.backButton = new BackButton(eventHandler);
|
||||
}
|
||||
|
||||
ScreenTopUI.prototype.makeHomeButton = function(eventHandler) {
|
||||
this.homeButton = new HomeButton(eventHandler);
|
||||
}
|
||||
|
||||
ScreenTopUI.prototype.makeFullScreenButton = function() {
|
||||
// this.fullscreenButton = new FullscreenButton();
|
||||
}
|
||||
|
||||
+16
-4
@@ -2,6 +2,7 @@ var Login = {
|
||||
|
||||
preload: function() {
|
||||
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
|
||||
game.load.image('icon_home', '../../../resources/image/icon/home.png');
|
||||
},
|
||||
|
||||
create: function() {
|
||||
@@ -10,12 +11,18 @@ var Login = {
|
||||
this.game.stage.backgroundColor = '#4d4d4d';
|
||||
this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
this.keyboardShortcut.addCallback(
|
||||
Phaser.KeyCode.ESC, // keyCode
|
||||
null, // keyDownHandler
|
||||
(function() { this.back(); }).bind(this), // keyUpHandler
|
||||
"login" // callerClassName
|
||||
);
|
||||
|
||||
// top ui
|
||||
var screenTopUI = new ScreenTopUI();
|
||||
screenTopUI.makeBackButton( function() {
|
||||
sessionStorageManager.clear();
|
||||
location.href = '../../web/main/index.html';
|
||||
});
|
||||
screenTopUI.makeHomeButton( (function() { this.back(); }).bind(this) );
|
||||
screenTopUI.makeFullScreenButton();
|
||||
|
||||
|
||||
@@ -36,6 +43,11 @@ var Login = {
|
||||
this.makeInfoText();
|
||||
},
|
||||
|
||||
back: function() {
|
||||
sessionStorageManager.clear();
|
||||
location.href = '../../web/main/index.html';
|
||||
},
|
||||
|
||||
makeMaestroNameText: function(x, y) {
|
||||
this.makeTextField(x, y, "마에스트로 계정 :");
|
||||
this.inputTextMaestroName = this.makeInputTypeText(x, y, "jisangs");
|
||||
|
||||
Reference in New Issue
Block a user