shorcuts
This commit is contained in:
parent
4f74636ce9
commit
175d813230
3 changed files with 79 additions and 12 deletions
|
|
@ -1115,7 +1115,7 @@ _observedEntity = NodePath("../../../../../../../..")
|
|||
|
||||
[node name="LeftLowerArm" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm"]
|
||||
position = Vector2(-2, 14)
|
||||
scale = Vector2(0.999828, 0.999828)
|
||||
scale = Vector2(0.999829, 0.999829)
|
||||
rest = Transform2D(1, 0, 0, 1, -2, 14)
|
||||
editor_settings/show_bone_gizmo = false
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=21 format=3 uid="uid://cfnmspei3k4p7"]
|
||||
[gd_scene load_steps=32 format=3 uid="uid://cfnmspei3k4p7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"]
|
||||
[ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/themes/GameStyle.tres" id="1_xf6ra"]
|
||||
|
|
@ -19,6 +19,72 @@ texture_margin_right = 4.0
|
|||
texture_margin_bottom = 4.0
|
||||
axis_stretch_horizontal = 1
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_lxxir"]
|
||||
resource_name = "shortcutter"
|
||||
script/source = "extends Node
|
||||
|
||||
@export var keys : Array[InputEventKey]
|
||||
@export var where_to_map : Node
|
||||
|
||||
func _ready() -> void:
|
||||
while get_tree().paused:
|
||||
await get_tree().process_frame
|
||||
for i in range(where_to_map.get_child_count()):
|
||||
var key = InputEventKey.new()
|
||||
where_to_map.get_child(i).shortcut = Shortcut.new()
|
||||
where_to_map.get_child(i).shortcut.events.append(keys[i])
|
||||
"
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_lxxir"]
|
||||
device = -1
|
||||
keycode = 49
|
||||
unicode = 49
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_5kkbf"]
|
||||
device = -1
|
||||
keycode = 50
|
||||
unicode = 50
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_xq48m"]
|
||||
device = -1
|
||||
keycode = 51
|
||||
unicode = 51
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_cti1a"]
|
||||
device = -1
|
||||
keycode = 52
|
||||
unicode = 52
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_s07y0"]
|
||||
device = -1
|
||||
keycode = 53
|
||||
unicode = 53
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_hmpwl"]
|
||||
device = -1
|
||||
keycode = 54
|
||||
unicode = 54
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_kqrbi"]
|
||||
device = -1
|
||||
keycode = 55
|
||||
unicode = 55
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_s6pj4"]
|
||||
device = -1
|
||||
keycode = 56
|
||||
unicode = 56
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_ar74i"]
|
||||
device = -1
|
||||
keycode = 57
|
||||
unicode = 57
|
||||
|
||||
[sub_resource type="InputEventKey" id="InputEventKey_k8sc7"]
|
||||
device = -1
|
||||
keycode = 48
|
||||
unicode = 48
|
||||
|
||||
[sub_resource type="InputEventAction" id="InputEventAction_xq48m"]
|
||||
action = &"short_shovel"
|
||||
pressed = true
|
||||
|
|
@ -128,6 +194,12 @@ layout_mode = 2
|
|||
mouse_filter = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="ShortcutSetter" type="Node" parent="MarginContainer/Control/Hotbar/PanelContainer" node_paths=PackedStringArray("where_to_map")]
|
||||
process_mode = 1
|
||||
script = SubResource("GDScript_lxxir")
|
||||
keys = Array[InputEventKey]([SubResource("InputEventKey_lxxir"), SubResource("InputEventKey_5kkbf"), SubResource("InputEventKey_xq48m"), SubResource("InputEventKey_cti1a"), SubResource("InputEventKey_s07y0"), SubResource("InputEventKey_hmpwl"), SubResource("InputEventKey_kqrbi"), SubResource("InputEventKey_s6pj4"), SubResource("InputEventKey_ar74i"), SubResource("InputEventKey_k8sc7")])
|
||||
where_to_map = NodePath("../Seedpackets")
|
||||
|
||||
[node name="Space" type="Control" parent="MarginContainer/Control/Hotbar"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ namespace Newlon.Components.GUI.Seedpackets;
|
|||
|
||||
public partial class Seedpacket : TextureButton
|
||||
{
|
||||
public static AudioStream TapStream;
|
||||
public static AudioStream UntapStream;
|
||||
public static AudioStream LiftStream;
|
||||
public static AudioStream TapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap.mp3");
|
||||
public static AudioStream UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
|
||||
public static AudioStream LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
|
||||
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
|
||||
private DisplayResource _resource;
|
||||
private Label _cost;
|
||||
|
|
@ -21,12 +21,6 @@ public partial class Seedpacket : TextureButton
|
|||
// Node overrides
|
||||
public override void _Ready()
|
||||
{
|
||||
if (TapStream == null)
|
||||
{
|
||||
TapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap.mp3");
|
||||
UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
|
||||
LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
|
||||
}
|
||||
if (_resource != null)
|
||||
UpdateContents();
|
||||
if (Prefab == null)
|
||||
|
|
@ -84,6 +78,7 @@ public partial class Seedpacket : TextureButton
|
|||
{
|
||||
if (_handler is ISeedpacketPress pressHandler)
|
||||
pressHandler.Pressed();
|
||||
GrabFocus();
|
||||
}
|
||||
|
||||
public void Recharge()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue