Funkční komunikace mezi jedním clientem a serverem
This commit is contained in:
commit
3f235f6e04
44 changed files with 1030 additions and 0 deletions
23
FNAF_Clone/CommandManager.cs
Normal file
23
FNAF_Clone/CommandManager.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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()]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue