private void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            InputInterceptor.EnableInput();
        }

        if (Input.GetKeyDown(debugSequence[debugSequenceIndex].ToString()))
        {
            debugSequenceIndex++;
            if (debugSequenceIndex != debugSequence.Length)
            {
                return;
            }

            TwitchPlaySettings.data.TwitchPlaysDebugEnabled = !TwitchPlaySettings.data.TwitchPlaysDebugEnabled;
            TwitchPlaySettings.WriteDataToFile();

            debugSequenceIndex = 0;
            UserAccess.AddUser("_TPDEBUG".ToLowerInvariant(), AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod);
            UserAccess.WriteAccessList();
        }
        else if (Input.anyKeyDown)
        {
            debugSequenceIndex = 0;
        }
    }
Exemplo n.º 2
0
        public GameManager(Form mainForm)
        {
            instance  = this;
            games     = new Dictionary <string, GenericGameInfo>();
            gameInfos = new Dictionary <string, GenericGameInfo>();

            GameManager.mainForm       = mainForm;
            GameManager.mainFormHandle = mainForm.Handle;

            string appData = GetAppContentPath();

            Directory.CreateDirectory(appData);

            string gameJs = GetJsScriptsPath();

            Directory.CreateDirectory(gameJs);

            inputInterceptor = new InputInterceptor();

            //Subscribe to raw input
            //TODO: update isRunningSplitScreen
            Debug.WriteLine("Registering raw input");
            rawInputProcessor = new RawInputProcessor(() => LockInput.IsLocked);            //TODO: needs more robust method
            //Action<IntPtr> rawInputAction = rawInputProcessor.Process;
            //GameManager.mainForm.GetType().GetProperty("RawInputAction").SetValue(GameManager.mainForm, rawInputAction, new object[] { });
            //IntPtr rawInputHwnd = GameManager.mainFormHandle;

            RawInputManager.RegisterRawInput(rawInputProcessor);

            Initialize();
            LoadUser();
        }
    private void Update()
    {
        MainThreadQueue.ProcessQueue();

        if (Input.GetKey(KeyCode.Escape))
        {
            InputInterceptor.EnableInput();
            TwitchGame.ModuleCameras?.DisableCameraWall();
        }

        if (Input.GetKeyDown(DebugSequence[_debugSequenceIndex].ToString()))
        {
            _debugSequenceIndex++;
            if (_debugSequenceIndex != DebugSequence.Length)
            {
                return;
            }

            TwitchPlaySettings.data.TwitchPlaysDebugEnabled = !TwitchPlaySettings.data.TwitchPlaysDebugEnabled;
            TwitchPlaySettings.WriteDataToFile();

            chatSimulator.SetActive(TwitchPlaySettings.data.TwitchPlaysDebugEnabled);

            _debugSequenceIndex = 0;
            UserAccess.AddUser("_TPDEBUG".ToLowerInvariant(), AccessLevel.Streamer | AccessLevel.SuperUser | AccessLevel.Admin | AccessLevel.Mod);
            UserAccess.WriteAccessList();
        }
        else if (Input.anyKeyDown)
        {
            _debugSequenceIndex = 0;
        }
    }
Exemplo n.º 4
0
 private void Update()
 {
     if (Input.GetKey(KeyCode.Escape))
     {
         InputInterceptor.EnableInput();
     }
 }
 /// <inheritdoc />
 protected override void OnAttached()
 {
     _inputInterceptor = IoC.Resolve <InputInterceptor>();
     _inputInterceptor.VirtualMouseAction += InputInterceptorVirtualMouseAction;
     VirtualMouse.KeyDown += VirtualMouse_KeyDown;
     VirtualMouse.KeyUp   += VirtualMouse_KeyDown;
     _wih          = new WindowInteropHelper(Application.Current.MainWindow);
     _windowHandle = _wih.EnsureHandle();
 }
Exemplo n.º 6
0
 public GameAreaFocusService()
 {
     FocusedElements = new ConcurrentDictionary <int, DependencyObject>();
     Conatainer      = new ConcurrentDictionary <int, UIElement>();
     IoC.ResolveLater <InputInterceptor>().ContinueWith(e =>
     {
         _inputInterceptor = e.Result;
         _inputInterceptor.VirtualMouseAction += InputInterceptor_VirtualMouseAction;
     });
 }
Exemplo n.º 7
0
    private void OnEnable()
    {
        if (!TwitchPlaysService.DebugMode)
        {
            InputInterceptor.DisableInput();
        }

        leaderboard.ClearSolo();
        TwitchPlaysService.logUploader.Clear();

        StartCoroutine(CheckForBomb());
    }
    private void Update()
    {
        if (_ircConnection != null)
        {
            _ircConnection.Update();
        }

        if (Input.GetKey(KeyCode.Escape))
        {
            InputInterceptor.EnableInput();
        }
    }
Exemplo n.º 9
0
 public static bool EnableDisableInput()
 {
     if (IRCConnection.Instance.State == IRCConnectionState.Connected && !TwitchPlaySettings.data.EnableInteractiveMode && BombActive)
     {
         InputInterceptor.DisableInput();
         return(true);
     }
     else
     {
         InputInterceptor.EnableInput();
         return(false);
     }
 }
 public static bool EnableDisableInput()
 {
     if (!TwitchPlaysService.DebugMode && TwitchPlaySettings.data.EnableTwitchPlaysMode && !TwitchPlaySettings.data.EnableInteractiveMode && BombActive)
     {
         InputInterceptor.DisableInput();
         return(true);
     }
     else
     {
         InputInterceptor.EnableInput();
         return(false);
     }
 }
Exemplo n.º 11
0
    private IEnumerator CheckForResultsPage()
    {
        yield return(null);

        while (true)
        {
            ResultPage[] resultPages = FindObjectsOfType <ResultPage>();
            if (resultPages != null && resultPages.Length > 0)
            {
                ResultPage resultPageBehaviour = resultPages[0];
                _postGameCommander = new PostGameCommander(resultPageBehaviour);
                break;
            }

            yield return(null);
        }
        InputInterceptor.EnableInput();
    }
Exemplo n.º 12
0
    private IEnumerator CheckForResultsPage()
    {
        yield return(null);

        while (true)
        {
            UnityEngine.Object[] resultPages = FindObjectsOfType(CommonReflectedTypeInfo.ResultPageType);
            if (resultPages != null && resultPages.Length > 0)
            {
                MonoBehaviour resultPageBehaviour = (MonoBehaviour)resultPages[0];
                _postGameCommander = new PostGameCommander(resultPageBehaviour);
                break;
            }

            yield return(null);
        }
        InputInterceptor.EnableInput();
    }
 /// <inheritdoc />
 protected override void OnAttached()
 {
     _inputInterceptor     = IoC.Resolve <InputInterceptor>();
     _gameAreaFocusService = IoC.Resolve <GameAreaFocusService>();
     _inputInterceptor.VirtualKeyboardAction += InputInterceptorOnVirtualKeyboardAction;
 }