Работа в процессе. Исчезает сектор

This commit is contained in:
sasha80
2023-06-07 08:41:11 +03:00
parent 4eedfc85fc
commit 7db6da0fd0
18 changed files with 324 additions and 355 deletions

19
scenes/Sector.tscn Normal file
View File

@@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://c73ahpv8uiuc7"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_sp5oo"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xo5or"]
resource_local_to_scene = true
shader = ExtResource("1_sp5oo")
shader_parameter/color = Color(1, 1, 1, 0.168627)
shader_parameter/width = 45.0
shader_parameter/inner_radius = 0.1
shader_parameter/outer_radius = 0.125
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2lkm8"]
[node name="строб" type="Sprite2D"]
material = SubResource("ShaderMaterial_xo5or")
position = Vector2(610, 600)
scale = Vector2(1108, 1108)
texture = SubResource("PlaceholderTexture2D_2lkm8")

22
scenes/bip.tscn Normal file
View File

@@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://cfk41dnfbr0wx"]
[ext_resource type="Shader" path="res://shaders/bip.gdshader" id="1_tkf3y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2dulj"]
shader = ExtResource("1_tkf3y")
shader_parameter/color = Color(1, 1, 1, 1)
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_tgf76"]
[sub_resource type="GDScript" id="GDScript_4xy3s"]
script/source = "extends Sprite2D
func set_bip_color(col: Color): material.set('shader_parameter/color', col)
func get_bip_color() -> Color: return material.get('shader_parameter/color')
"
[node name="bip" type="Sprite2D"]
material = SubResource("ShaderMaterial_2dulj")
scale = Vector2(10, 10)
texture = SubResource("PlaceholderTexture2D_tgf76")
script = SubResource("GDScript_4xy3s")

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://da7w3vkhadfwe"]
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="1"]
[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="2"]
[ext_resource type="Script" path="res://scenes/nine-patch-button.gd" id="1_wo7pi"]
[ext_resource type="Texture2D" uid="uid://ct0ajcwno03h7" path="res://data/кнопка-квадрат-0.png" id="2_r8bpq"]
[sub_resource type="StyleBoxEmpty" id="1"]
@@ -19,13 +19,13 @@
offset_right = 30.0
offset_bottom = 30.0
theme_override_styles/panel = SubResource("1")
script = ExtResource("2")
script = ExtResource("1_wo7pi")
toggle_mode = true
[node name="state" type="NinePatchRect" parent="."]
show_behind_parent = true
layout_mode = 2
texture = ExtResource("1")
texture = ExtResource("2_r8bpq")
patch_margin_left = 10
patch_margin_top = 10
patch_margin_right = 10

11
scenes/canvas.gd Normal file
View File

@@ -0,0 +1,11 @@
extends Sprite2D
func get_center() -> Vector2: return $строб.position
func set_strob_color(color: Color): $строб.material.set('shader_parameter/color', color);
func set_strob_dir(dir: float): $строб.rotation_degrees = dir - 90.0
func set_strob_width(width: float): $строб.material.set('shader_parameter/width', width)
func get_strob_width() -> float: return $строб.material.get('shader_parameter/width')
func set_strob_visible(val: bool): $строб.visible = val
func get_strob_visible() -> bool: return $строб.visible
func set_strob_band(val: float): $строб.material.set('shader_parameter/inner_radius', val)
func get_strob_band() -> float: return $строб.material.get('shader_parameter/inner_radius')

View File

@@ -1,163 +1,32 @@
[gd_scene load_steps=14 format=3 uid="uid://b5kjdyxuwsot5"]
[gd_scene load_steps=8 format=3 uid="uid://b5kjdyxuwsot5"]
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_ow7xo"]
[ext_resource type="Texture2D" uid="uid://cqu18m05sdl5w" path="res://data/прицел-табличка.png" id="2_g47s7"]
[ext_resource type="Texture2D" uid="uid://6qqcqds5majk" path="res://data/отметка-бпла.png" id="3_bgvyj"]
[ext_resource type="Texture2D" uid="uid://bibsq2uejlm0s" path="res://data/отметка-корабль.png" id="4_wasyy"]
[ext_resource type="Texture2D" uid="uid://b8ern67qnb5ky" path="res://data/кораблик-22800.png" id="5_1y104"]
[ext_resource type="Texture2D" uid="uid://biy3dmtuefrqe" path="res://data/отметка-ракета.png" id="6_mvioa"]
[ext_resource type="Texture2D" uid="uid://b3woliae871je" path="res://data/отметка-неопред.png" id="7_6ag6n"]
[ext_resource type="Texture2D" uid="uid://ccgavrtpkd56i" path="res://data/прицел-сопровождение.png" id="8_l63ig"]
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://shaders/shader_edu.tres" id="1_utgq5"]
[ext_resource type="Script" path="res://scenes/canvas.gd" id="2_crgvr"]
[ext_resource type="Texture2D" uid="uid://b8ern67qnb5ky" path="res://data/кораблик-22800.png" id="3_s5jac"]
[ext_resource type="PackedScene" uid="uid://c73ahpv8uiuc7" path="res://scenes/Sector.tscn" id="4_nfjoq"]
[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="5_bj4e3"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2bft1"]
size = Vector2(1600, 1200)
[sub_resource type="Animation" id="Animation_vbwp0"]
length = 0.001
loop_mode = 1
[sub_resource type="Animation" id="Animation_wfwqs"]
resource_name = "вращение"
length = 6.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("canvas/прицел-сопровождение-3:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 3, 6),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 6.28319, 12.5664]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("canvas/прицел-сопровождение-1:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = false
tracks/1/keys = {
"times": PackedFloat32Array(0, 3, 6),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 6.28319, 12.5664]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("canvas/прицел-табличка:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = false
tracks/2/keys = {
"times": PackedFloat32Array(0, 3, 6),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [6.28319, 0.0, -6.28319]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("canvas:material:shader_parameter/pc2")
tracks/3/interp = 2
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 2.5, 6),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(100, 1065), Vector2(115, 1070), Vector2(100, 1065)]
}
[sub_resource type="Animation" id="Animation_dch6g"]
resource_name = "направление"
length = 3.6
[sub_resource type="AnimationLibrary" id="AnimationLibrary_codoa"]
_data = {
"RESET": SubResource("Animation_vbwp0"),
"вращение": SubResource("Animation_wfwqs"),
"направление": SubResource("Animation_dch6g")
}
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xjvew"]
resource_local_to_scene = true
shader = ExtResource("5_bj4e3")
shader_parameter/color = Color(1, 1, 1, 0.168627)
shader_parameter/width = 97.2
shader_parameter/inner_radius = 0.0742
shader_parameter/outer_radius = 0.1099
[node name="canvas" type="Sprite2D"]
material = ExtResource("1_ow7xo")
position = Vector2(800, 596)
material = ExtResource("1_utgq5")
texture = SubResource("PlaceholderTexture2D_2bft1")
metadata/_edit_lock_ = true
[node name="animator" type="AnimationPlayer" parent="."]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_codoa")
}
[node name="прицел-табличка" type="Sprite2D" parent="."]
position = Vector2(-101, -176)
rotation = 6.28319
texture = ExtResource("2_g47s7")
[node name="отметка-бпла" type="Sprite2D" parent="."]
position = Vector2(-101, -176)
texture = ExtResource("3_bgvyj")
[node name="отметка-корабль" type="Sprite2D" parent="."]
position = Vector2(-350, -103)
rotation = -2.09439
texture = ExtResource("4_wasyy")
centered = false
script = ExtResource("2_crgvr")
[node name="кораблик" type="Sprite2D" parent="."]
position = Vector2(-192, 3)
scale = Vector2(0.25, 0.25)
texture = ExtResource("5_1y104")
position = Vector2(610, 600)
scale = Vector2(0.2, 0.2)
texture = ExtResource("3_s5jac")
[node name="отметка_ракета" type="Sprite2D" parent="."]
position = Vector2(-130, 19)
rotation = -1.309
texture = ExtResource("6_mvioa")
[node name="отметкаеопред" type="Sprite2D" parent="."]
position = Vector2(-200, -191)
texture = ExtResource("7_6ag6n")
[node name="прицел-сопровождение-3" type="Sprite2D" parent="."]
position = Vector2(-500, -200)
texture = ExtResource("8_l63ig")
[node name="прицел-сопровождение-1" type="Sprite2D" parent="."]
position = Vector2(-200, 400)
texture = ExtResource("8_l63ig")
[node name="номер-цели-3" type="Label" parent="."]
offset_left = -517.0
offset_top = -248.0
offset_right = -477.0
offset_bottom = -226.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 2
text = "3"
horizontal_alignment = 1
vertical_alignment = 1
[node name="номер-цели-2" type="Label" parent="."]
z_index = 1
offset_left = -120.0
offset_top = -212.0
offset_right = -80.0
offset_bottom = -190.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 2
text = "2"
horizontal_alignment = 1
vertical_alignment = 1
[node name="номер-цели-1" type="Label" parent="."]
offset_left = -219.0
offset_top = 357.0
offset_right = -179.0
offset_bottom = 379.0
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 2
text = "1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="строб" parent="." instance=ExtResource("4_nfjoq")]
material = SubResource("ShaderMaterial_xjvew")

View File

@@ -1,17 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://bq7haw1ypiv48"]
[ext_resource type="Script" path="res://scenes/рамка.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="2"]
[ext_resource type="Texture2D" uid="uid://cs6i1xwx0pmdk" path="res://data/рамка-панели.png" id="1_s1rm1"]
[ext_resource type="Script" path="res://scenes/рамка.gd" id="2_pjc2i"]
[node name="ramka" type="NinePatchRect"]
offset_right = 150.0
offset_bottom = 100.0
texture = ExtResource("2")
texture = ExtResource("1_s1rm1")
patch_margin_left = 15
patch_margin_top = 30
patch_margin_right = 15
patch_margin_bottom = 10
script = ExtResource("1")
script = ExtResource("2_pjc2i")
[node name="header" type="Label" parent="."]
clip_contents = true

View File

@@ -1,15 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://3slb0i3pvowc"]
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="1_jjcv4"]
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="2_h2mc4"]
[ext_resource type="PackedScene" uid="uid://b276iygic5itk" path="res://scenes/работа.tscn" id="1_kf06s"]
[ext_resource type="PackedScene" uid="uid://lwmw4egynmd1" path="res://scenes/контроль.tscn" id="2_ep1i3"]
[node name="tab_switch" type="TabContainer"]
offset_right = 1600.0
offset_bottom = 1200.0
[node name="работа" parent="." instance=ExtResource("1_jjcv4")]
[node name="работа" parent="." instance=ExtResource("1_kf06s")]
layout_mode = 2
[node name="контроль" parent="." instance=ExtResource("2_h2mc4")]
[node name="контроль" parent="." instance=ExtResource("2_ep1i3")]
visible = false
layout_mode = 2

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://w6ta0ck1bedl"]
[ext_resource type="PackedScene" uid="uid://cbfp6bylx8g4i" path="res://tab_container_stc.tscn" id="1_c76qk"]
[ext_resource type="PackedScene" uid="uid://cbfp6bylx8g4i" path="res://tab_container_stc.tscn" id="1_76mnm"]
[node name="wnd_stc" type="Window"]
initial_position = 3
@@ -8,4 +8,4 @@ size = Vector2i(1600, 1200)
mode = 3
current_screen = 1
[node name="TabContainer" parent="." instance=ExtResource("1_c76qk")]
[node name="TabContainer" parent="." instance=ExtResource("1_76mnm")]

View File

