コード例 #1
0
        private static void ResetHandler()
        {
            clientComponentAutomaton?.Destroy();
            clientComponentAutomaton = null;

            gameplayInputContext?.Stop();
            gameplayInputContext = null;
        }
コード例 #2
0
        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."));
            });
        }