Original first, please poke: (v) Unity4.6ugui Chinese Course document-------Overview-ugui Interaction components
4.Interaction components
This section covers components in a UI system that handles interactions such as mouse or touch events, and interacts with the keyboard or controller .
4.1 selectable BaseClass
All of the interactions have some common elements. Selectables is the base class for all of their controls, which means they all have a shared state, a forward-looking transition between them and a built-in feature that navigates to other selectables using the keyboard or controller. This shared feature is described here.
There are several transition options within a selectable component to choose which state is currently in. The different statuses arenormal,highlighted highlighted,pressed pressed and disabled disabled.
Here is the transition transition option:
Color Tint-the color is changed according to what state the button is in, and each state can correspond to one color. It is also possible to set the Fade Duration between different states . The higher the number, the slower the fade color will be.
Spriteswap-Changes the picture according to what state the button is in, and the sprite can customize the display.
Animation -Performs a different animation depending on what state the button is in, andthe animator component must exist in order to use an animated transition. It is important to ensure that the root movement is in a disabled state. To create a animation controller click Generate animation (or you create it yourself) and make sure that the animation controller has been added to the button's animation component. For more information, see Animation integration.
none-This option is the effect that the button has no state at all.
The navigation navigation option refers to how the Ugui element in playback mode will navigate control.
4.2 Button
Button has an option for the onclick function to define what to do when the button is clicked. In the lower right corner is a ' + ' symbol, to add a delegate;
The first step is to select an object whose functionality is required.
The next step is to select the function
The last step is based on the variables in the selected function.
The label attached to the button has a text component that separates the label and button, allowing more freedom in design and customization. It is possible to set the displayed text, font, font style, font size, text color, and whether rich text formatting is enabled.
4.3 Toggle
The toggle switch has a Rect transform component, animage component, and a toggle switch assembly. It also has a sub-object label label appended to it,and the label has a Rect transform component and Text text component. The Toggle switch has additional sub-game object image called background background, setting the switch toggle background, and owning its own sub-object image game object called Checkmark to show toggle to selected or unselected.
Toggle Group
is on the check box to determine whether it is currently on or off.
Toggle Transition gives you the option of fade between Toggle activation and not activating.
The graphic graphics option is used to toggle the background change to a more appropriate image if the Colortint is selected and this will be affected by the color change.
There is also an option on the function of Value Changed , which defines what will be done if you choose to switch. In the lower right corner is a symbol of ' + ', to add a delegate:
The first step is to select an object whose functionality is required
The next step is to select the function
The last step is used according to the variables in the selected function.
4.4 Toggle Group
You can Toggle The group Switch Switch Group is a set of switching switches. A toggle that belongs to the same group, the constraint is such that only one switch is selected at a time, and selecting one of them will automatically deselect all other people.
Togglegroup is created by creating a new empty object, and then adding the Toggle group component to the empty object. The object becomes a togglegroup. Assigning it to toggle's toggle group enables the group to function.
Look at a switch in the switch group.
Toggle Group
Toggle Group switch is Setup, drag the toggle Group object to the Group property of the switch . Switching groups is useful for any user who chooses from a list of mutually exclusive items.
4.5 Slider
The slider slider game object can be vertical or horizontal, and it has a child object attached to it called the fill area, which also has a child object attached to it that is called a fill. Therefore, it cannot exceed the bounds of the slider game object, and the transformed value of the filled game object is driven by its parent's transformation value.
The value increase direction can be set to the horizontal slider, left to right or right to left or bottom up to a vertical scroll bar.
You can set the Min and max values in the minimum minimum and maximum maximum slider values for the field. If the entire numbers number option is selected then the slider will only move up or down when the value is an integer. The value is the current value where the slider is located.
It is also possible to add script behavior, when the value of the slider changes, it can be customized on the field on value changed.
4.6 Scrollbar
The scroll bar Game object can be vertical or horizontal. It has a child object attached to it called the background background, there is also child attached to it called Sliding area, there is a child called handle. The transform value of the handle game object is driven by its parent object transform value, so it cannot exceed the bounds of the ScrollBar game object.
Handle rect defines what the slider will be, by default it is set to a child game object called Handle. The value increase direction can be set to left to right or right to left for a horizontal scroll bar, or down to a vertical scroll bar.
You can use the Value field to start the scroll bar, and you can change the size of the scrollbar itself in the size field. You can also usethe ' number of steps ' field to set the value of the scroll bar, for example, 3. The step means that the scroll bar will display 0%, 50%, 100%.
It is also possible to customize the behavior of the Add script when the value of the scroll bar changes when it can be in the field of on value changed.
4.7 Scroll Rect
Scroll Rect with a large image, or a large group of UI controls that need to be displayed in a small area. Scroll rect provides functions for scrolling in images or other UI elements, using or not using scroll bars. Usually it is combined with mask and the parent object on the image Rect Transform to create a scrolling view where only the scrollable content of the inner Scroll Rect is visible.
In hierarchy, things are arranged like this:Recttransform and Rect transform also have a mask component for it. The image below this object is called the scrollview scrolling view.
As a child to the scrollview scrolling view should be a single recttransform that can act as the parent of all scrollable content. In the picture below this object is called content contents . All UI elements that can be scrolled should be children of this content of the object. the Content object should also be dragged into the content property of the Scroll Rect component .
Optionally, the scroll rect can be linked to a horizontal or vertical scroll bar. These are usually placed in the hierarchy as siblings to the scrolling view, and when present, respectively, should be dragged into the scrolling rect property of the horizontal scroll bar and the vertical scrollbar . Notice that the orientation on such a horizontal scrollbar should be set to the vertical scroll bar from left to right up to bottom to top.
4.8 Input Field
The input field is used to make the text of the text control editable.
"Turn" (v) Unity4.6ugui Chinese Course documentation-------Overview-ugui Interaction components