/// <summary> /// 打开面板 /// </summary> /// <param name="isSync">是否同步加载</param> /// <param name="pageLoadPath">加载的相对路径</param> public void ShowPage(string pageName) { if (string.IsNullOrEmpty(pageName)) { Debug.LogError("pageName--是null"); return; } bool isExist = CheckPageExist(pageName); XPage currXPage = null; if (isExist) { currXPage = m_pageDic[pageName]; if (currXPage.m_currState == EPageState.HIDE) { CheckPageMode(currXPage); currXPage.Rest(); currShowXPage = currXPage; } } else { //add currXPage = new XPage(pageName, ""); currXPage.Awake(); currXPage.LoadAsync(ResManager, o => { m_pageDic.Add(pageName, currXPage); currShowXPage = currXPage; CheckPageMode(currXPage); currXPage.Start(); Debug.LogWarning("CreatePanel::>> " + name + " " + o); }); } }
static int LoadAsync(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage)); System.Action <UnityEngine.GameObject> arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 2); obj.LoadAsync(arg0); return(0); } else if (count == 3) { XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage)); LuaFramework.ResourceManager arg0 = (LuaFramework.ResourceManager)ToLua.CheckObject <LuaFramework.ResourceManager>(L, 2); System.Action <UnityEngine.GameObject> arg1 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 3); obj.LoadAsync(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: XPage.LoadAsync")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LoadAsync(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage)); System.Action <UnityEngine.GameObject> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckObject(L, 2, typeof(System.Action <UnityEngine.GameObject>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.GameObject>), func) as System.Action <UnityEngine.GameObject>; } obj.LoadAsync(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_delegateAsyncLoadUI(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; System.Action <string, System.Action <UnityEngine.Object> > arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <string, System.Action <UnityEngine.Object> >)ToLua.CheckObject(L, 2, typeof(System.Action <string, System.Action <UnityEngine.Object> >)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <string, System.Action <UnityEngine.Object> >), func) as System.Action <string, System.Action <UnityEngine.Object> >; } obj.delegateAsyncLoadUI = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index delegateAsyncLoadUI on a nil value" : e.Message)); } }
/// <summary> /// 销毁 /// </summary> public void Destroy() { CloseAllPages(); currShowXPage = null; m_pageDic = null; m_pageNeedBackPool = null; Debug.Log("~XPageMgr was destroy"); }
/// <summary> /// 绑定你自己的资源加载管理器 /// </summary> /// <param name="xPage"></param> public static void Bind(XPage xPage) { //binding同步加载方法 xPage.delegateSyncLoadUI = Resources.Load; //开发过程可以用Resource.Load, 真机调试时: 打包用AssetBundle的非压缩格式,加载用LoadFromFile同步加载.考虑修改ResourceMgr TODO //binding异步加载方法,注:异步我们不用,因为要等回调!即时是AssetBundle,也在loading的时候,预加载到内存,在游戏中,就可以同步的实例化. //xPage.delegateAsyncLoadUI =null;// AppFacade.Instance.GetManager<ResourceManager>(ManagerName.Resource).LoadPrefab;//ResourcesMgr.Load; }
protected override ICollection <Field> InstantiateCore() { XView xView = XTemplate.XProject.XViews.Single(); AddCheckCode(xView); XPage xPage = xView.XPages.Single(); Page page = InstantiatePage(xPage, View); return(InstantiateFields(xPage, page).ToList()); }
/// <summary> ///隐藏指定面板 /// </summary> /// <param name="pageName">Page name.</param> public void HidePage(string pageName) { bool isExist = CheckPageExist(pageName); if (isExist) { XPage _currXpage = m_pageDic[pageName]; if (_currXpage.m_currState == EPageState.OPEN) { _currXpage.Hide(); } } }
static int Rest(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage)); obj.Rest(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
protected Page InstantiatePage(XPage xPage, View view) { Progress?.Report($"Adding page: {view.Name}/{xPage.Name}"); Page page = xPage.Instantiate(view); if (context.PageNameGenerator.Exists(page.Name)) { page.Name = context.PageNameGenerator.MakeUnique(page.Name); Progress?.Report($"Renamed page: {page.Name}"); } page.Position = view.Pages.Count; Metadata.InsertPage(page); view.Pages.Add(page); return(page); }
/// <summary> /// 检查面板打开类型 /// </summary> /// <param name="currXPage"></param> private void CheckPageMode(XPage currXPage) { if (currXPage.m_pageMode == EPageHideMode.DoNothing) { } else if (currXPage.m_pageMode == EPageHideMode.HideOtherOnly) { HideOtherPages(currXPage); } else if (currXPage.m_pageMode == EPageHideMode.HideOtherAndNeedBack) { HideOtherPages(currXPage); m_pageNeedBackPool.Push(currXPage); } }
static int LoadSync(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage)); System.Action <UnityEngine.GameObject> arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 2); obj.LoadSync(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
protected void AddPage(Page page, XView xView) { View view = page.GetView(); Progress?.Report($"Adding page: {view.Name}/{page.Name}"); XPage xPage = XPage.Create(page); xView.Add(xPage); foreach (DataRow field in GetFields(page)) { string fieldName = field.Field <string>(ColumnNames.NAME); Progress?.Report($"Adding field: {view.Name}/{page.Name}/{fieldName}"); xPage.Add(XField.Create(field)); } }
/// <summary> /// 检查面板打开类型 /// </summary> /// <param name="currXPage"></param> private void CheckPageMode(XPage currXPage) { if (currXPage.m_pageMode == EPageMode.DoNothing) { } else if (currXPage.m_pageMode == EPageMode.HideOther) { } else if (currXPage.m_pageMode == EPageMode.NeedBack) { } else if (currXPage.m_pageMode == EPageMode.NoNeedBack) { } }
/// <summary> /// 打开面板 /// </summary> /// <param name="isSync">是否同步加载</param> /// <param name="pageLoadPath">加载的相对路径</param> public void ShowPage(bool isSync, string pageLoadPath) { string pageName = GetPageName(pageLoadPath); bool isExist = CheckPageExist(pageName); XPage currXPage = null; if (isExist) { currXPage = m_pageDic[pageName]; CheckPageMode(currXPage); currXPage.Rest(); currShowXPage = currXPage; } else { //add currXPage = new XPage(pageName, pageLoadPath); currXPage.Awake(); XPageLoadBind.Bind(currXPage); if (isSync) { currXPage.LoadSync((go) => { CheckPageMode(currXPage); currXPage.Start(); m_pageDic.Add(pageName, currXPage); }); } else { currXPage.LoadAsync((go) => { currXPage.Awake(); CheckPageMode(currXPage); m_pageDic.Add(pageName, currXPage); }); } } }
static int set_m_loadPath(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; string arg0 = ToLua.CheckString(L, 2); obj.m_loadPath = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_loadPath on a nil value" : e.Message)); } }
static int get_delegateAsyncLoadUI(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; System.Action <string, System.Action <UnityEngine.Object> > ret = obj.delegateAsyncLoadUI; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index delegateAsyncLoadUI on a nil value" : e.Message)); } }
static int get_m_currState(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; EPageState ret = obj.m_currState; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_currState on a nil value" : e.Message)); } }
static int get_m_pageTrans(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; UnityEngine.Transform ret = obj.m_pageTrans; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_pageTrans on a nil value" : e.Message)); } }
static int get_m_loadPath(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; string ret = obj.m_loadPath; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_loadPath on a nil value" : e.Message)); } }
static int get_m_pageMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; EPageHideMode ret = obj.m_pageMode; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index m_pageMode on a nil value")); } }
static int get_m_pageInst(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; UnityEngine.GameObject ret = obj.m_pageInst; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index m_pageInst on a nil value")); } }
static int set_m_pageTrans(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Transform)); obj.m_pageTrans = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_pageTrans on a nil value" : e.Message)); } }
static int set_m_pageInst(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject)); obj.m_pageInst = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index m_pageInst on a nil value")); } }
static int set_m_pageMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; EPageHideMode arg0 = (EPageHideMode)ToLua.CheckObject(L, 2, typeof(EPageHideMode)); obj.m_pageMode = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index m_pageMode on a nil value")); } }
static int set_delegateAsyncLoadUI(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; System.Action <string, System.Action <UnityEngine.Object> > arg0 = (System.Action <string, System.Action <UnityEngine.Object> >)ToLua.CheckDelegate <System.Action <string, System.Action <UnityEngine.Object> > >(L, 2); obj.delegateAsyncLoadUI = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index delegateAsyncLoadUI on a nil value")); } }
static int set_m_currState(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; EPageState arg0 = (EPageState)ToLua.CheckObject(L, 2, typeof(EPageState)); obj.m_currState = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_currState on a nil value" : e.Message)); } }
static int set_m_pageName(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPage obj = (XPage)o; string arg0 = ToLua.CheckString(L, 2); obj.m_pageName = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index m_pageName on a nil value")); } }
static int get_currShowXPage(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPageMgr obj = (XPageMgr)o; XPage ret = obj.currShowXPage; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index currShowXPage on a nil value" : e.Message)); } }
static int set_currShowXPage(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); XPageManager obj = (XPageManager)o; XPage arg0 = (XPage)ToLua.CheckObject(L, 2, typeof(XPage)); obj.currShowXPage = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index currShowXPage on a nil value")); } }