Доработка. Добавление элементов для ЭМС-ТГ
This commit is contained in:
52
scenes/button-six-state/six-state.tscn
Normal file
52
scenes/button-six-state/six-state.tscn
Normal file
@@ -0,0 +1,52 @@
|
||||
[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_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]
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
for fn in image_states:
|
||||
txr_states.append(load(fn))
|
||||
$done.texture = txr_states[state]
|
||||
"
|
||||
|
||||
[node name="six-state" type="GridContainer"]
|
||||
offset_right = 156.0
|
||||
offset_bottom = 24.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
columns = 3
|
||||
script = SubResource("GDScript_ufod8")
|
||||
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
|
||||
Reference in New Issue
Block a user