Add: home button

This commit is contained in:
2018-10-16 12:20:03 +09:00
parent 9061ab54c3
commit e6c9dd95f1
6 changed files with 62 additions and 4 deletions
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+41
View File
@@ -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);
}
+4
View File
@@ -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
View File
@@ -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");
+1
View File
@@ -17,6 +17,7 @@
<script src="../../game/lib/keyboard_shortcut.js"></script>
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/button/round_rect_button.js"></script>
<script src="../../game/lib/button/home_button.js"></script>
<script src="../../game/lib/button/back_button.js"></script>
<script src="../../game/lib/button/fullscreen_button.js"></script>
<script src="../../game/lib/screen_top_ui.js"></script>