bug fixes for exporting to android

This commit is contained in:
Nitwel 2023-11-26 03:06:31 +01:00
parent 1d06821736
commit 9bab4348af
5 changed files with 29 additions and 23 deletions

View File

@ -12,17 +12,23 @@ const IconFont = preload("res://assets/icons/icons.tres")
@export var label: String = "":
set(value):
if !is_inside_tree(): await ready
label = value
if label_node == null:
return
label_node.text = value
get:
return label_node.text
@export var icon: bool = false:
set(value):
icon = value
if !is_inside_tree(): await ready
label_node.font = IconFont if value else null
label_node.font_size = 48 if value else 10
if label_node == null:
return
if value:
label_node.font = IconFont
label_node.font_size = 48
label_node.width = 1000
label_node.autowrap_mode = TextServer.AUTOWRAP_OFF
@export var toggleable: bool = false
@export var disabled: bool = false
@ -44,6 +50,9 @@ var active: bool = false :
@onready var animation_player: AnimationPlayer = $AnimationPlayer
func _ready():
label = label
icon = icon
if initial_active:
active = true

View File

@ -13,9 +13,11 @@ var text_handler = preload("res://content/ui/components/input/text_handler.gd").
get:
return text_handler.width
set(value):
width = value
text_handler.width = value
if !is_inside_tree(): await ready
if mesh_box == null:
return
mesh_box.mesh.size.x = value
collision.shape.size.x = value
@ -25,10 +27,12 @@ var text_handler = preload("res://content/ui/components/input/text_handler.gd").
get:
return text_handler.text
set(value):
text = value
var focused = Engine.is_editor_hint() == false && EventSystem.is_focused(self) == false
text_handler.set_text(value, focused)
if label == null:
return
if !is_inside_tree(): await ready
text_handler.set_text(value, focused)
label.text = text_handler.get_display_text()
var keyboard_input: bool = false
@ -37,6 +41,8 @@ var input_plane = Plane(Vector3.UP, Vector3.ZERO)
func _ready():
text_handler.label = label
width = width
text = text
if Engine.is_editor_hint():
return

View File

@ -1,8 +1,8 @@
extends Node3D
@onready var label: Label3D = $Button/Label
@onready var button = $Button
@export var id: String = "0"
func set_device_name(text):
assert(label != null, "Device has to be added to the scene tree")
label.text = text
assert(button != null, "Device has to be added to the scene tree")
button.label = text

View File

@ -9,14 +9,5 @@ script = ExtResource("1_rbo86")
[node name="Button" parent="." instance=ExtResource("2_go2es")]
[node name="Label" type="Label3D" parent="Button"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0142873, 0)
pixel_size = 0.001
text = "Texttexttexttexttexttextext"
font_size = 7
outline_size = 0
autowrap_mode = 3
width = 50.0
[node name="Clickable" type="Node" parent="."]
script = ExtResource("3_6wicx")

View File

@ -31,7 +31,7 @@ func _enter_tree():
load_devices()
else:
HomeApi.on_connect.connect(func():
if is_inside_tree():
if is_node_ready():
load_devices()
)
@ -42,7 +42,7 @@ func load_devices():
HomeApi.on_disconnect.connect(func():
devices = []
if is_inside_tree():
if is_node_ready():
render()
)