Усилитель на контроле
This commit is contained in:
247
table/блок-а.tscn
Normal file
247
table/блок-а.tscn
Normal file
@@ -0,0 +1,247 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bkxblfoj7ejv0"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ce3qpf070wgd2" path="res://pictures/состояние-исправности-0.png" id="1_xcvfs"]
|
||||
[ext_resource type="Texture2D" uid="uid://byweg7pgt8o4h" path="res://pictures/состояние-исправности-1.png" id="2_ad1dj"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvikuv0lbvou8" path="res://pictures/состояние-исправности-2.png" id="3_vxg7f"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://pictures/nine-patch-round.png" id="4_1bnn6"]
|
||||
[ext_resource type="PackedScene" uid="uid://dyjtmfm4u58mu" path="res://table/уровень.tscn" id="5_3i5am"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_oj3k3"]
|
||||
script/source = "@tool
|
||||
|
||||
extends PanelContainer
|
||||
|
||||
|
||||
@export var textures: Array
|
||||
|
||||
signal pressed(control: PanelContainer)
|
||||
|
||||
@export var value0: float:
|
||||
set(v):
|
||||
value0 = v
|
||||
$margin/vbox/grid1/indicator0.value = v
|
||||
|
||||
|
||||
@export var value1: float:
|
||||
set(v):
|
||||
value1 = v
|
||||
$margin/vbox/grid1/indicator1.value = v
|
||||
|
||||
|
||||
@export var min_value0: float:
|
||||
set(v):
|
||||
min_value0 = v
|
||||
$margin/vbox/grid1/indicator0.min_value = v
|
||||
|
||||
|
||||
@export var min_value1: float:
|
||||
set(v):
|
||||
min_value1 = v
|
||||
$margin/vbox/grid1/indicator1.min_value = v
|
||||
|
||||
|
||||
@export var max_value0: float:
|
||||
set(v):
|
||||
max_value0 = v
|
||||
$margin/vbox/grid1/indicator0.max_value = v
|
||||
|
||||
|
||||
@export var max_value1: float:
|
||||
set(v):
|
||||
max_value1 = v
|
||||
$margin/vbox/grid1/indicator1.max_value = v
|
||||
|
||||
|
||||
@export var step0: float:
|
||||
set(v):
|
||||
step0 = v
|
||||
$margin/vbox/grid1/indicator0.step = v
|
||||
|
||||
|
||||
@export var step1: float:
|
||||
set(v):
|
||||
step1 = v
|
||||
$margin/vbox/grid1/indicator1.step = v
|
||||
|
||||
|
||||
@export var value_name0: String:
|
||||
set(v):
|
||||
value_name0 = v
|
||||
$margin/vbox/grid1/indicator0.value_name = v
|
||||
|
||||
|
||||
@export var value_name1: String:
|
||||
set(v):
|
||||
value_name1 = v
|
||||
$margin/vbox/grid1/indicator1.value_name = v
|
||||
|
||||
|
||||
@export var name_min_size0: Vector2i:
|
||||
set(v):
|
||||
name_min_size0 = v
|
||||
$margin/vbox/grid1/indicator0.name_min_size = v
|
||||
|
||||
|
||||
@export var name_min_size1: Vector2i:
|
||||
set(v):
|
||||
name_min_size1 = v
|
||||
$margin/vbox/grid1/indicator1.name_min_size = v
|
||||
|
||||
|
||||
@export var fname: String:
|
||||
set(v):
|
||||
fname = v
|
||||
$margin/vbox/grid0/fname.text = v
|
||||
|
||||
|
||||
@export var rname: String:
|
||||
set(v):
|
||||
rname = v
|
||||
$margin/vbox/grid0/rname.text = v
|
||||
|
||||
|
||||
@export var state: int:
|
||||
set(v):
|
||||
state = clip_value(v, 0, textures.size() - 1)
|
||||
$margin/vbox/grid0/state.texture = textures[state]
|
||||
|
||||
|
||||
@export var alignment: int:
|
||||
set(v):
|
||||
alignment = v
|
||||
$margin/vbox.alignment = v
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
emit_signal('pressed', self)
|
||||
|
||||
|
||||
## Отсекает значение до заданного диапазона.
|
||||
func clip_value(val, val_min, val_max):
|
||||
if val < val_min: val = val_min
|
||||
if val > val_max: val = val_max
|
||||
return val
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rceim"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8yvwo"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6qu57"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mlxje"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3dspb"]
|
||||
|
||||
[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="blok_a" type="PanelContainer"]
|
||||
editor_description = "Элемент замены из ЗИП"
|
||||
offset_right = 160.0
|
||||
offset_bottom = 88.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
|
||||
script = SubResource("GDScript_oj3k3")
|
||||
textures = [ExtResource("1_xcvfs"), ExtResource("2_ad1dj"), ExtResource("3_vxg7f")]
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_rceim")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_8yvwo")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_6qu57")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_mlxje")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_3dspb")
|
||||
|
||||
[node name="rect" type="NinePatchRect" parent="."]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_1bnn6")
|
||||
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="grid0" type="GridContainer" parent="margin/vbox"]
|
||||
layout_mode = 2
|
||||
columns = 3
|
||||
|
||||
[node name="state" type="TextureRect" parent="margin/vbox/grid0"]
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource("1_xcvfs")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="fname" type="Label" parent="margin/vbox/grid0"]
|
||||
self_modulate = Color(1, 1, 1, 0.627451)
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_font_sizes/font_size = 17
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="rname" type="Label" parent="margin/vbox/grid0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="grid1" type="GridContainer" parent="margin/vbox"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
|
||||
[node name="indicator0" parent="margin/vbox/grid1" instance=ExtResource("5_3i5am")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="indicator1" parent="margin/vbox/grid1" instance=ExtResource("5_3i5am")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]
|
||||
83
table/уровень.tscn
Normal file
83
table/уровень.tscn
Normal file
@@ -0,0 +1,83 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dyjtmfm4u58mu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cdhpvkivmjkje" path="res://pictures/прогресс-фон-1.png" id="1_n4uxh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnviii2u0ls78" path="res://pictures/прогресс-заполнение-1.png" id="2_os1gp"]
|
||||
[ext_resource type="FontFile" uid="uid://bxq4fvfeecmia" path="res://pictures/DSEG7Classic-Regular.ttf" id="3_px0hn"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_eyk47"]
|
||||
script/source = "@tool
|
||||
|
||||
extends GridContainer
|
||||
|
||||
@export var min_value: float:
|
||||
set(v):
|
||||
min_value = v
|
||||
$indicator_h.min_value = v
|
||||
|
||||
|
||||
@export var max_value: float:
|
||||
set(v):
|
||||
max_value = v
|
||||
$indicator_h.max_value = v
|
||||
|
||||
|
||||
@export var step: float:
|
||||
set(v):
|
||||
step = v
|
||||
$indicator_h.step = v
|
||||
|
||||
|
||||
@export var value: float:
|
||||
set(v):
|
||||
value = v
|
||||
$indicator_h.value = v
|
||||
$lbl_val.text = '%02d' % int(v)
|
||||
|
||||
|
||||
@export var value_name: String:
|
||||
set(v):
|
||||
value_name = v
|
||||
$lbl_name.text = v
|
||||
|
||||
|
||||
@export var name_min_size: Vector2i:
|
||||
set(v):
|
||||
name_min_size = v
|
||||
$lbl_name.custom_minimum_size = v
|
||||
"
|
||||
|
||||
[node name="grid" type="GridContainer"]
|
||||
offset_right = 95.0
|
||||
offset_bottom = 19.0
|
||||
columns = 3
|
||||
script = SubResource("GDScript_eyk47")
|
||||
|
||||
[node name="lbl_name" type="Label" parent="."]
|
||||
custom_minimum_size = Vector2(30, 20)
|
||||
layout_mode = 2
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="indicator_h" type="TextureProgressBar" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
value = 50.0
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
stretch_margin_top = 8
|
||||
stretch_margin_right = 8
|
||||
stretch_margin_bottom = 8
|
||||
texture_under = ExtResource("1_n4uxh")
|
||||
texture_progress = ExtResource("2_os1gp")
|
||||
tint_under = Color(1, 1, 1, 0.419608)
|
||||
tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
|
||||
[node name="lbl_val" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
theme_override_fonts/font = ExtResource("3_px0hn")
|
||||
text = "00"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
Reference in New Issue
Block a user