UDN
Search public documentation:
GFxKeyFiltersCH
English Translation
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
日本語訳
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
bCaptureInput, AddCaptureKey和AddFocusIgnoreKey指南
概述
我们需要筛选输入,这样当玩家按下一个按钮或移动了一个模拟杆时,就能给出正确的反应。 这大大改善了用户界面的使用情况。
bCaptureInput
在您类的默认设置中将此项设置成true(真值)可以将所有的输入(鼠标、键盘和游戏控制器)发送到Flash类/SWF,而不是发送到游戏。 将它设置为false(假值),则所有的输入都会传输到游戏。
defaultproperties { bCaptureInput=true or false }
AddFocusIgnoreKey
如果您将bCaptureInput设置为true(真值),SWF文件就不能捕捉单独的帧,而是使用AddFocusIgnoreKey将单独的帧传入游戏中。
AddFocusIgnoreKey('W');
AddCaptureKey
如果您将bCaptureInput设置为false(假值),SWF文件就能捕捉单独的帧,而不是将单独的帧传入游戏。
AddCaptureKey('W');
可捕捉帧的示例列表
当捕捉或忽略帧时,以下列表可以使用:
- 1 - 0, A - Z, F1 - F12
- 上、下、左、右
- Spacebar, Enter, Escape
- BackSpace、左Control键、右Control键
- 左Shift键、右Shift键、PageUp
- PageDown键、Home键、Insert键
- 等号、加号、Tab键
- 左Alt键、右Alt键
- one, two, three, ...
在ActionScript(动作脚本)中拦截输入
一旦您通过UnrealScript(虚幻脚本)或Kismet拦截一个帧时候,您可以使用以下代码监听在ActionScript(动作脚本)中的那些帧。
import flash.external.ExternalInterface; var keyboardInput:Object = new Object(); // creates a new object to hold keyboard input. Key.addListener(keyboardInput); // uses the object to listen for keyboard input. /* when a key is pressed, execute this function. */ keyboardInput.onKeyDown = function() { /* store the keyboard input ASCII code inside 'keyPressed'. */ var keyPressed:Number = Key.getCode(); trace("Key Pressed" + keyPressed); /* Call the UnrealScript function 'KeyPressed' and send it the 'keyPressed' value. */ ExternalInterface.call("KeyPressed", keyPressed); }