Exemplo n.º 1
0
        public static async ETTask <GObject> CreateGObjectAsync(Scene scene, string packageName, string resName)
        {
            await scene.GetComponent <FGUIPackageComponent>().AddPackageAsync(packageName);

            ETTask <GObject> tcs = ETTask <GObject> .Create(true);

            UIPackage.CreateObjectAsync(packageName, resName, (go) => { tcs.SetResult(go); });
            return(await tcs);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 内部接口,显示窗口
 /// </summary>
 public void Init()
 {
     OnInit();
     if (!string.IsNullOrEmpty(_windowName))
     {
         _window.Show();
         if (_asyncCreate)//异步加载
         {
             UIPackage.CreateObjectAsync(_pkgName, _windowName, OnInitAsyncCallBack);
         }
         else
         {
             _window.contentPane = UIPackage.CreateObject(_pkgName, _windowName).asCom;
             _contentPane        = _window.contentPane;
             Init2();
             DoShowAnimation();
         }
     }
 }
    public void LoadUI(string pkg, string pageName, System.Action <GObject> gobj = null)
    {
#if ASYNC_MODE
        UIPackage.CreateObjectAsync(pkg, pageName, delegate(GObject obj)
        {
            Debug.Log("异步加载打开");
            if (gobj != null)
            {
                gobj(obj);
                gobj = null;
            }
        });
#else
        Debug.Log("同步加载打开");
        GObject obj = UIPackage.CreateObject(pkg, pageName);
        if (gobj != null)
        {
            gobj(obj);
            gobj = null;
        }
#endif
    }
    public void LoadUI(string pkg, string pageName, LuaInterface.LuaFunction gfunc = null)
    {
#if ASYNC_MODE
        UIPackage.CreateObjectAsync(pkg, pageName, delegate(GObject obj)
        {
            Debug.Log("异步加载打开");
            if (gfunc != null)
            {
                gfunc.Call <GObject>(obj);
                gfunc.Dispose();
                gfunc = null;
            }
        });
#else
        Debug.Log("同步加载打开");
        GObject obj = UIPackage.CreateObject(pkg, pageName);
        if (gfunc != null)
        {
            gfunc.Call <GObject>(obj);
            gfunc.Dispose();
            gfunc = null;
        }
#endif
    }
Exemplo n.º 5
0
 private static void CreateGObjectAsync(UIPackage.CreateObjectCallback result)
 {
     UIPackage.CreateObjectAsync(UIPackageName, UIResName, result);
 }