Improved signal handling
This commit is contained in:
@ -3,17 +3,37 @@ extends Control
|
||||
|
||||
signal chat_message_submitted(message: String)
|
||||
|
||||
var signals := [
|
||||
"login",
|
||||
"logout",
|
||||
"ping_changed",
|
||||
"download_changed",
|
||||
"upload_changed",
|
||||
"message_received",
|
||||
]
|
||||
|
||||
var login: Signal
|
||||
var logout: Signal
|
||||
var ping_changed: Signal
|
||||
var download_changed: Signal
|
||||
var upload_changed: Signal
|
||||
var message_received: Signal
|
||||
var login: Signal
|
||||
var logout: Signal
|
||||
|
||||
func _enter_tree():
|
||||
if get_node_or_null("/root/Main"):
|
||||
connect_main_scene()
|
||||
else:
|
||||
connect_fake()
|
||||
|
||||
func connect_main_scene():
|
||||
login = %Login.success
|
||||
logout = %Logout.success
|
||||
ping_changed = %Ping.changed
|
||||
download_changed = %Client.download_changed
|
||||
upload_changed = %Client.upload_changed
|
||||
message_received = %Chat.message_received
|
||||
login = %Login.success
|
||||
logout = %Logout.success
|
||||
|
||||
func connect_fake():
|
||||
for signal_name in signals:
|
||||
set(signal_name, Signal(self, signal_name))
|
||||
add_user_signal(signal_name)
|
@ -1,7 +1,5 @@
|
||||
extends LineEdit
|
||||
|
||||
signal chat_message_submitted(message: String)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if Global.interacting_with_ui:
|
||||
return
|
||||
|
9
client/ui/debug/DebugLabelText.gd
Normal file
9
client/ui/debug/DebugLabelText.gd
Normal file
@ -0,0 +1,9 @@
|
||||
@tool
|
||||
extends Label
|
||||
|
||||
func _ready():
|
||||
text = get_parent().name + ":"
|
||||
|
||||
func _get_configuration_warnings():
|
||||
text = get_parent().name + ":"
|
||||
return []
|
@ -1,4 +1,4 @@
|
||||
extends Range
|
||||
extends Slider
|
||||
|
||||
func _ready():
|
||||
set_value_no_signal(Global.environment.adjustment_brightness)
|
||||
|
@ -1,4 +1,4 @@
|
||||
extends Range
|
||||
extends Slider
|
||||
|
||||
func _ready():
|
||||
set_value_no_signal(Global.environment.adjustment_contrast)
|
||||
|
@ -3,7 +3,7 @@ extends OptionButton
|
||||
var fsrQuality: Array[float] = [0.50, 0.59, 0.67, 0.77, 1.0]
|
||||
|
||||
func _ready():
|
||||
var viewport_scale := get_viewport().scaling_3d_scale
|
||||
var viewport_scale := Global.viewport.scaling_3d_scale
|
||||
var closest := -1
|
||||
var closest_diff := 999.0
|
||||
|
||||
@ -17,4 +17,4 @@ func _ready():
|
||||
selected = closest
|
||||
|
||||
func on_item_selected(index):
|
||||
get_viewport().scaling_3d_scale = fsrQuality[index]
|
||||
Global.viewport.scaling_3d_scale = fsrQuality[index]
|
@ -1,4 +1,4 @@
|
||||
extends Range
|
||||
extends Slider
|
||||
|
||||
func _ready():
|
||||
set_value_no_signal(Global.environment.adjustment_saturation)
|
||||
|
@ -1,9 +1,7 @@
|
||||
extends OptionButton
|
||||
|
||||
func _ready():
|
||||
var viewport = get_viewport()
|
||||
|
||||
match viewport.scaling_3d_mode:
|
||||
match Global.viewport.scaling_3d_mode:
|
||||
Viewport.SCALING_3D_MODE_BILINEAR:
|
||||
selected = 0
|
||||
Viewport.SCALING_3D_MODE_FSR:
|
||||
@ -12,12 +10,10 @@ func _ready():
|
||||
selected = 2
|
||||
|
||||
func on_item_selected(index: int):
|
||||
var viewport = get_viewport()
|
||||
|
||||
match index:
|
||||
0:
|
||||
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR
|
||||
Global.viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR
|
||||
1:
|
||||
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR
|
||||
Global.viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR
|
||||
2:
|
||||
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR2
|
||||
Global.viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR2
|
||||
|
Reference in New Issue
Block a user