Skip to main content

GObject

Namespace:FairyGUI
Source:Assets/Scripts/UI/GObject.cs (line 7)

public class GObject : EventDispatcher

Inheritance:EventDispatcher → GObject

Inherited members​

EventDispatcher

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

Constructors​

GObject()​

public GObject();

Source:UI/GObject.cs (line 151)

Fields​

data​

public object data;

User defined data.

Source:UI/GObject.cs (line 23)

dragBounds​

public Rect? dragBounds;

Restricted range of dragging.

Source:UI/GObject.cs (line 73)

initHeight​

public int initHeight;

The initial height of the object.

Source:UI/GObject.cs (line 43)

initWidth​

public int initWidth;

The initial width of the object.

Source:UI/GObject.cs (line 38)

maxHeight​

public int maxHeight;

Source:UI/GObject.cs (line 63)

maxWidth​

public int maxWidth;

Source:UI/GObject.cs (line 53)

minHeight​

public int minHeight;

Source:UI/GObject.cs (line 58)

minWidth​

public int minWidth;

Source:UI/GObject.cs (line 48)

name​

public string name;

Name of the object.

Source:UI/GObject.cs (line 18)

packageItem​

public PackageItem packageItem;

Source:UI/GObject.cs (line 93)

sourceHeight​

public int sourceHeight;

The source height of the object.

Source:UI/GObject.cs (line 33)

sourceWidth​

public int sourceWidth;

The source width of the object.

Source:UI/GObject.cs (line 28)

underConstruct​

internal protected bool underConstruct;

Source:UI/GObject.cs (line 139)

Methods​

AddRelation(GObject, RelationType)​

public void AddRelation(GObject target, RelationType relationType);
ParameterTypeDescription
targetGObject
relationTypeRelationType

Source:UI/GObject.cs (line 1336)

AddRelation(GObject, RelationType, bool)​

public void AddRelation(GObject target, RelationType relationType, bool usePercent);
ParameterTypeDescription
targetGObject
relationTypeRelationType
usePercentbool

Source:UI/GObject.cs (line 1347)

Center(bool)​

public virtual void Center(bool restraint);

Set the object in middle of the parent or GRoot if the parent is not set.

ParameterTypeDescription
restraintboolAdd relations to maintain the center state.

Source:UI/GObject.cs (line 455)

Center()​

public void Center();

Set the object in middle of the parent or GRoot if the parent is not set.

Source:UI/GObject.cs (line 446)

ConstructFromResource()​

virtual public void ConstructFromResource();

Source:UI/GObject.cs (line 1890)

CreateDisplayObject()​

virtual protected void CreateDisplayObject();

Source:UI/GObject.cs (line 1836)

Dispose()​

virtual public void Dispose();

Source:UI/GObject.cs (line 1667)

GetGear(int)​

public GearBase GetGear(int index);
ParameterTypeDescription
indexint

Source:UI/GObject.cs (line 1197)

GlobalToLocal(Rect)​

public Rect GlobalToLocal(Rect rect);
ParameterTypeDescription
rectRect

Source:UI/GObject.cs (line 1549)

GlobalToLocal(Vector2)​

public Vector2 GlobalToLocal(Vector2 pt);

Transforms a point from global (Stage) coordinates to the local coordinate system.

ParameterTypeDescription
ptVector2

Source:UI/GObject.cs (line 1516)

HandleAlphaChanged()​

virtual protected void HandleAlphaChanged();

Source:UI/GObject.cs (line 1878)

HandleControllerChanged(Controller)​

virtual public void HandleControllerChanged(Controller c);
ParameterTypeDescription
cController

Source:UI/GObject.cs (line 1317)

HandleGrayedChanged()​

virtual protected void HandleGrayedChanged();

Source:UI/GObject.cs (line 1872)

HandlePositionChanged()​

virtual protected void HandlePositionChanged();

Source:UI/GObject.cs (line 1845)