@@ -1,11 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://lwmw4egynmd1"]
[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_tse8d"]
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2"]
[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3"]
[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="4"]
[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="5"]
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="6"]
[ext_resource type="Script" path="res://scenes/контроль.gd" id="1_pdhey"]
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_c8mnm"]
[ext_resource type="Texture2D" uid="uid://dkqlvd750pplc" path="res://data/СПТ.png" id="3_uldf5"]
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="4_pojm0"]
[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="5_5hce7"]
[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="6_0mr8a"]
[node name="Контроль" type="Panel"]
anchors_preset = 15
@@ -13,7 +13,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_tse8d")
script = ExtResource("1_pdhey")
metadata/_edit_lock_ = true
[node name="pribor_uf" type="TextureButton" parent="."]
@@ -24,7 +24,7 @@ offset_right = 1191.0
offset_bottom = 657.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("2")
texture_normal = ExtResource("2_c8mnm")
stretch_mode = 4
[node name="pribor_rtr" type="TextureButton" parent="."]
@@ -35,7 +35,7 @@ offset_right = 1198.0
offset_bottom = 361.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("3")
texture_normal = ExtResource("3_uldf5")
stretch_mode = 4
[node name="pribor_afsp_l" type="TextureButton" parent="."]
@@ -47,7 +47,7 @@ offset_bottom = 860.0
scale = Vector2(0.2, 0.2)
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("6")
texture_normal = ExtResource("4_pojm0")
stretch_mode = 4
[node name="pribor_afsp_r" type="TextureButton" parent="."]
@@ -59,7 +59,7 @@ offset_bottom = 865.0
scale = Vector2(0.2, 0.2)
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("6")
texture_normal = ExtResource("4_pojm0")
stretch_mode = 4
[node name="pribor_sch3" type="TextureButton" parent="."]
@@ -70,7 +70,7 @@ offset_right = 1208.0
offset_bottom = 951.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("4")
texture_normal = ExtResource("5_5hce7")
stretch_mode = 4
[node name="pribor_spt_l" type="TextureButton" parent="."]
@@ -81,7 +81,7 @@ offset_right = 1053.0
offset_bottom = 951.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("3")
texture_normal = ExtResource("3_uldf5")
stretch_mode = 4
[node name="pribor_spt_r" type="TextureButton" parent="."]
@@ -92,7 +92,7 @@ offset_right = 1353.0
offset_bottom = 951.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("3")
texture_normal = ExtResource("3_uldf5")
stretch_mode = 4
[node name="pribor_prd_v_2" type="TextureButton" parent="."]
@@ -103,7 +103,7 @@ offset_right = 872.0
offset_bottom = 377.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_prd_n_2" type="TextureButton" parent="."]
@@ -114,7 +114,7 @@ offset_right = 827.0
offset_bottom = 553.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_prd_k_2" type="TextureButton" parent="."]
@@ -125,7 +125,7 @@ offset_right = 952.0
offset_bottom = 555.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_prd_v_3" type="TextureButton" parent="."]
@@ -136,7 +136,7 @@ offset_right = 1494.0
offset_bottom = 896.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -148,7 +148,7 @@ offset_right = 1417.0
offset_bottom = 721.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -160,7 +160,7 @@ offset_right = 1537.0
offset_bottom = 721.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -172,7 +172,7 @@ offset_right = 1522.0
offset_bottom = 391.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -184,7 +184,7 @@ offset_right = 1412.0
offset_bottom = 553.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -196,7 +196,7 @@ offset_right = 1537.0
offset_bottom = 562.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
flip_h = true
@@ -208,7 +208,7 @@ offset_right = 882.0
offset_bottom = 896.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_prd_n_4" type="TextureButton" parent="."]
@@ -219,7 +219,7 @@ offset_right = 827.0
offset_bottom = 723.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_prd_k_4" type="TextureButton" parent="."]
@@ -230,7 +230,7 @@ offset_right = 962.0
offset_bottom = 723.0
size_flags_horizontal = 15
size_flags_vertical = 15
texture_normal = ExtResource("5")
texture_normal = ExtResource("6_0mr8a")
stretch_mode = 4
[node name="pribor_sch" type="Panel" parent="."]

View File

