PDA

View Full Version : Hooking up a Key Ingame?



FlynT
02-01-2010, 12:28 PM
Hello everyone,

i got a small problem. I wanna hook up the Escape Key Ingame so that it open a UIScene.

The reason why i'm asking is, i managed the Main Menu stuff and all of that. My Menu has the following layout "Play, Options, Extras, Quit" so if i start the game the map loads etc. but as soon as i hit the Escape Button it returns to the Standard Main Menu Scene where i didn't have an option to simple continue the game. You know so that i can have another Menu Layout while you play the game, something like "Continue, Play, Options, Quit".

Excuse me English, i hope you understand what i mean.
Thanks in advanced :)

Star Weaver
02-01-2010, 12:47 PM
UTFrontend does it like this.

First they ste up this in their underlying root class.



class UTUIFrontEnd extends UTUIScene
...
function bool HandleInputKey( const out InputEventParameters EventParms )
{
return false;
}
...
defaultproperties
{
...
// Setup handler for input keys - do it in defaultproperties so that it doesn't get serialized in the editor
OnInterceptRawInputKey=HandleInputKey
}


I think that sets up a native callback based on code in UIScene? I'm not sure, I ran out of time to check that out.

That would probably prevent ESCing all on its own, but they go one step farther:



class UTUIFrontEnd_BasicMenu extends UTUIFrontEnd;
...
/** Whether or not to support a back button for this scene. */
var bool bSupportBackButton;
...
function bool HandleInputKey( const out InputEventParameters EventParms )
{
local bool bResult;
bResult=false;
if(bSupportBackButton && EventParms.EventType==IE_Released)
{
if(EventParms.InputKeyName=='XboxTypeS_B' || EventParms.InputKeyName=='Escape')
{
OnBack();
bResult=true;
}
}
return bResult;
}


And the root menu is the only one that dosen't have bSupportBackButton set to true; thus, you can ESC out of all the child windows (which are just opened on top of that one) but not out of the main menu itself.


Erm, and if what you're looking for is an ingame esc menu -- I realize I'm not totally clear on which problem (or is it both?) you're having -- do an advanced title only search for "MENU" starting at the UDK root forum; I found a bunch of stuff about that while looking for somethign else :)

FlynT
02-01-2010, 01:59 PM
First of all thanks for your reply and thanks for your help!

If fixed the problem, all i have to do was extending my UTPlayerController with




exec function PressEscape()
{
SetPause(true);
OpenUIScene(UIScene'Mypackage.UIScenes.MyScene');
}


As described in this Thread -> http://forums.epicgames.com/showthread.php?t=715177

My problem was that i redirected the OpenUIScene(); Command to my Standard Main menu and not the Ingame Menu.

Anyway thanks again for your help.

Star Weaver
02-01-2010, 03:27 PM
Cool, glad you got it working. I'm bored and frustrated with annoying slow things today, and I'm at the point of needing to get to understand the UDK codebase so I can start extending it, so I've no problem sitting around grepping things at the moment :)