UiPanel

Description

UiPanel is the main object that stores 2D UI objects displayed on the player's screen. A UI object that you want to displayed in the editor must be the child of the UiPanel.

After the game is running, the interfaces stored under the StarterUI will be copied to the GameUI. Only the interfaces under the GameUI can display in the game.

Properties

        string    Name
    The custom name of this object.

        string    ClassName
    The object-type name.

        RWObject    Parent
    The parent of this object.

        Vector2    AnchorMin
    The anchor area is an area drawn from the start point of the anchor area to the end point (if the two points are the same, the anchor area will be a point). The control position relative to the anchor area will not change.

        Vector2    AnchorMax
    The anchor area is an area drawn from the start point of the anchor area to the end point (if the two points are the same, the anchor area will be a point). The control position relative to the anchor area will not change.

        Vector2    RelativeSize
    Relative size ratio affects the final width and height of a control (Control's final width and height are also influenced by width and height properties, determined by both relative size ration and width and height properties.), which represents the control size relative to its parent. X is the width ratio of child control to parent control. Y is the height ratio of child control to parent control. 0 means there's no relationship with parent control and 1 means it has the same width and height as parent control.

        Vector2    AnchoredPosition
    The distance between the control pivot and the anchor area. If the anchor area is a point, it represents the distance between the two points. If the anchor area is not a point, it represents the distance between the control pivot and the anchor area pivot (this pivot takes the same value as the control pivot).

        Vector2    SizeDelta
    The width and height of the control. X is the control's width. Y is the control's height. The control's final width and height are the values after conversion with the relative size ratio plus its width and height. When the relative size ratio is 0, the control's width and height are the actual width and height.

        Vector2    Pivot
    Control's pivot. It is the reference point when the control changes its width and height or rotates itself.

        Vector3    LocalScale
    Zoom factor of the control relative to its actual width and height. When the parameter is 1, the width and height of the control are the same as the width and height of the control itself.

        bool    IsVisable
    Check it to display.

        Vector3    LocalEulerAngles
    Rotation angle of a control around its pivot point.

        int    ZIndex
    Display order of controls. The higher layer of a control, the closer it will get to the front.

        string    SourceImage
    Select a UI image from resource.

        Vector3    ImageColor
    Change the color of source image.

        float    ImageColorA
    Change the color transparency of source image.

        Enum.ImageType    ImageCurType
    Source image display format (there are 4 types: Simple, Sliced, Tiled, Filled).

        bool    RayCastTarget
    It can be penetrated.

        bool    PreserveAspect
    Preserve aspect ratio.

        Vector4    Border
    The size which is kept while the picture is stretched.

Functions

    RWObject.Create(classname)
    A special function, creating an instance of the specified class.

    DelAllChild()
    Deletes all child objects.

    Clone()
    Clones an object to create a copy.

    Destroy()
    Delete objects.

    GetAncestorByName(Name)
    Returns the object's first parent node with the same name.

    GetAncestorByClassName(className)
    Returns the object's first parent node of the same class.

    GetChildByName(Name,recursive)
    Returns the object's first child object with the same name. If the second parameter is true, it will search through descendants of all hierarchies.

    GetChildByClassName(className,recursive)
    Returns the object's first child object of the same type. If the second parameter is true, it will search through descendants of all hierarchies.

    GetAllChild()
    Seeks all its child objects and returns as a list.

    GetAllDescendant()
    Recursively seeks all its descendants and returns as a list.

    IsClass(ClassName)
    Judges whether it is the class the same as the given object class or not.

    IsAncestor(TarObj)
    Judges whether itself is the ancestor of the target object or not.

    IsDescendant(TarObj)
    Judges whether itself is the descendant of the target object or not.

    WaitForChild(childName,timeout)
    Seeks its own child object.

    Child(childName)
    Seeks its own child object by a given name.

    Equals(TarObj)
    Judges whether the target object is the same as itself or not.

Events

    ChildAdded(childobject)
    Triggered when a child object is added.

    ChildRemoved(childobject)
    Deletes all child objects.

    DescendantAdded(descendantobject)
    Triggered when a descendant is added.

    DescendantRemoved(descendantobject)
    Triggered when a descendant is removed.

    AncestryChanged(AncestryChanged)
    Triggered when the ancestry is changed.

    GuiMouseLeftPress()
    This event is triggered when the GUI object is left-clicked on.

    GuiMouseLeftDown(mousePosition.x, mousePosition.y)
    This event is triggered when the left mouse button is pressed on the GUI object.

    GuiMouseLeftUp(mousePosition.x, mousePosition.y)
    This event is triggered when the left mouse button is released from the GUI object.

    GuiMouseRightPress()
    This event is triggered when the GUI object is right-clicked on.

    GuiMouseRightDown(mousePosition.x, mousePosition.y)
    This event is triggered when the right mouse button is pressed on the GUI object.

    GuiMouseRightUp(mousePosition.x, mousePosition.y)
    This event is triggered when the right mouse button is released from the GUI object.

    GuiMouseScrollDown(mousePosition.x, mousePosition.y)
    This event is triggered when the middle mouse button is pressed on the GUI object.

    GuiMouseScrollUp(mousePosition.x, mousePosition.y)
    This event is triggered when the middle mouse button is released from the GUI object.

    GuiMouseScrollPress()
    This event is triggered when the GUI object is middle-clicked on.

    GuiInputBegan(inputobject,bool)
    This event is triggered when the user input (by mouse, touch, keyboard, etc.) starts.

    GuiInputChanged(inputobject,bool)
    This event is triggered when the user input changes.

    GuiInputEnded(inputobject,bool)
    This event is triggered when the user input ends.

    GuiMouseWheelBackward(mousePosition.x, mousePosition.y)
    This event is triggered when the mouse wheel scrolls backwards.

    GuiMouseWheelForward(mousePosition.x, mousePosition.y)
    This event is triggered when the mouse wheel scrolls forwards.

    GuiTouchLongPress(Touch.position, touchState)
    This event is triggered when the GUI object is long pressed at the same position.

    GuiTouchPan(Touch.position, pandistance, panspeed, touchState)
    This event is triggered when a finger moves on the GUI object.

    GuiTouchPinch({ newtouch1.position, newtouch2.position }, scale , pinchspeed, touchState)
    This event is triggered when two fingers are pinched or pulled apart on the GUI object.

    GuiTouchRotate({ newtouch1.position, newtouch2.position }, signedAngle, signedAnglespeed , touchState)
    This event is triggered when two fingers are rotated on the GUI object.

    GuiTouchSwipe(touchMoveDir, touchCount)
    This event is triggered when one or more fingers swipe on the GUI object.

    GuiTouchTap(Touch.position)
    This event is triggered when the user touches lightly on the touch device.