@@ -1,9 +1,15 @@
extends Panel
@export_color_no_alpha var col_red
@export_color_no_alpha var col_grey
@export var col_red: Color
@export var col_grey: Color
@export var strob_min_width: float
@export var strob_max_width: float
@export var strob_min_band: float
@export var strob_max_band: float
@export var drag_scale: float
enum DRAG_FSM { IDLE, DRAG }
enum DRAG_FSM { IDLE, DRAG, DISABLE }
""" Состояние перетаскивания """
var drag_pos_begin: Vector2
@@ -15,13 +21,16 @@ var drag_fsm: DRAG_FSM = DRAG_FSM.IDLE
var drag_button: MouseButton
""" Кнопка мыши нажатая при перетаскивании """
var ant_width_begin: float
""" Ширина ДН антенны в момент начала перетаскивания """
var strob_width_begin: float
""" Ширина строба по углу в момент начала перетаскивания """
var ant_dir_begin: float
var strob_dir_begin: float
""" Направление антенны в момент начала перетаскивания """
var ant_center: Vector2
var strob_band_begin: float
""" Ширина строба в момент начала перетаскивания """
var strob_center: Vector2
""" Центр антенн """
signal drag_begin
@@ -38,33 +47,42 @@ signal full_screen
func _ready():
$btn_strobe.button_connect('pressed', Callable(self, 'on_button_stobe_pressed'))
$canvas/animator.play('вращение')
$btn_strobe.button_connect('pressed', Callable(self, 'on_button_strobe_pressed'))
$'рамка-режим/btn_off'.set_pressed(true)
ant_center = $canvas.material.get('shader_parameter/pc0')
$canvas.material.set('shader_parameter/ap_ant_col', col_grey)
strob_center = $canvas.get_center()
on_button_strobe_pressed()
drag_fsm = DRAG_FSM.DISABLE
var nodes: = get_tree().get_nodes_in_group('группа-режим-помехи')
for btn in nodes:
btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes))
func on_button_stobe_pressed():
if $btn_strobe.is_pressed():
$canvas.material.set('shader_parameter/ap_ant_col', col_red)
func on_button_strobe_pressed():
if $btn_strobe.is_pressed():
$canvas.set_strob_visible(true)
drag_fsm = DRAG_FSM.IDLE
else:
$canvas.material.set('shader_parameter/ap_ant_col', col_grey)
$canvas.set_strob_visible(false)
drag_fsm = DRAG_FSM.DISABLE
func on_button_pressed(btn_this, btn_others):
# поведение радиокнопок в группе
for btn_other in btn_others: btn_other.set_pressed(btn_this == btn_other)
for btn_other in btn_others:
btn_other.set_pressed(btn_this == btn_other)
func hypot(x: float, y: float) -> float:
return sqrt(x * x + y * y)
func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2:
func clip_value(val, val_min, val_max):
if val < val_min: val = val_min
if val > val_max: val = val_max
return val
func map_dec_to_rad(pos0: Vector2, pos: Vector2) -> Vector2:
""" Преобразует декартовые координаты в полярные """
var x1: float = pos.x - pos0.x
var y1: float = pos.y - pos0.y
@@ -74,33 +92,41 @@ func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2:
return Vector2(ang, radius)
func get_ant_width(pos: Vector2, prev: float) -> float:
var ap_ant_w: float = prev + (drag_pos_begin.y - pos.y) / 5.0
if ap_ant_w < 5.0: ap_ant_w = 5.0
if ap_ant_w > 90.0: ap_ant_w = 90.0
return ap_ant_w
func get_strob_width(pos: Vector2, prev: float) -> float:
var strob_dir_width: float = prev + (drag_pos_begin.y - pos.y) / drag_scale
strob_dir_width = clip_value(strob_dir_width, strob_min_width, strob_max_width)
return strob_dir_width
func set_ant_dir(pos: Vector2):
var radp: Vector2 = map_xy_ang(ant_center, pos)
if radp.y < 600:
$canvas.material.set('shader_parameter/sec_var', radp.x)
func get_strob_band(pos: Vector2, prev: float) -> float:
var strob_dir_band: float = prev + (drag_pos_begin.x - pos.x) / drag_scale
strob_dir_band = clip_value(strob_dir_band, strob_min_band, strob_max_band)
return strob_dir_band
func set_strob_dir(pos: Vector2):
var radp: Vector2 = map_dec_to_rad(strob_center, pos)
if radp.y < 600.0:
$canvas.set_strob_dir(radp.x)
func _on_drag_continue(event):
if drag_button == MOUSE_BUTTON_RIGHT:
var ap_ant_w: float = get_ant_width(event.position, ant_width_begin)
$canvas.material.set('shader_parameter/ap_ant_w', ap_ant_w)
var strob_width: float = get_strob_width(event.position, strob_width_begin)
$canvas.set_strob_width(strob_width)
print_debug(strob_width_begin, strob_width)
#var strob_band: float = get_strob_band(event.position, strob_band_begin)
#$canvas.set_strob_band(strob_band)
elif drag_button == MOUSE_BUTTON_LEFT:
set_ant_dir(event.position)
set_strob_dir(event.position)
func _on_drag_begin(event):
drag_pos_begin = event.position
if drag_button == MOUSE_BUTTON_LEFT:
set_ant_dir(event.position)
set_strob_dir(event.position)
elif drag_button == MOUSE_BUTTON_RIGHT:
ant_width_begin = $canvas.material.get('shader_parameter/ap_ant_w')
strob_width_begin = $canvas.get_strob_width()
func _input(event):

