Skip to main content

GRoot

Namespace:FairyGUI
Source:Assets/Scripts/UI/GRoot.cs (line 10)

public class GRoot : GComponent

GRoot is a topmost component of UI display list.You dont need to create GRoot. It is created automatically.

Inheritance:EventDispatcher → GObject → GComponent → GRoot

Inherited members​

GComponent

__onConstruct, __onDispose, _apexIndex, _boundsChanged, _childrenRenderOrder, _margin, _trackBounds, AddChild, AddChildAt, AddController, CallLua, ChangeChildrenOrder, ConstructExtension, ConstructFromResource, ConstructFromXML, CreateDisplayObject, EnsureBoundsCorrect, GetChild, GetChildAt, GetChildByPath, GetChildInGroup, GetChildIndex, GetChildren, GetController, GetControllerAt, GetFirstChildInView, GetSnappingPosition, GetSnappingPositionWithDir, GetTransition, GetTransitionAt, GetVisibleChild, HandleControllerChanged, HandleGrayedChanged, HandleSizeChanged, InvalidateBatchingState, IsAncestorOf, IsChildInView, OnUpdate, RemoveChild, RemoveChildAt, RemoveChildren, RemoveController, SetBounds, SetBoundsChangedFlag, SetChildIndex, SetChildIndexBefore, SetLuaPeer, SetupOverflow, SetupScroll, Setup_AfterAdd, 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, 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

Constructors​

GRoot()​

public GRoot();

Source:UI/GRoot.cs (line 57)

Methods​

ApplyContentScaleFactor()​

public void ApplyContentScaleFactor();

This is called after screen size changed.

Source:UI/GRoot.cs (line 121)

BringToFront(Window)​

public void BringToFront(Window win);

将一个窗口提到所有窗口的最前面

ParameterTypeDescription
winWindow

Source:UI/GRoot.cs (line 177)

CloseAllExceptModals()​

public void CloseAllExceptModals();

Close all windows except modal windows.

Source:UI/GRoot.cs (line 232)

CloseAllWindows()​

public void CloseAllWindows();

Close all windows.

Source:UI/GRoot.cs (line 245)

CloseModalWait()​

public void CloseModalWait();

Hide modal layer and waiting sign.

Source:UI/GRoot.cs (line 223)

DisableSound()​

public void DisableSound();

Source:UI/GRoot.cs (line 823)

DisplayObjectToGObject(DisplayObject)​

public GObject DisplayObjectToGObject(DisplayObject obj);
ParameterTypeDescription
objDisplayObject

Source:UI/GRoot.cs (line 332)

Dispose()​

override public void Dispose();

Source:UI/GRoot.cs (line 70)

EnableSound()​

public void EnableSound();

Source:UI/GRoot.cs (line 815)

GetPoupPosition(GObject, GObject, PopupDirection)​

public Vector2 GetPoupPosition(GObject popup, GObject target, PopupDirection dir);
ParameterTypeDescription
popupGObject
targetGObject
dirPopupDirection

Source:UI/GRoot.cs (line 487)

GetPoupPosition(GObject, GObject, object)​

public Vector2 GetPoupPosition(GObject popup, GObject target, object downward);
ParameterTypeDescription
popupGObject
targetGObject
downwardobject

Source:UI/GRoot.cs (line 473)

GetTopWindow()​

public Window GetTopWindow();

Get window on top.

Source:UI/GRoot.cs (line 259)

HidePopup()​

public void HidePopup();

Close all popups.

Source:UI/GRoot.cs (line 575)

HidePopup(GObject)​

public void HidePopup(GObject popup);

Close a popup.

ParameterTypeDescription
popupGObject

Source:UI/GRoot.cs (line 584)

HideTooltips()​

public void HideTooltips();

Source:UI/GRoot.cs (line 714)

HideWindow(Window)​

public void HideWindow(Window win);

Call window.Hide 关闭一个窗口。将调用Window.Hide方法。

