diff --git a/scenes/pribor-prd-n-1/pribor-prd-n-1.tscn b/scenes/pribor-prd-n-1/pribor-prd-n-1.tscn index 39650a5d..b547c497 100644 --- a/scenes/pribor-prd-n-1/pribor-prd-n-1.tscn +++ b/scenes/pribor-prd-n-1/pribor-prd-n-1.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://dnuexoef2nnv5"] [ext_resource type="Texture2D" uid="uid://b1brrobrh4abl" path="res://data/прд-н-1-мнемо.png" id="1_jlonr"] -[ext_resource type="PackedScene" uid="uid://ckrunkgwb5cuo" path="res://scenes/контроль/element.tscn" id="2_lpj3d"] +[ext_resource type="PackedScene" uid="uid://ckrunkgwb5cuo" path="res://scenes/контроль/element_v.tscn" id="2_lpj3d"] [node name="pribor_prd_n_1" type="Control"] layout_mode = 3 diff --git a/scenes/контроль/element_h.tscn b/scenes/контроль/element_h.tscn new file mode 100644 index 00000000..00f6561d --- /dev/null +++ b/scenes/контроль/element_h.tscn @@ -0,0 +1,121 @@ +[gd_scene load_steps=8 format=3 uid="uid://d3iqb5e4g81m5"] + +[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_vtino"] +[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_jqsb6"] +[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_cw6yg"] +[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_ydwtw"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"] + +[sub_resource type="GDScript" id="GDScript_oj3k3"] +script/source = "@tool + +extends PanelContainer + + +@export var textures: Array + + +@export var fname: String: + set(v): + fname = v + $margin/vbox/grid/fname.text = v + + +@export var rname: String: + set(v): + rname = v + $margin/vbox/grid/rname.text = v + + +@export var state: int: + set(v): + v = 0 if v < 0 else v + v %= textures.size() + state = v + $margin/vbox/grid/state.texture = textures[v] +" + +[sub_resource type="GDScript" id="GDScript_45hqb"] +script/source = "@tool + +extends MarginContainer + + +func _enter_tree() -> void: + margins = [8, 8, 8, 8] + + +@export var margins: Array: + set(vals): + add_theme_constant_override('margin_top', vals[0]) + add_theme_constant_override('margin_left', vals[1]) + add_theme_constant_override('margin_bottom', vals[2]) + add_theme_constant_override('margin_right', vals[3]) + get: + var vals = [0, 0, 0, 0] + vals[0] = get_theme_constant('margin_top') + vals[1] = get_theme_constant('margin_left') + vals[2] = get_theme_constant('margin_bottom') + vals[3] = get_theme_constant('margin_right') + return vals + + +" + +[node name="element_v" type="PanelContainer"] +offset_right = 153.0 +offset_bottom = 42.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") +script = SubResource("GDScript_oj3k3") +textures = [ExtResource("1_vtino"), ExtResource("2_jqsb6"), ExtResource("3_cw6yg")] + +[node name="rect" type="NinePatchRect" parent="."] +layout_mode = 2 +texture = ExtResource("4_ydwtw") +draw_center = false +region_rect = Rect2(0, 0, 63, 63) +patch_margin_left = 17 +patch_margin_top = 17 +patch_margin_right = 17 +patch_margin_bottom = 15 + +[node name="margin" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 8 +script = SubResource("GDScript_45hqb") +margins = [8, 8, 8, 8] + +[node name="vbox" type="VBoxContainer" parent="margin"] +layout_mode = 2 + +[node name="grid" type="GridContainer" parent="margin/vbox"] +layout_mode = 2 +columns = 3 + +[node name="state" type="TextureRect" parent="margin/vbox/grid"] +custom_minimum_size = Vector2(24, 24) +layout_mode = 2 +size_flags_horizontal = 2 +size_flags_vertical = 6 +texture = ExtResource("2_jqsb6") +expand_mode = 1 + +[node name="fname" type="Label" parent="margin/vbox/grid"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_colors/font_color = Color(1, 1, 1, 0.588235) +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="rname" type="Label" parent="margin/vbox/grid"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 6 +theme_override_font_sizes/font_size = 22 +horizontal_alignment = 2 +vertical_alignment = 1 diff --git a/scenes/контроль/element.tscn b/scenes/контроль/element_v.tscn similarity index 95% rename from scenes/контроль/element.tscn rename to scenes/контроль/element_v.tscn index 10e7dc5c..5bac42db 100644 --- a/scenes/контроль/element.tscn +++ b/scenes/контроль/element_v.tscn @@ -34,12 +34,6 @@ extends PanelContainer v %= textures.size() state = v $margin/vbox/grid/state.texture = textures[v] - - -@export var vertical: bool = false: - set(v): - vertical = v - rotation_degrees = 90.0 if v else 0.0 " [sub_resource type="GDScript" id="GDScript_45hqb"] @@ -69,8 +63,8 @@ func _enter_tree() -> void: " -[node name="element" type="PanelContainer"] -offset_right = 209.0 +[node name="element_h" type="PanelContainer"] +offset_right = 153.0 offset_bottom = 42.0 theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") script = SubResource("GDScript_oj3k3")