Skip to main content

GButton

Namespace:FairyGUI
Source:Assets/Scripts/UI/GButton.cs (line 9)

public class GButton : GComponent, IColorGear

GButton class.

Inheritance:EventDispatcher → GObject → GComponent → GButton

Interfaces:IColorGear

Inherited members​

GComponent

__onConstruct, __onDispose, _apexIndex, _boundsChanged, _childrenRenderOrder, _margin, _trackBounds, AddChild, AddChildAt, AddController, CallLua, ChangeChildrenOrder, ConstructFromResource, ConstructFromXML, CreateDisplayObject, Dispose, EnsureBoundsCorrect, GetChild, GetChildAt, GetChildByPath, GetChildInGroup, GetChildIndex, GetChildren, GetController, GetControllerAt, GetFirstChildInView, GetSnappingPosition, GetSnappingPositionWithDir, GetTransition, GetTransitionAt, GetVisibleChild, HandleSizeChanged, InvalidateBatchingState, IsAncestorOf, IsChildInView, OnUpdate, RemoveChild, RemoveChildAt, RemoveChildren, RemoveController, SetBounds, SetBoundsChangedFlag, SetChildIndex, SetChildIndexBefore, SetLuaPeer, SetupOverflow, SetupScroll, ShouldSnapToNext, SwapChildren, SwapChildrenAt, UpdateBounds, Controllers, Transitions, apexIndex, baseUserData, childrenRenderOrder, clipSoftness, container, fairyBatching, margin, mask, numChildren, onDrop, opaque, reversedMask, rootContainer, scrollPane, tabStopChildren, viewHeight, viewWidth

GObject

data, dragBounds, initHeight, initWidth, maxHeight, maxWidth, minHeight, minWidth, name, packageItem, sourceHeight, sourceWidth, underConstruct, AddRelation, Center, GetGear, GlobalToLocal, HandleAlphaChanged, HandlePositionChanged, HandleScaleChanged, HandleVisibleChanged, LocalToGlobal, LocalToRoot, MakeFullScreen, RemoveFromParent, RemoveRelation, RequestFocus, RootToLocal, SetHome, SetPivot, SetPosition, SetScale, SetSize, SetSizeDirectly, SetXY, Setup_BeforeAdd, StartDrag, StopDrag, TransformPoint, TransformRect, TweenFade, TweenMove, TweenMoveX, TweenMoveY, TweenResize, TweenRotate, TweenScale, TweenScaleX, TweenScaleY, UpdateGear, WorldToLocal, actualHeight, actualWidth, alpha, asButton, asComboBox, asCom, asGraph, asGroup, asImage, asLabel, asList, asLoader3D, asLoader, asMovieClip, asProgress, asRichTextField, asSlider, asTextField, asTextInput, asTree, blendMode, cursor, displayObject, dragStartPos, draggable, draggingObject, dragging, enabled, filter, focusable, focused, gameObjectName, gearLook, gearSize, gearXY, grayed, group, height, id, inContainer, isDisposed, onAddedToStage, onClickLink, onClick, onDragEnd, onDragMove, onDragStart, onFocusIn, onFocusOut, onGearStop, onKeyDown, onPositionChanged, onRemovedFromStage, onRightClick, onRollOut, onRollOver, onSizeChanged, onStage, onTouchBegin, onTouchEnd, onTouchMove, parent, pivotAsAnchor, pivotX, pivotY, pivot, pixelSnapping, position, relations, resourceURL, root, rotationX, rotationY, rotation, scaleX, scaleY, scale, size, skew, sortingOrder, tabStop, tooltips, touchable, treeNode, visible, width, xMin, xy, x, yMin, y, z

EventDispatcher

AddCapture, AddEventListener, BroadcastEvent, BubbleEvent, DispatchEvent, RemoveCapture, RemoveEventListener, RemoveEventListeners, hasEventListeners, isDispatching

Constructors​

GButton()​

public GButton();

Source:UI/GButton.cs (line 61)

Fields​

DISABLED​

public const string DISABLED = "disabled";

Source:UI/GButton.cs (line 58)

DOWN​

public const string DOWN = "down";

Source:UI/GButton.cs (line 55)

OVER​

public const string OVER = "over";

Source:UI/GButton.cs (line 56)

SELECTED_DISABLED​

public const string SELECTED_DISABLED = "selectedDisabled";

Source:UI/GButton.cs (line 59)

SELECTED_OVER​

public const string SELECTED_OVER = "selectedOver";

Source:UI/GButton.cs (line 57)

UP​

public const string UP = "up";

Source:UI/GButton.cs (line 54)

_iconObject​

protected GObject _iconObject;

Source:UI/GButton.cs (line 34)

_relatedController​

protected Controller _relatedController;

Source:UI/GButton.cs (line 35)

_relatedPageId​

protected string _relatedPageId;

Source:UI/GButton.cs (line 36)

_titleObject​

protected GObject _titleObject;

Source:UI/GButton.cs (line 33)

changeStateOnClick​

public bool changeStateOnClick;

For radio or checkbox. if false, the button will not change selected status on click. Default is true. 如果为true,对于单选和多选按钮,当玩家点击时,按钮会自动切换状态。设置为false,则不会。默认为true。

Source:UI/GButton.cs (line 25)

linkedPopup​

public GObject linkedPopup;

Show a popup on click. 可以为按钮设置一个关联的组件,当按钮被点击时,此组件被自动弹出。

Source:UI/GButton.cs (line 31)

sound​

public NAudioClip sound;

Play sound when button is clicked.

Source:UI/GButton.cs (line 14)

soundVolumeScale​

public float soundVolumeScale;

Volume of the click sound. (0-1)

Source:UI/GButton.cs (line 19)

Methods​

ConstructExtension(ByteBuffer)​

override protected void ConstructExtension(ByteBuffer buffer);
ParameterTypeDescription
bufferByteBuffer

Source:UI/GButton.cs (line 466)

FireClick(bool, bool)​

public void FireClick(bool downEffect, bool clickCall = false);

Simulates a click on this button. 模拟点击这个按钮。

ParameterTypeDescription
downEffectboolIf the down effect will simulate too.
clickCallbool

Source:UI/GButton.cs (line 324)

GetTextField()​

public GTextField GetTextField();

Source:UI/GButton.cs (line 356)

HandleControllerChanged(Controller)​

override public void HandleControllerChanged(Controller c);
ParameterTypeDescription
cController

Source:UI/GButton.cs (line 435)

HandleGrayedChanged()​

override protected void HandleGrayedChanged();

Source:UI/GButton.cs (line 443)

SetCurrentState()​

protected void SetCurrentState();

Source:UI/GButton.cs (line 417)

SetState(string)​

protected void SetState(string val);
ParameterTypeDescription
valstring

Source:UI/GButton.cs (line 368)

Setup_AfterAdd(ByteBuffer, int)​

override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos);
ParameterTypeDescription
bufferByteBuffer
beginPosint

Source:UI/GButton.cs (line 499)

Properties​

color​

public Color color { get; set; }

Source:UI/GButton.cs (line 187)

icon​

override public string icon { get; set; }

Icon of the button.

Source:UI/GButton.cs (line 82)

mode​

public ButtonMode mode { get; set; }

Button mode.

Source:UI/GButton.cs (line 267)

onChanged​

public EventListener onChanged { get; }

Dispatched when the button status was changed. 如果为单选或多选按钮,当按钮的选中状态发生改变时,此事件触发。

Source:UI/GButton.cs (line 74)

relatedController​

public Controller relatedController { get; set; }

A controller is connected to this button, the activate page of this controller will change while the button status changed. 对应编辑器中的单选控制器。

Source:UI/GButton.cs (line 288)

relatedPageId​

public string relatedPageId { get; set; }

Source:UI/GButton.cs (line 307)

selected​

public bool selected { get; set; }

If the button is in selected status.

Source:UI/GButton.cs (line 221)

selectedIcon​

public string selectedIcon { get; set; }

Icon value on selected status.

Source:UI/GButton.cs (line 128)

selectedTitle​

public string selectedTitle { get; set; }

Title value on selected status.

Source:UI/GButton.cs (line 146)

text​

override public string text { get; set; }

Same of the title.

Source:UI/GButton.cs (line 119)

title​

public string title { get; set; }

Title of the button

Source:UI/GButton.cs (line 101)

titleColor​

public Color titleColor { get; set; }

Title color.

Source:UI/GButton.cs (line 163)

titleFontSize​

public int titleFontSize { get; set; }

Source:UI/GButton.cs (line 196)