Unity3D說明文檔翻譯-Interaction Components

Interaction Components

組件交互

This section covers components in the UI system that handles interaction, such as mouse or touch events and interaction using a keyboard or controller.

這節介紹了UI系統內的組件交互操縱,諸如鼠標或觸摸事件和使用鍵盤或控制器的交互.

The interaction components are not visible on their own, and must be combined with one or morevisual elements in order to work correctly.

組件交互自身不可見,而必須和一個或多個可見元素聯合纔可正確工作.

Common Functionality

通用功能

Most of the interaction components have some things in common. They are selectables, which means they have shared built-in functionality for visualising transitions between states (normal, highlighted, pressed, disabled), and for navigation to other selectables using keyboard or controller. This shared functionality is described on the Selectable page.

大部分組件交互有一些相同的東西.它們是可選的,意味着它們分享內建功能用於使狀態(正常,高亮,按下,不可用)間的轉換可見,和用於導航到其他可選,使用鍵盤或控制器.共享功能在可選頁面描述.

Button

按鈕

A Button has an OnClick UnityEvent to define what it will do when clicked.

一個按鈕有一個OnClick Unity事件以定義當點擊時它將做什麼.

See the Button page for details on using the Button component.

查看按鈕頁面獲取使用按鈕組件的詳細信息.

Toggle

開關

A Toggle has an Is On checkbox that determines whether the Toggle is currently on or off. This value is flipped when the user clicks the Toggle, and a visual checkmark can be turned on or off accordingly. It also has an OnValueCHanged UnityEvent to define what it will do when the value is changed.

一個開關有一個IsOn複選框確定觸發器是開還是關.當用戶點擊開關值反轉,且一個可視化的鉤形符號可相應的開或關.也有一個OnValueChanged Unity事件以定義當值改變時它將做什麼.

See the Toggle page for details on using the Toggle component.

查看開關頁面獲取使用開關組件的詳情.

Toggle Group

開關組

A Toggle Group can be used to group a set of Toggles that are mutually exclusive. Toggles that belong to the same group are constrained so that only one of them can be selected at a time - selecting one of them automatically deselects all the others.

一個開關組可用於分組一組相互排斥的開關.屬於一個組開關是被約束的因此一次只有其中之一可被選中--選定其中一個自動取消其他所有選擇.

See the Toggle Group page for details on using the Toggle Group component.

查看開關組頁面獲取使用開關組組件詳情.

Slider

滑塊

A Slider has a decimal number Value that the user can drag between a minimum and maximum value. It can be either horizontal or vertical. It also has a OnValueChanged UnityEvent to define what it will do when the value is changed.

一個滑塊有一個十進制數值,用戶可以在一個最小和最大值之間拖動.它可以是橫向和縱向.它也有一個OnValueChangedUnity事件以定義當值改變時它將做什麼.

See the Slider page for details on using the Slider component.

詳情查看滑塊頁面.

Scrollbar

滾動條

A Scrollbar has a decimal number Value between 0 and 1. When the user drags the scrollbar, the value changes accordingly.

一個滾動條有一個十進制數值在0和1之間.當用戶拖動滾動條,值相應的改變.

Scrollbars are often used together with a Scroll Rect and a Mask to create a scroll view. The Scrollbar has a Size value between 0 and 1 that determines how big the handle is as a fraction of the entire scrollbar length. This is often controlled from another component to indicate how buig a proportion of the content in a scroll view is visible. The Scroll Rect component can automatically do this.

滾動條通常和一個滾動矩形和一個遮罩一起使用以創建一個滾動視圖.滾動條有一個大小屬性值在0和1之間,確定手柄作爲整個滾動條長度一部分的大小.這通常由另一個組件控制以指出多大比例的內容在滾動視圖內可見.滾動矩形組件可以自動做此事.

The Scrollbar can be either horizontal or vertical. It also has a OnValueChanged UnityEvent to define what it will do when the value is changed.

滾動條可以是橫向或縱向的.它也有一個OnValueChanged Unity事件以定義當值改變時它將怎麼做.

See the Scrollbar page for details on using the Scrollbar component.

查看滾動條頁面獲取使用滾動條組件詳情.

Dropdown

下拉菜單

A Dropdown has a list of options to choose from. A text string and optionally an image can be specified for each option, and can be set either in the Inspector or dynamically from code. It has a OnValueChanged UnityEvent to define what it will do when the currently chosen option is changed.

一個下拉菜單有一系列選項來選擇.一個文本字符串和一個可選的圖片可被指定到每個選項,且可在檢視面板或從代碼動態設置.它有一個OnValueChanged Unity事件以定義噹噹前選項改變時它將怎麼做.

See the Dropdown page for details on using the Dropdown component.

查看下拉菜單頁面獲取使用下拉菜單組件詳情.

Input Field

輸入字段

An Input Field is used to make the text of a Text Element editable by the user. It has a UnityEvent to define what it will do when the text content is changed, and an another to define what it will do when the user has finished editing it.

一個輸入字段用於使一個文本元素的文本可被用戶編輯.它有一個Unity事件以定義當文本內容改變時它將如何做,而另一個定義當用戶編輯完成時它如何做.

See the Input Field page for details on using the Input Field component.

查看輸入字段頁面獲取使用輸入字段組件詳情.

Scroll Rect (Scroll View)

滾動矩形(滾動視圖)

A Scroll Rect can be used when content that takes up a lot of space needs to be displayed in a small area. The Scroll Rect provides functionality to scroll over this content.

一個滾動矩形可用於當內容需要許多空間來在一小塊區域顯示時.滾動矩形提供功能來在內容上滾動.

Usually a Scroll Rect is combined with a Mask in order to create a scroll view, where only the scrollable content inside the Scroll Rect is visible. It can also additionally be combined with one or two Scrollbars that can be dragged to scroll horizontally or vertically.

通常一個滾動矩形是和一個遮罩聯合的以便創建一個滾動視圖,只有滾動矩形內的可滾動內容可見.它也能額外聯合一個或兩個滾動條,可橫向或縱向被拖拽滾動.

See the Scroll Rect page for details on using the Scroll Rect component.

查看滾動矩形頁面獲取使用滾動矩形組件詳情.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章