diff --git a/scenes/bip/bip.gd b/scenes/bip/bip.gd index 1d8d487..b5bfabd 100644 --- a/scenes/bip/bip.gd +++ b/scenes/bip/bip.gd @@ -2,18 +2,27 @@ class_name bip_ extends Control var selected: bool +## Присваивает заданое значение видимости селектору. +func set_track_visible(value: bool): $track.visible = value + + +## Присваивает заданое значение видимости индикатору выполнения. +func set_ecm_visible(value: bool): $ecm_done.visible = value + + +func update(): $bip.material.set('shader_parameter/tick_update', float(Time.get_ticks_msec()/1000)) + + +## Задаёт цвет для всех экземпляров +func set_color(color: Color): $bip.material.set('shader_parameter/color', Vector3(color.r, color.g, color.b)) + + ## Функция присваивает заданое значение видимости селектору. func set_sel_visible(value: bool): selected = value $selector.visible = value -## Функция присваивает заданое значение видимости селектору. -func set_track_visible(value: bool): $track.visible = value -## Функция присваивает заданое значение видимости индикатору выполнения. -func set_ecm_visible(value: bool): $ecm_done.visible = value - - func _on_bip_gui_input(event): if event is InputEventMouseButton and event.pressed: match event.button_index: @@ -22,7 +31,3 @@ func _on_bip_gui_input(event): MOUSE_BUTTON_RIGHT: if selected: signaller.emit_signal('rto_threat_unsel', name.to_int()) - - -func update(): - $bip.material.set('shader_parameter/tick_update', float(Time.get_ticks_msec()/1000)) diff --git a/scenes/bip/bip.tscn b/scenes/bip/bip.tscn index 0551c8b..559a225 100644 --- a/scenes/bip/bip.tscn +++ b/scenes/bip/bip.tscn @@ -7,6 +7,7 @@ [sub_resource type="ShaderMaterial" id="ShaderMaterial_2dulj"] shader = ExtResource("2_rt0la") shader_parameter/tick_update = 0.0 +shader_parameter/color = Color(0.972549, 0.12549, 0.411765, 1) [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_w5pye"] @@ -232,6 +233,7 @@ layout_mode = 0 offset_right = 1.0 offset_bottom = 1.0 scale = Vector2(20, 20) +action_mode = 0 button_mask = 3 texture_normal = SubResource("PlaceholderTexture2D_w5pye") stretch_mode = 3 diff --git a/scenes/работа/CharacterBody2D.gd b/scenes/работа/CharacterBody2D.gd deleted file mode 100644 index eaeb4de..0000000 --- a/scenes/работа/CharacterBody2D.gd +++ /dev/null @@ -1,28 +0,0 @@ -class_name characterBody extends CharacterBody2D - - -const SPEED = 300.0 -const JUMP_VELOCITY = -400.0 - -## Получить гравитацию из настроек проекта для синхронизации с узлами RigidBody. -var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") - - -func _physics_process(delta): - # Add the gravity. - if not is_on_floor(): - velocity.y += gravity * delta - - # Handle jump. - if Input.is_action_just_pressed("ui_accept") and is_on_floor(): - velocity.y = JUMP_VELOCITY - - # Get the input direction and handle the movement/deceleration. - # As good practice, you should replace UI actions with custom gameplay actions. - var direction = Input.get_axis("ui_left", "ui_right") - if direction: - velocity.x = direction * SPEED - else: - velocity.x = move_toward(velocity.x, 0, SPEED) - - move_and_slide() diff --git a/shaders/bip.gdshader b/shaders/bip.gdshader index 17eb231..64a0e6e 100644 --- a/shaders/bip.gdshader +++ b/shaders/bip.gdshader @@ -4,9 +4,7 @@ shader_type canvas_item; /* Закрашенная окружность */ uniform float tick_update = 0.0; /* Время последнего обновления, мс */ -const float red_channel = 0.972549; -const float green_channel = 0.12549; -const float blue_channel = 0.411765; +uniform vec3 color : source_color = vec3(1.0, 1.0, 1.0); const float time_delta = 0.5; /* Время вспышки при обновлении, c */ const float ds = 0.01; /* Относительное расстояние на котором выполняется сглаживание краёв */ const vec2 center = vec2(0.125, 0.125); /* Центр должен быть в (0.5, 0.5), но это не так */ @@ -16,12 +14,10 @@ const float alpha_main = 1.0; void fragment() { - float time_now = TIME; float alpha = 0.0; - if ((time_now - tick_update) < time_delta) + if ((TIME - tick_update) < time_delta) { - alpha = time_delta - (time_now - tick_update) * alpha_offset; + alpha = time_delta - (TIME - tick_update) * alpha_offset; } - vec4 color = vec4(red_channel, green_channel, blue_channel, alpha_main - alpha); - COLOR = color * smooth_px(length(UV - center), radius, ds); + COLOR = vec4(color, alpha_main - alpha) * smooth_px(length(UV - center), radius, ds); } diff --git a/table/table.gd b/table/table.gd index 4bec1b3..43f1704 100644 --- a/table/table.gd +++ b/table/table.gd @@ -220,7 +220,7 @@ func get_key_indexes(key: String) -> Array: ## func set_columns_min_size(sizes: Array) -> void: - assert((columns == 1) or (columns == sizes.size())) + _assert(columns == sizes.size(), 'неверный размер массива с ширинами колонок: передано %d, но требуется %d' % [sizes.size(), columns]) columns = sizes.size() var rows_count: = get_rows_count() columns_min_size.clear() @@ -317,9 +317,7 @@ func set_row_selected(i_row: int, selected: bool = true) -> void: func _set_row_selected(i_row: int, selected: bool = true) -> void: var selector_key: = SELECTOR_KEY_FORMAT % [i_row, 0] var node_key: = NODE_KEY_FORMAT % [i_row, 0] - if not nodes.has(node_key): - push_error('ошибка: нет такого ряда: %d' % i_row) - return + _assert(nodes.has(node_key), 'нет такого ряда: %d' % i_row) if nodes.has(selector_key) and (not selected): var node = nodes[node_key] var selector = nodes[selector_key] @@ -401,11 +399,11 @@ func _on_focus_entered(node): ## func set_header(header_types: Array): - assert(header_types.size() < MAX_INDEX, 'ошибка: количество колонок в заголовке: %d больше допустимого: %d' % [header_types.size(), MAX_INDEX + 1]) + _assert(header_types.size() < MAX_INDEX, 'количество колонок в заголовке: %d больше допустимого: %d' % [header_types.size(), MAX_INDEX + 1]) if columns == 1: set_columns(header_types.size()) else: - assert(columns == header_types.size(), 'ошибка: количество колонок в заголовке %d, но ранее установлено: %d' % [header_types.size(), columns]) + _assert(columns == header_types.size(), 'количество колонок в заголовке %d, но ранее установлено: %d' % [header_types.size(), columns]) var do_adj: = false if not header: header = GridContainer.new()