HandleScaleChanged()​

virtual protected void HandleScaleChanged();

Source:UI/GObject.cs (line 1866)

HandleSizeChanged()​

virtual protected void HandleSizeChanged();

Source:UI/GObject.cs (line 1860)

HandleVisibleChanged()​

virtual internal protected void HandleVisibleChanged();

Source:UI/GObject.cs (line 1884)

InvalidateBatchingState()​

public void InvalidateBatchingState();

Mark the fairy batching state is invalid.

Source:UI/GObject.cs (line 1309)

LocalToGlobal(Rect)​

public Rect LocalToGlobal(Rect rect);
ParameterTypeDescription
rectRect

Source:UI/GObject.cs (line 1532)

LocalToGlobal(Vector2)​

public Vector2 LocalToGlobal(Vector2 pt);

Transforms a point from the local coordinate system to global (Stage) coordinates.

ParameterTypeDescription
ptVector2

Source:UI/GObject.cs (line 1501)

LocalToRoot(Vector2, GRoot)​

public Vector2 LocalToRoot(Vector2 pt, GRoot r);

Transforms a point from the local coordinate system to GRoot coordinates.

ParameterTypeDescription
ptVector2
rGRoot

Source:UI/GObject.cs (line 1567)

MakeFullScreen()​

public void MakeFullScreen();

设置对象为全屏大小(逻辑屏幕)。

Source:UI/GObject.cs (line 474)

RemoveFromParent()​

public void RemoveFromParent();

Source:UI/GObject.cs (line 1365)

RemoveRelation(GObject, RelationType)​

public void RemoveRelation(GObject target, RelationType relationType);
ParameterTypeDescription
targetGObject
relationTypeRelationType

Source:UI/GObject.cs (line 1357)

RequestFocus()​

public void RequestFocus();

Request focus on this object.

Source:UI/GObject.cs (line 1017)

RequestFocus(bool)​

public void RequestFocus(bool byKey);

Request focus on this object.

ParameterTypeDescription
byKeybool

Source:UI/GObject.cs (line 1026)

RootToLocal(Vector2, GRoot)​

public Vector2 RootToLocal(Vector2 pt, GRoot r);

Transforms a point from the GRoot coordinate to local coordinates system.

ParameterTypeDescription
ptVector2
rGRoot

Source:UI/GObject.cs (line 1587)

SetHome(GObject)​

public void SetHome(GObject obj);
ParameterTypeDescription
objGObject

Source:UI/GObject.cs (line 1122)

SetPivot(float, float)​

public void SetPivot(float xv, float yv);

Change the x and y coordinates of the object's origin in its own coordinate space.

ParameterTypeDescription
xvfloatx value in ratio
yvfloaty value in ratio

Source:UI/GObject.cs (line 766)

SetPivot(float, float, bool)​

public void SetPivot(float xv, float yv, bool asAnchor);

Change the x and y coordinates of the object's origin in its own coordinate space.

ParameterTypeDescription
xvfloatx value in ratio
yvfloaty value in ratio
asAnchorboolIf use the pivot as the anchor position

Source:UI/GObject.cs (line 777)

SetPosition(float, float, float)​

public void SetPosition(float xv, float yv, float zv);

change the x,y,z coordinates of the object relative to the local coordinates of the parent.

ParameterTypeDescription
xvfloatx value.
yvfloaty value.
zvfloatz value.

Source:UI/GObject.cs (line 406)

SetScale(float, float)​

public void SetScale(float wv, float hv);

Change the scale factor.

ParameterTypeDescription
wvfloatThe horizontal scale factor.
hvfloatThe vertical scale factor

Source:UI/GObject.cs (line 687)

SetSize(float, float)​

public void SetSize(float wv, float hv);

Change size.

ParameterTypeDescription
wvfloatWidth value.
hvfloatHeight value.

Source:UI/GObject.cs (line 539)

SetSize(float, float, bool)​

public void SetSize(float wv, float hv, bool ignorePivot);

Change size.

ParameterTypeDescription
wvfloatWidth value.
hvfloatHeight value.
ignorePivotboolIf pivot is set, the object's positon will change when its size change. Set ignorePivot=true to keep the position.

Source:UI/GObject.cs (line 550)

SetSizeDirectly(float, float)​

protected void SetSizeDirectly(float wv, float hv);
ParameterTypeDescription
wvfloat
hvfloat

Source:UI/GObject.cs (line 601)

SetXY(float, float)​

public void SetXY(float xv, float yv);

change the x and y coordinates of the object relative to the local coordinates of the parent.

ParameterTypeDescription
xvfloatx value.
yvfloaty value.

Source:UI/GObject.cs (line 381)

SetXY(float, float, bool)​

public void SetXY(float xv, float yv, bool topLeftValue);
ParameterTypeDescription
xvfloat
yvfloat
topLeftValuebool

Source:UI/GObject.cs (line 392)

Setup_AfterAdd(ByteBuffer, int)​

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

Source:UI/GObject.cs (line 1974)

Setup_BeforeAdd(ByteBuffer, int)​

virtual public void Setup_BeforeAdd(ByteBuffer buffer, int beginPos);
ParameterTypeDescription
bufferByteBuffer
beginPosint

Source:UI/GObject.cs (line 1894)

StartDrag()​

public void StartDrag();

Source:UI/GObject.cs (line 1455)

StartDrag(int)​

public void StartDrag(int touchId);
ParameterTypeDescription
touchIdint

Source:UI/GObject.cs (line 1464)

StopDrag()​

public void StopDrag();

Source:UI/GObject.cs (line 1475)

TransformPoint(Vector2, GObject)​

public Vector2 TransformPoint(Vector2 pt, GObject targetSpace);
ParameterTypeDescription
ptVector2
targetSpaceGObject

Source:UI/GObject.cs (line 1630)

TransformRect(Rect, GObject)​

public Rect TransformRect(Rect rect, GObject targetSpace);
ParameterTypeDescription
rectRect
targetSpaceGObject

Source:UI/GObject.cs (line 1646)

TweenFade(float, float)​

public GTweener TweenFade(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2176)

TweenMove(Vector2, float)​

public GTweener TweenMove(Vector2 endValue, float duration);
ParameterTypeDescription
endValueVector2
durationfloat

Source:UI/GObject.cs (line 2141)

TweenMoveX(float, float)​

public GTweener TweenMoveX(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2146)

TweenMoveY(float, float)​

public GTweener TweenMoveY(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2151)

TweenResize(Vector2, float)​

public GTweener TweenResize(Vector2 endValue, float duration);
ParameterTypeDescription
endValueVector2
durationfloat

Source:UI/GObject.cs (line 2171)

TweenRotate(float, float)​

public GTweener TweenRotate(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2181)

TweenScale(Vector2, float)​

public GTweener TweenScale(Vector2 endValue, float duration);
ParameterTypeDescription
endValueVector2
durationfloat

Source:UI/GObject.cs (line 2156)

TweenScaleX(float, float)​

public GTweener TweenScaleX(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2161)

TweenScaleY(float, float)​

public GTweener TweenScaleY(float endValue, float duration);
ParameterTypeDescription
endValuefloat
durationfloat

Source:UI/GObject.cs (line 2166)

UpdateGear(int)​

protected void UpdateGear(int index);
ParameterTypeDescription
indexint

Source:UI/GObject.cs (line 1242)

WorldToLocal(Vector3)​

public Vector2 WorldToLocal(Vector3 pt);
ParameterTypeDescription
ptVector3

Source:UI/GObject.cs (line 1605)

WorldToLocal(Vector3, Camera)​

public Vector2 WorldToLocal(Vector3 pt, Camera camera);
ParameterTypeDescription
ptVector3
cameraCamera

