Inheritance: System.EventArgs
Ejemplo n.º 1
0
		private bool ProcessMenuEvent(SystemEvent ev)
		{
			if(_guiActive == null)
			{
				return true;
			}

			string menuCommand = _guiActive.HandleEvent(ev, idE.System.FrameTime);

			if((menuCommand != null) && (menuCommand.Length > 0))
			{
				idConsole.Warning("TODO: key binding");
				// if the menu didn't handle the event, and it's a key down event for an F key, run the bind
				// TODO: keys
				/*if ( event->evType == SE_KEY && event->evValue2 == 1 && event->evValue >= K_F1 && event->evValue <= K_F12 ) {
					idKeyInput::ExecKeyBinding( event->evValue );
				}*/
			}
			else
			{
				DispatchCommand(_guiActive, menuCommand);
			}

			return true;
		}
Ejemplo n.º 2
0
		public bool ProcessEvent(SystemEvent ev)
		{
			// hitting escape anywhere brings up the menu
			if((_guiActive == null) && (ev.Type == SystemEventType.Key) && (ev.Value2 == 1) && (ev.Value == (int) Keys.Escape))
			{
				idConsole.Warning("TODO: escape");
			
				/*console->Close();
				if ( game ) {
					idUserInterface	*gui = NULL;
					escReply_t		op;
					op = game->HandleESC( &gui );
					if ( op == ESC_IGNORE ) {
						return true;
					} else if ( op == ESC_GUI ) {
						SetGUI( gui, NULL );
						return true;
					}
				}
				StartMenu();
				return true;*/
			}

			// let the pull-down console take it if desired
			if(idE.Console.ProcessEvent(ev, false) == true)
			{
				return true;
			}

			// if we are testing a GUI, send all events to it
			if(_guiTest != null)
			{
				// hitting escape exits the testgui
				if((ev.Type == SystemEventType.Key) && (ev.Value2 == 1) && (ev.Value == (int) Keys.Escape))
				{
					_guiTest = null;
					return true;
				}
		
				string cmd = _guiTest.HandleEvent(ev, idE.System.FrameTime);

				if(cmd != string.Empty)
				{
					idConsole.WriteLine("testGui event returned: '{0}'", cmd);
				}

				return true;
			}

			// menus / etc
			if(_guiActive != null)
			{
				ProcessMenuEvent(ev);
				return true;
			}

			// if we aren't in a game, force the console to take it
			if(_mapSpawned == false)
			{
				idE.Console.ProcessEvent(ev, true);
				return true;
			}

			// in game, exec bindings for all key downs
			if((ev.Type == SystemEventType.Key) && (ev.Value2 == 1))
			{
				idConsole.Warning("TODO: idKeyInput::ExecKeyBinding( event->evValue );");
				return true;
			}

			return false;
		}
Ejemplo n.º 3
0
        private SystemEvent GetRealEvent()
        {
            SystemEvent ev;

            //idConsole.Warning("TODO: journalling");
            // either get an event from the system or the journal file
            // TODO: journalling

            /*if(com_journal.GetInteger() == 2)
             * {
             *      r = com_journalFile->Read(&ev, sizeof(ev));
             *      if(r != sizeof(ev))
             *      {
             *              common->FatalError("Error reading from journal file");
             *      }
             *      if(ev.evPtrLength)
             *      {
             *              ev.evPtr = Mem_ClearedAlloc(ev.evPtrLength);
             *              r = com_journalFile->Read(ev.evPtr, ev.evPtrLength);
             *              if(r != ev.evPtrLength)
             *              {
             *                      common->FatalError("Error reading from journal file");
             *              }
             *      }
             * }
             * else*/
            {
                // return if we have data
                if (_events.Count > 0)
                {
                    return(_events.Dequeue());
                }
                else
                {
                    // return the empty event
                    ev = new SystemEvent(SystemEventType.None);
                }

                // write the journal value out if needed
                // TODO: journalling

                /*if(com_journal.GetInteger() == 1)
                 * {
                 *      r = com_journalFile->Write(&ev, sizeof(ev));
                 *      if(r != sizeof(ev))
                 *      {
                 *              common->FatalError("Error writing to journal file");
                 *      }
                 *      if(ev.evPtrLength)
                 *      {
                 *              r = com_journalFile->Write(ev.evPtr, ev.evPtrLength);
                 *              if(r != ev.evPtrLength)
                 *              {
                 *                      common->FatalError("Error writing to journal file");
                 *              }
                 *      }
                 * }*/
            }

            return(ev);
        }
Ejemplo n.º 4
0
		private void ProcessEvent(SystemEvent ev)
		{
			if(ev.Type == SystemEventType.Console)
			{
				idConsole.Warning("TODO: external console");

				// from a text console outside the game window
				// TODO: console
				//cmdSystem->BufferCommandText( CMD_EXEC_APPEND, (char *)ev.evPtr );
				//cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "\n" );
			} 
			else 
			{
				idE.Session.ProcessEvent(ev);
			}
		}
