Window
Namespace:FairyGUI
Source:Assets/Scripts/UI/Window.cs (line 18)
public class Window : GComponent
Window class. 窗口使用前首先要设置窗口中需要显示的内容,这通常是在编辑器里制作好的,可以直接使用Window.contentPane进行设置。 建议把设置contentPane等初始化操作放置到Window.onInit方法中。 另外,FairyGUI还提供了一套机制用于窗口动态创建。动态创建是指初始时仅指定窗口需要使用的资源,等窗口需要显示时才实际开始构建窗口的内容。 首先需要在窗口的构造函数中调用Window.addUISource。这个方法需要一个IUISource类型的参数,而IUISource是一个接口, 用户需要自行实现载入相关UI包的逻辑。当窗口第一次显示之前,IUISource的加载方法将会被调用,并等待载入完成后才返回执行Window.OnInit,然后窗口才会显示。 如果你需要窗口显示时播放动画效果,那么覆盖doShowAnimation编写你的动画代码,并且在动画结束后调用onShown。覆盖onShown编写其他需要在窗口显示时处理的业务逻辑。 如果你需要窗口隐藏时播放动画效果,那么覆盖doHideAnimation编写你的动画代码,并且在动画结束时调用Window.hideImmediately(注意不是直接调用onHide!)。覆盖onHide编写其他需要在窗口隐藏时处理的业务逻辑。
Inheritance:EventDispatcher → GObject → GComponent → Window
Inherited members
__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
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
AddCapture, AddEventListener, BroadcastEvent, BubbleEvent, DispatchEvent, RemoveCapture, RemoveEventListener, RemoveEventListeners, hasEventListeners, isDispatching
Constructors
Window()
public Window();
Source:UI/Window.cs (line 47)
Fields
__doHideAnimation
public Action __doHideAnimation;
Compilation conditions:
FAIRYGUI_PUERTS
Source:UI/Window.cs (line 44)
__doShowAnimation
public Action __doShowAnimation;
Compilation conditions:
FAIRYGUI_PUERTS
Source:UI/Window.cs (line 43)
__onHide
public Action __onHide;
Compilation conditions:
FAIRYGUI_PUERTS
Source:UI/Window.cs (line 42)
__onInit
public Action __onInit;
Compilation conditions:
FAIRYGUI_PUERTS
Source:UI/Window.cs (line 40)
__onShown
public Action __onShown;
Compilation conditions:
FAIRYGUI_PUERTS
Source:UI/Window.cs (line 41)
_requestingCmd
protected int _requestingCmd;
Source:UI/Window.cs (line 37)
bringToFontOnClick
public bool bringToFontOnClick;
Source:UI/Window.cs (line 23)
Methods
AddUISource(IUISource)
public void AddUISource(IUISource source);
Set a UISource to this window. It must call before the window is shown. When the window is first time to show, UISource.Load is called. Only after all UISource is loaded, the window will continue to init. 为窗口添加一个源。这个方法建议在构造函数调用。当窗口第一次显示前,UISource的Load方法将被调用,然后只有所有的UISource 都ready后,窗口才会继续初始化和显示。
| Parameter | Type | Description |
|---|---|---|
source | IUISource |
Source:UI/Window.cs (line 69)
BringToFront()
public void BringToFront();
Source:UI/Window.cs (line 274)
CenterOn(GRoot, bool)
public void CenterOn(GRoot r, bool restraint);
Make the window be center of the screen.
| Parameter | Type | Description |
|---|---|---|
r | GRoot | |
restraint | bool | Add relations to ensure keeping center on screen size changed. |
Source:UI/Window.cs (line 225)
CloseModalWait()
public bool CloseModalWait();
Source:UI/Window.cs (line 329)
CloseModalWait(int)
public bool CloseModalWait(int requestingCmd);
Close modal waiting. If rquestingCmd is equal to the value you transfer in ShowModalWait, mowal wait will be closed. Otherwise, this function has no effect. 关闭模式等待。如果requestingCmd和ShowModalWait传入的不相同,则这个函数没有任何动作,立即返回。
| Parameter | Type | Description |
|---|---|---|
requestingCmd | int |
Source:UI/Window.cs (line 341)
Dispose()
override public void Dispose();
Source:UI/Window.cs (line 494)
DoHideAnimation()
virtual protected void DoHideAnimation();
Source:UI/Window.cs (line 456)
DoShowAnimation()
virtual protected void DoShowAnimation();
Source:UI/Window.cs (line 438)
Hide()
public void Hide();
Source:UI/Window.cs (line 206)
HideImmediately()
public void HideImmediately();
Hide window immediately, no OnHide will be called.
Source:UI/Window.cs (line 215)
Init()
public void Init();
Source:UI/Window.cs (line 367)
LayoutModalWaitPane()
virtual protected void LayoutModalWaitPane();
Source:UI/Window.cs (line 312)
OnHide()
virtual protected void OnHide();
Source:UI/Window.cs (line 424)
OnInit()
virtual protected void OnInit();
Source:UI/Window.cs (line 396)
OnShown()
virtual protected void OnShown();
Source:UI/Window.cs (line 410)
Show()
public void Show();
Source:UI/Window.cs (line 189)
ShowModalWait()
public void ShowModalWait();
Source:UI/Window.cs (line 282)
ShowModalWait(int)
public void ShowModalWait(int requestingCmd);
Display a modal waiting sign in the front. 显示一个等待标志在最前面。等待标志的资源可以通过UIConfig.windowModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。 还可以设定一个requestingCmd作为等待的命令字,在CloseModalWait里传入相同的命令字ModalWait将结束,否则CloseModalWait无效。
| Parameter | Type | Description |
|---|---|---|
requestingCmd | int |
Source:UI/Window.cs (line 293)
ShowOn(GRoot)
public void ShowOn(GRoot r);
| Parameter | Type | Description |
|---|---|---|
r | GRoot |
Source:UI/Window.cs (line 198)
ToggleStatus()
public void ToggleStatus();
Switch show and hide status.
Source:UI/Window.cs (line 238)
closeEventHandler(EventContext)
virtual protected void closeEventHandler(EventContext context);
| Parameter | Type | Description |
|---|---|---|
context | EventContext |
Source:UI/Window.cs (line 521)
Properties
closeButton
public GObject closeButton { get; set; }
Source:UI/Window.cs (line 127)
contentArea
public GObject contentArea { get; set; }
Source:UI/Window.cs (line 172)
contentPane
public GComponent contentPane { set; get; }
Source:UI/Window.cs (line 77)
dragArea
public GObject dragArea { get; set; }
Source:UI/Window.cs (line 143)
frame
public GComponent frame { get; }
Source:UI/Window.cs (line 119)
isShowing
public bool isShowing { get; }
Source:UI/Window.cs (line 249)
isTop
public bool isTop { get; }
Source:UI/Window.cs (line 257)
modal
public bool modal { get; set; }
Source:UI/Window.cs (line 265)
modalWaiting
public bool modalWaiting { get; }
Source:UI/Window.cs (line 359)
modalWaitingPane
public GObject modalWaitingPane { get; }
Source:UI/Window.cs (line 181)