NGUI: UICamera
- 詳細內容
- 分類:Unity
- 發佈:2013-11-20, 週三 00:35
- 點擊數:1820
(維克:此為舊版說明文件,新版請參考:NGUI:UICamera)
NGUI: UICamera
UICamera script is a key component of every functional UI. It’s responsible for sending out NGUI events to the colliders of all objects drawn by that camera. If you have one camera in the scene, make sure it has UICamera script on it. If you have more than one, make sure that at least the camera that’s drawing the UI has it. Placing this script on your main camera used to draw your scene allows your in-game objects to receive all the OnClick, OnHover, OnDrag and other events as well.
UICamera 腳本是各種功能UI(使用者介面)的重要組件。他負責送出NGUI事件給所有由該攝影機所繪出物件的碰撞器。假如你場景中有一個攝影機,就要確定它有UICamera腳本在其中。假如你有多個的攝影機,要確定至少用來繪出UI的攝影機有這個腳本。把這個腳本放到你的主要攝影機中會讓你所有在遊戲中的物件也都能接受到OnClick, OnHover, OnDrag與其它的NGUI事件。
Parameters
-
Use Mouse determines whether the camera is going to react to mouse events.
-
Use Touch turns touch event handling on or off.
-
Use Keyboard will allow the keyboard events to be sent out (OnKey).
-
Use Controller will allow the joystick-based events to work (also via OnKey).
-
Event Receiver Mask determines which layers will be eligible to receive events. Generally you will want it to match the Culling Mask on the Camera.
-
Tooltip Delay controls how many seconds the mouse needs to be stationary for before an OnTooltip event is sent out to the hovered object.
-
Mouse Click Threshold controls how far the mouse is able to travel after OnPress(true) event before it’s no longer eligible for OnClick().
-
Touch Click Threshold is the same, but for touch-based devices.
-
Range Distance determines how far away the objects are able to receive events from the camera, if the value is above zero. Below zero means “as far as the camera can see”.
-
Scroll Axis Name lets you change the axis used for theOnScroll events.
參數:
-
Use Mouse 決定攝影機是否響應滑鼠事件。
-
Use Touch 開啟或關閉touch(接觸)事件處理。
-
Use Keyboard 是否允許鍵盤事件送出(OnKey)。
-
Use Controller 是否允許基於搖桿的事件運作(藉由OnKey)。
-
Event Receiver Mask 決定哪個layers(層)能夠接收到事件。一般情況下,會是希望跟Camera中的Culling Mask相同。(維克:Culling Mask是camera的屬性,用來決定哪些層會在攝影機中出現,那些層不會出現)。
-
Tooltip Delay 要懸停多久的時間才會送出OnTooltip事件到滑鼠懸停的物件上。
-
Mouse Click Threshold 控制滑鼠在 OnPress(true)事件後能到達多遠,在OnClick()失效前。
-
Touch Click Threshold 與上面相同,但是是基於搖桿裝置。
-
Range Distance 決定由攝影機算起,物件能接收訊息的距離,假如該值小於0,則代表攝影機能看到的遠距離。
-
Scroll Axis Name 讓你改變使用在theOnScroll事件上的軸。
Tips
-
It’s possible to use UICamera without using the rest of the NGUI system just for the handy event system feature.
提示:
為了便利的NGUI 事件系統功能,而只單獨使用UICamera腳本,不使用NGUI系統中的其餘部分是可行的。
按個讚!~支持本站!~