78 lines
2.1 KiB
Plaintext
78 lines
2.1 KiB
Plaintext
[gd_scene load_steps=3 format=3 uid="uid://cixwl6xi22buo"]
|
|
|
|
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_ufod8"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_ufod8"]
|
|
script/source = "@tool
|
|
extends GridContainer
|
|
|
|
@export var text_check: Array[String]
|
|
@export_file var image_states: Array[String]
|
|
var txr_states: Array[CompressedTexture2D]
|
|
|
|
|
|
@export var state: int = 0:
|
|
set(val):
|
|
state = val % image_states.size()
|
|
if is_inside_tree():
|
|
val %= txr_states.size()
|
|
state = val
|
|
$done.texture = txr_states[val]
|
|
|
|
|
|
@export var pressed: bool = false:
|
|
set(val):
|
|
pressed = val
|
|
if is_inside_tree():
|
|
$check.button_pressed = pressed
|
|
|
|
|
|
func _enter_tree() -> void:
|
|
txr_states.clear()
|
|
for fn in image_states:
|
|
txr_states.append(load(fn))
|
|
$done.texture = txr_states[state]
|
|
$check.button_pressed = pressed
|
|
|
|
|
|
func connect_check(signal_name: StringName, callable: Callable):
|
|
$check.connect(signal_name, callable)
|
|
|
|
|
|
func disconnect_check(signal_name: StringName, callable: Callable):
|
|
$check.disconnect(signal_name, callable)
|
|
|
|
|
|
func _on_check_toggled(toggled_on: bool) -> void:
|
|
$text.text = text_check[int(toggled_on)]
|
|
"
|
|
|
|
[node name="six-state" type="GridContainer"]
|
|
offset_right = 156.0
|
|
offset_bottom = 24.0
|
|
columns = 3
|
|
script = SubResource("GDScript_ufod8")
|
|
text_check = Array[String](["Запрещено", "Разрешено"])
|
|
image_states = Array[String](["uid://c6nve6f8sfyj2", "uid://dnreyfh3cd1k2", "uid://c6booa8753u5t"])
|
|
|
|
[node name="done" type="TextureRect" parent="."]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 0
|
|
size_flags_vertical = 3
|
|
texture = ExtResource("1_ufod8")
|
|
expand_mode = 3
|
|
|
|
[node name="text" type="Label" parent="."]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 6
|
|
size_flags_vertical = 6
|
|
text = "Запрещено"
|
|
horizontal_alignment = 1
|
|
|
|
[node name="check" type="CheckButton" parent="."]
|
|
layout_mode = 2
|
|
size_flags_horizontal = 8
|
|
action_mode = 0
|
|
|
|
[connection signal="toggled" from="check" to="." method="_on_check_toggled"]
|