Add control panel

This commit is contained in:
2024-12-18 20:47:40 +03:00
parent 38e958adac
commit 3865ac1128
22 changed files with 1221 additions and 289 deletions

BIN
table/off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

34
table/off.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfktmk2rowmul"
path="res://.godot/imported/off.png-1e39e374275baa601325fa6406753589.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://table/off.png"
dest_files=["res://.godot/imported/off.png-1e39e374275baa601325fa6406753589.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
table/on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

34
table/on.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdxdluvyb5uei"
path="res://.godot/imported/on.png-206ee6e6bfd662244aa1e9ef9d746f4b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://table/on.png"
dest_files=["res://.godot/imported/on.png-206ee6e6bfd662244aa1e9ef9d746f4b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -20,7 +20,7 @@ script = ExtResource("1_h0k6p")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 2
color = Color(0, 0, 0, 0.490196)
color = Color(0, 0, 0, 0.011)
[node name="CheckButton" type="CheckButton" parent="."]
layout_mode = 2
@@ -30,3 +30,4 @@ theme_override_styles/focus = SubResource("StyleBoxTexture_b6sp7")
theme_override_styles/hover = SubResource("StyleBoxTexture_bc33d")
theme_override_styles/pressed = SubResource("StyleBoxTexture_46fou")
theme_override_styles/normal = SubResource("StyleBoxTexture_o64tc")
metadata/_edit_lock_ = true

View File

@@ -0,0 +1,195 @@
[gd_scene load_steps=15 format=3 uid="uid://p2suppildvq0"]
[ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://nine-patch-round.png" id="2_4b43i"]
[ext_resource type="Shader" path="res://opt_btn.gdshader" id="2_ecsml"]
[ext_resource type="Texture2D" uid="uid://dkef6xwxwdxi8" path="res://эмс-бланк.png" id="3_4kmgr"]
[ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://эмс-бланк-пост.png" id="4_omove"]
[ext_resource type="Texture2D" uid="uid://ijdfo2mml54" path="res://эмс-бланк-перем.png" id="5_jia67"]
[sub_resource type="GDScript" id="GDScript_fbktk"]
script/source = "@tool
extends Control
@export var margins: Array[int] = [8, 8, 8, 8] # top, left, bottom, right
@export var textures: Array[Texture]
@export var self_size: Vector2i = Vector2i(50, 150):
set(v):
self_size = v
size = v
$np_rect.size = v
_resize_children()
get: return size
@export var fname: String:
set(v):
fname = v
$lbl_fname.text = v
@export var rname: String:
set(v):
rname = v
$lbl_rname.text = v
func _resize_children() -> void:
$lbl_rname.size.x = size.x
$lbl_rname.position.y = margins[0]
$lbl_fname.size.y = size.x
$lbl_fname.position.y = size.y / 2 + $lbl_fname.size.x / 2
$light_ind.position.x = size.x / 2 - ($light_ind.size.x * $light_ind.scale.x) / 2
$light_ind.position.y = size.y - $light_ind.size.y * $light_ind.scale.x - margins[2]
func _on_nine_patch_rect_resized() -> void:
size = $np_rect.size
self_size = $np_rect.size
_resize_children()
func _on_resized() -> void:
$np_rect.size = size
self_size = size
_resize_children()
@export var state: int:
set(v):
v = 0 if v < 0 else v
v %= textures.size()
state = v
$txr_state.texture = textures[v]
get:
return state
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_45ast"]
shader = ExtResource("2_ecsml")
shader_parameter/range = 0.4
shader_parameter/color = Color(0.764706, 0.764706, 0.764706, 1)
[sub_resource type="Gradient" id="Gradient_x8k3w"]
colors = PackedColorArray(1, 1, 1, 1, 0.393086, 0.393086, 0.393085, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_cgu2r"]
gradient = SubResource("Gradient_x8k3w")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
fill_to = Vector2(1.125, 0)
[sub_resource type="Gradient" id="Gradient_1tk1g"]
colors = PackedColorArray(0.1, 1, 0.1, 1, 0.124744, 0.328804, 0.202483, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_d3qtt"]
gradient = SubResource("Gradient_1tk1g")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="Gradient" id="Gradient_6e32x"]
colors = PackedColorArray(1, 0.1, 0.1, 1, 0.329, 0.125, 0.202, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_k8o6s"]
gradient = SubResource("Gradient_6e32x")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="SpriteFrames" id="SpriteFrames_nofpw"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_4kmgr")
}, {
"duration": 1.0,
"texture": ExtResource("4_omove")
}, {
"duration": 1.0,
"texture": ExtResource("5_jia67")
}, {
"duration": 1.0,
"texture": null
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="yelement_v" type="Control"]
editor_description = "Элемент замены из ЗИП"
layout_mode = 3
anchors_preset = 0
offset_right = 50.0
offset_bottom = 150.0
script = SubResource("GDScript_fbktk")
textures = Array[Texture]([ExtResource("2_4b43i"), ExtResource("2_4b43i"), ExtResource("2_4b43i")])
metadata/ref_des = ""
metadata/dec_num = ""
[node name="lbl_rname" type="Label" parent="."]
layout_mode = 0
offset_top = 8.0
offset_right = 50.0
offset_bottom = 34.0
theme_override_colors/font_color = Color(0.991, 0.991, 0.991, 0.675)
theme_override_font_sizes/font_size = 17
text = "A1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_top = 123.0
offset_right = 94.0
offset_bottom = 173.0
rotation = -1.5708
theme_override_font_sizes/font_size = 17
text = "Ячейка"
horizontal_alignment = 1
vertical_alignment = 1
[node name="light_ind" type="TextureButton" parent="."]
material = SubResource("ShaderMaterial_45ast")
layout_mode = 0
offset_left = 13.0
offset_top = 114.0
offset_right = 38.0
offset_bottom = 139.0
size_flags_vertical = 6
toggle_mode = true
button_mask = 0
texture_normal = SubResource("GradientTexture2D_cgu2r")
texture_pressed = SubResource("GradientTexture2D_d3qtt")
texture_disabled = SubResource("GradientTexture2D_k8o6s")
[node name="np_rect" type="NinePatchRect" parent="."]
layout_mode = 0
offset_right = 50.0
offset_bottom = 150.0
texture = ExtResource("2_4b43i")
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="SZI_x" type="AnimatedSprite2D" parent="."]
visible = false
position = Vector2(524, 454)
sprite_frames = SubResource("SpriteFrames_nofpw")
metadata/_edit_lock_ = true
[connection signal="resized" from="." to="." method="_on_resized"]
[connection signal="resized" from="np_rect" to="." method="_on_nine_patch_rect_resized"]

View File

@@ -0,0 +1,140 @@
[gd_scene load_steps=7 format=3 uid="uid://bnlkbbn7b4a3k"]
[ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://nine-patch-round.png" id="1_lmmwb"]
[ext_resource type="Texture2D" uid="uid://dkef6xwxwdxi8" path="res://эмс-бланк.png" id="3_2trq1"]
[ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://эмс-бланк-пост.png" id="4_vgjvf"]
[ext_resource type="Texture2D" uid="uid://ijdfo2mml54" path="res://эмс-бланк-перем.png" id="5_1heoc"]
[sub_resource type="GDScript" id="GDScript_fbktk"]
script/source = "@tool
extends Control
@export var margins: Array[int] = [8, 8, 8, 8] # top, left, bottom, right
@export var textures: Array[Texture]
@export var self_size: Vector2i = Vector2i(50, 150):
set(v):
self_size = v
size = v
$np_rect.size = v
_resize_children()
get: return size
@export var fname: String:
set(v):
fname = v
$lbl_fname.text = v
@export var rname: String:
set(v):
rname = v
$lbl_rname.text = v
func _resize_children() -> void:
$lbl_rname.size.x = size.x
$lbl_rname.position.y = margins[0]
$lbl_fname.size.y = size.x
$lbl_fname.position.y = size.y / 2 + $lbl_fname.size.x / 2
func _on_nine_patch_rect_resized() -> void:
size = $np_rect.size
self_size = $np_rect.size
_resize_children()
func _on_resized() -> void:
$np_rect.size = size
self_size = size
_resize_children()
@export var state: int:
set(v):
v = 0 if v < 0 else v
v %= textures.size()
state = v
$txr_state.texture = textures[v]
get:
return state
"
[sub_resource type="SpriteFrames" id="SpriteFrames_nofpw"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_2trq1")
}, {
"duration": 1.0,
"texture": ExtResource("4_vgjvf")
}, {
"duration": 1.0,
"texture": ExtResource("5_1heoc")
}, {
"duration": 1.0,
"texture": null
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="yelement_ems" type="Control"]
editor_description = "Элемент замены из ЗИП"
layout_mode = 3
anchors_preset = 0
offset_right = 50.0
offset_bottom = 150.0
script = SubResource("GDScript_fbktk")
textures = Array[Texture]([ExtResource("1_lmmwb"), ExtResource("1_lmmwb"), ExtResource("1_lmmwb")])
metadata/ref_des = ""
metadata/dec_num = ""
[node name="lbl_rname" type="Label" parent="."]
layout_mode = 0
offset_top = 8.0
offset_right = 50.0
offset_bottom = 34.0
theme_override_colors/font_color = Color(0.991, 0.991, 0.991, 0.675)
theme_override_font_sizes/font_size = 17
text = "A1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_top = 123.0
offset_right = 94.0
offset_bottom = 173.0
rotation = -1.5708
theme_override_font_sizes/font_size = 17
text = "Ячейка"
horizontal_alignment = 1
vertical_alignment = 1
[node name="np_rect" type="NinePatchRect" parent="."]
layout_mode = 0
offset_right = 50.0
offset_bottom = 150.0
texture = ExtResource("1_lmmwb")
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="SZI_x" type="AnimatedSprite2D" parent="."]
position = Vector2(25, 155)
sprite_frames = SubResource("SpriteFrames_nofpw")
[connection signal="resized" from="." to="." method="_on_resized"]
[connection signal="resized" from="np_rect" to="." method="_on_nine_patch_rect_resized"]