125 lines
3.3 KiB
Plaintext
125 lines
3.3 KiB
Plaintext
[gd_scene load_steps=6 format=3 uid="uid://p2suppildvq0"]
|
|
|
|
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_01aoa"]
|
|
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_4b43i"]
|
|
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_q7pyf"]
|
|
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_u8ivy"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_fbktk"]
|
|
script/source = "@tool
|
|
|
|
extends Control
|
|
|
|
|
|
@export var margins: Array[int] = [8, 8, 8, 8] # top, left, bottom, right
|
|
|
|
|
|
@export var textures: Array[Texture]
|
|
|
|
|
|
@export var self_size: Vector2i = Vector2i(50, 150):
|
|
set(v):
|
|
self_size = v
|
|
size = v
|
|
$np_rect.size = v
|
|
_resize_children()
|
|
get: return size
|
|
|
|
|
|
@export var fname: String:
|
|
set(v):
|
|
fname = v
|
|
$lbl_fname.text = v
|
|
|
|
|
|
@export var rname: String:
|
|
set(v):
|
|
rname = v
|
|
$lbl_rname.text = v
|
|
|
|
|
|
func _resize_children() -> void:
|
|
$lbl_rname.size.x = size.x
|
|
$lbl_rname.position.y = margins[0]
|
|
$lbl_fname.size.y = size.x
|
|
$lbl_fname.position.y = size.y / 2 + $lbl_fname.size.x / 2
|
|
$txr_state.position.x = size.x / 2 - ($txr_state.size.x * $txr_state.scale.x) / 2
|
|
$txr_state.position.y = size.y - $txr_state.size.y * $txr_state.scale.x - margins[2]
|
|
|
|
|
|
func _on_nine_patch_rect_resized() -> void:
|
|
size = $np_rect.size
|
|
self_size = $np_rect.size
|
|
_resize_children()
|
|
|
|
|
|
func _on_resized() -> void:
|
|
$np_rect.size = size
|
|
self_size = size
|
|
_resize_children()
|
|
|
|
|
|
@export var state: int:
|
|
set(v):
|
|
v = 0 if v < 0 else v
|
|
v %= textures.size()
|
|
state = v
|
|
$txr_state.texture = textures[v]
|
|
"
|
|
|
|
[node name="element_v" type="Control"]
|
|
editor_description = "Элемент замены из ЗИП"
|
|
layout_mode = 3
|
|
anchors_preset = 0
|
|
offset_right = 50.0
|
|
offset_bottom = 150.0
|
|
script = SubResource("GDScript_fbktk")
|
|
textures = Array[Texture]([ExtResource("1_01aoa"), ExtResource("2_q7pyf"), ExtResource("3_u8ivy")])
|
|
metadata/ref_des = ""
|
|
metadata/dec_num = ""
|
|
|
|
[node name="lbl_rname" type="Label" parent="."]
|
|
layout_mode = 0
|
|
offset_top = 8.0
|
|
offset_right = 50.0
|
|
offset_bottom = 34.0
|
|
theme_override_font_sizes/font_size = 22
|
|
text = "A1"
|
|
horizontal_alignment = 1
|
|
vertical_alignment = 1
|
|
|
|
[node name="lbl_fname" type="Label" parent="."]
|
|
self_modulate = Color(1, 1, 1, 0.627451)
|
|
layout_mode = 0
|
|
offset_top = 123.0
|
|
offset_right = 94.0
|
|
offset_bottom = 173.0
|
|
rotation = -1.5708
|
|
theme_override_font_sizes/font_size = 17
|
|
text = "Ячейка"
|
|
horizontal_alignment = 1
|
|
vertical_alignment = 1
|
|
|
|
[node name="txr_state" type="TextureRect" parent="."]
|
|
layout_mode = 0
|
|
offset_left = 13.8
|
|
offset_top = 119.6
|
|
offset_right = 237.8
|
|
offset_bottom = 343.6
|
|
scale = Vector2(0.1, 0.1)
|
|
texture = ExtResource("1_01aoa")
|
|
|
|
[node name="np_rect" type="NinePatchRect" parent="."]
|
|
layout_mode = 0
|
|
offset_right = 50.0
|
|
offset_bottom = 150.0
|
|
texture = ExtResource("2_4b43i")
|
|
region_rect = Rect2(0, 0, 63, 63)
|
|
patch_margin_left = 16
|
|
patch_margin_top = 16
|
|
patch_margin_right = 16
|
|
patch_margin_bottom = 16
|
|
|
|
[connection signal="resized" from="." to="." method="_on_resized"]
|
|
[connection signal="resized" from="np_rect" to="." method="_on_nine_patch_rect_resized"]
|