NGUI v2.0 UI_3:UICamera UI摄像机类

沈子实
2023-12-01

UICamera

 

 

UICamera Class Reference
UICamera类引用

 

This script should be attached to each camera that's used to draw the objects with UI components on them. This may mean only one camera (main camera or your UI camera), or multiple cameras if you happen to have multiple viewports. Failing to attach this script simply means that objects drawn by this camera won't receive UI notifications:More...

这个脚本应该连接到每个相机,用来绘制对象与UI组件的相机。这可能意味着只有一个相机(主相机或你的UI相机),或多个摄像头如果你碰巧有多个视窗。未能将此脚本只是意味着对象受到这相机不会接收UI的通知:更多…

List of all members.所有成员的列表。

Classes

class  Highlighted
class  MouseOrTouch

Static Public Member Functions静态公共成员函数

staticUICamera FindCameraForLayer (int layer)
 Find the camera responsible for handling events on objects of the specified layer.
找到照相机负责事件处理对象指定的层。

Public Attributes公共属性

bool useMouse = true
 Whether the mouse input is used. 
是否使用鼠标输入。
bool useTouch = true
 Whether the touch-based input is used. 
是否使用触摸屏。
bool useKeyboard = true
 Whether the keyboard events will be processed. 
键盘事件是否会被处理。
bool useController = true
 Whether the joystick and controller events will be processed.
操纵杆和控制器的事件是否将会被处理。
LayerMask eventReceiverMask = -1
 Which layers will receive events. 
将接收事件的层。
float tooltipDelay = 1f
 How long of a delay to expect before showing the tooltip. 
延迟多久    显示工具提示。
string scrollAxisName = "Mouse ScrollWheel"
 Name of the axis used for scrolling. 
用于滚动的轴名。

Static Public Attributes静态公共属性

static Camera lastCamera
 Last camera active prior to sending out the event. This will always be the camera that actually sent out the event.
相机最活跃之前发送的事件。这将总会是实际上发出事件的照相机。
static RaycastHit lastHit
 Last raycast hit prior to sending out the event. This is useful if you want detailed information about what was actually hit in your OnClick, OnHover, and other event functions.
raycast最后打击之前发送的事件。这是有益的,如果你想要关于击中的详细信息     发生在OnClick,OnHover和其他事件函数中。
static Vector3 lastTouchPosition
 Last mouse or touch position in screen coordinates prior to sending out the event.
鼠标或触摸最后在屏幕坐标发送事件最后的位置。
static int lastTouchID = -1
 ID of the touch or mouse operation prior to sending out the event. Mouse ID is '-1' for left, '-2' for right mouse button, '-3' for middle.
ID触碰或鼠标操作之前,发送事件。鼠标ID ' -1 '用于左,' -2 '为鼠标右键,‘-3’为中间。
static GameObject fallThrough
 If events don't get handled, they will be forwarded to this game object.
如果事件没有得到处理,他们将被转发到这个游戏对象。

Properties属性

Camera cachedCamera [get]
 Caching is always preferable for performance. 
缓存的性能总是更可取的。
static GameObject hoveredObject [get]
 The object the mouse is hovering over. Results may be somewhat odd on touch-based devices.
鼠标悬停的对象。结果可能有些奇怪的触摸设备。
static GameObject selectedObject [get, set]
 Option to manually set the selected game object. 
选择手动设置选定的游戏对象。
static Camera mainCamera [get]
 Convenience function that returns the main HUD camera. 
便利函数,它返回主HUD相机。
staticUICamera eventHandler [get]
 Event handler for all types of events. 
对所有类型的事件事件处理程序。

Detailed Description详细描述

This script should be attached to each camera that's used to draw the objects with UI components on them. This may mean only one camera (main camera or your UI camera), or multiple cameras if you happen to have multiple viewports. Failing to attach this script simply means that objects drawn by this camera won't receive UI notifications:

这个脚本应该连接到每个相机,用来绘制对象与UI组件构成的。这可能意味着只有一个相机(主相机或你的UI相机),或多个摄像头如果你碰巧有多个视窗。未能将此脚本只是意味着对象受到这相机不会接收UI的通知:

  • OnHover (isOver) is sent when the mouse hovers over a collider or moves away.
  • OnPress (isDown) is sent when a mouse button gets pressed on the collider.
  • OnSelect (selected) is sent when a mouse button is released on the same object as it was pressed on.
  • OnClick (int button) is sent with the same conditions as OnSelect, with the added check to see if the mouse has not moved much.
  • OnDrag (delta) is sent when a mouse or touch gets pressed on a collider and starts dragging it.
  • OnDrop (gameObject) is sent when the mouse or touch get released on a different collider than the one that was being dragged.
  • OnInput (text) is sent when typing (after selecting a collider by clicking on it).
  • OnTooltip (show) is sent when the mouse hovers over a collider for some time without moving.
  • OnScroll (float delta) is sent out when the mouse scroll wheel is moved.
  • OnKey (KeyCode key) is sent when keyboard or controller input is used.
  OnHover(isOver)   当鼠标悬停在一个碰撞器或在碰撞器上移开时发送。  
        OnPress(isDown)   当鼠标按钮点击在一个碰撞器时发送。  
        OnSelect(selected)   当鼠标按钮在同一个对象上按下并释放时发送。  
        OnClick(int button)  包含OnSelect相同的条件下,且鼠标没有移动过。  
        OnDrag(delta)   一个鼠标或触摸被点击在一个碰撞器上并开始拖它时发送。  
        OnDrop(gameObject)    当鼠标或触摸得到释放   (拖拽一个碰撞器碰到另一个不同的碰撞器 释放鼠标时发送)。 
        OnInput(text)   当输入时(通过单击选择一个碰撞器)发送。  
        OnTooltip(show)   当鼠标悬停在一个碰撞器一段时间没有动时发送。  
        OnScroll(float delta)    当鼠标滚轮是滑动时。  
        OnKey(KeyCode key) 当键盘或输入控制器被使用时发送。

Member Function Documentation成员函数文档

static UICamera UICamera.FindCameraForLayer(int layer)[static]

Find the camera responsible for handling events on objects of the specified layer. 找到照相机负责事件处理对象指定的层。


Member Data Documentation
成员数据的文档

LayerMask UICamera.eventReceiverMask = -1

Which layers will receive events.

这层将接收事件。
 
GameObject UICamera.fallThrough [static]

If events don't get handled, they will be forwarded to this game object.

如果事件没有得到处理,他们将被转发到这个游戏对象。
 
Camera UICamera.lastCamera [static]

Last camera active prior to sending out the event. This will always be the camera that actually sent out the event.(上面已有  不再重复)

RaycastHit UICamera.lastHit[static]

Last raycast hit prior to sending out the event. This is useful if you want detailed information about what was actually hit in your OnClick, OnHover, and other event functions.

int UICamera.lastTouchID = -1 [static]

ID of the touch or mouse operation prior to sending out the event. Mouse ID is '-1' for left, '-2' for right mouse button, '-3' for middle.

Vector3 UICamera.lastTouchPosition [static]

Last mouse or touch position in screen coordinates prior to sending out the event.

string UICamera.scrollAxisName = "Mouse ScrollWheel"

Name of the axis used for scrolling.

float UICamera.tooltipDelay = 1f

How long of a delay to expect before showing the tooltip.

bool UICamera.useController = true

Whether the joystick and controller events will be processed.

bool UICamera.useKeyboard = true

Whether the keyboard events will be processed.

bool UICamera.useMouse = true

Whether the mouse input is used.

bool UICamera.useTouch = true

Whether the touch-based input is used.


Property Documentation属性的文档

Camera UICamera.cachedCamera [get]

Caching is always preferable for performance.

Event handler for all types of events.

GameObject UICamera.hoveredObject [static, get]

The object the mouse is hovering over. Results may be somewhat odd on touch-based devices.

Camera UICamera.mainCamera [static, get]

Convenience function that returns the main HUD camera.

GameObject UICamera.selectedObject [static, get, set]

Option to manually set the selected game object.


The documentation for this class was generated from the following file:
  • Assets/NGUI/Scripts/UI/UICamera.cs
 类似资料: