Shortcut fix
This commit is contained in:
parent
f3977a9f91
commit
fdff25d451
6 changed files with 224 additions and 39 deletions
|
|
@ -2,7 +2,7 @@ extends Node
|
|||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
LevelController.call("StartLevel",preload("uid://bu0dh5ct387xu"),preload("uid://br3364jty1j0i"))
|
||||
LevelController.call("StartLevel",preload("uid://bu0dh5ct387xu"),preload("uid://ctbue7dex4umy"))
|
||||
$ChannelPlayer.call("Play")
|
||||
|
||||
|
||||
|
|
|
|||
25
scripts/gui/seedpackets/HotbarShortcutSetter.cs
Normal file
25
scripts/gui/seedpackets/HotbarShortcutSetter.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
public partial class HotbarShortcutSetter : Node
|
||||
{
|
||||
[Export] private Array<Shortcut> shortcuts;
|
||||
[Export] private Control hotbar;
|
||||
public override void _Ready()
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Pregame)
|
||||
{
|
||||
for (int i = 0; i < hotbar.GetChildCount(); i++)
|
||||
{
|
||||
((Seedpacket)hotbar.GetChild(i)).Shortcut = shortcuts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
1
scripts/gui/seedpackets/HotbarShortcutSetter.cs.uid
Normal file
1
scripts/gui/seedpackets/HotbarShortcutSetter.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://di45o67gxmiql
|
||||
|
|
@ -28,11 +28,14 @@ public partial class RuntimeLevelData : Node
|
|||
|
||||
private LevelStates _currentState = LevelStates.ChooseYourSeeds;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
Engine.TimeScale = 1.0;
|
||||
SetLevelState(LevelStates.ChooseYourSeeds);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue