Added help and about, minor improvements
This commit is contained in:
parent
18674efd8e
commit
e5296a41b9
BIN
resources/button_info.png
(Stored with Git LFS)
Normal file
BIN
resources/button_info.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/button_info_pressed.png
(Stored with Git LFS)
Normal file
BIN
resources/button_info_pressed.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/button_invmouse.png
(Stored with Git LFS)
Normal file
BIN
resources/button_invmouse.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/button_invmouse_pressed.png
(Stored with Git LFS)
Normal file
BIN
resources/button_invmouse_pressed.png
(Stored with Git LFS)
Normal file
Binary file not shown.
218
resources/config/about.json
Normal file
218
resources/config/about.json
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
{
|
||||||
|
"root": {
|
||||||
|
"type": "LinearLayout",
|
||||||
|
"orientation": "vertical",
|
||||||
|
"vertical_align": "center",
|
||||||
|
"horizontal_align": "center",
|
||||||
|
"spacing": 10,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "match_parent",
|
||||||
|
"height": "match_parent",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "titleBtn",
|
||||||
|
"width": 434,
|
||||||
|
"height": 35,
|
||||||
|
"texture": "resources/main_menu/title.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "aboutSpace1",
|
||||||
|
"width": 434,
|
||||||
|
"height": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FrameLayout",
|
||||||
|
"spacing": 10,
|
||||||
|
"width": 434,
|
||||||
|
"height": 460,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText1",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 0,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Producer: Vladislav Khorev",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 60,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Lead Developer: Vladislav Khorev",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 120,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Game Designer: Leila Bobrova",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 180,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Developers: ",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 220,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Vladislav Kan",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 260,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Beksultan Almazbekov",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 300,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "Sergei Zotov",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 360,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "3D Artist: David \"nokken\" Im",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextView",
|
||||||
|
"name": "aboutText2",
|
||||||
|
"width": 434,
|
||||||
|
"height": 40,
|
||||||
|
"x": -300,
|
||||||
|
"y": 420,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"text": "UI/UX Design: Kenje Kazmatova",
|
||||||
|
"fontSize": 32,
|
||||||
|
"color": [
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
255,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"centered": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "aboutBackButton",
|
||||||
|
"width": 382,
|
||||||
|
"height": 56,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/game_over/Secondarybutton.png",
|
||||||
|
"hover": "resources/game_over/Secondarybutton.png",
|
||||||
|
"pressed": "resources/game_over/Secondarybutton.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -52,6 +52,17 @@
|
|||||||
"hover": "resources/main_menu/Variant7.png",
|
"hover": "resources/main_menu/Variant7.png",
|
||||||
"pressed": "resources/main_menu/Variant8.png"
|
"pressed": "resources/main_menu/Variant8.png"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "aboutButton",
|
||||||
|
"width": 382,
|
||||||
|
"height": 56,
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/main_menu/about.png",
|
||||||
|
"hover": "resources/main_menu/about_hover.png",
|
||||||
|
"pressed": "resources/main_menu/about_pressed.png"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "StaticImage",
|
"type": "StaticImage",
|
||||||
|
|||||||
@ -48,13 +48,31 @@
|
|||||||
"y": 100,
|
"y": 100,
|
||||||
"width": 150,
|
"width": 150,
|
||||||
"height": 150,
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
"horizontal_gravity": "right",
|
"horizontal_gravity": "right",
|
||||||
"vertical_gravity": "top",
|
"vertical_gravity": "top",
|
||||||
"textures": {
|
"textures": {
|
||||||
"normal": "resources/fire.png",
|
"normal": "resources/button_invmouse.png",
|
||||||
"hover": "resources/fire.png",
|
"hover": "resources/button_invmouse.png",
|
||||||
"pressed": "resources/fire2.png",
|
"pressed": "resources/button_invmouse_pressed.png",
|
||||||
"disabled": "resources/fire.png"
|
"disabled": "resources/button_invmouse.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "infoButton",
|
||||||
|
"x": 0,
|
||||||
|
"y": 250,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"textures": {
|
||||||
|
"normal": "resources/button_info.png",
|
||||||
|
"hover": "resources/button_info.png",
|
||||||
|
"pressed": "resources/button_info_pressed.png",
|
||||||
|
"disabled": "resources/button_info.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
163
resources/config/ui_with_help.json
Normal file
163
resources/config/ui_with_help.json
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
{
|
||||||
|
"root": {
|
||||||
|
"type": "FrameLayout",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "match_parent",
|
||||||
|
"height": "match_parent",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "showPlayersButton_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 100,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"texture": "resources/button_players.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "infoButton_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 250,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"texture":"resources/button_info.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "infoButtonTopLeft_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 300,
|
||||||
|
"height": 400,
|
||||||
|
"border" : 0,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"texture": "resources/help_top_left.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "inverseMouseButton_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 100,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"texture": "resources/button_invmouse.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "infoButtonTopRight_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 300,
|
||||||
|
"height": 230,
|
||||||
|
"border" : 0,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "top",
|
||||||
|
"texture": "resources/help_top_right.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "infoButtonBottomLeft_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 300,
|
||||||
|
"height": 200,
|
||||||
|
"border" : 0,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/help_bottom_left.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "shootButton_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/fire.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "shootButton2_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"horizontal_gravity": "left",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/fire.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "minusButton_help",
|
||||||
|
"x": -20,
|
||||||
|
"y": 110,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/button_minus.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "plusButton_help",
|
||||||
|
"x": -20,
|
||||||
|
"y": 220,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/button_plus.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "takeButton_help",
|
||||||
|
"x": -20,
|
||||||
|
"y": 320,
|
||||||
|
"width": 150,
|
||||||
|
"height": 150,
|
||||||
|
"border" : 20,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/button_take.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "StaticImage",
|
||||||
|
"name": "infoButtonBottomRight_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": 300,
|
||||||
|
"height": 450,
|
||||||
|
"border" : 0,
|
||||||
|
"horizontal_gravity": "right",
|
||||||
|
"vertical_gravity": "bottom",
|
||||||
|
"texture": "resources/help_bottom_right.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "infoButtonUnderlying_help",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"width": "match_parent",
|
||||||
|
"height": "match_parent",
|
||||||
|
"border" : 0,
|
||||||
|
"textures": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
resources/gameover.png
(Stored with Git LFS)
BIN
resources/gameover.png
(Stored with Git LFS)
Binary file not shown.
260
resources/help_bottom_left.pdn
Normal file
260
resources/help_bottom_left.pdn
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/help_bottom_left.png
(Stored with Git LFS)
Normal file
BIN
resources/help_bottom_left.png
(Stored with Git LFS)
Normal file
Binary file not shown.
637
resources/help_bottom_right.pdn
Normal file
637
resources/help_bottom_right.pdn
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/help_bottom_right.png
(Stored with Git LFS)
Normal file
BIN
resources/help_bottom_right.png
(Stored with Git LFS)
Normal file
Binary file not shown.
209
resources/help_top_left.pdn
Normal file
209
resources/help_top_left.pdn
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/help_top_left.png
(Stored with Git LFS)
Normal file
BIN
resources/help_top_left.png
(Stored with Git LFS)
Normal file
Binary file not shown.
167
resources/help_top_right.pdn
Normal file
167
resources/help_top_right.pdn
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/help_top_right.png
(Stored with Git LFS)
Normal file
BIN
resources/help_top_right.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/main_menu/about.png
(Stored with Git LFS)
BIN
resources/main_menu/about.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/main_menu/about_hover.png
(Stored with Git LFS)
BIN
resources/main_menu/about_hover.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/main_menu/about_pressed.png
(Stored with Git LFS)
BIN
resources/main_menu/about_pressed.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/main_menu/lang.png
(Stored with Git LFS)
BIN
resources/main_menu/lang.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/platform_base.png
(Stored with Git LFS)
BIN
resources/platform_base.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/shoot_hover.png
(Stored with Git LFS)
BIN
resources/shoot_hover.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/shoot_normal.png
(Stored with Git LFS)
BIN
resources/shoot_normal.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/shoot_pressed.png
(Stored with Git LFS)
BIN
resources/shoot_pressed.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/sky/space_red.png
(Stored with Git LFS)
BIN
resources/sky/space_red.png
(Stored with Git LFS)
Binary file not shown.
BIN
resources/transparent.png
(Stored with Git LFS)
Normal file
BIN
resources/transparent.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -17,12 +17,14 @@ namespace ZL {
|
|||||||
|
|
||||||
void MenuManager::setupMenu()
|
void MenuManager::setupMenu()
|
||||||
{
|
{
|
||||||
mainMenuRoot = loadUiFromFile("resources/config/main_menu.json", renderer, CONST_ZIP_FILE);
|
mainMenuRoot = loadUiFromFile("resources/config/main_menu.json", renderer, CONST_ZIP_FILE);
|
||||||
|
aboutMenuRoot = loadUiFromFile("resources/config/about.json", renderer, CONST_ZIP_FILE);
|
||||||
shipSelectionRoot = loadUiFromFile("resources/config/ship_selection_menu.json", renderer, CONST_ZIP_FILE);
|
shipSelectionRoot = loadUiFromFile("resources/config/ship_selection_menu.json", renderer, CONST_ZIP_FILE);
|
||||||
connectingRoot = loadUiFromFile("resources/config/connecting.json", renderer, CONST_ZIP_FILE);
|
connectingRoot = loadUiFromFile("resources/config/connecting.json", renderer, CONST_ZIP_FILE);
|
||||||
connectionFailedRoot= loadUiFromFile("resources/config/connection_failed.json", renderer, CONST_ZIP_FILE);
|
connectionFailedRoot= loadUiFromFile("resources/config/connection_failed.json", renderer, CONST_ZIP_FILE);
|
||||||
gameplayRoot = loadUiFromFile("resources/config/ui.json", renderer, CONST_ZIP_FILE);
|
gameplayRoot = loadUiFromFile("resources/config/ui.json", renderer, CONST_ZIP_FILE);
|
||||||
gameOverRoot = loadUiFromFile("resources/config/game_over.json", renderer, CONST_ZIP_FILE);
|
gameOverRoot = loadUiFromFile("resources/config/game_over.json", renderer, CONST_ZIP_FILE);
|
||||||
|
helpScreenRoot = loadUiFromFile("resources/config/ui_with_help.json", renderer, CONST_ZIP_FILE);
|
||||||
connectionLostRoot = loadUiFromFile("resources/config/connection_lost.json", renderer, CONST_ZIP_FILE);
|
connectionLostRoot = loadUiFromFile("resources/config/connection_lost.json", renderer, CONST_ZIP_FILE);
|
||||||
|
|
||||||
enterMainMenu();
|
enterMainMenu();
|
||||||
@ -32,6 +34,7 @@ namespace ZL {
|
|||||||
{
|
{
|
||||||
return state == GameState::Gameplay
|
return state == GameState::Gameplay
|
||||||
|| state == GameState::GameOver
|
|| state == GameState::GameOver
|
||||||
|
|| state == GameState::HelpScreen
|
||||||
|| state == GameState::ConnectionLost;
|
|| state == GameState::ConnectionLost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +54,20 @@ namespace ZL {
|
|||||||
uiManager.setButtonCallback("multiplayerButton", [this](const std::string&) {
|
uiManager.setButtonCallback("multiplayerButton", [this](const std::string&) {
|
||||||
enterShipSelectionMulti();
|
enterShipSelectionMulti();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
uiManager.setButtonCallback("aboutButton", [this](const std::string&) {
|
||||||
|
enterAboutMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MenuManager::enterAboutMenu()
|
||||||
|
{
|
||||||
|
state = GameState::AboutMenu;
|
||||||
|
uiManager.replaceRoot(aboutMenuRoot);
|
||||||
|
uiManager.setButtonCallback("aboutBackButton", [this](const std::string&) {
|
||||||
|
enterMainMenu();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── State: ShipSelectionSingle ───────────────────────────────────────────
|
// ── State: ShipSelectionSingle ───────────────────────────────────────────
|
||||||
@ -190,8 +207,53 @@ namespace ZL {
|
|||||||
state = GameState::Gameplay;
|
state = GameState::Gameplay;
|
||||||
uiManager.replaceRoot(gameplayRoot);
|
uiManager.replaceRoot(gameplayRoot);
|
||||||
|
|
||||||
uiManager.findButton("minusButton")->state = ButtonState::Disabled;
|
if (Environment::shipState.shipType == 1)
|
||||||
|
{
|
||||||
|
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
|
||||||
|
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Environment::shipState.velocity < 0.1)
|
||||||
|
{
|
||||||
|
uiManager.findButton("minusButton")->state = ButtonState::Disabled;
|
||||||
|
uiManager.findButton("plusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("shootButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("shootButton2")->state = ButtonState::Normal;
|
||||||
|
}
|
||||||
|
else if (Environment::shipState.velocity >= 0.1 && Environment::shipState.velocity <= 200)
|
||||||
|
{
|
||||||
|
uiManager.findButton("minusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("plusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("shootButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("shootButton2")->state = ButtonState::Normal;
|
||||||
|
}
|
||||||
|
else if (Environment::shipState.velocity > 200 && Environment::shipState.velocity < 400 - 0.1)
|
||||||
|
{
|
||||||
|
uiManager.findButton("minusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("plusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
|
||||||
|
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
|
||||||
|
}
|
||||||
|
else if (Environment::shipState.velocity >= 400 - 0.1)
|
||||||
|
{
|
||||||
|
uiManager.findButton("minusButton")->state = ButtonState::Normal;
|
||||||
|
uiManager.findButton("plusButton")->state = ButtonState::Disabled;
|
||||||
|
uiManager.findButton("shootButton")->state = ButtonState::Disabled;
|
||||||
|
uiManager.findButton("shootButton2")->state = ButtonState::Disabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forceSetupSpaceUICallback)
|
||||||
|
{
|
||||||
|
forceSetupSpaceUICallback();
|
||||||
|
}
|
||||||
|
|
||||||
if (auto btn = uiManager.findButton("takeButton")) btn->state = ButtonState::Disabled;
|
if (auto btn = uiManager.findButton("takeButton")) btn->state = ButtonState::Disabled;
|
||||||
|
if (auto btn = uiManager.findButton("showPlayersButton"))
|
||||||
|
{
|
||||||
|
btn->state = ButtonState::Disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -244,13 +306,15 @@ namespace ZL {
|
|||||||
if (onShowPlayersPressed) onShowPlayersPressed();
|
if (onShowPlayersPressed) onShowPlayersPressed();
|
||||||
});
|
});
|
||||||
|
|
||||||
//inverseMouseButton
|
|
||||||
|
|
||||||
uiManager.setButtonPressCallback("inverseMouseButton", [this](const std::string&) {
|
uiManager.setButtonPressCallback("inverseMouseButton", [this](const std::string&) {
|
||||||
inverseVertical = !inverseVertical;
|
inverseVertical = !inverseVertical;
|
||||||
std::cout << "Inverse mouse: " << (inverseVertical ? "ON" : "OFF") << std::endl;
|
std::cout << "Inverse mouse: " << (inverseVertical ? "ON" : "OFF") << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
uiManager.setButtonCallback("infoButton", [this](const std::string&) {
|
||||||
|
//if (onShowPlayersPressed) onShowPlayersPressed();
|
||||||
|
enterHelp();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -281,6 +345,16 @@ namespace ZL {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuManager::enterHelp()
|
||||||
|
{
|
||||||
|
state = GameState::HelpScreen;
|
||||||
|
uiManager.replaceRoot(helpScreenRoot);
|
||||||
|
|
||||||
|
uiManager.setButtonCallback("infoButtonUnderlying_help", [this](const std::string&) {
|
||||||
|
enterGameplay();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ── State: ConnectionLost ─────────────────────────────────────────────────
|
// ── State: ConnectionLost ─────────────────────────────────────────────────
|
||||||
|
|
||||||
void MenuManager::enterConnectionLost()
|
void MenuManager::enterConnectionLost()
|
||||||
|
|||||||
@ -10,12 +10,14 @@ namespace ZL {
|
|||||||
|
|
||||||
enum class GameState {
|
enum class GameState {
|
||||||
MainMenu,
|
MainMenu,
|
||||||
|
AboutMenu,
|
||||||
ShipSelectionSingle,
|
ShipSelectionSingle,
|
||||||
ShipSelectionMulti,
|
ShipSelectionMulti,
|
||||||
Connecting,
|
Connecting,
|
||||||
ConnectionFailed,
|
ConnectionFailed,
|
||||||
Gameplay,
|
Gameplay,
|
||||||
GameOver,
|
GameOver,
|
||||||
|
HelpScreen,
|
||||||
ConnectionLost
|
ConnectionLost
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,11 +27,13 @@ namespace ZL {
|
|||||||
|
|
||||||
// Pre-loaded UI roots (loaded once in setupMenu)
|
// Pre-loaded UI roots (loaded once in setupMenu)
|
||||||
std::shared_ptr<UiNode> mainMenuRoot;
|
std::shared_ptr<UiNode> mainMenuRoot;
|
||||||
|
std::shared_ptr<UiNode> aboutMenuRoot;
|
||||||
std::shared_ptr<UiNode> shipSelectionRoot;
|
std::shared_ptr<UiNode> shipSelectionRoot;
|
||||||
std::shared_ptr<UiNode> connectingRoot;
|
std::shared_ptr<UiNode> connectingRoot;
|
||||||
std::shared_ptr<UiNode> connectionFailedRoot;
|
std::shared_ptr<UiNode> connectionFailedRoot;
|
||||||
std::shared_ptr<UiNode> gameplayRoot;
|
std::shared_ptr<UiNode> gameplayRoot;
|
||||||
std::shared_ptr<UiNode> gameOverRoot;
|
std::shared_ptr<UiNode> gameOverRoot;
|
||||||
|
std::shared_ptr<UiNode> helpScreenRoot;
|
||||||
std::shared_ptr<UiNode> connectionLostRoot;
|
std::shared_ptr<UiNode> connectionLostRoot;
|
||||||
|
|
||||||
// Stored for multiplayer retry
|
// Stored for multiplayer retry
|
||||||
@ -40,12 +44,14 @@ namespace ZL {
|
|||||||
|
|
||||||
// State transition methods
|
// State transition methods
|
||||||
void enterMainMenu();
|
void enterMainMenu();
|
||||||
|
void enterAboutMenu();
|
||||||
void enterShipSelectionSingle();
|
void enterShipSelectionSingle();
|
||||||
void enterShipSelectionMulti();
|
void enterShipSelectionMulti();
|
||||||
void enterConnecting();
|
void enterConnecting();
|
||||||
void enterConnectionFailed();
|
void enterConnectionFailed();
|
||||||
void enterGameplay();
|
void enterGameplay();
|
||||||
void enterGameOver(int score);
|
void enterGameOver(int score);
|
||||||
|
void enterHelp();
|
||||||
void enterConnectionLost();
|
void enterConnectionLost();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -74,6 +80,8 @@ namespace ZL {
|
|||||||
std::function<void(const std::string&, int)> onSingleplayerPressed;
|
std::function<void(const std::string&, int)> onSingleplayerPressed;
|
||||||
std::function<void(const std::string&, int)> onMultiplayerPressed;
|
std::function<void(const std::string&, int)> onMultiplayerPressed;
|
||||||
std::function<void()> onShowPlayersPressed;
|
std::function<void()> onShowPlayersPressed;
|
||||||
|
|
||||||
|
std::function<void()> forceSetupSpaceUICallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ZL
|
} // namespace ZL
|
||||||
@ -273,30 +273,50 @@ namespace ZL
|
|||||||
Environment::zoom = DEFAULT_ZOOM;
|
Environment::zoom = DEFAULT_ZOOM;
|
||||||
Environment::tapDownHold = false;
|
Environment::tapDownHold = false;
|
||||||
playerScore = 0;
|
playerScore = 0;
|
||||||
if (menuManager.uiManager.findButton("minusButton"))
|
|
||||||
{
|
mainThreadHandler.EnqueueMainThreadTask([this]() {
|
||||||
menuManager.uiManager.findButton("minusButton")->state = ButtonState::Disabled;
|
if (menuManager.uiManager.findButton("minusButton"))
|
||||||
}
|
|
||||||
if (menuManager.uiManager.findButton("plusButton"))
|
|
||||||
{
|
|
||||||
menuManager.uiManager.findButton("plusButton")->state = ButtonState::Normal;
|
|
||||||
}
|
|
||||||
if (Environment::shipState.shipType == 0)
|
|
||||||
{
|
|
||||||
if (menuManager.uiManager.findButton("shootButton"))
|
|
||||||
{
|
{
|
||||||
menuManager.uiManager.findButton("shootButton")->state = ButtonState::Normal;
|
menuManager.uiManager.findButton("minusButton")->state = ButtonState::Disabled;
|
||||||
}
|
}
|
||||||
if (menuManager.uiManager.findButton("shootButton2"))
|
if (menuManager.uiManager.findButton("plusButton"))
|
||||||
{
|
{
|
||||||
menuManager.uiManager.findButton("shootButton2")->state = ButtonState::Normal;
|
menuManager.uiManager.findButton("plusButton")->state = ButtonState::Normal;
|
||||||
}
|
}
|
||||||
}
|
if (Environment::shipState.shipType == 0)
|
||||||
|
{
|
||||||
|
if (menuManager.uiManager.findButton("shootButton"))
|
||||||
|
{
|
||||||
|
menuManager.uiManager.findButton("shootButton")->state = ButtonState::Normal;
|
||||||
|
}
|
||||||
|
if (menuManager.uiManager.findButton("shootButton2"))
|
||||||
|
{
|
||||||
|
menuManager.uiManager.findButton("shootButton2")->state = ButtonState::Normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Space::setup() {
|
void Space::updateShowPlayersButtonState()
|
||||||
|
{
|
||||||
|
bool hasAlivePlayers = false;
|
||||||
|
for (auto const& [id, _] : remotePlayerStates) {
|
||||||
|
if (!deadRemotePlayers.count(id)) {
|
||||||
|
hasAlivePlayers = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasAlivePlayers == showPlayersButtonEnabled) return;
|
||||||
|
showPlayersButtonEnabled = hasAlivePlayers;
|
||||||
|
auto btn = menuManager.uiManager.findButton("showPlayersButton");
|
||||||
|
if (!btn) return;
|
||||||
|
btn->state = hasAlivePlayers ? ButtonState::Normal : ButtonState::Disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Space::setup() {
|
||||||
|
|
||||||
menuManager.onRestartPressed = [this]() {
|
menuManager.onRestartPressed = [this]() {
|
||||||
resetPlayerState();
|
resetPlayerState();
|
||||||
|
|
||||||
@ -359,6 +379,12 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
menuManager.forceSetupSpaceUICallback = [this]() {
|
||||||
|
this->nearPickupBox = false;
|
||||||
|
this->showPlayersButtonEnabled = false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
bool cfgLoaded = sparkEmitter.loadFromJsonFile("resources/config/spark_config.json", renderer, CONST_ZIP_FILE);
|
bool cfgLoaded = sparkEmitter.loadFromJsonFile("resources/config/spark_config.json", renderer, CONST_ZIP_FILE);
|
||||||
bool cfgLoaded2 = sparkEmitterCargo.loadFromJsonFile("resources/config/spark_config_cargo.json", renderer, CONST_ZIP_FILE);
|
bool cfgLoaded2 = sparkEmitterCargo.loadFromJsonFile("resources/config/spark_config_cargo.json", renderer, CONST_ZIP_FILE);
|
||||||
sparkEmitter.setIsActive(false);
|
sparkEmitter.setIsActive(false);
|
||||||
@ -1695,6 +1721,7 @@ namespace ZL
|
|||||||
remotePlayerStates[id] = playerState;
|
remotePlayerStates[id] = playerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateShowPlayersButtonState();
|
||||||
updateSparkEmitters(static_cast<float>(delta));
|
updateSparkEmitters(static_cast<float>(delta));
|
||||||
|
|
||||||
for (auto& p : projectiles) {
|
for (auto& p : projectiles) {
|
||||||
@ -2017,6 +2044,7 @@ namespace ZL
|
|||||||
}
|
}
|
||||||
|
|
||||||
rebuildPlayerListIfVisible();
|
rebuildPlayerListIfVisible();
|
||||||
|
updateShowPlayersButtonState();
|
||||||
auto boxDestructions = networkClient->getPendingBoxDestructions();
|
auto boxDestructions = networkClient->getPendingBoxDestructions();
|
||||||
if (!boxDestructions.empty()) {
|
if (!boxDestructions.empty()) {
|
||||||
std::cout << "Game: Received " << boxDestructions.size() << " box destruction events" << std::endl;
|
std::cout << "Game: Received " << boxDestructions.size() << " box destruction events" << std::endl;
|
||||||
|
|||||||
@ -113,7 +113,7 @@ namespace ZL {
|
|||||||
const uint64_t explosionDurationMs = 500;
|
const uint64_t explosionDurationMs = 500;
|
||||||
|
|
||||||
bool serverBoxesApplied = false;
|
bool serverBoxesApplied = false;
|
||||||
bool nearPickupBox = false;
|
bool nearPickupBox = false;
|
||||||
|
|
||||||
static constexpr float MAX_DIST_SQ = 10000.f * 10000.f;
|
static constexpr float MAX_DIST_SQ = 10000.f * 10000.f;
|
||||||
static constexpr float FADE_START = 6000.f;
|
static constexpr float FADE_START = 6000.f;
|
||||||
@ -149,6 +149,8 @@ namespace ZL {
|
|||||||
|
|
||||||
void resetPlayerState();
|
void resetPlayerState();
|
||||||
void clearTextRendererCache();
|
void clearTextRendererCache();
|
||||||
|
void updateShowPlayersButtonState();
|
||||||
|
bool showPlayersButtonEnabled = false;
|
||||||
|
|
||||||
// Player list overlay
|
// Player list overlay
|
||||||
void buildAndShowPlayerList();
|
void buildAndShowPlayerList();
|
||||||
|
|||||||
@ -98,12 +98,12 @@ namespace ZL {
|
|||||||
|
|
||||||
stoneToBake = planetStones.inflateOne(0, 0.75);
|
stoneToBake = planetStones.inflateOne(0, 0.75);
|
||||||
|
|
||||||
|
/*
|
||||||
campPlatform.data = LoadFromTextFile02("resources/platform1.txt", CONST_ZIP_FILE);
|
campPlatform.data = LoadFromTextFile02("resources/platform1.txt", CONST_ZIP_FILE);
|
||||||
campPlatform.RefreshVBO();
|
campPlatform.RefreshVBO();
|
||||||
|
|
||||||
campPlatformTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/platform_base.png", CONST_ZIP_FILE));
|
campPlatformTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/platform_base.png", CONST_ZIP_FILE));
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user