private static void ResetHandler() { clientComponentAutomaton?.Destroy(); clientComponentAutomaton = null; gameplayInputContext?.Stop(); gameplayInputContext = null; }
private static void GameInitHandler(ICharacter currentCharacter) { clientComponentAutomaton = Api.Client.Scene.GetSceneObject(currentCharacter) .AddComponent <ClientComponentAutomaton>(AutomatonManager.IsEnabled); gameplayInputContext = ClientInputContext .Start("Automaton options toggle") .HandleButtonDown(AutomatonButton.OpenSettings, AutomatonOverlay.Toggle) .HandleButtonDown(AutomatonButton.Toggle, () => { if (clientComponentAutomaton == null) { return; } AutomatonManager.IsEnabled = !clientComponentAutomaton.IsEnabled; clientComponentAutomaton.IsEnabled = AutomatonManager.IsEnabled; NotificationSystem.ClientShowNotification( "Automaton is " + (AutomatonManager.IsEnabled ? "enabled." : "disabled.")); }); }