From 8239c133fce8627fc4884bba6365eedef7172f83 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Sun, 28 Nov 2021 00:08:40 -0600 Subject: [PATCH] Lobby: Multiple cosmetic changes were made to improve the user experience --- godot_ship/dark_theme.tres | 44 ++++++++++++++++---- godot_ship/debug.tres | 28 ++++++++++++- godot_ship/export_presets.cfg | 8 ++-- godot_ship/light_theme.tres | 65 ++++++++++++++++++++++++------ godot_ship/scenes/Lobby.tscn | 4 +- godot_ship/script/network/Lobby.gd | 35 ++++++++-------- 6 files changed, 139 insertions(+), 45 deletions(-) diff --git a/godot_ship/dark_theme.tres b/godot_ship/dark_theme.tres index 3ed6bd8..1383dce 100644 --- a/godot_ship/dark_theme.tres +++ b/godot_ship/dark_theme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=6 format=2] +[gd_resource type="Theme" load_steps=8 format=2] [ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=1] [ext_resource path="res://assets/backgrounds/PanelBG_Dark.tres" type="StyleBox" id=2] @@ -19,7 +19,24 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 shadow_size = 3 -[sub_resource type="DynamicFont" id=3] +[sub_resource type="StyleBoxEmpty" id=3] +content_margin_left = 5.0 +content_margin_right = 5.0 + +[sub_resource type="StyleBoxFlat" id=4] +bg_color = Color( 0.109804, 0.0862745, 0.172549, 1 ) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color( 0.19, 0.15, 0.3, 1 ) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 +expand_margin_top = 20.0 + +[sub_resource type="DynamicFont" id=5] outline_size = 1 outline_color = Color( 0, 0, 0, 1 ) extra_spacing_top = 5 @@ -28,7 +45,7 @@ extra_spacing_char = 1 font_data = ExtResource( 1 ) [resource] -default_font = SubResource( 3 ) +default_font = SubResource( 5 ) Button/colors/font_color = Color( 1, 1, 1, 1 ) Button/colors/font_color_disabled = Color( 0.901961, 0.901961, 0.901961, 0.2 ) Button/colors/font_color_hover = Color( 1, 1, 1, 1 ) @@ -39,9 +56,7 @@ Button/styles/disabled = null Button/styles/focus = null Button/styles/hover = SubResource( 1 ) Button/styles/normal = SubResource( 2 ) -Button/styles/pressed = null -Dialogs/constants/button_margin = 100 -Dialogs/constants/margin = 8 +Button/styles/pressed = SubResource( 2 ) Label/colors/font_color = Color( 1, 1, 1, 1 ) Label/colors/font_color_shadow = Color( 0, 0, 0, 0.25098 ) Label/colors/font_outline_modulate = Color( 0, 0, 0, 1 ) @@ -51,9 +66,22 @@ Label/constants/shadow_offset_x = 0 Label/constants/shadow_offset_y = 2 Label/fonts/font = null Label/styles/normal = null +LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) +LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) +LineEdit/colors/cursor_color = Color( 0.878431, 0.878431, 0.878431, 1 ) +LineEdit/colors/font_color = Color( 0.878431, 0.878431, 0.878431, 1 ) +LineEdit/colors/font_color_selected = Color( 0, 0, 0, 1 ) +LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 ) +LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 ) +LineEdit/constants/minimum_spaces = 12 +LineEdit/fonts/font = null +LineEdit/icons/clear = null +LineEdit/styles/focus = null +LineEdit/styles/normal = SubResource( 3 ) +LineEdit/styles/read_only = null Panel/styles/panel = ExtResource( 2 ) PanelContainer/styles/panel = ExtResource( 2 ) -WindowDialog/colors/title_color = Color( 0.152941, 0.152941, 0.152941, 1 ) +WindowDialog/colors/title_color = Color( 1, 1, 1, 1 ) WindowDialog/constants/close_h_ofs = 18 WindowDialog/constants/close_v_ofs = 18 WindowDialog/constants/scaleborder_size = 4 @@ -61,4 +89,4 @@ WindowDialog/constants/title_height = 20 WindowDialog/fonts/title_font = null WindowDialog/icons/close = null WindowDialog/icons/close_highlight = null -WindowDialog/styles/panel = null +WindowDialog/styles/panel = SubResource( 4 ) diff --git a/godot_ship/debug.tres b/godot_ship/debug.tres index 7f37538..5897485 100644 --- a/godot_ship/debug.tres +++ b/godot_ship/debug.tres @@ -1,7 +1,31 @@ -[gd_resource type="Theme" format=2] +[gd_resource type="Theme" load_steps=3 format=2] + +[sub_resource type="StyleBoxFlat" id=1] +content_margin_left = 5.0 +content_margin_right = 5.0 +content_margin_top = 5.0 +content_margin_bottom = 5.0 +bg_color = Color( 0, 0.117647, 0.152941, 1 ) +expand_margin_top = 5.0 + +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0, 0.117647, 0.152941, 1 ) [resource] resource_name = "Debug Theme" +LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) +LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) +LineEdit/colors/cursor_color = Color( 0.94, 0.94, 0.94, 1 ) +LineEdit/colors/font_color = Color( 0.88, 0.88, 0.88, 1 ) +LineEdit/colors/font_color_selected = Color( 0, 0, 0, 1 ) +LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 ) +LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 ) +LineEdit/constants/minimum_spaces = 12 +LineEdit/fonts/font = null +LineEdit/icons/clear = null +LineEdit/styles/focus = null +LineEdit/styles/normal = SubResource( 1 ) +LineEdit/styles/read_only = null TextEdit/colors/background_color = Color( 0, 0.117647, 0.152941, 1 ) TextEdit/colors/bookmark_color = Color( 0.0784314, 0.490196, 0.980392, 1 ) TextEdit/colors/brace_mismatch_color = Color( 1, 0.2, 0.2, 1 ) @@ -40,4 +64,4 @@ TextEdit/icons/tab = null TextEdit/styles/completion = null TextEdit/styles/focus = null TextEdit/styles/normal = null -TextEdit/styles/read_only = null +TextEdit/styles/read_only = SubResource( 2 ) diff --git a/godot_ship/export_presets.cfg b/godot_ship/export_presets.cfg index fafb8c4..00e405e 100644 --- a/godot_ship/export_presets.cfg +++ b/godot_ship/export_presets.cfg @@ -16,7 +16,7 @@ script_encryption_key="" custom_template/debug="" custom_template/release="" binary_format/64_bits=true -binary_format/embed_pck=false +binary_format/embed_pck=true texture_format/bptc=false texture_format/s3tc=true texture_format/etc=false @@ -34,8 +34,8 @@ codesign/custom_options=PoolStringArray( ) application/icon="res://icon.ico" application/file_version="" application/product_version="" -application/company_name="" -application/product_name="" +application/company_name="Group12" +application/product_name="Ship Battle" application/file_description="" -application/copyright="" +application/copyright="2021 Group 12 Industries" application/trademarks="" diff --git a/godot_ship/light_theme.tres b/godot_ship/light_theme.tres index da4e5b0..48e3e74 100644 --- a/godot_ship/light_theme.tres +++ b/godot_ship/light_theme.tres @@ -1,9 +1,9 @@ -[gd_resource type="Theme" load_steps=6 format=2] +[gd_resource type="Theme" load_steps=9 format=2] [ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=1] [ext_resource path="res://assets/backgrounds/PanelBG_Light.tres" type="StyleBox" id=2] -[sub_resource type="StyleBoxFlat" id=1] +[sub_resource type="StyleBoxFlat" id=5] bg_color = Color( 1, 1, 1, 1 ) corner_radius_top_left = 3 corner_radius_top_right = 3 @@ -11,7 +11,7 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 shadow_size = 4 -[sub_resource type="StyleBoxFlat" id=2] +[sub_resource type="StyleBoxFlat" id=6] bg_color = Color( 0.847059, 0.921569, 0.964706, 1 ) corner_radius_top_left = 3 corner_radius_top_right = 3 @@ -19,8 +19,36 @@ corner_radius_bottom_right = 3 corner_radius_bottom_left = 3 shadow_size = 3 +[sub_resource type="StyleBoxFlat" id=4] +bg_color = Color( 0.941176, 0.941176, 0.941176, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_size = 3 + +[sub_resource type="StyleBoxEmpty" id=1] +content_margin_left = 5.0 +content_margin_right = 5.0 + +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0.847059, 0.921569, 0.964706, 1 ) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color( 0.219608, 0.239216, 0.25098, 1 ) +border_blend = true +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 +expand_margin_top = 20.0 +shadow_color = Color( 0, 0, 0, 1 ) + [sub_resource type="DynamicFont" id=3] outline_size = 1 +outline_color = Color( 0.847059, 0.921569, 0.964706, 0.501961 ) extra_spacing_top = 5 extra_spacing_bottom = 3 extra_spacing_char = 1 @@ -29,18 +57,16 @@ font_data = ExtResource( 1 ) [resource] default_font = SubResource( 3 ) Button/colors/font_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) -Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) -Button/colors/font_color_hover = Color( 0, 0, 0, 1 ) -Button/colors/font_color_pressed = Color( 0, 0, 0, 1 ) +Button/colors/font_color_disabled = Color( 0.901961, 0.901961, 0.901961, 0.2 ) +Button/colors/font_color_hover = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) +Button/colors/font_color_pressed = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) Button/constants/hseparation = 2 Button/fonts/font = null Button/styles/disabled = null Button/styles/focus = null -Button/styles/hover = SubResource( 1 ) -Button/styles/normal = SubResource( 2 ) -Button/styles/pressed = null -Dialogs/constants/button_margin = 100 -Dialogs/constants/margin = 8 +Button/styles/hover = SubResource( 5 ) +Button/styles/normal = SubResource( 6 ) +Button/styles/pressed = SubResource( 4 ) Label/colors/font_color = Color( 1, 1, 1, 1 ) Label/colors/font_color_shadow = Color( 0, 0, 0, 1 ) Label/colors/font_outline_modulate = Color( 0, 0, 0, 1 ) @@ -50,9 +76,22 @@ Label/constants/shadow_offset_x = 0 Label/constants/shadow_offset_y = 2 Label/fonts/font = null Label/styles/normal = null +LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) +LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) +LineEdit/colors/cursor_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) +LineEdit/colors/font_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) +LineEdit/colors/font_color_selected = Color( 0.309804, 0.309804, 0.309804, 1 ) +LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 ) +LineEdit/colors/selection_color = Color( 0.490196, 0.490196, 0.490196, 1 ) +LineEdit/constants/minimum_spaces = 12 +LineEdit/fonts/font = null +LineEdit/icons/clear = null +LineEdit/styles/focus = null +LineEdit/styles/normal = SubResource( 1 ) +LineEdit/styles/read_only = null Panel/styles/panel = ExtResource( 2 ) PanelContainer/styles/panel = ExtResource( 2 ) -WindowDialog/colors/title_color = Color( 0.152941, 0.152941, 0.152941, 1 ) +WindowDialog/colors/title_color = Color( 0, 0, 0, 1 ) WindowDialog/constants/close_h_ofs = 18 WindowDialog/constants/close_v_ofs = 18 WindowDialog/constants/scaleborder_size = 4 @@ -60,4 +99,4 @@ WindowDialog/constants/title_height = 20 WindowDialog/fonts/title_font = null WindowDialog/icons/close = null WindowDialog/icons/close_highlight = null -WindowDialog/styles/panel = null +WindowDialog/styles/panel = SubResource( 2 ) diff --git a/godot_ship/scenes/Lobby.tscn b/godot_ship/scenes/Lobby.tscn index e8ab806..519979b 100644 --- a/godot_ship/scenes/Lobby.tscn +++ b/godot_ship/scenes/Lobby.tscn @@ -89,7 +89,7 @@ __meta__ = { margin_top = 24.0 margin_right = 123.0 margin_bottom = 44.0 -text = "Connect to Game" +text = "Join Game" [node name="Connected Options" type="VBoxContainer" parent="Lobby Options"] visible = false @@ -154,7 +154,7 @@ margin_top = 404.977 margin_right = 441.136 margin_bottom = 450.977 rect_min_size = Vector2( 240, 46 ) -window_title = "Connect to Game" +window_title = "Join Game" __meta__ = { "_edit_use_anchors_": false } diff --git a/godot_ship/script/network/Lobby.gd b/godot_ship/script/network/Lobby.gd index 6464d0e..203f65f 100644 --- a/godot_ship/script/network/Lobby.gd +++ b/godot_ship/script/network/Lobby.gd @@ -19,7 +19,8 @@ func _on_peers_updated(): func set_IP_Address_text(show): # Print the IP address and port if show: - ip_address.text = "IP: %s\nPort: %s" % [Net.get_ip(), Net.DEFAULT_PORT] +# ip_address.text = "IP: %sPort:%s" % [Net.get_ip(), Net.DEFAULT_PORT] + ip_address.text = "IP: %s" % Net.get_ip() else: ip_address.text = "" @@ -30,13 +31,13 @@ func _ready(): _on_peers_updated() pass -func show_Connected_Options(show, host = false): +func show_Connected_Options(): # [Hide]/Show the host options - get_node("Lobby Options/Connected Options/Host Options").visible = host + get_node("Lobby Options/Connected Options/Host Options").visible = Net.hosting # [Hide]/Show the host and connect buttons - get_node("Lobby Options/Host or Connect").visible = !show + get_node("Lobby Options/Host or Connect").visible = !Net.connected # [Show]/Hide the host options - get_node("Lobby Options/Connected Options").visible = show + get_node("Lobby Options/Connected Options").visible = Net.connected # Buttons # Host Button: Host a game @@ -44,12 +45,12 @@ func show_Connected_Options(show, host = false): func _on_Host_Button_pressed(): # Make noise AudioBus.emit_signal("button_clicked") - # Show "Connected Options" - show_Connected_Options(true, true) # Show the host IP address set_IP_Address_text(true) # Begin hosting Net.start_host() + # Show "Connected Options" + show_Connected_Options() # Disconnect # Disconnect from (or stop hosting) a game @@ -59,10 +60,10 @@ func _on_Disconnect_Button_pressed(): AudioBus.emit_signal("button_clicked") # Disconnect Net.disconnect_host() - # Hide "Connected Options" - show_Connected_Options(false) # Hide the host IP address set_IP_Address_text(false) + # Hide "Connected Options" + show_Connected_Options() func _on_Start_Game_pressed(): # If there are enough players for a game @@ -72,22 +73,25 @@ func _on_Start_Game_pressed(): pass # Replace with function body. func _on_Net_disconnected(): - # Hide "Connected Options" - show_Connected_Options(false) # Hide the host IP address set_IP_Address_text(false) + # Hide "Connected Options" + show_Connected_Options() func _on_Change_Name_Button_pressed(): # Make noise AudioBus.emit_signal("button_clicked") # Show the Change Name dialogue get_node("Change Name").popup_centered() + get_node("Change Name/Name Entry").grab_focus() func _on_Connect_Button_pressed(): # Make noise AudioBus.emit_signal("button_clicked") # Show the Connect to Game dialogue - get_node("Connect to Game").popup_centered() + game_popup.popup_centered() + game_popup.get_node("IP and Port Entry").grab_focus() + game_popup.get_node("IP and Port Entry").caret_position = -1 func _on_Exit_Lobby_pressed(): # Make noise @@ -98,7 +102,6 @@ func _on_Exit_Lobby_pressed(): # Close Lobby menu queue_free() - func _on_IP_and_Port_Entry_text_entered(text): # Make noise AudioBus.emit_signal("button_clicked") @@ -107,12 +110,12 @@ func _on_IP_and_Port_Entry_text_entered(text): # If text exists and contains valid IP address if ip_port.size() > 0 and ip_port[0].is_valid_ip_address(): # Connect to host - var connected = Net.callv("connect_host", ip_port) + var connected = Net.connect_host(ip_port[0]) if connected == OK: - # Show "Connected Options" - show_Connected_Options(true) # Hide the popup game_popup.hide() + # Show "Connected Options" + show_Connected_Options() func _on_Name_Entry_text_entered(text):