def HandleInputKey(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if caller != self._TrainingBox: return True self._HandleInput(params.ukey, params.uevent) self.OnInput(params.ukey, params.uevent) # Decode when we exit from keypresses if params.uevent == 1: if params.ukey in self._SubmitKeys: unrealsdk.RemoveHook( "WillowGame.WillowGFxTrainingDialogBox.HandleInputKey", "CustomTextInputBox") self._TrainingBox = None self.OnSubmit("".join(self._Message)) elif params.ukey in self._ExitKeys: unrealsdk.RemoveHook( "WillowGame.WillowGFxTrainingDialogBox.HandleInputKey", "CustomTextInputBox") self._TrainingBox = None self.OnSubmit("") # Normally the use key causes exits too, block it useKey = "FAKE" if caller.GetPC().PlayerInput is not None: useKey = caller.GetPC().PlayerInput.GetKeyForAction( "Use", True) return str(params.ukey) != useKey
def HandleInputKey(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if caller == self._TrainingBox: self.OnInput(params.ukey, params.uevent) # We don't have a good function to hook for when this exits so we have to decode it # from the key presses if self._TrainingBox is not None and self._TrainingBox.DelayUntilShowOk < 0 and params.uevent == 1: use_key = "FAKE" if caller.GetPC().PlayerInput is not None: use_key = caller.GetPC().PlayerInput.GetKeyForAction("Use", True) if params.ukey in self._ExitKeys or params.ukey == use_key: unrealsdk.RemoveHook("WillowGame.WillowGFxTrainingDialogBox.HandleInputKey", "CustomTrainingBox") self._TrainingBox = None self.OnExit() return True