Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit 64ba5a9

Browse files
committed
Add KeybindingHelper
1 parent 22e6515 commit 64ba5a9

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using SFS.Builds;
2+
using SFS.Input;
3+
using SFS.World;
4+
using System;
5+
6+
namespace ModLoader.Helpers
7+
{
8+
/// <summary>
9+
/// Use this class if you need add key events.
10+
/// </summary>
11+
static class KeybindingHelper
12+
{
13+
14+
/// <summary>
15+
/// Add onKeyDown on world and map
16+
/// </summary>
17+
/// <param name="key">key to trigger the event</param>
18+
/// <param name="action"> is executed when the event occurs</param>
19+
public static void AddOnKeyDownWorld(I_Key key, Action action)
20+
{
21+
GameManager.main.world_Input.keysNode.AddOnKeyDown(key, action);
22+
GameManager.main.map_Input.keysNode.AddOnKeyDown(key, action);
23+
}
24+
25+
/// <summary>
26+
/// Add onKeyDown on builder
27+
/// </summary>
28+
/// <param name="key">key to trigger the event</param>
29+
/// <param name="action"> is executed when the event occurs</param>
30+
public static void AddOnKeyDownBuilder(I_Key key, Action action)
31+
{
32+
BuildManager.main.build_Input.keysNode.AddOnKeyDown(key, action);
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)