Доработка. Убраны лишние элементы управления в режиме "Работа"

This commit is contained in:
sasha80
2025-04-09 16:09:36 +03:00
parent 8df381526c
commit 2b386c3ec8
4 changed files with 156 additions and 143 deletions

View File

@@ -1,28 +0,0 @@
extends VSlider
const VAL_TO_LABEL = { 0: 'label0', 1: 'label1', 2: 'label2', 3: 'label3' }
const VAL_TO_EVENT = {
0: 'manual_control', ## Есть.
1: 'interfer_auto', ## TODO: не реализовано. Выбор помехи для выбранной оператором цели автоматически.
2: 'threat_auto', ## TODO: не реализовано. Выбор цели автоматически, оператор выставляет помеху вручную.
3: 'full_auto' } ## Выбор целей и установка помех автоматически.
func _ready():
on_value_changed(0)
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno'))
func on_value_changed(val):
val = int(val)
for nm in VAL_TO_LABEL.values():
var lbl0 = get_node(nm)
lbl0.self_modulate.a = 0.45
var lbl1 = get_node(VAL_TO_LABEL[val])
lbl1.self_modulate.a = 1.0
signaller.emit_signal(VAL_TO_EVENT[val])
func on_interfer_prinuditelno(_interfer_sectors):
set_value_no_signal(0)
on_value_changed(0)

View File

@@ -1 +0,0 @@
uid://c560choneojy8

View File

@@ -59,6 +59,11 @@ enum BtnSel {
}
const VAL_TO_EVENT = {
false: 'manual_control', ## Выбор целей и установка помех вручную.
true: 'full_auto' } ## Выбор целей и установка помех автоматически.
## Обработчик сигнала изменения списка целей.
func on_threats_resized(threats: Dictionary): $count_all_pad/count_all.text = '%02d' % threats.size()
@@ -71,6 +76,9 @@ func on_threat_selected(th, ecm_btns): on_rto_threat_sel(th.id, ecm_btns)
func on_enter_tree() -> void: call_deferred('on_button_strobe_pressed')
func on_btn_activate(val: bool): signaller.emit_signal('emit_changed', val)
## Обработчик нажатия на кнопку вид.
func on_button_view_toggled(toggled: bool):
signaller.emit_signal('map_mode_changed', int(toggled))
@@ -102,8 +110,7 @@ func _ready():
min_zoom = ProjectSettings.get_setting('application/config/map_minimum_zoom', 5)
max_zoom = ProjectSettings.get_setting('application/config/map_maximum_zoom', 19)
drag_fsm = DragFSM.OFF
var btns_select: Array = $btns_select.get_children()
$btn_activate.button_connect('pressed', Callable(self, 'on_btn_activate').bind($btn_activate))
var btns_select: Array = get_tree().get_nodes_in_group('группа-режим-выбора')
btns_select.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_select').bind(btn, btns_select)))
var nodes: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
nodes.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes)))
@@ -122,6 +129,16 @@ func _ready():
signaller.connect('fs_selected', Callable(self, 'on_fs_selected'))
signaller.connect('fs_update_color', Callable(self, 'on_fs_update_color'))
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno'))
func on_chk_interfer_prinuditelno(_interfer_sectors):
$chk_auto.set_pressed_no_signal(false)
on_value_changed(false)
func on_value_changed(val: bool):
signaller.emit_signal(VAL_TO_EVENT[val])
func get_all_nodes(root):
@@ -253,6 +270,22 @@ func on_button_strobe_pressed() -> void:
$canvas.set_strob_visible(drag_fsm == DragFSM.IDLE)
func _on_sld_selmode_value_changed(val: float) -> void:
var ival: = int(val)
if ival == 2:
drag_fsm = DragFSM.IDLE
$canvas.set_strob_visible(true)
else:
drag_fsm = DragFSM.OFF
$canvas.set_strob_visible(false)
btn_select = 2 - ival
print_debug(btn_select)
on_button_strobe_pressed()
signaller.emit_signal('rto_threat_unsel_all')
unsel_fs_all(true)
set_ecm_btns_state(true)
## Поведение радиокнопок в группе. Управляет состоянием кнопок выбора целей.
func on_button_select(btn_this, btn_others) -> void:
for btn_other in btn_others: btn_other.set_pressed(btn_this == btn_other)
@@ -472,7 +505,3 @@ func on_interfer_prinuditelno (prenuditelno_sectors, btns):
for btn in btns:
btn.set_pressed(false)
set_btns_disabled(true, btn)
func on_btn_activate(btn):
signaller.emit_signal('emit_changed', btn.is_pressed())

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://b276iygic5itk"]
[gd_scene load_steps=13 format=3 uid="uid://b276iygic5itk"]
[ext_resource type="Script" uid="uid://daudc0s3oox3i" path="res://scenes/работа/работа.gd" id="1_niok4"]
[ext_resource type="PackedScene" uid="uid://nl1vklubr5kr" path="res://scenes/bip/bip.tscn" id="2_br3s6"]
@@ -7,9 +7,14 @@
[ext_resource type="PackedScene" uid="uid://dymo732qc2doa" path="res://scenes/count-all/count-all-pad.tscn" id="6_e3re7"]
[ext_resource type="PackedScene" uid="uid://bwti82byphl68" path="res://scenes/count-danger/count_danger_pad.tscn" id="7_2arls"]
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat/button-flat.tscn" id="8_k0iv2"]
[ext_resource type="Texture2D" uid="uid://c1785x8wf1hdg" path="res://data/power-0.png" id="10_cnr1s"]
[ext_resource type="PackedScene" uid="uid://ceknxxfu1loo5" path="res://scenes/tilemap/tilemap.tscn" id="10_gtwyg"]
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/diagram/diagram.tscn" id="11_b6su4"]
[ext_resource type="Script" uid="uid://c560choneojy8" path="res://scenes/работа/sld-mode.gd" id="12_gqdkl"]
[ext_resource type="Texture2D" uid="uid://csdw3q5dtvu4w" path="res://data/power-1.png" id="11_xp4y6"]
[sub_resource type="Gradient" id="Gradient_cnr1s"]
offsets = PackedFloat32Array(0.181818, 0.751623)
colors = PackedColorArray(1, 1, 1, 0.352941, 1, 1, 1, 0)
[node name="Работа" type="Panel"]
script = ExtResource("1_niok4")
@@ -31,14 +36,15 @@ metadata/_edit_vertical_guides_ = []
[node name="btn_view" type="CheckBox" parent="."]
layout_mode = 0
offset_left = 795.0
offset_left = 835.0
offset_top = 5.0
offset_right = 954.0
offset_right = 994.0
offset_bottom = 32.0
action_mode = 0
text = "Обзорная карта"
[node name="canvas" parent="." instance=ExtResource("11_b6su4")]
metadata/_edit_lock_ = true
[node name="tilemap" parent="." instance=ExtResource("10_gtwyg")]
self_modulate = Color(1, 1, 1, 0.415686)
@@ -50,75 +56,75 @@ offset_left = 1114.0
offset_top = 7.0
offset_right = 1594.0
offset_bottom = 1170.0
metadata/_edit_lock_ = true
[node name="grd_btns" parent="." instance=ExtResource("5_2jnbs")]
layout_mode = 0
offset_left = 10.0
offset_top = 1116.0
offset_right = 1106.0
offset_right = 1110.0
offset_bottom = 1170.0
tooltip_text = "Кнопки выбора типа помехи"
mouse_filter = 0
[node name="count_all_pad" parent="." instance=ExtResource("6_e3re7")]
layout_mode = 0
offset_left = 100.0
offset_top = 117.0
offset_right = 133.0
offset_bottom = 140.0
offset_left = 142.0
offset_top = 70.0
offset_right = 175.0
offset_bottom = 93.0
[node name="count_danger_pad" parent="." instance=ExtResource("7_2arls")]
layout_mode = 0
offset_left = 96.0
offset_top = 29.0
offset_right = 188.0
offset_bottom = 92.0
offset_left = 31.0
offset_top = 70.0
offset_right = 122.0
offset_bottom = 130.0
[node name="Label2" type="Label" parent="."]
layout_mode = 0
offset_left = 18.0
offset_right = 146.0
offset_bottom = 23.0
offset_left = 50.0
offset_top = 15.0
offset_right = 178.0
offset_bottom = 34.0
text = "Счётчики целей"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label3" type="Label" parent="."]
layout_mode = 0
offset_left = 18.0
offset_top = 110.0
offset_right = 74.0
offset_bottom = 146.0
text = "Всего:"
offset_left = 132.0
offset_top = 45.0
offset_right = 188.0
offset_bottom = 65.0
text = "всего"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label4" type="Label" parent="."]
layout_mode = 0
offset_left = 18.0
offset_top = 50.0
offset_right = 83.0
offset_bottom = 72.0
text = "Опасных:"
[node name="btn_activate" parent="." instance=ExtResource("8_k0iv2")]
layout_mode = 2
offset_left = 964.0
offset_top = 1060.0
offset_right = 1106.0
offset_bottom = 1112.0
size_flags_horizontal = 3
size_flags_vertical = 3
strips_rotation = 15.0
text = "Подавление"
pressed = true
offset_left = 43.0
offset_top = 45.0
offset_right = 108.0
offset_bottom = 65.0
text = "опасных"
horizontal_alignment = 1
[node name="btns_select" type="GridContainer" parent="."]
layout_mode = 0
offset_left = 1018.0
offset_top = 38.0
offset_right = 1092.0
offset_bottom = 154.0
offset_left = 1000.0
offset_top = 10.0
offset_right = 1110.0
offset_bottom = 125.0
[node name="btn_strob" parent="btns_select" instance=ExtResource("8_k0iv2")]
[node name="label9" type="Label" parent="btns_select"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 2
text = "Режим выбора"
horizontal_alignment = 1
vertical_alignment = 1
[node name="btn_strob" parent="btns_select" groups=["группа-режим-выбора"] instance=ExtResource("8_k0iv2")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -127,7 +133,7 @@ strips_rotation = 25.0
text = "Строб"
metadata/state = 0
[node name="btn_threats" parent="btns_select" instance=ExtResource("8_k0iv2")]
[node name="btn_threats" parent="btns_select" groups=["группа-режим-выбора"] instance=ExtResource("8_k0iv2")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -136,7 +142,7 @@ strips_rotation = 25.0
text = "Цель"
metadata/state = 1
[node name="btn_fs_sector" parent="btns_select" instance=ExtResource("8_k0iv2")]
[node name="btn_fs_sector" parent="btns_select" groups=["группа-режим-выбора"] instance=ExtResource("8_k0iv2")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
@@ -145,78 +151,85 @@ strips_rotation = 25.0
text = "Сектор"
metadata/state = 2
[node name="vslider" type="VSlider" parent="."]
layout_mode = 2
offset_left = 1113.0
offset_top = 975.0
offset_right = 1143.0
offset_bottom = 1055.0
scale = Vector2(-1, 1)
max_value = 3.0
tick_count = 4
ticks_on_borders = true
script = ExtResource("12_gqdkl")
[node name="label0" type="Label" parent="vslider"]
self_modulate = Color(1, 1, 1, 0.5)
[node name="chk_auto" type="CheckBox" parent="."]
layout_mode = 0
offset_left = 158.0
offset_top = 62.0
offset_right = 283.0
offset_bottom = 82.0
scale = Vector2(-1, 1)
text = "Автомат отключен"
horizontal_alignment = 2
vertical_alignment = 1
offset_left = 115.0
offset_top = 1085.0
offset_right = 257.0
offset_bottom = 1112.0
text = "Автоматически"
[node name="label1" type="Label" parent="vslider"]
self_modulate = Color(1, 1, 1, 0.5)
layout_mode = 0
offset_left = 182.0
offset_top = 40.0
offset_right = 331.0
offset_bottom = 60.0
scale = Vector2(-1, 1)
text = "Автомат выбора цели"
horizontal_alignment = 2
vertical_alignment = 1
[node name="line0" type="Line2D" parent="chk_auto"]
position = Vector2(-2.06741, -5)
points = PackedVector2Array(-92.9326, 25, -92.9326, 20, 2.06741, 20)
width = 2.0
default_color = Color(1, 1, 1, 0.317647)
[node name="label2" type="Label" parent="vslider"]
self_modulate = Color(1, 1, 1, 0.5)
layout_mode = 0
offset_left = 200.0
offset_top = 19.0
offset_right = 368.0
offset_bottom = 39.0
scale = Vector2(-1, 1)
text = "Автомат выбора помехи"
horizontal_alignment = 2
vertical_alignment = 1
[node name="line1" type="Line2D" parent="chk_auto"]
position = Vector2(250, 0)
points = PackedVector2Array(735, 20, 735, 15, 350, 15)
width = 2.0
default_color = Color(1, 1, 1, 0.317647)
[node name="label3" type="Label" parent="vslider"]
self_modulate = Color(1, 1, 1, 0.5)
layout_mode = 0
offset_left = 191.0
offset_top = -2.0
offset_right = 351.0
offset_bottom = 18.0
scale = Vector2(-1, 1)
text = "Автомат помехи и цели"
horizontal_alignment = 2
vertical_alignment = 1
[node name="line2" type="Line2D" parent="chk_auto"]
position = Vector2(-30, 0)
points = PackedVector2Array(160, 15, 320, 15)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
[node name="label9" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.62)
[node name="line3" type="Line2D" parent="chk_auto"]
position = Vector2(155, 0)
points = PackedVector2Array(135, 15, 165, 15)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
gradient = SubResource("Gradient_cnr1s")
[node name="line5" type="Line2D" parent="chk_auto"]
position = Vector2(-220, 5)
points = PackedVector2Array(125, 15, 125, 25)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
gradient = SubResource("Gradient_cnr1s")
[node name="line6" type="Line2D" parent="chk_auto"]
position = Vector2(855, 0)
points = PackedVector2Array(130, 20, 130, 30)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
gradient = SubResource("Gradient_cnr1s")
[node name="line4" type="Line2D" parent="chk_auto"]
position = Vector2(405, 0)
points = PackedVector2Array(195, 15, 165, 15)
width = 2.0
default_color = Color(1, 1, 1, 0.352941)
gradient = SubResource("Gradient_cnr1s")
[node name="btn_activate" type="TextureButton" parent="."]
layout_mode = 0
offset_left = 1002.0
offset_top = 6.0
offset_right = 1106.0
offset_bottom = 31.0
text = "Режим выбора"
offset_left = 1004.0
offset_top = 995.0
offset_right = 1136.0
offset_bottom = 1127.0
scale = Vector2(0.5, 0.5)
toggle_mode = true
action_mode = 0
texture_normal = ExtResource("10_cnr1s")
texture_pressed = ExtResource("11_xp4y6")
[node name="label" type="Label" parent="btn_activate"]
layout_mode = 0
offset_left = -18.0
offset_top = 120.0
offset_right = 66.0
offset_bottom = 139.0
scale = Vector2(2, 2)
text = "Подавление"
horizontal_alignment = 1
vertical_alignment = 1
[connection signal="drag_begin" from="." to="." method="_on_drag_begin"]
[connection signal="drag_continue" from="." to="." method="_on_drag_continue"]
[connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"]
[connection signal="value_changed" from="vslider" to="vslider" method="on_value_changed"]
[connection signal="toggled" from="chk_auto" to="." method="on_value_changed"]
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"]