Feelx234 Posted March 28, 2016 Share Posted March 28, 2016 Hallo there, I'd like to handle keyboard input for my mod "Nice Dropship (De) Briefing". Unfortunately I have only found this entry on keyboard inputs:http://forums.nexusmods.com/index.php?/topic/3840700-handling-keyboard-input-from-uiscreenlistener-extension/?hl=%2Bkeyboard&do=findComment&comment=34962335which is pretty vague when it comes to how to actually do things. (Create Dummy class derived from UIScreen & use OnUnrealCommand???)So how are keyboard presses handled in XCom 2 and how could a mod do stuff on keyboard press? Link to comment Share on other sites More sharing options...
bountygiver Posted March 29, 2016 Share Posted March 29, 2016 (edited) you just put stuff like this into your UIScreen class simulated function bool OnUnrealCommand(int cmd, int arg) { if( !CheckInputIsReleaseOrDirectionRepeat(cmd, arg) ) return false; switch( cmd ) { case class'UIUtilities_Input'.const.FXS_BUTTON_B: case class'UIUtilities_Input'.const.FXS_KEY_ESCAPE: case class'UIUtilities_Input'.const.FXS_R_MOUSE_DOWN: OnCancel(); break; } return super.OnUnrealCommand(cmd, arg); } This example is how you implement closing a screen (OnCancel() function) with ESC/Controller button B/Right clickNote that screens don't catch listen to all input, you can listen to ctrl/alt/esc/arrows/mouse clicks/controller buttons Edited March 29, 2016 by bountygiver Link to comment Share on other sites More sharing options...
Recommended Posts