Source:UI/GObject.cs (line 1616)

Properties​

actualHeight​

public float actualHeight { get; }

actualHeight = height * scaleY

Source:UI/GObject.cs (line 529)

actualWidth​

public float actualWidth { get; }

actualWidth = width * scalex

Source:UI/GObject.cs (line 521)

alpha​

public float alpha { get; set; }

The opacity of the object. 0 = transparent, 1 = opaque.

Source:UI/GObject.cs (line 903)

asButton​

public GButton asButton { get; }

Source:UI/GObject.cs (line 1711)

asCom​

public GComponent asCom { get; }

Source:UI/GObject.cs (line 1703)

asComboBox​

public GComboBox asComboBox { get; }

Source:UI/GObject.cs (line 1743)

asGraph​

public GGraph asGraph { get; }

Source:UI/GObject.cs (line 1799)

asGroup​

public GGroup asGroup { get; }

Source:UI/GObject.cs (line 1807)

asImage​

public GImage asImage { get; }

Source:UI/GObject.cs (line 1695)

asLabel​

public GLabel asLabel { get; }

Source:UI/GObject.cs (line 1719)

asList​

public GList asList { get; }

Source:UI/GObject.cs (line 1791)

asLoader​

public GLoader asLoader { get; }

Source:UI/GObject.cs (line 1775)

asLoader3D​

public GLoader3D asLoader3D { get; }

Source:UI/GObject.cs (line 1783)

asMovieClip​

public GMovieClip asMovieClip { get; }

Source:UI/GObject.cs (line 1815)

asProgress​

public GProgressBar asProgress { get; }

Source:UI/GObject.cs (line 1727)

asRichTextField​

public GRichTextField asRichTextField { get; }

Source:UI/GObject.cs (line 1759)

asSlider​

public GSlider asSlider { get; }

Source:UI/GObject.cs (line 1735)

asTextField​

public GTextField asTextField { get; }

Source:UI/GObject.cs (line 1751)

asTextInput​

public GTextInput asTextInput { get; }

Source:UI/GObject.cs (line 1767)

asTree​

public GTree asTree { get; }

Source:UI/GObject.cs (line 1823)

blendMode​

virtual public BlendMode blendMode { get; set; }

Source:UI/GObject.cs (line 1092)

cursor​

public string cursor { get; set; }

Source:UI/GObject.cs (line 1060)

displayObject​

public DisplayObject displayObject { get; protected set; }

Lowlevel display object.

Source:UI/GObject.cs (line 83)

dragStartPos​

public Vector2 dragStartPos { get; }

Source:UI/GObject.cs (line 1491)

draggable​

public bool draggable { get; set; }

Source:UI/GObject.cs (line 1439)

dragging​

public bool dragging { get; }

Source:UI/GObject.cs (line 1483)

draggingObject​

public static GObject draggingObject { get; private set; }

当前全局正在被拖动的对象

Source:UI/GObject.cs (line 88)

enabled​

public bool enabled { get; set; }

Enabled is shortcut for grayed and !touchable combination.

Source:UI/GObject.cs (line 835)

filter​

virtual public IFilter filter { get; set; }

Source:UI/GObject.cs (line 1083)

focusable​

public bool focusable { get; set; }

If the object can be focused?

Source:UI/GObject.cs (line 991)

focused​

public bool focused { get; }

If the object is focused.

Source:UI/GObject.cs (line 1009)

gameObjectName​

public string gameObjectName { get; set; }

设定GameObject的名称

Source:UI/GObject.cs (line 1101)

gearLook​

public GearLook gearLook { get; }

Gear to look controller.

Source:UI/GObject.cs (line 1189)

gearSize​

public GearSize gearSize { get; }

Gear to size controller.

Source:UI/GObject.cs (line 1178)

gearXY​

public GearXY gearXY { get; }

Gear to xy controller.

Source:UI/GObject.cs (line 1167)