ParameterTypeDescription
winWindow

Source:UI/GRoot.cs (line 142)

HideWindowImmediately(Window)​

public void HideWindowImmediately(Window win);

Remove a window from stage immediatelly. window.Hide/window.OnHide will never be called. 立刻关闭一个窗口。不会调用Window.Hide方法,Window.OnHide也不会被调用。

ParameterTypeDescription
winWindow

Source:UI/GRoot.cs (line 152)

HideWindowImmediately(Window, bool)​

public void HideWindowImmediately(Window win, bool dispose);

Remove a window from stage immediatelly. window.Hide/window.OnHide will never be called. 立刻关闭一个窗口。不会调用Window.Hide方法,Window.OnHide也不会被调用。

ParameterTypeDescription
winWindow
disposeboolTrue to dispose the window.

Source:UI/GRoot.cs (line 163)

PlayOneShotSound(AudioClip)​

public void PlayOneShotSound(AudioClip clip);
ParameterTypeDescription
clipAudioClip

Source:UI/GRoot.cs (line 842)

PlayOneShotSound(AudioClip, float)​

public void PlayOneShotSound(AudioClip clip, float volumeScale);
ParameterTypeDescription
clipAudioClip
volumeScalefloat

Source:UI/GRoot.cs (line 833)

SetContentScaleFactor(float)​

public void SetContentScaleFactor(float constantScaleFactor);
ParameterTypeDescription
constantScaleFactorfloat

Source:UI/GRoot.cs (line 109)

SetContentScaleFactor(int, int)​

public void SetContentScaleFactor(int designResolutionX, int designResolutionY);

Set content scale factor.

ParameterTypeDescription
designResolutionXintDesign resolution of x axis.
designResolutionYintDesign resolution of y axis.

Source:UI/GRoot.cs (line 83)

SetContentScaleFactor(int, int, ScreenMatchMode)​

public void SetContentScaleFactor(int designResolutionX, int designResolutionY, UIContentScaler.ScreenMatchMode screenMatchMode);

Set content scale factor.

ParameterTypeDescription
designResolutionXintDesign resolution of x axis.
designResolutionYintDesign resolution of y axis.
screenMatchModeScreenMatchModeMatch mode.

Source:UI/GRoot.cs (line 94)

ShowModalWait()​

public void ShowModalWait();

Display a modal layer and a waiting sign in the front. 显示一个半透明层和一个等待标志在最前面。半透明层的颜色可以通过UIConfig.modalLayerColor设定。 等待标志的资源可以通过UIConfig.globalModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。

Source:UI/GRoot.cs (line 204)

ShowPopup(GObject)​

public void ShowPopup(GObject popup);

Show a popup object. 显示一个popup。 popup的特点是点击popup对象外的区域,popup对象将自动消失。

ParameterTypeDescription
popupGObject

Source:UI/GRoot.cs (line 377)

ShowPopup(GObject, GObject)​

public void ShowPopup(GObject popup, GObject target);

Show a popup object along with the specific target object. 显示一个popup。将popup显示在指定对象的上边或者下边。 popup的特点是点击popup对象外的区域,popup对象将自动消失。

ParameterTypeDescription
popupGObject
targetGObject

Source:UI/GRoot.cs (line 389)

ShowPopup(GObject, GObject, PopupDirection)​

public void ShowPopup(GObject popup, GObject target, PopupDirection dir);

Show a popup object along with the specific target object. 显示一个popup。将popup显示在指定对象的上方或者下方。 popup的特点是点击popup对象外的区域,popup对象将自动消失。

ParameterTypeDescription
popupGObject
targetGObject
dirPopupDirection

Source:UI/GRoot.cs (line 410)

ShowPopup(GObject, GObject, PopupDirection, bool)​

public void ShowPopup(GObject popup, GObject target, PopupDirection dir, bool closeUntilUpEvent);

