/// <summary> /// 打开面板 /// </summary> /// <param name="pageLoadPath">加载的相对路径</param> public void ShowPage(string pkg, string pageName) { FairyUI currXPage = CheckPageExist(pageName); if (currXPage != null) { if (currXPage.fairyUIState == FairyUIState.CLOSE || currXPage.needPool) { CheckUIMode(currXPage); currXPage.Show(); currShowUI = currXPage; Debug.Log("直接打开"); } } else { currXPage = new FairyUI(); currXPage.InitUI(pkg, pageName); currXPage.Awake(); LoadUI(pkg, pageName, delegate(GObject obj) { currXPage.AddGObject(obj.asCom); allPages.Add(pageName, currXPage); CheckUIMode(currXPage); currXPage.Start(); currShowUI = currXPage; }); } }
/// <summary> ///隐藏指定面板 /// </summary> /// <param name="pageName">Page name.</param> public void HidePage(string pageName) { FairyUI _currXpage = CheckPageExist(pageName); if (_currXpage != null) { if (_currXpage.fairyUIState == FairyUIState.OPEN) { _currXpage.Hide(); } } }
static int Awake(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); FairyUI obj = (FairyUI)ToLua.CheckObject <FairyUI>(L, 1); obj.Awake(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CheckUIMode(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FairyUIManager obj = (FairyUIManager)ToLua.CheckObject <FairyUIManager>(L, 1); FairyUI arg0 = (FairyUI)ToLua.CheckObject <FairyUI>(L, 2); obj.CheckUIMode(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 检查面板打开类型 /// </summary> /// <param name="currXPage"></param> public void CheckUIMode(FairyUI currXPage) { if (currXPage.fairyUIMode == FairyUIMode.DoNothing) { } else if (currXPage.fairyUIMode == FairyUIMode.HideOtherOnly) { HideOtherPages(currXPage); } else if (currXPage.fairyUIMode == FairyUIMode.HideOtherAndNeedBack) { HideOtherPages(currXPage); stackPages.Push(currXPage); } }
static int AddGObject(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FairyUI obj = (FairyUI)ToLua.CheckObject <FairyUI>(L, 1); FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2); obj.AddGObject(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int HasGInStack(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); FairyUI obj = (FairyUI)ToLua.CheckObject <FairyUI>(L, 1); bool o = obj.HasGInStack(); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int InitUI(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); FairyUI obj = (FairyUI)ToLua.CheckObject <FairyUI>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); obj.InitUI(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 隐藏当前的页面 /// </summary> public bool HideCurrPage() { if (currShowUI != null) { if (currShowUI.fairyUIMode == FairyUIMode.HideOtherAndNeedBack) { if (stackPages.Count > 0) { if (stackPages.Peek().Equals(currShowUI)) { FairyUI topPage = stackPages.Pop(); topPage.Hide(); currShowUI = null; if (stackPages.Count > 0) { FairyUI _curr = stackPages.Peek(); _curr.Show(); currShowUI = _curr; } } } } else { if (currShowUI.fairyUIState == FairyUIState.OPEN && !currShowUI.needPool) { currShowUI.Hide(); currShowUI = null; } else if (currShowUI.needPool) { currShowUI.Hide(); if (!currShowUI.HasGInStack()) { currShowUI = null; } } } return(true); } else { Debug.Log("currShowPage is null"); return(false); } }
static int get_fairyUIState(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; FairyUIState ret = obj.fairyUIState; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index fairyUIState on a nil value")); } }
static int get_needPool(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; bool ret = obj.needPool; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index needPool on a nil value")); } }
static int set_needPool(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.needPool = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index needPool on a nil value")); } }
static int set_fairyURL(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; string arg0 = ToLua.CheckString(L, 2); obj.fairyURL = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index fairyURL on a nil value")); } }
static int get_stack(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; System.Collections.Generic.Stack <FairyGUI.GComponent> ret = obj.stack; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index stack on a nil value")); } }
static int get_inst(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; FairyGUI.GComponent ret = obj.inst; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index inst on a nil value")); } }
static int get_fairyURL(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; string ret = obj.fairyURL; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index fairyURL on a nil value")); } }
static int set_inst(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2); obj.inst = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index inst on a nil value")); } }
static int set_fairyUIMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; FairyUIMode arg0 = (FairyUIMode)ToLua.CheckObject(L, 2, typeof(FairyUIMode)); obj.fairyUIMode = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index fairyUIMode on a nil value")); } }
static int get_pool(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyUI obj = (FairyUI)o; FairyGUI.GObjectPool ret = obj.pool; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index pool on a nil value")); } }
//之关闭fixed和popup层 private void HideOtherPages(FairyUI currXPage) { List <FairyUI> xpages = GetAllUIs(); int count = xpages.Count; for (int i = 0; i < count; i++) { FairyUI curr = xpages[i]; if (curr.Equals(currXPage)) { continue; } if (curr.fairyUIState == FairyUIState.OPEN && (curr.fairyUIType != FairyUIType.Fixed || curr.fairyUIType != FairyUIType.PopUp)) { curr.HideAll(); } } }
static int _CreateFairyUI(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { FairyUI obj = new FairyUI(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyUI.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }