Window
命名空间:FairyGUI
源码:Assets/Scripts/UI/Window.cs (行 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编写其他需要在窗口隐藏时处理的业务逻辑。
继承:EventDispatcher → GObject → GComponent → Window
继承成员
__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
构造函数
Window()
public Window();
源码:UI/Window.cs (行 47)
字段
__doHideAnimation
public Action __doHideAnimation;
编译条件:
FAIRYGUI_PUERTS
源码:UI/Window.cs (行 44)
__doShowAnimation
public Action __doShowAnimation;
编译条件:
FAIRYGUI_PUERTS
源码:UI/Window.cs (行 43)
__onHide
public Action __onHide;
编译条件:
FAIRYGUI_PUERTS
源码:UI/Window.cs (行 42)
__onInit
public Action __onInit;
编译条件:
FAIRYGUI_PUERTS
源码:UI/Window.cs (行 40)
__onShown
public Action __onShown;
编译条件:
FAIRYGUI_PUERTS
源码:UI/Window.cs (行 41)
_requestingCmd
protected int _requestingCmd;
源码:UI/Window.cs (行 37)
bringToFontOnClick
public bool bringToFontOnClick;
源码:UI/Window.cs (行 23)
方法
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后,窗口才会继续初始化和显示。
| 参数 | 类型 | 说明 |
|---|---|---|
source | IUISource |
源码:UI/Window.cs (行 69)
BringToFront()
public void BringToFront();
源码:UI/Window.cs (行 274)
CenterOn(GRoot, bool)
public void CenterOn(GRoot r, bool restraint);
Make the window be center of the screen.
| 参数 | 类型 | 说明 |
|---|---|---|
r | GRoot | |
restraint | bool | Add relations to ensure keeping center on screen size changed. |
源码:UI/Window.cs (行 225)
CloseModalWait()
public bool CloseModalWait();
源码:UI/Window.cs (行 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传入的不相同,则这个函数没有任何动作,立即返回。
| 参数 | 类型 | 说明 |
|---|---|---|
requestingCmd | int |
源码:UI/Window.cs (行 341)
Dispose()
override public void Dispose();
源码:UI/Window.cs (行 494)
DoHideAnimation()
virtual protected void DoHideAnimation();
源码:UI/Window.cs (行 456)
DoShowAnimation()
virtual protected void DoShowAnimation();
源码:UI/Window.cs (行 438)
Hide()
public void Hide();
源码:UI/Window.cs (行 206)
HideImmediately()
public void HideImmediately();
Hide window immediately, no OnHide will be called.
源码:UI/Window.cs (行 215)
Init()
public void Init();
源码:UI/Window.cs (行 367)
LayoutModalWaitPane()
virtual protected void LayoutModalWaitPane();
源码:UI/Window.cs (行 312)
OnHide()
virtual protected void OnHide();
源码:UI/Window.cs (行 424)
OnInit()
virtual protected void OnInit();
源码:UI/Window.cs (行 396)
OnShown()
virtual protected void OnShown();
源码:UI/Window.cs (行 410)
Show()
public void Show();
源码:UI/Window.cs (行 189)
ShowModalWait()
public void ShowModalWait();
源码:UI/Window.cs (行 282)
ShowModalWait(int)
public void ShowModalWait(int requestingCmd);
Display a modal waiting sign in the front. 显示一个等待标志在最前面。等待标志的资源可以通过UIConfig.windowModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。 还可以设定一个requestingCmd作为等待的命令字,在CloseModalWait里传入相同的命令字ModalWait将结束,否则CloseModalWait无效。
| 参数 | 类型 | 说明 |
|---|---|---|
requestingCmd | int |
源码:UI/Window.cs (行 293)
ShowOn(GRoot)
public void ShowOn(GRoot r);
| 参数 | 类型 | 说明 |
|---|---|---|
r | GRoot |
源码:UI/Window.cs (行 198)
ToggleStatus()
public void ToggleStatus();
Switch show and hide status.
源码:UI/Window.cs (行 238)
closeEventHandler(EventContext)
virtual protected void closeEventHandler(EventContext context);
| 参数 | 类型 | 说明 |
|---|---|---|
context | EventContext |
源码:UI/Window.cs (行 521)
属性
closeButton
public GObject closeButton { get; set; }
源码:UI/Window.cs (行 127)
contentArea
public GObject contentArea { get; set; }
源码:UI/Window.cs (行 172)
contentPane
public GComponent contentPane { set; get; }
源码:UI/Window.cs (行 77)
dragArea
public GObject dragArea { get; set; }
源码:UI/Window.cs (行 143)
frame
public GComponent frame { get; }
源码:UI/Window.cs (行 119)
isShowing
public bool isShowing { get; }
源码:UI/Window.cs (行 249)
isTop
public bool isTop { get; }
源码:UI/Window.cs (行 257)
modal
public bool modal { get; set; }
源码:UI/Window.cs (行 265)
modalWaiting
public bool modalWaiting { get; }
源码:UI/Window.cs (行 359)
modalWaitingPane
public GObject modalWaitingPane { get; }
源码:UI/Window.cs (行 181)