23 lines
703 B
C#
23 lines
703 B
C#
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Microsoft.Xna.Framework.Input;
|
||
|
|
using MonoGameLibrary.Input;
|
||
|
|
using PacketLib;
|
||
|
|
|
||
|
|
namespace FNAF_Clone;
|
||
|
|
|
||
|
|
public class CommandManager {
|
||
|
|
private static (string label, Keys key, Action action)[] keybinds = [
|
||
|
|
("Toggle Camera", Keys.S, ToggleCamera)
|
||
|
|
];
|
||
|
|
|
||
|
|
private static InputListenerHook toggleCamHook = new(true);
|
||
|
|
|
||
|
|
public static void InitInputListeners() {
|
||
|
|
Array.ForEach(keybinds, tuple => InputManager.AddListener(tuple.label, tuple.key, _ => tuple.action(), InputTiming.PRESS, toggleCamHook));
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void ToggleCamera() {
|
||
|
|
Client.SendCommands([PlayerCommand.TOGGLE_MONITOR()]);
|
||
|
|
}
|
||
|
|
}
|