Доработка. WIP Отображение разрешённых/запрещённых диапазонов разным цветом

This commit is contained in:
sasha80
2026-03-26 11:55:23 +03:00
parent 7b80852017
commit 4079d55aa5
2 changed files with 54 additions and 22 deletions

View File

@@ -10,10 +10,10 @@ extends Panel
@export var freq_min: float
## Максимальная частота, МГЦ
@export var freq_max: float
## Цвет диапазона передатчика на шкале
@export_color_no_alpha var color_clear: Color
## Цвет диапазона приёмника на шкале
@export_color_no_alpha var color_intersec: Color
## Цвет диапазона если включен (разрешён)
@export_color_no_alpha var color_enabled: Color
## Цвет диапазона если выключен (запрещён)
@export_color_no_alpha var color_disabled: Color
## Прозрачность диапазон на шкале (диапазоны могут накладываться, что бы было видно наложения)
@export_range(0, 1.0) var color_alpha: float
## Цвет нечётных строк шкалы
@@ -89,6 +89,8 @@ enum ClasterState {
func _ready() -> void:
# Инициализировать переменные
color_enabled.a = color_alpha
color_disabled.a = color_alpha
for i in index_to_unit_names.size():
var nm: = index_to_unit_names[i]
name_to_index[nm] = i
@@ -364,7 +366,7 @@ func find_inters(info: Dictionary) -> Array:
#print_debug([cls.cname, cls.wfb, cls.cfb, cls.txe, cls.rxe])
pass
# заглушка для возвращаемых данных
return [['эмс-ор63', 'эмс-454', 'Кластер-0', 'Кластер-0', 1600.0, 2400.0]]
return [['эмс-ор63', 'эмс-ор63', 'Кластер-0', 'Кластер-0', 1600.0, 2400.0]]
## Отображает кластеры на шкале
@@ -375,25 +377,18 @@ func map_yems_data_to_scale(unit_data: Dictionary, claster_scale: GridContainer)
# Преобразовать диапазоны частот в диапазоны отображения
var c: = remap(cls.cfb, freq_min, freq_max, 0.0, 1.0)
var w: = remap(cls.wfb, freq_min, freq_max, 0.0, 0.5)
w = clampf(w, 0.005, 1.0) # Чтобы диапазон всегда был виден, даже если он слишком узкий
# Чтобы диапазон всегда был виден, даже если он слишком узкий
w = clampf(w, 0.005, 1.0)
# Отсечь значения по границам
var l: = clampf(c - w, 0.0, 1.0)
var h: = clampf(c + w, 0.0, 1.0)
# Получить шкалу приёмника
var scale_rx: = claster_scale.get_node('panel_rx')
# Отобразить диапазон, если приёмник включен
if cls.get('rxe', false):
color_intersec.a = color_alpha
scale_rx.set_range(cls.cname, l, h, color_intersec)
# Удалить диапазон, если приёмник выключен
else:
scale_rx.del_range(cls.cname)
# Отобразить диапазон приёмника, в соответствии с разрешением
var color_rxe: = color_enabled if cls.get('rxe', false) else color_disabled
scale_rx.set_range(cls.cname, l, h, color_rxe)
# Получить шкалу передатчика
var scale_tx: = claster_scale.get_node('panel_tx')
# Отобразить диапазон, если передатчик включен
if cls.get('txe', false):
color_intersec.a = color_alpha
scale_tx.set_range(cls.cname, l, h, color_intersec)
# Удалить диапазон, если передатчик выключен
else:
scale_tx.del_range(cls.cname)
# Отобразить диапазон передатчика, в соответсвии с разрешением
var color_txe: = color_enabled if cls.get('txe', false) else color_disabled
scale_tx.set_range(cls.cname, l, h, color_txe)

View File

@@ -42,8 +42,8 @@ script = ExtResource("1_b7tfl")
index_to_unit_names = Array[StringName]([&"эмс-ор63", &"эмс-454", &"эмс-го", &"эмс-рлс1", &"эмс-рлс2", &"эмс-ннвс", &"эмс-изделие7", &"эмс-изделие8"])
freq_min = 300.0
freq_max = 6000.0
color_clear = Color(0.898039, 0.458824, 0.239216, 1)
color_intersec = Color(0.898039, 0.458824, 0.239216, 1)
color_enabled = Color(0.898039, 0.458824, 0.239216, 1)
color_disabled = Color(0.601223, 0.601223, 0.601223, 1)
color_alpha = 0.7
color_odd = Color(0.31863, 0.32773, 0.327729, 1)
color_even = Color(0.258824, 0.266667, 0.266667, 1)
@@ -411,36 +411,43 @@ metadata/unit_name = &"эмс-ор63"
[node name="матрица-0-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
action_mode = 0
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-0-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-0-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-0-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-0-4" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-0-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
@@ -452,36 +459,42 @@ metadata/unit_name = &""
[node name="матрица-1-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-1-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-1-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-1-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-1-4" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-1-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
@@ -493,36 +506,42 @@ metadata/unit_name = &""
[node name="матрица-2-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-2-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-2-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-2-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-2-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-2-4" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
@@ -534,36 +553,42 @@ metadata/unit_name = &""
[node name="матрица-3-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-3-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-3-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-3-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-3-4" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-3-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
@@ -575,36 +600,42 @@ metadata/unit_name = &""
[node name="матрица-4-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-4-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-4-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-4-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-4-4" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-4-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
@@ -616,36 +647,42 @@ metadata/unit_name = &""
[node name="матрица-5-0" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-5-1" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-5-2" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-5-3" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-5-5" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")
[node name="матрица-5-6" type="TextureButton" parent="матрица" groups=["матрица-к"]]
layout_mode = 2
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("2_s28jr")
texture_pressed = ExtResource("3_its7t")