Controller
命名空间:FairyGUI
源码:Assets/Scripts/UI/Controller.cs (行 12)
public class Controller : EventDispatcher
Controller class. 控制器类。控制器的创建和设计需通过编辑器完成,不建议使用代码创建。 最常用的方法是通过selectedIndex获得或改变控制器的活动页面。如果要获得控制器页面改变的通知,使用onChanged事件。
继承:EventDispatcher → Controller
继承成员
AddCapture, AddEventListener, BroadcastEvent, BubbleEvent, DispatchEvent, RemoveCapture, RemoveEventListener, RemoveEventListeners, hasEventListeners, isDispatching
构造函数
Controller()
public Controller();
源码:UI/Controller.cs (行 34)
字段
name
public string name;
Name of the controller 控制器名称。
源码:UI/Controller.cs (行 18)
方法
AddPage(string)
public void AddPage(string name);
Add a new page to this controller.
| 参数 | 类型 | 说明 |
|---|---|---|
name | string | Page name |
源码:UI/Controller.cs (行 221)
AddPageAt(string, int)
public void AddPageAt(string name, int index);
Add a new page to this controller at a certain index.
| 参数 | 类型 | 说明 |
|---|---|---|
name | string | Page name |
index | int | Insert position |
源码:UI/Controller.cs (行 234)
ClearPages()
public void ClearPages();
Remove all pages.
源码:UI/Controller.cs (行 284)
Dispose()
public void Dispose();
源码:UI/Controller.cs (行 42)
GetPageId(int)
public string GetPageId(int index);
Get page id by an index. 通过页面索引获得页面id。
返回值
Page Id
| 参数 | 类型 | 说明 |
|---|---|---|
index | int | Page index |
源码:UI/Controller.cs (行 198)
GetPageIdByName(string)
public string GetPageIdByName(string aName);
Get page id by name
| 参数 | 类型 | 说明 |
|---|---|---|
aName | string |
源码:UI/Controller.cs (行 208)
GetPageName(int)
public string GetPageName(int index);
Get page name by an index. 通过页面索引获得页面名称。
返回值
Page Name
| 参数 | 类型 | 说明 |
|---|---|---|
index | int | Page index |
源码:UI/Controller.cs (行 187)
HasPage(string)
public bool HasPage(string aName);
Check if the controller has a page.
| 参数 | 类型 | 说明 |
|---|---|---|
aName | string | Page name. |
源码:UI/Controller.cs (行 299)
RemovePage(string)
public void RemovePage(string name);
Remove a page.
| 参数 | 类型 | 说明 |
|---|---|---|
name | string | Page name |
源码:UI/Controller.cs (行 253)
RemovePageAt(int)
public void RemovePageAt(int index);
Removes a page at a certain index.
| 参数 | 类型 | 说明 |
|---|---|---|
index | int |
源码:UI/Controller.cs (行 271)
RunActions()
public void RunActions();
源码:UI/Controller.cs (行 358)
SetSelectedIndex(int)
public void SetSelectedIndex(int value);
Set current page index, no onChanged event. 通过索引设置当前活动页面,和selectedIndex的区别在于,这个方法不会触发onChanged事件。
| 参数 | 类型 | 说明 |
|---|---|---|
value | int | Page index |
源码:UI/Controller.cs (行 92)
SetSelectedPage(string)
public void SetSelectedPage(string value);
Set current page by name, no onChanged event. 通过页面名称设置当前活动页面,和selectedPage的区别在于,这个方法不会触发onChanged事件。
| 参数 | 类型 | 说明 |
|---|---|---|
value | string | Page name |
源码:UI/Controller.cs (行 112)
Setup(ByteBuffer)
public void Setup(ByteBuffer buffer);
| 参数 | 类型 | 说明 |
|---|---|---|
buffer | ByteBuffer |
源码:UI/Controller.cs (行 370)
属性
onChanged
public EventListener onChanged { get; }
When controller page changed. 当控制器活动页面改变时,此事件被触发。
源码:UI/Controller.cs (行 52)
pageCount
public int pageCount { get; }
Page count of this controller. 获得页面数量。
源码:UI/Controller.cs (行 176)
previousIndex
public int previousIndex { get; }
Previouse page index. 获得上次活动页面索引
源码:UI/Controller.cs (行 152)
previousPage
public string previousPage { get; }
Previous page name. 获得上次活动页面名称。
源码:UI/Controller.cs (行 161)
previsousIndex
public int previsousIndex { get; }
源码:UI/Controller.cs (行 142)
selectedIndex
public int selectedIndex { get; set; }
Current page index. 获得或设置当前活动页面索引。
源码:UI/Controller.cs (行 61)
selectedPage
public string selectedPage { get; set; }
Current page name. 获得当前活动页面名称
源码:UI/Controller.cs (行 124)