From 4fc961c2dd4143fe7eb2de4ef1b355f4534ca2ba Mon Sep 17 00:00:00 2001 From: "@racascou" Date: Wed, 17 Aug 2022 18:00:59 -0300 Subject: [PATCH] map buttons --- prototype/ui/button/menu_button.gd | 23 +++++-- prototype/ui/ui.tscn | 100 ++++++++++++++++++++++++----- 2 files changed, 102 insertions(+), 21 deletions(-) diff --git a/prototype/ui/button/menu_button.gd b/prototype/ui/button/menu_button.gd index adc14af4..6c7ff5d3 100644 --- a/prototype/ui/button/menu_button.gd +++ b/prototype/ui/button/menu_button.gd @@ -6,6 +6,8 @@ export var value:String var blue_team_button:Node var red_team_button:Node +var small_map_button:Node +var large_map_button:Node var play_button:Node @@ -13,14 +15,16 @@ func _ready(): game = get_tree().get_current_scene() yield(get_tree(), "idle_frame") - var buttons = game.ui.main_menu.get_node("container/menu_team_buttons") - blue_team_button = buttons.get_node("blue_team_button") - red_team_button = buttons.get_node("red_team_button") + var menu_buttons = game.ui.main_menu.get_node("container/menu_team_buttons") + blue_team_button = menu_buttons.get_node("blue_team_button") + red_team_button = menu_buttons.get_node("red_team_button") + var map_buttons = game.ui.main_menu.get_node("container/menu_map_buttons") + small_map_button = map_buttons.get_node("small_map_button") + large_map_button = map_buttons.get_node("large_map_button") play_button = game.ui.main_menu.get_node("container/play_button") - func button_down(): match self.value: @@ -58,6 +62,17 @@ func button_down(): blue_team_button.disabled = false red_team_button.disabled = true + "small": + game.maps.current_map = "1lane_map" + large_map_button.pressed = false + large_map_button.disabled = false + small_map_button.disabled = true + + "large": + game.maps.current_map = "3lane_map" + small_map_button.pressed = false + small_map_button.disabled = false + large_map_button.disabled = true "menu": game.paused = true diff --git a/prototype/ui/ui.tscn b/prototype/ui/ui.tscn index 789ca6db..16c579c8 100644 --- a/prototype/ui/ui.tscn +++ b/prototype/ui/ui.tscn @@ -336,20 +336,17 @@ anchor_bottom = 0.5 [node name="main_menu" type="ItemList" parent="mid"] pause_mode = 2 margin_left = -200.0 -margin_top = -140.0 +margin_top = -180.0 margin_right = 200.0 -margin_bottom = 140.0 +margin_bottom = 180.0 custom_styles/bg = SubResource( 15 ) -__meta__ = { -"_edit_use_anchors_": false -} [node name="container" type="VBoxContainer" parent="mid/main_menu"] margin_left = 16.0 margin_top = 16.0 margin_right = 384.0 margin_bottom = 264.0 -custom_constants/separation = 8 +custom_constants/separation = 3 [node name="menu_title" type="Label" parent="mid/main_menu/container"] margin_right = 368.0 @@ -362,29 +359,29 @@ __meta__ = { } [node name="separator" type="HSeparator" parent="mid/main_menu/container"] -margin_top = 26.0 +margin_top = 21.0 margin_right = 368.0 -margin_bottom = 50.0 +margin_bottom = 45.0 custom_constants/separation = 24 __meta__ = { "_edit_use_anchors_": false } [node name="team_choose" type="Label" parent="mid/main_menu/container"] -margin_top = 58.0 +margin_top = 48.0 margin_right = 368.0 -margin_bottom = 74.0 +margin_bottom = 64.0 custom_fonts/font = SubResource( 7 ) -text = "choose your team" +text = "choose team" align = 1 __meta__ = { "_edit_use_anchors_": false } [node name="menu_team_buttons" type="HBoxContainer" parent="mid/main_menu/container"] -margin_top = 82.0 +margin_top = 67.0 margin_right = 368.0 -margin_bottom = 142.0 +margin_bottom = 127.0 custom_constants/separation = 20 alignment = 1 __meta__ = { @@ -430,18 +427,85 @@ visible = false text = "2" [node name="separator2" type="HSeparator" parent="mid/main_menu/container"] -margin_top = 150.0 +margin_top = 130.0 margin_right = 368.0 -margin_bottom = 174.0 +margin_bottom = 154.0 +custom_constants/separation = 24 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="map_choose" type="Label" parent="mid/main_menu/container"] +margin_top = 157.0 +margin_right = 368.0 +margin_bottom = 173.0 +custom_fonts/font = SubResource( 7 ) +text = "choose map" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="menu_map_buttons" type="HBoxContainer" parent="mid/main_menu/container"] +margin_top = 176.0 +margin_right = 368.0 +margin_bottom = 236.0 +custom_constants/separation = 20 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="small_map_button" parent="mid/main_menu/container/menu_map_buttons" instance=ExtResource( 15 )] +margin_left = 14.0 +margin_right = 174.0 +rect_min_size = Vector2( 160, 60 ) +custom_styles/focus = SubResource( 41 ) +disabled = true +pressed = true +text = "small" +icon = null +value = "small" + +[node name="name" parent="mid/main_menu/container/menu_map_buttons/small_map_button" index="0"] +visible = false +text = "blue" + +[node name="hint" parent="mid/main_menu/container/menu_map_buttons/small_map_button" index="2"] +visible = false +text = "1" + +[node name="large_map_button" parent="mid/main_menu/container/menu_map_buttons" instance=ExtResource( 15 )] +margin_left = 194.0 +margin_right = 354.0 +rect_min_size = Vector2( 160, 60 ) +focus_mode = 2 +custom_styles/focus = SubResource( 42 ) +text = "large" +icon = null +value = "large" + +[node name="name" parent="mid/main_menu/container/menu_map_buttons/large_map_button" index="0"] +visible = false +text = "red" + +[node name="hint" parent="mid/main_menu/container/menu_map_buttons/large_map_button" index="2"] +visible = false +text = "2" + +[node name="separator3" type="HSeparator" parent="mid/main_menu/container"] +margin_top = 239.0 +margin_right = 368.0 +margin_bottom = 263.0 custom_constants/separation = 24 __meta__ = { "_edit_use_anchors_": false } [node name="play_button" parent="mid/main_menu/container" instance=ExtResource( 15 )] -margin_top = 182.0 +margin_top = 266.0 margin_right = 368.0 -margin_bottom = 242.0 +margin_bottom = 326.0 rect_min_size = Vector2( 360, 60 ) custom_styles/pressed = SubResource( 26 ) custom_styles/focus = SubResource( 49 ) @@ -1000,6 +1064,8 @@ text = "y" [editable path="top_right/shop/scroll_container/container/consumable_items/item_button3"] [editable path="mid/main_menu/container/menu_team_buttons/blue_team_button"] [editable path="mid/main_menu/container/menu_team_buttons/red_team_button"] +[editable path="mid/main_menu/container/menu_map_buttons/small_map_button"] +[editable path="mid/main_menu/container/menu_map_buttons/large_map_button"] [editable path="mid/main_menu/container/play_button"] [editable path="bot_right/controls/scroll_container/container/controls_buttons/teleport_button"] [editable path="bot_right/controls/scroll_container/container/controls_buttons/lane_button"]