Add: home button
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -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);
|
this.backButton = new BackButton(eventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScreenTopUI.prototype.makeHomeButton = function(eventHandler) {
|
||||||
|
this.homeButton = new HomeButton(eventHandler);
|
||||||
|
}
|
||||||
|
|
||||||
ScreenTopUI.prototype.makeFullScreenButton = function() {
|
ScreenTopUI.prototype.makeFullScreenButton = function() {
|
||||||
// this.fullscreenButton = new FullscreenButton();
|
// this.fullscreenButton = new FullscreenButton();
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-4
@@ -2,6 +2,7 @@ var Login = {
|
|||||||
|
|
||||||
preload: function() {
|
preload: function() {
|
||||||
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
|
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
|
||||||
|
game.load.image('icon_home', '../../../resources/image/icon/home.png');
|
||||||
},
|
},
|
||||||
|
|
||||||
create: function() {
|
create: function() {
|
||||||
@@ -10,12 +11,18 @@ var Login = {
|
|||||||
this.game.stage.backgroundColor = '#4d4d4d';
|
this.game.stage.backgroundColor = '#4d4d4d';
|
||||||
this.textStyle = { font: "bold 32px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "middle" };
|
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
|
// top ui
|
||||||
var screenTopUI = new ScreenTopUI();
|
var screenTopUI = new ScreenTopUI();
|
||||||
screenTopUI.makeBackButton( function() {
|
screenTopUI.makeHomeButton( (function() { this.back(); }).bind(this) );
|
||||||
sessionStorageManager.clear();
|
|
||||||
location.href = '../../web/main/index.html';
|
|
||||||
});
|
|
||||||
screenTopUI.makeFullScreenButton();
|
screenTopUI.makeFullScreenButton();
|
||||||
|
|
||||||
|
|
||||||
@@ -36,6 +43,11 @@ var Login = {
|
|||||||
this.makeInfoText();
|
this.makeInfoText();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
back: function() {
|
||||||
|
sessionStorageManager.clear();
|
||||||
|
location.href = '../../web/main/index.html';
|
||||||
|
},
|
||||||
|
|
||||||
makeMaestroNameText: function(x, y) {
|
makeMaestroNameText: function(x, y) {
|
||||||
this.makeTextField(x, y, "마에스트로 계정 :");
|
this.makeTextField(x, y, "마에스트로 계정 :");
|
||||||
this.inputTextMaestroName = this.makeInputTypeText(x, y, "jisangs");
|
this.inputTextMaestroName = this.makeInputTypeText(x, y, "jisangs");
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<script src="../../game/lib/keyboard_shortcut.js"></script>
|
<script src="../../game/lib/keyboard_shortcut.js"></script>
|
||||||
<script src="../../game/lib/input_type_text.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/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/back_button.js"></script>
|
||||||
<script src="../../game/lib/button/fullscreen_button.js"></script>
|
<script src="../../game/lib/button/fullscreen_button.js"></script>
|
||||||
<script src="../../game/lib/screen_top_ui.js"></script>
|
<script src="../../game/lib/screen_top_ui.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user