gd: input sync

This commit is contained in:
Nordup 2023-05-19 04:10:14 +03:00
parent 64e08d8c18
commit 00e6c3070a
2 changed files with 24 additions and 1 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=31 format=3 uid="uid://dagj0celx6tjq"]
[gd_scene load_steps=32 format=3 uid="uid://dagj0celx6tjq"]
[ext_resource type="Script" path="res://the_gates/scripts/loading/pack_loader.gd" id="1_5swiq"]
[ext_resource type="Script" path="res://the_gates/scripts/loading/gate_loader.gd" id="1_coscx"]
@ -17,6 +17,7 @@
[ext_resource type="Texture2D" uid="uid://cykx425p6ylwr" path="res://the_gates/textures/background.png" id="9_req2b"]
[ext_resource type="Script" path="res://the_gates/scripts/ui/world/release_focus.gd" id="10_6a8ws"]
[ext_resource type="PackedScene" path="res://the_gates/scenes/components/hint.tscn" id="11_cltj4"]
[ext_resource type="Script" path="res://the_gates/scripts/input/input_sync.gd" id="18_rsdyb"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_shmbc"]
bg_color = Color(0.3384, 0.188, 0.47, 1)
@ -717,6 +718,10 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="InputSync" type="Node" parent="WorldCanvas"]
script = ExtResource("18_rsdyb")
gate_events = ExtResource("2_ot8b0")
[connection signal="pressed" from="UICanvas/UI/Blur/HideOnPress" to="UICanvas/UI" method="hide_ui"]
[connection signal="pressed" from="UICanvas/UI/GateInfo/Bookmark/Star" to="UICanvas/UI/GateInfo" method="_on_star_pressed"]
[connection signal="pressed" from="UICanvas/UI/GateInfo/Bookmark/Unstar" to="UICanvas/UI/GateInfo" method="_on_unstar_pressed"]

View file

@ -0,0 +1,18 @@
extends Node
@export var gate_events: GateEvents
var input_sync: InputSync
func _ready() -> void:
gate_events.gate_entered.connect(start_server)
func start_server() -> void:
input_sync = InputSync.new()
input_sync.bind()
func _input(event: InputEvent) -> void:
if input_sync == null: return
input_sync.send_input_event(event)