Show a popup object along with the specific target object. 显示一个popup。将popup显示在指定对象的上方或者下方。 popup的特点是点击popup对象外的区域,popup对象将自动消失。 默认情况下,popup在touchEnd事件中关闭;特别设置closeUntilUpEvent=true则可使该popup在touchEnd中才关闭。

ParameterTypeDescription
popupGObject
targetGObject
dirPopupDirection
closeUntilUpEventbool

Source:UI/GRoot.cs (line 425)

ShowPopup(GObject, GObject, object)​

public void ShowPopup(GObject popup, GObject target, object downward);
ParameterTypeDescription
popupGObject
targetGObject
downwardobject

Source:UI/GRoot.cs (line 394)

ShowTooltips(string)​

public void ShowTooltips(string msg);
ParameterTypeDescription
msgstring

Source:UI/GRoot.cs (line 633)

ShowTooltips(string, float)​

public void ShowTooltips(string msg, float delay);
ParameterTypeDescription
msgstring
delayfloat

Source:UI/GRoot.cs (line 643)

ShowTooltipsWin(GObject)​

public void ShowTooltipsWin(GObject tooltipWin);
ParameterTypeDescription
tooltipWinGObject

Source:UI/GRoot.cs (line 667)

ShowTooltipsWin(GObject, float)​

public void ShowTooltipsWin(GObject tooltipWin, float delay);
ParameterTypeDescription
tooltipWinGObject
delayfloat

Source:UI/GRoot.cs (line 677)

ShowWindow(Window)​

public void ShowWindow(Window win);

Display a window.

ParameterTypeDescription
winWindow

Source:UI/GRoot.cs (line 131)

TogglePopup(GObject)​

public void TogglePopup(GObject popup);

If a popup is showing, then close it; otherwise, open it.

ParameterTypeDescription
popupGObject

Source:UI/GRoot.cs (line 523)

TogglePopup(GObject, GObject)​

public void TogglePopup(GObject popup, GObject target);
ParameterTypeDescription
popupGObject
targetGObject

Source:UI/GRoot.cs (line 533)

TogglePopup(GObject, GObject, PopupDirection)​

public void TogglePopup(GObject popup, GObject target, PopupDirection dir);
ParameterTypeDescription
popupGObject
targetGObject
dirPopupDirection

Source:UI/GRoot.cs (line 552)

TogglePopup(GObject, GObject, PopupDirection, bool)​

public void TogglePopup(GObject popup, GObject target, PopupDirection dir, bool closeUntilUpEvent);
ParameterTypeDescription
popupGObject
targetGObject
dirPopupDirection
closeUntilUpEventbool

Source:UI/GRoot.cs (line 564)

TogglePopup(GObject, GObject, object)​

public void TogglePopup(GObject popup, GObject target, object downward);
ParameterTypeDescription
popupGObject
targetGObject
downwardobject

Source:UI/GRoot.cs (line 538)

Properties​

contentScaleFactor​

public static float contentScaleFactor { get; }

Source:UI/GRoot.cs (line 15)

contentScaleLevel​

public static int contentScaleLevel { get; }

Source:UI/GRoot.cs (line 23)

focus​

public GObject focus { get; set; }

Source:UI/GRoot.cs (line 727)

hasAnyPopup​

public bool hasAnyPopup { get; }

Source:UI/GRoot.cs (line 613)

hasModalWindow​

public bool hasModalWindow { get; }

Return true if a modal window is on stage.

Source:UI/GRoot.cs (line 300)

inst​

public static GRoot inst { get; }

Source:UI/GRoot.cs (line 37)

modalLayer​

public GGraph modalLayer { get; }

Source:UI/GRoot.cs (line 277)

modalWaiting​

public bool modalWaiting { get; }

Return true if modal waiting layer is on stage.

Source:UI/GRoot.cs (line 308)

soundVolume​

public float soundVolume { get; set; }

Source:UI/GRoot.cs (line 850)

touchTarget​

public GObject touchTarget { get; }

Get current touch target. (including hover)

Source:UI/GRoot.cs (line 319)