From d2a8e927c9859017efe5be3f06c4ce9949c138b0 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Wed, 22 Nov 2023 17:05:34 +0100 Subject: [PATCH] move keyboard and fix signal tool error --- content/main.tscn | 2 +- content/{ui => system}/keyboard/keyboard.gd | 1 + content/{ui => system}/keyboard/keyboard.tscn | 2 +- content/ui/components/button/button.gd | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) rename content/{ui => system}/keyboard/keyboard.gd (99%) rename content/{ui => system}/keyboard/keyboard.tscn (94%) diff --git a/content/main.tscn b/content/main.tscn index 381fae9..0832e3b 100644 --- a/content/main.tscn +++ b/content/main.tscn @@ -7,7 +7,7 @@ [ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"] [ext_resource type="Material" uid="uid://bf5ina366dwm6" path="res://assets/materials/sky.material" id="5_wgwf8"] [ext_resource type="PackedScene" uid="uid://83lb5p4e0qk0" path="res://content/scenes/house.tscn" id="8_qkrg7"] -[ext_resource type="PackedScene" uid="uid://lrehk38exd5n" path="res://content/ui/keyboard/keyboard.tscn" id="9_e5n3p"] +[ext_resource type="PackedScene" uid="uid://lrehk38exd5n" path="res://content/system/keyboard/keyboard.tscn" id="9_e5n3p"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m58yb"] ao_enabled = true diff --git a/content/ui/keyboard/keyboard.gd b/content/system/keyboard/keyboard.gd similarity index 99% rename from content/ui/keyboard/keyboard.gd rename to content/system/keyboard/keyboard.gd index f511f6f..e74f8e0 100644 --- a/content/ui/keyboard/keyboard.gd +++ b/content/system/keyboard/keyboard.gd @@ -23,6 +23,7 @@ func _ready(): for key in row: var button = create_key(key) keys.add_child(button) + button.on_button_down.connect(func(): _emit_event("key_down", key) ) diff --git a/content/ui/keyboard/keyboard.tscn b/content/system/keyboard/keyboard.tscn similarity index 94% rename from content/ui/keyboard/keyboard.tscn rename to content/system/keyboard/keyboard.tscn index 0e7e822..90b304f 100644 --- a/content/ui/keyboard/keyboard.tscn +++ b/content/system/keyboard/keyboard.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=3 uid="uid://lrehk38exd5n"] -[ext_resource type="Script" path="res://content/ui/keyboard/keyboard.gd" id="1_maojw"] +[ext_resource type="Script" path="res://content/system/keyboard/keyboard.gd" id="1_maojw"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"] [ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_mx544"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="4_86fct"] diff --git a/content/ui/components/button/button.gd b/content/ui/components/button/button.gd index dbcdc4d..f12787d 100644 --- a/content/ui/components/button/button.gd +++ b/content/ui/components/button/button.gd @@ -1,3 +1,4 @@ +@tool extends StaticBody3D class_name Button3D @@ -21,7 +22,6 @@ var active: bool = false : animation_player.play_backwards("down") @onready var animation_player: AnimationPlayer = $AnimationPlayer -@onready var click_sound: AudioStreamPlayer = $ClickSound func _ready(): if initial_active: