跳到主要内容

GComponent

命名空间:FairyGUI
源码:Assets/Scripts/UI/GComponent.cs (行 14)

public class GComponent : GObject

Component

继承:EventDispatcher → GObject → GComponent

继承成员​

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, icon, 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, text, tooltips, touchable, treeNode, visible, width, xMin, xy, x, yMin, y, z

EventDispatcher

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

构造函数​

GComponent()​

public GComponent();

源码:UI/GComponent.cs (行 48)

字段​

__onConstruct​

public Action __onConstruct;

编译条件:FAIRYGUI_PUERTS

源码:UI/GComponent.cs (行 1722)

__onDispose​

public Action __onDispose;

编译条件:FAIRYGUI_PUERTS

源码:UI/GComponent.cs (行 1723)

_apexIndex​

protected int _apexIndex;

源码:UI/GComponent.cs (行 38)

_boundsChanged​

protected bool _boundsChanged;

源码:UI/GComponent.cs (行 36)

_childrenRenderOrder​

protected ChildrenRenderOrder _childrenRenderOrder;

源码:UI/GComponent.cs (行 37)

_margin​

protected Margin _margin;

源码:UI/GComponent.cs (行 34)

_trackBounds​

protected bool _trackBounds;

源码:UI/GComponent.cs (行 35)

方法​

AddChild(GObject)​

public GObject AddChild(GObject child);

Add a child to the component. It will be at the frontmost position.

返回值

GObject

参数类型说明
childGObjectA child object

源码:UI/GComponent.cs (行 214)

AddChildAt(GObject, int)​

virtual public GObject AddChildAt(GObject child, int index);

Adds a child to the component at a certain index.

返回值

GObject

参数类型说明
childGObjectA child object
indexintIndex

源码:UI/GComponent.cs (行 226)

AddController(Controller)​

public void AddController(Controller controller);

Adds a controller to the container.

参数类型说明
controllerControllerController object

源码:UI/GComponent.cs (行 689)

CallLua(string)​

public bool CallLua(string funcName);

编译条件:FAIRYGUI_TOLUA

参数类型说明
funcNamestring

源码:UI/GComponent.cs (行 1695)

ChangeChildrenOrder(IList<GObject>)​

public void ChangeChildrenOrder(IList<GObject> objs);
参数类型说明
objsIList<GObject>

源码:UI/GComponent.cs (行 670)

ConstructExtension(ByteBuffer)​

virtual protected void ConstructExtension(ByteBuffer buffer);
参数类型说明
bufferByteBuffer

源码:UI/GComponent.cs (行 1615)

ConstructFromResource()​

override public void ConstructFromResource();

源码:UI/GComponent.cs (行 1363)

ConstructFromXML(XML)​

virtual public void ConstructFromXML(XML xml);

Method for extensions to override

参数类型说明
xmlXML

源码:UI/GComponent.cs (行 1623)

CreateDisplayObject()​

override protected void CreateDisplayObject();

源码:UI/GComponent.cs (行 57)

Dispose()​

override public void Dispose();

源码:UI/GComponent.cs (行 67)

EnsureBoundsCorrect()​

public void EnsureBoundsCorrect();

Make sure the bounds of the component is correct. Bounds of the component is not updated on every changed. For example, you add a new child to the list, children in the list will be rearranged in next frame. If you want to access the correct child position immediatelly, call this function first.

源码:UI/GComponent.cs (行 1149)

GetChild(string)​

public GObject GetChild(string name);

Returns a child object with a certain name.

返回值

A child object. Null if not found.

参数类型说明
namestringName

源码:UI/GComponent.cs (行 399)

GetChildAt(int)​

public GObject GetChildAt(int index);

Returns a child object at a certain index. If index out of bounds, exception raised.

返回值

A child object.

参数类型说明
indexintIndex

源码:UI/GComponent.cs (行 386)

GetChildByPath(string)​

public GObject GetChildByPath(string path);
参数类型说明
pathstring

源码:UI/GComponent.cs (行 411)

GetChildInGroup(GGroup, string)​

public GObject GetChildInGroup(GGroup group, string name);

Returns a child object belong to a group with a certain name.

返回值

A child object. Null if not found.

参数类型说明
groupGGroupA group object
namestringName

源码:UI/GComponent.cs (行 462)

GetChildIndex(GObject)​

public int GetChildIndex(GObject child);

Returns the index of a child within the container, or "-1" if it is not found.

返回值

Index of the child. -1 If not found.

参数类型说明
childGObjectA child object

源码:UI/GComponent.cs (行 501)

GetChildren()​

public GObject[] GetChildren();

Returns a copy of all children with an array.

返回值

An array contains all children

源码:UI/GComponent.cs (行 491)

GetController(string)​

public Controller GetController(string name);

Returns a controller object with a certain name.

返回值

Controller object. Null if not found.

参数类型说明
namestringName

源码:UI/GComponent.cs (行 711)

GetControllerAt(int)​

public Controller GetControllerAt(int index);

Returns a controller object at a certain index.

返回值

Controller object.

参数类型说明
indexintIndex

源码:UI/GComponent.cs (行 701)

GetFirstChildInView()​

virtual public int GetFirstChildInView();

源码:UI/GComponent.cs (行 1045)

GetSnappingPosition(float, float)​

public void GetSnappingPosition(ref float xValue, ref float yValue);
参数类型说明
xValuefloat
yValuefloat

源码:UI/GComponent.cs (行 1247)

GetSnappingPositionWithDir(float, float, float, float)​

virtual public void GetSnappingPositionWithDir(ref float xValue, ref float yValue, float xDir, float yDir);
参数类型说明
xValuefloat
yValuefloat
xDirfloat
yDirfloat

源码:UI/GComponent.cs (行 1262)

GetTransition(string)​

public Transition GetTransition(string name);

Returns a transition object at a certain name.

返回值

Transition Object

参数类型说明
namestringName

源码:UI/GComponent.cs (行 769)

GetTransitionAt(int)​

public Transition GetTransitionAt(int index);

Returns a transition object at a certain index.

返回值

transition object.

参数类型说明
indexintIndex

源码:UI/GComponent.cs (行 759)

GetVisibleChild(string)​

public GObject GetVisibleChild(string name);

Returns a visible child object with a certain name.

返回值

A child object. Null if not found.

参数类型说明
namestringName

源码:UI/GComponent.cs (行 443)

HandleControllerChanged(Controller)​

override public void HandleControllerChanged(Controller c);
参数类型说明
cController

源码:UI/GComponent.cs (行 1125)

HandleGrayedChanged()​

override protected void HandleGrayedChanged();

源码:UI/GComponent.cs (行 1116)

HandleSizeChanged()​

override protected void HandleSizeChanged();

源码:UI/GComponent.cs (行 1106)

InvalidateBatchingState(bool)​

public void InvalidateBatchingState(bool childChanged);
参数类型说明
childChangedbool

源码:UI/GComponent.cs (行 133)

IsAncestorOf(GObject)​

public bool IsAncestorOf(GObject obj);
参数类型说明
objGObject

源码:UI/GComponent.cs (行 649)

IsChildInView(GObject)​

public bool IsChildInView(GObject child);

Test if a child is in view.

返回值

True if in view

参数类型说明
childGObjectA child object

源码:UI/GComponent.cs (行 1030)

OnUpdate()​

virtual protected void OnUpdate();

每帧调用的一个回调。如果你要override,请记住以下两点: 1、记得调用base.onUpdate; 2、不要在方法里进行任何会更改显示列表的操作,例如AddChild、RemoveChild、visible等。

源码:UI/GComponent.cs (行 1357)

RemoveChild(GObject)​

public GObject RemoveChild(GObject child);

Removes a child from the component. If the object is not a child, nothing happens.

返回值

GObject

参数类型说明
childGObjectA child object

源码:UI/GComponent.cs (行 288)

RemoveChild(GObject, bool)​

public GObject RemoveChild(GObject child, bool dispose);

Removes a child from the component. If the object is not a child, nothing happens.

返回值

GObject

参数类型说明
childGObjectA child object
disposeboolIf true, the child will be disposed right away.

源码:UI/GComponent.cs (行 299)

RemoveChildAt(int)​

public GObject RemoveChildAt(int index);

Removes a child at a certain index. Children above the child will move down.

返回值

GObject

参数类型说明
indexintIndex

源码:UI/GComponent.cs (行 314)

RemoveChildAt(int, bool)​

virtual public GObject RemoveChildAt(int index, bool dispose);

Removes a child at a certain index. Children above the child will move down.

返回值

GObject

参数类型说明
indexintIndex
disposeboolIf true, the child will be disposed right away.

源码:UI/GComponent.cs (行 325)

RemoveChildren()​

public void RemoveChildren();

Remove all children.

源码:UI/GComponent.cs (行 361)

RemoveChildren(int, int, bool)​

public void RemoveChildren(int beginIndex, int endIndex, bool dispose);

Removes a range of children from the container (endIndex included).

参数类型说明
beginIndexintBegin index.
endIndexintEnd index.(Included).
disposeboolIf true, the child will be disposed right away.

源码:UI/GComponent.cs (行 372)

RemoveController(Controller)​

public void RemoveController(Controller c);

Removes a controller from the container.

参数类型说明
cControllerController object.

源码:UI/GComponent.cs (行 728)

SetBounds(float, float, float, float)​

protected void SetBounds(float ax, float ay, float aw, float ah);
参数类型说明
axfloat
ayfloat
awfloat
ahfloat

源码:UI/GComponent.cs (行 1196)

SetBoundsChangedFlag()​

public void SetBoundsChangedFlag();

Notify the component the bounds should recaculate.

源码:UI/GComponent.cs (行 1136)

SetChildIndex(GObject, int)​

public void SetChildIndex(GObject child, int index);

Moves a child to a certain index. Children at and after the replaced position move up.

参数类型说明
childGObjectA Child
indexintIndex

源码:UI/GComponent.cs (行 511)

SetChildIndexBefore(GObject, int)​

public int SetChildIndexBefore(GObject child, int index);

Moves a child to a certain position which is in front of the child previously at given index. 与SetChildIndex不同的是,如果child原来在index的前面,那么child插入的位置是index-1,即保证排在原来占据index的对象的前面。

参数类型说明
childGObject
indexint

源码:UI/GComponent.cs (行 536)

SetLuaPeer(LuaTable)​

public void SetLuaPeer(LuaTable peerTable);

编译条件:FAIRYGUI_TOLUA

参数类型说明
peerTableLuaTable

源码:UI/GComponent.cs (行 1690)

SetupOverflow(OverflowType)​

protected void SetupOverflow(OverflowType overflow);
参数类型说明
overflowOverflowType

源码:UI/GComponent.cs (行 1069)

SetupScroll(ByteBuffer)​

protected void SetupScroll(ByteBuffer buffer);
参数类型说明
bufferByteBuffer

源码:UI/GComponent.cs (行 1057)

Setup_AfterAdd(ByteBuffer, int)​

public override void Setup_AfterAdd(ByteBuffer buffer, int beginPos);
参数类型说明
bufferByteBuffer
beginPosint

源码:UI/GComponent.cs (行 1627)

ShouldSnapToNext(float, float, float)​

protected bool ShouldSnapToNext(float dir, float delta, float size);
参数类型说明
dirfloat
deltafloat
sizefloat

源码:UI/GComponent.cs (行 1252)

SwapChildren(GObject, GObject)​

public void SwapChildren(GObject child1, GObject child2);

Swaps the indexes of two children.

参数类型说明
child1GObjectA child object
child2GObjectA child object

源码:UI/GComponent.cs (行 613)

SwapChildrenAt(int, int)​

public void SwapChildrenAt(int index1, int index2);

Swaps the indexes of two children.

参数类型说明
index1intindex of first child
index2intindex of second child

源码:UI/GComponent.cs (行 627)

UpdateBounds()​

virtual protected void UpdateBounds();

源码:UI/GComponent.cs (行 1155)

属性​

Controllers​

public List<Controller> Controllers { get; }

Returns controller list.

返回值

Controller list

源码:UI/GComponent.cs (行 749)

Transitions​

public List<Transition> Transitions { get; }

Returns transition list.

返回值

Transition list

源码:UI/GComponent.cs (行 786)

apexIndex​

public int apexIndex { get; set; }

源码:UI/GComponent.cs (行 185)

baseUserData​

public string baseUserData { get; }

源码:UI/GComponent.cs (行 1015)

childrenRenderOrder​

public ChildrenRenderOrder childrenRenderOrder { get; set; }

源码:UI/GComponent.cs (行 169)

clipSoftness​

public Vector2 clipSoftness { get; set; }

If clipping softness is set, clipped containers will have soft border effect.

源码:UI/GComponent.cs (行 974)

container​

public Container container { get; protected set; }

Content container. If the component is not clipped, then container==rootContainer.

源码:UI/GComponent.cs (行 23)

fairyBatching​

public bool fairyBatching { get; set; }

Draw call optimization switch.

源码:UI/GComponent.cs (行 123)

margin​

public Margin margin { get; set; }

源码:UI/GComponent.cs (行 154)

mask​

public DisplayObject mask { get; set; }

The mask of the component.

源码:UI/GComponent.cs (行 992)

numChildren​

public int numChildren { get; }

The number of children of this component.

源码:UI/GComponent.cs (行 639)

onDrop​

public EventListener onDrop { get; }

Dispatched when an object was dragged and dropped to this component.

源码:UI/GComponent.cs (行 115)

opaque​

public bool opaque { get; set; }

If true, mouse/touch events cannot pass through the empty area of the component. Default is true.

源码:UI/GComponent.cs (行 144)

reversedMask​

public bool reversedMask { get; set; }

源码:UI/GComponent.cs (行 1006)

rootContainer​

public Container rootContainer { get; private set; }

Root container.

源码:UI/GComponent.cs (行 19)

scrollPane​

public ScrollPane scrollPane { get; private set; }

ScrollPane of the component. If the component is not scrollable, the value is null.

源码:UI/GComponent.cs (行 27)

tabStopChildren​

public bool tabStopChildren { get; set; }

If true, children can be navigated by TAB from first to last, and repeat

源码:UI/GComponent.cs (行 203)

viewHeight​

public float viewHeight { get; set; }

View port height of the container.

源码:UI/GComponent.cs (行 1228)

viewWidth​

public float viewWidth { get; set; }

Viwe port width of the container.

源码:UI/GComponent.cs (行 1206)