grayed​

public bool grayed { get; set; }

If true, apply a grayed effect on this object.

Source:UI/GObject.cs (line 815)

group​

public GGroup group { get; set; }

Group belonging to.

Source:UI/GObject.cs (line 1374)

height​

public float height { get; set; }

The height of the object in pixels.

Source:UI/GObject.cs (line 497)

icon​

virtual public string icon { get; set; }

Source:UI/GObject.cs (line 1430)

id​

public string id { get; private set; }

GObject的id,仅作为内部使用。与name不同,id值是不会相同的。 id is for internal use only.

Source:UI/GObject.cs (line 13)

inContainer​

public bool inContainer { get; }

If the object has lowlevel displayobject and the displayobject has a container parent?

Source:UI/GObject.cs (line 1131)

isDisposed​

public bool isDisposed { get; }

Source:UI/GObject.cs (line 1659)

onAddedToStage​

public EventListener onAddedToStage { get; }

Dispatched when the object was added to the stage.

Source:UI/GObject.cs (line 229)

onClick​

public EventListener onClick { get; }

Dispatched when the object or its child was clicked.

Source:UI/GObject.cs (line 173)

onClickLink​

public EventListener onClickLink { get; }

Dispatched when links in the object or its child was clicked.

Source:UI/GObject.cs (line 253)

onDragEnd​

public EventListener onDragEnd { get; }

Dispatched when drag end.

Source:UI/GObject.cs (line 293)

onDragMove​

public EventListener onDragMove { get; }

Dispatched when dragging.

Source:UI/GObject.cs (line 285)

onDragStart​

public EventListener onDragStart { get; }

Dispatched when drag start.

Source:UI/GObject.cs (line 277)

onFocusIn​

public EventListener onFocusIn { get; }

Source:UI/GObject.cs (line 309)

onFocusOut​

public EventListener onFocusOut { get; }

Source:UI/GObject.cs (line 317)

onGearStop​

public EventListener onGearStop { get; }

Source:UI/GObject.cs (line 301)

onKeyDown​

public EventListener onKeyDown { get; }

Dispatched on key pressed when the object is in focus.

Source:UI/GObject.cs (line 245)

onPositionChanged​

public EventListener onPositionChanged { get; }

Dispatched when the object was moved.

Source:UI/GObject.cs (line 261)

onRemovedFromStage​

public EventListener onRemovedFromStage { get; }

Dispatched when the object was removed from the stage.

Source:UI/GObject.cs (line 237)

onRightClick​

public EventListener onRightClick { get; }

Dispatched when the object or its child was clicked by right mouse button. Web only.

Source:UI/GObject.cs (line 181)

onRollOut​

public EventListener onRollOut { get; }

The cursor or finger leave an object.

Source:UI/GObject.cs (line 221)

onRollOver​

public EventListener onRollOver { get; }

The cursor or finger hovers over an object.

Source:UI/GObject.cs (line 213)

onSizeChanged​

public EventListener onSizeChanged { get; }

Dispatched when the object was resized.

Source:UI/GObject.cs (line 269)

onStage​

public bool onStage { get; }

If the object is on stage.

Source:UI/GObject.cs (line 1142)

onTouchBegin​

public EventListener onTouchBegin { get; }

Dispatched when the finger touched the object or its child just now.

Source:UI/GObject.cs (line 189)

onTouchEnd​

public EventListener onTouchEnd { get; }

Dispatched when the finger was lifted from the screen or from the mouse button.

Source:UI/GObject.cs (line 205)

onTouchMove​

public EventListener onTouchMove { get; }

Source:UI/GObject.cs (line 197)

parent​

public GComponent parent { get; private set; }

Parent object.

Source:UI/GObject.cs (line 78)

pivot​

public Vector2 pivot { get; set; }

The x and y coordinates of the object's origin in its own coordinate space.

Source:UI/GObject.cs (line 746)

