C# Class FairyGUI.Window

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: GComponent
显示文件 Open project: fairygui/FairyGUI-unity Class Usage Examples

Protected Properties

Property Type Description
_requestingCmd int

Public Methods

Method Description
AddUISource ( IUISource source ) : void

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后,窗口才会继续初始化和显示。

BringToFront ( ) : void

CenterOn ( GRoot r, bool restraint ) : void

Make the window be center of the screen.

CloseModalWait ( ) : bool

CloseModalWait ( int requestingCmd ) : bool

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传入的不相同,则这个函数没有任何动作,立即返回。

Dispose ( ) : void
Hide ( ) : void

HideImmediately ( ) : void

Hide window immediately, no OnHide will be called.

Init ( ) : void

Show ( ) : void

ShowModalWait ( ) : void

ShowModalWait ( int requestingCmd ) : void

Display a modal waiting sign in the front. 显示一个等待标志在最前面。等待标志的资源可以通过UIConfig.windowModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。 还可以设定一个requestingCmd作为等待的命令字,在CloseModalWait里传入相同的命令字ModalWait将结束,否则CloseModalWait无效。

ShowOn ( GRoot r ) : void

ToggleStatus ( ) : void

Switch show and hide status.

Window ( ) : System.Collections.Generic

Protected Methods

Method Description
DoHideAnimation ( ) : void

DoShowAnimation ( ) : void

LayoutModalWaitPane ( ) : void
OnHide ( ) : void

OnInit ( ) : void

OnShown ( ) : void

__onHide ( ) : void
__onShown ( ) : void
__uiLoadComplete ( ) : void
_init ( ) : void
closeEventHandler ( ) : void

Private Methods

Method Description
__dragStart ( EventContext context ) : void
__touchBegin ( EventContext context ) : void

Method Details

AddUISource() public method

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后,窗口才会继续初始化和显示。
public AddUISource ( IUISource source ) : void
source IUISource
return void

BringToFront() public method

public BringToFront ( ) : void
return void

CenterOn() public method

Make the window be center of the screen.
public CenterOn ( GRoot r, bool restraint ) : void
r GRoot
restraint bool Add relations to ensure keeping center on screen size changed.
return void

CloseModalWait() public method

public CloseModalWait ( ) : bool
return bool

CloseModalWait() public method

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传入的不相同,则这个函数没有任何动作,立即返回。
public CloseModalWait ( int requestingCmd ) : bool
requestingCmd int
return bool

Dispose() public method

public Dispose ( ) : void
return void

DoHideAnimation() protected method

protected DoHideAnimation ( ) : void
return void

DoShowAnimation() protected method

protected DoShowAnimation ( ) : void
return void

Hide() public method

public Hide ( ) : void
return void

HideImmediately() public method

Hide window immediately, no OnHide will be called.
public HideImmediately ( ) : void
return void

Init() public method

public Init ( ) : void
return void

LayoutModalWaitPane() protected method

protected LayoutModalWaitPane ( ) : void
return void

OnHide() protected method

protected OnHide ( ) : void
return void

OnInit() protected method

protected OnInit ( ) : void
return void

OnShown() protected method

protected OnShown ( ) : void
return void

Show() public method

public Show ( ) : void
return void

ShowModalWait() public method

public ShowModalWait ( ) : void
return void

ShowModalWait() public method

Display a modal waiting sign in the front. 显示一个等待标志在最前面。等待标志的资源可以通过UIConfig.windowModalWaiting。等待标志组件会设置为屏幕大小,请内部做好关联。 还可以设定一个requestingCmd作为等待的命令字,在CloseModalWait里传入相同的命令字ModalWait将结束,否则CloseModalWait无效。
public ShowModalWait ( int requestingCmd ) : void
requestingCmd int
return void

ShowOn() public method

public ShowOn ( GRoot r ) : void
r GRoot
return void

ToggleStatus() public method

Switch show and hide status.
public ToggleStatus ( ) : void
return void

Window() public method

public Window ( ) : System.Collections.Generic
return System.Collections.Generic

__onHide() protected method

protected __onHide ( ) : void
return void

__onShown() protected method

protected __onShown ( ) : void
return void

__uiLoadComplete() protected method

protected __uiLoadComplete ( ) : void
return void

_init() protected method

protected _init ( ) : void
return void

closeEventHandler() protected method

protected closeEventHandler ( ) : void
return void

Property Details

_requestingCmd protected_oe property

protected int _requestingCmd
return int