Доработка. WIP Добавление элементов для ЭМС-ТГ

This commit is contained in:
sasha80
2026-03-16 15:41:39 +03:00
parent e52f465654
commit 282a3a5218
6 changed files with 993 additions and 1227 deletions

View File

@@ -6,9 +6,11 @@
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()
@@ -19,6 +21,7 @@ var txr_states: Array[CompressedTexture2D]
func _enter_tree() -> void:
txr_states.clear()
for fn in image_states:
txr_states.append(load(fn))
$done.texture = txr_states[state]
@@ -30,15 +33,18 @@ func connect_check(signal_name: StringName, callable: 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
grow_horizontal = 2
grow_vertical = 2
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="."]
@@ -58,3 +64,5 @@ horizontal_alignment = 1
[node name="check" type="CheckButton" parent="."]
layout_mode = 2
size_flags_horizontal = 8
[connection signal="toggled" from="check" to="." method="_on_check_toggled"]

View File

@@ -6,6 +6,16 @@ extends PanelContainer
@export_range(0.0, 1.0) var gap_bottom: float = 0.05 ## Зазор снизу
@export var ranges_group_name: StringName = 'ranges' ## Имя группы для диапазонов
@export var ranges_save: Dictionary[StringName, Array] ## <имя диапазона>: [диапазон(x - начало, y - конец), цвет]
@export_file var image_file: String:
set(val):
image_file = val
if is_inside_tree():
_enter_tree()
func _enter_tree() -> void:
if ResourceLoader.exists(image_file):
$image.texture = load(image_file)
## Добавляет новый диапазон.

View File

@@ -1,13 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://hr55mkcneaer"]
[gd_scene load_steps=4 format=3 uid="uid://hr55mkcneaer"]
[ext_resource type="Script" uid="uid://jtio1scc72bl" path="res://scenes/hranges/panel.gd" id="1_pg3d7"]
[ext_resource type="Texture2D" uid="uid://c73tjrn8gr00o" path="res://data/Передатчик.png" id="2_ajqhv"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ajqhv"]
[node name="panel" type="PanelContainer"]
offset_right = 690.0
offset_bottom = 75.0
offset_right = 340.0
offset_bottom = 40.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ajqhv")
script = ExtResource("1_pg3d7")
[node name="image" type="TextureRect" parent="."]
layout_mode = 2
size_flags_horizontal = 0
texture = ExtResource("2_ajqhv")
expand_mode = 2
[connection signal="resized" from="." to="." method="_on_resized"]

File diff suppressed because it is too large Load Diff

View File

@@ -156,7 +156,8 @@ func map_dec_to_rad(pos0: Vector2, pos: Vector2) -> Vector2:
## [param p] - Координаты вершин полигона.[br]
func is_point_in_polygon(pos: Vector2, p: PackedVector2Array) -> bool:
var sz: = p.size()
assert(sz)
if not sz:
return false
var j: int = sz - 1
var odd_nodes: int = 0
for i in sz:

View File

@@ -1,14 +1,47 @@
[gd_scene load_steps=2 format=3 uid="uid://cymcld4mjmlhj"]
[gd_scene load_steps=3 format=3 uid="uid://cymcld4mjmlhj"]
[ext_resource type="Texture2D" uid="uid://c73tjrn8gr00o" path="res://data/Передатчик.png" id="1_nbmfn"]
[sub_resource type="GDScript" id="GDScript_63652"]
script/source = "extends GridContainer
@export var header_text: String:
set(val):
header_text = val
if is_inside_tree():
$label.text = val
get:
return header_text
@export_file var image_file: String:
set(val):
image_file = val
if is_inside_tree():
$image.texture = load(val)
get:
return image_file
func _enter_tree() -> void:
$image.texture = load(image_file)
$label.text = header_text
"
[node name="header-image" type="GridContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
offset_right = 91.0
offset_bottom = 19.0
columns = 2
script = SubResource("GDScript_63652")
[node name="image" type="TextureRect" parent="."]
layout_mode = 2
size_flags_vertical = 3
texture = ExtResource("1_nbmfn")
expand_mode = 3
[node name="label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
vertical_alignment = 1