РВП. Добавлен макет вида "ПО СТЦ"

This commit is contained in:
sasha80
2023-04-21 14:38:19 +03:00
parent a85375bc25
commit 8b1d07d3d5
12 changed files with 614 additions and 982 deletions

163
scenes/canvas.tscn Normal file
View File

@@ -0,0 +1,163 @@
[gd_scene load_steps=14 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"]
[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")
}
[node name="canvas" type="Sprite2D"]
material = ExtResource("1_ow7xo")
position = Vector2(800, 596)
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")
[node name="кораблик" type="Sprite2D" parent="."]
position = Vector2(-192, 3)
scale = Vector2(0.25, 0.25)
texture = ExtResource("5_1y104")
[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

16
scenes/tab_switch.tscn Normal file
View File

@@ -0,0 +1,16 @@
[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"]
[node name="tab_switch" type="TabContainer"]
offset_top = -2.0
offset_right = 1600.0
offset_bottom = 1200.0
[node name="работа" parent="." instance=ExtResource("1_jjcv4")]
layout_mode = 2
[node name="контроль" parent="." instance=ExtResource("2_h2mc4")]
visible = false
layout_mode = 2

12
scenes/wnd_stc.tscn Normal file
View File

@@ -0,0 +1,12 @@
[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"]
[node name="wnd_stc" type="Window"]
initial_position = 3
size = Vector2i(1600, 1200)
mode = 3
current_screen = 1
borderless = true
[node name="TabContainer" parent="." instance=ExtResource("1_c76qk")]

View File

@@ -25,18 +25,23 @@ tbl_celi.set_columns_min_size(CELI_COLUMNS_SIZE) """
const RADIO_GROUPE_NAMES = \
['btn_off', 'btn_p4', 'btn_p5', 'btn_p6', 'btn_p7',
'btn_p8', 'btn_p9', 'btn_p10', 'btn_p11', 'btn_p12',
'btn_p13', 'btn_p14', 'btn_p15', 'btn_p16', 'btn_auto']
'btn_p13', 'btn_p14', 'btn_p15', 'btn_p16', 'btn_auto_rfi']
enum DRAG_FSM { IDLE, DRAG }
var radio_groupe: Array
var band_ants = [10, 10, 10]
var drag_pos_begin: Vector2
var drag_pos_end: Vector2
var drag_fsm: DRAG_FSM
var drag_button: MouseButton
var pc0: Vector2
var ant_dir_width_begin: float
# Called when the node enters the scene tree for the first time.
func _ready():
$canvas.material.set('shader_parameter/band_ants', band_ants)
$animator.play('вращение')
$ramka_rezhim/btn_off.set_pressed(true)
var nodes = $ramka_rezhim.get_children()
$canvas/animator.play('вращение')
$'рамка-режим/btn_off'.set_pressed(true)
var nodes = $'рамка-режим'.get_children()
pc0 = $canvas.material.get('shader_parameter/pc0')
for btn in nodes:
if btn.name in RADIO_GROUPE_NAMES:
radio_groupe.append(btn)
@@ -46,15 +51,7 @@ func _ready():
func _on_button_pressed(btn):
# поведение радиокнопок в группе
for btn0 in radio_groupe:
if btn0 != btn:
btn0.set_pressed(false)
else:
btn0.set_pressed(true)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
btn0.set_pressed(btn0 == btn)
func hypot(x: float, y: float) -> float:
@@ -63,20 +60,46 @@ func hypot(x: float, y: float) -> float:
func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2:
""" Преобразует декартовые координаты в полярные """
var x1: float = pos.x - pos0.x
var y1: float = pos.y - pos0.y
var x1: float = pos.x - pos0.x
var y1: float = pos.y - pos0.y
var ang: float = (atan2(y1, x1) * 180.0) / PI
ang += 360.0 * float(ang < 0.0)
var radius: float = hypot(x1, y1)
return Vector2(ang, radius)
func _input(event):
if event is InputEventMouseButton:
if not event.pressed:
return
var radp: Vector2 = map_xy_ang(Vector2(600, 600), event.position)
if radp.y < 600:
$canvas/"направление-1".rotation_degrees = radp.x
$canvas.material.set('shader_parameter/sec_var', radp.x)
func set_ant_width(position: Vector2):
var radp: Vector2 = map_xy_ang(pc0, position)
var ant_dir_width: float = ant_dir_width_begin + (drag_pos_begin.y - position.y) / 5.0
if ant_dir_width < 5.0:
ant_dir_width = 5.0
if ant_dir_width > 90.0:
ant_dir_width = 90.0
$canvas.material.set('shader_parameter/ap_ant_w', ant_dir_width)
func set_ant_dir(position: Vector2):
var radp: Vector2 = map_xy_ang(pc0, position)
if radp.y < 600:
$canvas.material.set('shader_parameter/sec_var', radp.x)
func _input(event):
if event is InputEventMouseMotion:
if drag_fsm == DRAG_FSM.DRAG:
if drag_button == MOUSE_BUTTON_RIGHT:
set_ant_width(event.position)
elif drag_button == MOUSE_BUTTON_LEFT:
set_ant_dir(event.position)
if event is InputEventMouseButton:
drag_button = event.button_index
if event.pressed:
if drag_fsm == DRAG_FSM.IDLE:
drag_fsm = DRAG_FSM.DRAG
drag_pos_begin = event.position
if drag_button == MOUSE_BUTTON_LEFT:
set_ant_dir(event.position)
elif drag_button == MOUSE_BUTTON_RIGHT:
set_ant_width(event.position)
else:
drag_fsm = DRAG_FSM.IDLE

File diff suppressed because it is too large Load Diff

View File

@@ -15,4 +15,4 @@ extends NinePatchRect
@export var text: String = 'caption text':
get: return $header.text
set(text): $header.text = text
set(val): $header.text = val