pivotAsAnchor​

public bool pivotAsAnchor { get; set; }

Source:UI/GObject.cs (line 752)

pivotX​

public float pivotX { get; set; }

The x coordinate of the object's origin in its own coordinate space.

Source:UI/GObject.cs (line 722)

pivotY​

public float pivotY { get; set; }

The y coordinate of the object's origin in its own coordinate space.

Source:UI/GObject.cs (line 734)

pixelSnapping​

public bool pixelSnapping { get; set; }

Source:UI/GObject.cs (line 436)

position​

public Vector3 position { get; set; }

The x,y,z coordinates of the object relative to the local coordinates of the parent.

Source:UI/GObject.cs (line 370)

relations​

public Relations relations { get; private set; }

Relations Object.

Source:UI/GObject.cs (line 68)

resourceURL​

public string resourceURL { get; }

Resource url of this object.

Source:UI/GObject.cs (line 1153)

root​

public GRoot root { get; }

Source:UI/GObject.cs (line 1396)

rotation​

public float rotation { get; set; }

The rotation around the z axis of the object in degrees.

Source:UI/GObject.cs (line 851)

rotationX​

public float rotationX { get; set; }

The rotation around the x axis of the object in degrees.

Source:UI/GObject.cs (line 869)

rotationY​

public float rotationY { get; set; }

The rotation around the y axis of the object in degrees.

Source:UI/GObject.cs (line 886)

scale​

public Vector2 scale { get; set; }

The scale factor.

Source:UI/GObject.cs (line 676)

scaleX​

public float scaleX { get; set; }

The horizontal scale factor. '1' means no scale, cannt be negative.

Source:UI/GObject.cs (line 652)

scaleY​

public float scaleY { get; set; }

The vertical scale factor. '1' means no scale, cannt be negative.

Source:UI/GObject.cs (line 664)

size​

public Vector2 size { get; set; }

The size of the object in pixels.

Source:UI/GObject.cs (line 512)

skew​

public Vector2 skew { get; set; }

Source:UI/GObject.cs (line 702)

sortingOrder​

public int sortingOrder { get; set; }

By default(when sortingOrder==0), object added to component is arrange by the added roder. The bigger is the sorting order, the object is more in front.

Source:UI/GObject.cs (line 971)

tabStop​

public bool tabStop { get; set; }

If the object can be navigated by TAB?

Source:UI/GObject.cs (line 1000)

text​

virtual public string text { get; set; }

Source:UI/GObject.cs (line 1421)

tooltips​

public string tooltips { get; set; }

Tooltips of this object. UIConfig.tooltipsWin must be set first.

Source:UI/GObject.cs (line 1035)

touchable​

public bool touchable { get; set; }

If the object can touch or click. GImage/GTextField is not touchable even it is true.

Source:UI/GObject.cs (line 793)

treeNode​

public GTreeNode treeNode { get; }

Source:UI/GObject.cs (line 1831)

visible​

public bool visible { get; set; }

The visibility of the object. An invisible object will be untouchable.

Source:UI/GObject.cs (line 922)

width​

public float width { get; set; }

The width of the object in pixels.

Source:UI/GObject.cs (line 482)

x​

public float x { get; set; }

The x coordinate of the object relative to the local coordinates of the parent.

Source:UI/GObject.cs (line 325)

xMin​

public float xMin { get; set; }

Source:UI/GObject.cs (line 616)

xy​

public Vector2 xy { get; set; }

The x and y coordinates of the object relative to the local coordinates of the parent.

Source:UI/GObject.cs (line 361)

y​

public float y { get; set; }

The y coordinate of the object relative to the local coordinates of the parent.

Source:UI/GObject.cs (line 337)

yMin​

public float yMin { get; set; }

Source:UI/GObject.cs (line 634)

z​

public float z { get; set; }

The z coordinate of the object relative to the local coordinates of the parent.

Source:UI/GObject.cs (line 349)