Exemplo n.º 1
0
        public static WaitForUserInput alloc()
        {
            WaitForUserInput l_instance = new WaitForUserInput();

            l_instance.Pressed = false;
            return(l_instance);
        }
        public int GetUserInputChar()
        {
            try
            {
                InputCharQueue.Clear();
                InputCharQueue.Clear();
                WaitForUserInput?.Invoke(this, EventArgs.Empty);

                while (InputCharQueue.Count == 0)
                {
                    Thread.Sleep(10);
                }

                return(InputCharQueue.Pop());
            }
            finally
            {
                EndWaitForUserInput?.Invoke(this, EventArgs.Empty);
            }
        }
        public string GetUserInputString()
        {
            try
            {
                InputCharQueue.Clear();
                InputCharQueue.Clear();

                WaitForUserInput?.Invoke(this, EventArgs.Empty);

                while (!InputCharQueue.Contains('\r'))
                {
                    Thread.Sleep(10);
                }

                InputCharQueue.Pop(); //pops \r

                return(new string(InputCharQueue.Reverse().ToArray()));
            }
            finally
            {
                EndWaitForUserInput?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 4
0
 public override void OnEventExecuted(EventQueue p_eventQueue, StartTurnEvent p_event)
 {
     EventQueue.insertBefore(p_eventQueue, p_event.FutureEndTurnEvent, WaitForUserInput.alloc());
 }