View File

@@ -1,20 +1,22 @@
[gd_scene load_steps=6 format=3 uid="uid://b276iygic5itk"]
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_6kl7p"]
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_jfiel"]
[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="11_pmacq"]
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="12_pcemc"]
[ext_resource type="Script" path="res://scenes/работа.gd" id="1_bn2wv"]
[ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_7v6xf"]
[ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="3_hqrod"]
[ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button-flat.tscn" id="4_vg7if"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ugj8"]
[node name="Работа" type="Panel"]
script = ExtResource("1_6kl7p")
col_red = Color(1, 0.568627, 0.431373, 1)
col_grey = Color(0.6, 0.6, 0.6, 1)
script = ExtResource("1_bn2wv")
col_red = Color(1, 0.568627, 0.431373, 0.239216)
col_grey = Color(0.34902, 0.643137, 0.772549, 0.168627)
drag_scale = 5.0
metadata/_edit_vertical_guides_ = []
[node name="canvas" parent="." instance=ExtResource("2_jfiel")]
[node name="canvas" parent="." instance=ExtResource("2_7v6xf")]
[node name="рамка-режим" parent="." instance=ExtResource("11_pmacq")]
[node name="рамка-режим" parent="." instance=ExtResource("3_hqrod")]
layout_mode = 0
offset_left = 1180.0
offset_top = 892.0
@@ -22,7 +24,7 @@ offset_right = 1589.0
offset_bottom = 1162.0
text = "Режим помехи"
[node name="btn_off" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_off" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 10.0
offset_top = 30.0
@@ -30,7 +32,7 @@ offset_right = 100.0
offset_bottom = 80.0
text = "Откл"
[node name="btn_p4" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p4" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 110.0
offset_top = 210.0
@@ -38,7 +40,7 @@ offset_right = 200.0
offset_bottom = 260.0
text = "13"
[node name="btn_p5" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p5" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 10.0
@@ -49,7 +51,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "12"
[node name="btn_p6" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p6" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 210.0
offset_top = 150.0
@@ -57,7 +59,7 @@ offset_right = 300.0
offset_bottom = 200.0
text = "10"
[node name="btn_p7" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p7" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 310.0
offset_top = 150.0
@@ -65,7 +67,7 @@ offset_right = 400.0
offset_bottom = 200.0
text = "11"
[node name="btn_p8" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p8" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 110.0
offset_top = 150.0
@@ -73,7 +75,7 @@ offset_right = 200.0
offset_bottom = 200.0
text = "9"
[node name="btn_p9" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p9" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 10.0
offset_top = 150.0
@@ -81,7 +83,7 @@ offset_right = 100.0
offset_bottom = 200.0
text = "8"
[node name="btn_p10" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p10" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 310.0
@@ -92,7 +94,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "7"
[node name="btn_p11" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p11" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 310.0
offset_top = 30.0
@@ -100,7 +102,7 @@ offset_right = 399.0
offset_bottom = 80.0
text = "3"
[node name="btn_p12" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p12" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 10.0
@@ -111,7 +113,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "4"
[node name="btn_p13" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p13" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 110.0
@@ -122,7 +124,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "5"
[node name="btn_p14" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p14" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 210.0
@@ -133,7 +135,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "6"
[node name="btn_p15" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p15" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 1
anchors_preset = -1
offset_left = 210.0
@@ -144,7 +146,7 @@ grow_horizontal = 2
grow_vertical = 2
text = "2"
[node name="btn_p16" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_p16" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 110.0
offset_top = 30.0
@@ -152,7 +154,7 @@ offset_right = 200.0
offset_bottom = 80.0
text = "1"
[node name="btn_auto_rfi" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("12_pcemc")]
[node name="btn_auto_rfi" parent="рамка-режим" groups=["группа-режим-помехи"] instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 210.0
offset_top = 210.0
@@ -160,7 +162,7 @@ offset_right = 400.0
offset_bottom = 260.0
text = "Автоматически"
[node name="рамка-цели" parent="." instance=ExtResource("11_pmacq")]
[node name="рамка-цели" parent="." instance=ExtResource("3_hqrod")]
layout_mode = 0
offset_left = 1180.0
offset_top = 547.0
@@ -364,7 +366,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
text = "2"
horizontal_alignment = 1
[node name="рамка-общие" parent="." instance=ExtResource("11_pmacq")]
[node name="рамка-общие" parent="." instance=ExtResource("3_hqrod")]
layout_mode = 0
offset_left = 1180.0
offset_top = 276.0
@@ -461,7 +463,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
text = "3"
horizontal_alignment = 1
[node name="рамка-сеансы" parent="." instance=ExtResource("11_pmacq")]
[node name="рамка-сеансы" parent="." instance=ExtResource("3_hqrod")]
layout_mode = 0
offset_left = 1180.0
offset_top = 436.0
@@ -555,37 +557,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
text = "ПД-М4С"
horizontal_alignment = 1
[node name="надпись-качка" type="Label" parent="."]
layout_mode = 0
offset_left = 87.0
offset_top = 954.0
offset_right = 133.0
offset_bottom = 976.0
text = "Качка"
horizontal_alignment = 1
vertical_alignment = 1
[node name="lbl_b45" type="Label" parent="."]
layout_mode = 0
offset_left = 191.0
offset_top = 1057.0
offset_right = 237.0
offset_bottom = 1079.0
text = "45"
horizontal_alignment = 1
vertical_alignment = 1
[node name="lbl_k45" type="Label" parent="."]
layout_mode = 0
offset_left = 84.0
offset_top = 1154.0
offset_right = 130.0
offset_bottom = 1176.0
text = "-45"
horizontal_alignment = 1
vertical_alignment = 1
[node name="рамка-помеха" parent="." instance=ExtResource("11_pmacq")]
[node name="рамка-помеха" parent="." instance=ExtResource("3_hqrod")]
layout_mode = 0
offset_left = 1180.0
offset_top = 6.0
@@ -744,7 +716,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1)
text = "ЛЧМ"
horizontal_alignment = 1
[node name="btn_auto_threat" parent="." instance=ExtResource("12_pcemc")]
[node name="btn_auto_threat" parent="." instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 980.0
offset_top = 1101.0
@@ -752,7 +724,7 @@ offset_right = 1170.0
offset_bottom = 1151.0
text = "Автоматически"
[node name="btn_strobe" parent="." instance=ExtResource("12_pcemc")]
[node name="btn_strobe" parent="." instance=ExtResource("4_vg7if")]
layout_mode = 0
offset_left = 980.0
offset_top = 30.0