From 5020b62c9baf9bcc0bcee46924e53c75e3be7a03 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Wed, 30 Oct 2024 10:01:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/button-flat/nine-patch-button.gd | 6 +++++- scenes/pribor-uyep/pribor-uyep.tscn | 2 +- scenes/pribor-uyep/{spt25_view.gd => spt25-view.gd} | 6 +++++- scenes/контроль/элемент-я.gd | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) rename scenes/pribor-uyep/{spt25_view.gd => spt25-view.gd} (93%) diff --git a/scenes/button-flat/nine-patch-button.gd b/scenes/button-flat/nine-patch-button.gd index 67189a3b..9c2ccb24 100644 --- a/scenes/button-flat/nine-patch-button.gd +++ b/scenes/button-flat/nine-patch-button.gd @@ -65,7 +65,11 @@ func _enter_tree() -> void: $back.scale = size $back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0)) $button.set_toggle_mode(true) - $button.connect('toggled', Callable(self, '_on_button_toggled')) + $button.connect('toggled', _on_button_toggled) + + +func _exit_tree() -> void: + $button.disconnect('toggled', _on_button_toggled) func set_toggle_mode(val: bool): diff --git a/scenes/pribor-uyep/pribor-uyep.tscn b/scenes/pribor-uyep/pribor-uyep.tscn index e6c36c57..0d099151 100644 --- a/scenes/pribor-uyep/pribor-uyep.tscn +++ b/scenes/pribor-uyep/pribor-uyep.tscn @@ -3,7 +3,7 @@ [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_6olof"] [ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_46rp6"] [ext_resource type="PackedScene" uid="uid://ku8rdjoyscai" path="res://scenes/pribor-uyep/block-input.tscn" id="4_mrvir"] -[ext_resource type="Script" path="res://scenes/pribor-uyep/spt25_view.gd" id="4_v0lil"] +[ext_resource type="Script" path="res://scenes/pribor-uyep/spt25-view.gd" id="4_v0lil"] [ext_resource type="PackedScene" uid="uid://bsixhjfesq6r4" path="res://scenes/pribor-uyep/block-output.tscn" id="5_x74mk"] [ext_resource type="PackedScene" uid="uid://btpc78gucr57f" path="res://scenes/контроль/элемент-я.tscn" id="6_60xs3"] diff --git a/scenes/pribor-uyep/spt25_view.gd b/scenes/pribor-uyep/spt25-view.gd similarity index 93% rename from scenes/pribor-uyep/spt25_view.gd rename to scenes/pribor-uyep/spt25-view.gd index 65277465..1eb2b76f 100644 --- a/scenes/pribor-uyep/spt25_view.gd +++ b/scenes/pribor-uyep/spt25-view.gd @@ -1,3 +1,5 @@ +@tool + extends "res://scenes/контроль/элемент-я.gd" @export var unit_name: String = '' @@ -11,12 +13,14 @@ enum STATE_VAL func _enter_tree() -> void: + if Engine.is_editor_hint(): return var unit_key = repsettings.get_unit_key(unit_name) var unit = repnetwork.units[unit_key] unit.connect('data_received', on_data_received.bind(unit)) func _exit_tree() -> void: + if Engine.is_editor_hint(): return var unit_key = repsettings.get_unit_key(unit_name) var unit = repnetwork.units[unit_key] unit.disconnect('data_received', on_data_received) @@ -26,7 +30,7 @@ func on_data_received(data, unit): # Неисправность, напряжение на выходе меньше номинального $block_output.state0 = STATE_VAL.GOOD if (data[4] & (1 << 0)) == 0 else STATE_VAL.ERROR # Перегрузка и короткое замыкание по выходу - $block_output.state1 = STATE_VAL.GOOD if ((data[5] & (1 << 0)) == 0) or ((data[5] & (1 << 1)) == 0) else STATE_VAL.ERROR + $block_output.state1 = STATE_VAL.GOOD if ((data[5] & (1 << 0)) == 0) and ((data[5] & (1 << 1)) == 0) else STATE_VAL.ERROR # Критическая температура $block_output.state2 = STATE_VAL.GOOD if ((data[5] & (1 << 5)) == 0) else STATE_VAL.ERROR # Сеть 1. Вход diff --git a/scenes/контроль/элемент-я.gd b/scenes/контроль/элемент-я.gd index fd619a5e..5afb5177 100644 --- a/scenes/контроль/элемент-я.gd +++ b/scenes/контроль/элемент-я.gd @@ -28,6 +28,7 @@ func _on_button_pressed(): func _ready() -> void: call_deferred('_on_resized') + func _on_resized() -> void: $rect.size = size $margin.size = size