Ejemplo n.º 5
0
		private SystemEvent GetRealEvent()
		{
			SystemEvent ev;

			//idConsole.Warning("TODO: journalling");
			// either get an event from the system or the journal file
			// TODO: journalling
			/*if(com_journal.GetInteger() == 2)
			{
				r = com_journalFile->Read(&ev, sizeof(ev));
				if(r != sizeof(ev))
				{
					common->FatalError("Error reading from journal file");
				}
				if(ev.evPtrLength)
				{
					ev.evPtr = Mem_ClearedAlloc(ev.evPtrLength);
					r = com_journalFile->Read(ev.evPtr, ev.evPtrLength);
					if(r != ev.evPtrLength)
					{
						common->FatalError("Error reading from journal file");
					}
				}
			}
			else*/
			{
				// return if we have data
				if(_events.Count > 0)
				{
					return _events.Dequeue();
				}
				else 
				{
					// return the empty event 
					ev = new SystemEvent(SystemEventType.None);
				}

				// write the journal value out if needed
				// TODO: journalling
				/*if(com_journal.GetInteger() == 1)
				{
					r = com_journalFile->Write(&ev, sizeof(ev));
					if(r != sizeof(ev))
					{
						common->FatalError("Error writing to journal file");
					}
					if(ev.evPtrLength)
					{
						r = com_journalFile->Write(ev.evPtr, ev.evPtrLength);
						if(r != ev.evPtrLength)
						{
							common->FatalError("Error writing to journal file");
						}
					}
				}*/
			}

			return ev;
		}
Ejemplo n.º 6
0
		public bool ProcessEvent(SystemEvent ev, bool forceAccept)
		{
			 bool consoleKey = (ev.Type == SystemEventType.Key)
									&& ((Keys) ev.Value == Keys.Oem8);

			// we always catch the console key event
			if((forceAccept == false) && (consoleKey == true))
			{
				// ignore up events
				if(ev.Value2 == 0)
				{
					return true;
				}			

				idConsole.Warning("TODO: _consoleField.ClearAutoComplete();");

				// a down event will toggle the destination lines
				if(_keyCatching == true)
				{
					Close();

					idE.Input.GrabMouse = true;
					idE.CvarSystem.SetBool("ui_chat", false);
				}
				else
				{
					_consoleField.Clear();
					_keyCatching = true;

					if(idE.Input.IsKeyDown(Keys.LeftShift) == true)
					{
						// if the shift key is down, don't open the console as much
						SetDisplayFraction(0.2f);
					}
					else
					{
						SetDisplayFraction(0.5f);
					}

					idE.CvarSystem.SetBool("ui_chat", true);
				}

				return true;
			}

			// if we aren't key catching, dump all the other events
			if((forceAccept == false) && (_keyCatching == false))
			{
				return false;
			}

			// handle key and character events
			if(ev.Type == SystemEventType.Char)
			{
				idConsole.Warning("TODO: ev char");

				// never send the console key as a character
				/*if ( event->evValue != Sys_GetConsoleKey( false ) && event->evValue != Sys_GetConsoleKey( true ) ) {
					consoleField.CharEvent( event->evValue );
				}*/
				return true;
			}

			if(ev.Type == SystemEventType.Key)
			{
				// ignore up key events
				if(ev.Value2 == 0)
				{
					return true;
				}

				idConsole.Warning("TODO: KeyDownEvent( event->evValue );");
		
				return true;
			}

			// we don't handle things like mouse, joystick, and network packets
			return false;
		}
Ejemplo n.º 7
0
        public bool ProcessEvent(SystemEvent ev, bool forceAccept)
        {
            bool consoleKey = (ev.Type == SystemEventType.Key) &&
                              ((Keys)ev.Value == Keys.Oem8);

            // we always catch the console key event
            if ((forceAccept == false) && (consoleKey == true))
            {
                // ignore up events
                if (ev.Value2 == 0)
                {
                    return(true);
                }

                idConsole.Warning("TODO: _consoleField.ClearAutoComplete();");

                // a down event will toggle the destination lines
                if (_keyCatching == true)
                {
                    Close();

                    idE.Input.GrabMouse = true;
                    idE.CvarSystem.SetBool("ui_chat", false);
                }
                else
                {
                    _consoleField.Clear();
                    _keyCatching = true;

                    if (idE.Input.IsKeyDown(Keys.LeftShift) == true)
                    {
                        // if the shift key is down, don't open the console as much
                        SetDisplayFraction(0.2f);
                    }
                    else
                    {
                        SetDisplayFraction(0.5f);
                    }

                    idE.CvarSystem.SetBool("ui_chat", true);
                }

                return(true);
            }

            // if we aren't key catching, dump all the other events
            if ((forceAccept == false) && (_keyCatching == false))
            {
                return(false);
            }

            // handle key and character events
            if (ev.Type == SystemEventType.Char)
            {
                idConsole.Warning("TODO: ev char");

                // never send the console key as a character

                /*if ( event->evValue != Sys_GetConsoleKey( false ) && event->evValue != Sys_GetConsoleKey( true ) ) {
                 *      consoleField.CharEvent( event->evValue );
                 * }*/
                return(true);
            }

            if (ev.Type == SystemEventType.Key)
            {
                // ignore up key events
                if (ev.Value2 == 0)
                {
                    return(true);
                }

                idConsole.Warning("TODO: KeyDownEvent( event->evValue );");

                return(true);
            }

            // we don't handle things like mouse, joystick, and network packets
            return(false);
        }