Fix multiplayer presentation and Fishnet synchronization
This commit is contained in:
parent
31d459b3a7
commit
2045d8e288
19 changed files with 748 additions and 41 deletions
|
|
@ -62,6 +62,7 @@ var _discovery_refresh_timer: Timer
|
|||
var _editing_entry_id: String = ""
|
||||
var _name_entry_active: bool = false
|
||||
var _delete_armed: bool = false
|
||||
var _connection_error_latched: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -181,7 +182,7 @@ func open_page(preserved_endpoint: String = "") -> void:
|
|||
_address.text = "127.0.0.1:7777"
|
||||
show()
|
||||
UtilityPageStyle.animate_in(self)
|
||||
_set_mode(_mode)
|
||||
_set_mode(_mode, false)
|
||||
if _mode == Mode.DIRECT:
|
||||
_address.grab_focus()
|
||||
_address.select_all()
|
||||
|
|
@ -201,10 +202,13 @@ func get_endpoint_text() -> String:
|
|||
|
||||
|
||||
func set_status(message: String) -> void:
|
||||
_connection_error_latched = true
|
||||
_set_status(_friendly_connection_message(message), true)
|
||||
|
||||
|
||||
func _set_mode(mode: Mode) -> void:
|
||||
func _set_mode(mode: Mode, clear_connection_error: bool = true) -> void:
|
||||
if clear_connection_error:
|
||||
_connection_error_latched = false
|
||||
_mode = mode
|
||||
_selected_entry = null
|
||||
_selected_discovery_index = -1
|
||||
|
|
@ -225,6 +229,7 @@ func _set_mode(mode: Mode) -> void:
|
|||
|
||||
|
||||
func _request_join() -> void:
|
||||
_connection_error_latched = false
|
||||
if _network_session.state in [
|
||||
NetworkSession.State.CONNECTION_FAILED,
|
||||
NetworkSession.State.SERVER_LOST,
|
||||
|
|
@ -267,6 +272,10 @@ func _on_public_join_prepared(endpoint_text: String) -> void:
|
|||
|
||||
func _on_public_join_status_changed(message: String, is_error: bool) -> void:
|
||||
if _mode == Mode.DISCOVER and is_visible_in_tree():
|
||||
if is_error:
|
||||
_connection_error_latched = true
|
||||
elif _connection_error_latched:
|
||||
return
|
||||
_set_status(message, is_error)
|
||||
_refresh()
|
||||
|
||||
|
|
@ -708,7 +717,11 @@ func _on_discovery_rooms_updated(rooms: Array[Dictionary]) -> void:
|
|||
|
||||
|
||||
func _on_discovery_status_changed(message: String, is_error: bool) -> void:
|
||||
if _mode == Mode.DISCOVER and is_visible_in_tree():
|
||||
if (
|
||||
_mode == Mode.DISCOVER
|
||||
and is_visible_in_tree()
|
||||
and not _connection_error_latched
|
||||
):
|
||||
_set_status(message, is_error)
|
||||
|
||||
|
||||
|
|
@ -740,6 +753,7 @@ func _friendly_connection_message(message: String) -> String:
|
|||
return "Connection cancelled."
|
||||
if (
|
||||
"timeout" in normalized
|
||||
or "timed out" in normalized
|
||||
or "unavailable" in normalized
|
||||
or "refused" in normalized
|
||||
or "reach" in normalized
|
||||
|
|
@ -769,6 +783,7 @@ func _clear_edit_state() -> void:
|
|||
|
||||
|
||||
func _on_cancel_pressed() -> void:
|
||||
_connection_error_latched = false
|
||||
if _network_session != null:
|
||||
_network_session.cancel_connection()
|
||||
_refresh()
|
||||
|
|
@ -795,11 +810,14 @@ func _on_state_changed(_state: NetworkSession.State) -> void:
|
|||
|
||||
|
||||
func _on_status_message_changed(message: String) -> void:
|
||||
if _connection_error_latched:
|
||||
return
|
||||
_set_status(_friendly_connection_message(message))
|
||||
_refresh()
|
||||
|
||||
|
||||
func _on_connection_error(message: String) -> void:
|
||||
_connection_error_latched = true
|
||||
_set_status(_friendly_connection_message(message), true)
|
||||
_refresh()
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,8 @@ func _build_laptop() -> void:
|
|||
)
|
||||
forecast_stack.add_child(forecast_heading)
|
||||
_forecast_list = HBoxContainer.new()
|
||||
_forecast_list.custom_minimum_size = Vector2(272.0, 66.0)
|
||||
_forecast_list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
_forecast_list.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
_forecast_list.add_theme_constant_override("separation", 6)
|
||||
forecast_stack.add_child(_forecast_list)
|
||||
|
|
@ -501,7 +503,10 @@ func _daily_refresh_text() -> String:
|
|||
func _add_forecast_empty(message: String) -> void:
|
||||
var label := Label.new()
|
||||
label.text = message
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
label.custom_minimum_size = Vector2(252.0, 66.0)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_OFF
|
||||
label.add_theme_color_override(
|
||||
"font_color", UtilityPageStyle.OCEAN_TEXT_SECONDARY
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue