Example #1
0
    static int ReloadAssets(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
                obj.ReloadAssets();
                return(0);
            }
            else if (count == 2)
            {
                FairyGUI.UIPackage      obj  = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.CheckObject <UnityEngine.AssetBundle>(L, 2);
                obj.ReloadAssets(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.ReloadAssets"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
 static public int CreateObject(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
             System.String      a1;
             checkType(l, 2, out a1);
             var ret = self.CreateObject(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
             System.String      a1;
             checkType(l, 2, out a1);
             System.Type a2;
             checkType(l, 3, out a2);
             var ret = self.CreateObject(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
    static int GetItemAsset(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.UIPackage), typeof(string)))
            {
                FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)ToLua.ToObject(L, 1);
                string             arg0 = ToLua.ToString(L, 2);
                object             o    = obj.GetItemAsset(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(string)))
            {
                string arg0 = ToLua.ToString(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                object o    = FairyGUI.UIPackage.GetItemAsset(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.GetItemAsset"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #4
0
    static int CreateObjectAsync(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes <FairyGUI.UIPackage, string, FairyGUI.UIPackage.CreateObjectCallback>(L, 1))
            {
                FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)ToLua.ToObject(L, 1);
                string             arg0 = ToLua.ToString(L, 2);
                FairyGUI.UIPackage.CreateObjectCallback arg1 = (FairyGUI.UIPackage.CreateObjectCallback)ToLua.ToObject(L, 3);
                obj.CreateObjectAsync(arg0, arg1);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, string, FairyGUI.UIPackage.CreateObjectCallback>(L, 1))
            {
                string arg0 = ToLua.ToString(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                FairyGUI.UIPackage.CreateObjectCallback arg2 = (FairyGUI.UIPackage.CreateObjectCallback)ToLua.ToObject(L, 3);
                FairyGUI.UIPackage.CreateObjectAsync(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.CreateObjectAsync"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int CreateObjectAsync(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.UIPackage), typeof(string), typeof(FairyGUI.UIPackage.CreateObjectCallback)))
            {
                FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)ToLua.ToObject(L, 1);
                string             arg0 = ToLua.ToString(L, 2);
                FairyGUI.UIPackage.CreateObjectCallback arg1 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (FairyGUI.UIPackage.CreateObjectCallback)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(FairyGUI.UIPackage.CreateObjectCallback), func) as FairyGUI.UIPackage.CreateObjectCallback;
                }

                obj.CreateObjectAsync(arg0, arg1);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(string), typeof(FairyGUI.UIPackage.CreateObjectCallback)))
            {
                string arg0 = ToLua.ToString(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                FairyGUI.UIPackage.CreateObjectCallback arg2 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (FairyGUI.UIPackage.CreateObjectCallback)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg2 = DelegateFactory.CreateDelegate(typeof(FairyGUI.UIPackage.CreateObjectCallback), func) as FairyGUI.UIPackage.CreateObjectCallback;
                }

                FairyGUI.UIPackage.CreateObjectAsync(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.CreateObjectAsync"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #6
0
 public static void Create(FairyGUI.UIPackage target)
 {
     if (_instance != null)
     {
         _instance.Close();
         _instance = null;
     }
     _instance        = CreateInstance <CodeGenerateEditor>();
     _instance.target = target;
     _instance.Show();
 }
Example #7
0
 static public int get_customId(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.customId);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #8
0
 static public int GetItems(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         var ret = self.GetItems();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #9
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.UIPackage o;
         o = new FairyGUI.UIPackage();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #10
0
    static int CreateObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <FairyGUI.UIPackage, string>(L, 1))
            {
                FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)ToLua.ToObject(L, 1);
                string             arg0 = ToLua.ToString(L, 2);
                FairyGUI.GObject   o    = obj.CreateObject(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <string, string>(L, 1))
            {
                string           arg0 = ToLua.ToString(L, 1);
                string           arg1 = ToLua.ToString(L, 2);
                FairyGUI.GObject o    = FairyGUI.UIPackage.CreateObject(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <FairyGUI.UIPackage, string, System.Type>(L, 1))
            {
                FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)ToLua.ToObject(L, 1);
                string             arg0 = ToLua.ToString(L, 2);
                System.Type        arg1 = (System.Type)ToLua.ToObject(L, 3);
                FairyGUI.GObject   o    = obj.CreateObject(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, string, System.Type>(L, 1))
            {
                string           arg0 = ToLua.ToString(L, 1);
                string           arg1 = ToLua.ToString(L, 2);
                System.Type      arg2 = (System.Type)ToLua.ToObject(L, 3);
                FairyGUI.GObject o    = FairyGUI.UIPackage.CreateObject(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.CreateObject"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #11
0
 static int UnloadAssets(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         obj.UnloadAssets();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #12
0
 static public int set_customId(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         string             v;
         checkType(l, 2, out v);
         self.customId = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #13
0
 static int GetItems(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         System.Collections.Generic.List <FairyGUI.PackageItem> o = obj.GetItems();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #14
0
 static int GetByName(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         string             arg0 = ToLua.CheckString(L, 1);
         FairyGUI.UIPackage o    = FairyGUI.UIPackage.GetByName(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #15
0
 static public int GetItemAsset(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         System.String      a1;
         checkType(l, 2, out a1);
         var ret = self.GetItemAsset(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #16
0
 static int GetItemByName(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.UIPackage   obj  = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         string               arg0 = ToLua.CheckString(L, 2);
         FairyGUI.PackageItem o    = obj.GetItemByName(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #17
0
 static int GetPixelHitTestData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.UIPackage        obj  = (FairyGUI.UIPackage)ToLua.CheckObject(L, 1, typeof(FairyGUI.UIPackage));
         string                    arg0 = ToLua.CheckString(L, 2);
         FairyGUI.PixelHitTestData o    = obj.GetPixelHitTestData(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #18
0
    static int get_resBundle(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.UIPackage      obj = (FairyGUI.UIPackage)o;
            UnityEngine.AssetBundle ret = obj.resBundle;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index resBundle on a nil value"));
        }
    }
Example #19
0
 static int SetItemAsset(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         FairyGUI.UIPackage   obj  = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         FairyGUI.PackageItem arg0 = (FairyGUI.PackageItem)ToLua.CheckObject <FairyGUI.PackageItem>(L, 2);
         object arg1 = ToLua.ToVarObject(L, 3);
         FairyGUI.DestroyMethod arg2 = (FairyGUI.DestroyMethod)ToLua.CheckObject(L, 4, typeof(FairyGUI.DestroyMethod));
         obj.SetItemAsset(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #20
0
    static int get_assetPath(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.UIPackage obj = (FairyGUI.UIPackage)o;
            string             ret = obj.assetPath;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index assetPath on a nil value" : e.Message));
        }
    }
Example #21
0
    static int set_customId(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.UIPackage obj  = (FairyGUI.UIPackage)o;
            string             arg0 = ToLua.CheckString(L, 2);
            obj.customId = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index customId on a nil value"));
        }
    }
Example #22
0
    static int get_customId(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.UIPackage obj = (FairyGUI.UIPackage)o;
            string             ret = obj.customId;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index customId on a nil value"));
        }
    }
Example #23
0
    static int get_dependencies(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.UIPackage obj = (FairyGUI.UIPackage)o;
            System.Collections.Generic.Dictionary <string, string>[] ret = obj.dependencies;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index dependencies on a nil value"));
        }
    }
Example #24
0
 public void TryAddFairyGuiRes()
 {
     foreach (ResInfo info in mDic.Values)
     {
         if (info.isFairyGuiPack)
         {
             FairyGUI.UIPackage pack = FairyGUI.UIPackage.GetByName(info.name);
             if (pack == null)
             {
                 FairyGUI.UIPackage.AddPackage(info.name, (name, extension, type) =>
                 {
                     UnityEngine.Object obj = GetAsset(name);
                     return(obj);
                 });
             }
         }
     }
 }
Example #25
0
    public static void PickPackageToGenerateCode()
    {
        if (UnityEditor.Selection.objects.Length > 1)
        {
            return;
        }

        var selected = UnityEditor.Selection.activeObject;
        var path     = AssetDatabase.GetAssetPath(selected);

        if (!path.StartsWith(FairyGUIImportSetting.UIRes_Path) && !path.StartsWith(FairyGUIImportSetting.UIRes_Path1))
        {
            return;
        }
        var Object = selected as Object;

        if (Object.name.Contains("@"))
        {
            return;
        }

        var packageName = Object.name.Split('.')[0];

        #region Comment reload
        //FairyGUI.UIPackage.RemovePackage(packageName);
        //FairyGUI.UIPackage.AddPackage(path, (string name, string extension, System.Type type) =>
        //{
        //    AssetDatabase.LoadAssetAtPath<type>()
        //});
        #endregion
        FairyGUI.UIPackage pak = FairyGUI.UIPackage.AddPackage("FairyGUIPak/Common");
        //FairyGUIEditor.EditorToolSet.LoadPackages();
        //FairyGUIEditor.EditorToolSet.ReloadPackages();
        Debug.Log("$$ will load package:" + packageName);
        //pak = FairyGUI.UIPackage.GetByName("FairyGUIPak" + "/" + packageName);
        if (pak != null)
        {
            Debug.Log("$$ display code generate panel...");
            CodeGenerateEditor.Create(pak);
        }
    }
Example #26
0
    static int _CreateFairyGUI_UIPackage(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                FairyGUI.UIPackage obj = new FairyGUI.UIPackage();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.UIPackage.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #27
0
 public void TryUnLoadFariryGUIRes(string assetName = null, bool all = false)
 {
     if (all)
     {
         FairyGUI.UIPackage.RemoveAllPackages();
     }
     else
     {
         if (mDic.ContainsKey(assetName))
         {
             ResInfo info = mDic[assetName];
             if (info != null && info.isFairyGuiPack)
             {
                 FairyGUI.UIPackage pack = FairyGUI.UIPackage.GetByName(info.name);
                 if (pack != null)
                 {
                     FairyGUI.UIPackage.RemovePackage(info.name);
                 }
             }
         }
     }
 }
Example #28
0
 public void TryAddFairyGuiRes()
 {
     foreach (ResInfo info in mDic.Values)
     {
         if (info.isFairyGuiPack)
         {
             FairyGUI.UIPackage pack = FairyGUI.UIPackage.GetByName(info.name);
             if (pack == null)
             {
                 string packName = info.name;
                 if (packName.EndsWith("_fui"))
                 {
                     packName = packName.Substring(0, packName.LastIndexOf("_fui"));
                 }
                 FairyGUI.UIPackage.AddPackage(packName, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) =>
                 {
                     UnityEngine.Object obj = GetAsset(name);
                     destroyMethod          = DestroyMethod.None;
                     return(obj);
                 });
             }
         }
     }
 }
Example #29
0
 static int CompareUIPackage(UIPackage u1, UIPackage u2)
 {
     return u1.name.CompareTo(u2.name);
 }
Example #30
0
    static int AddPackage(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string             arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(FairyGUI.UIPackage.LoadResource)))
            {
                string arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage.LoadResource arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (FairyGUI.UIPackage.LoadResource)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(FairyGUI.UIPackage.LoadResource), func) as FairyGUI.UIPackage.LoadResource;
                }

                FairyGUI.UIPackage o = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.AssetBundle)))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle), typeof(UnityEngine.AssetBundle)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle), typeof(UnityEngine.AssetBundle), typeof(string)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                string             arg2      = ToLua.ToString(L, 3);
                FairyGUI.UIPackage o         = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.AssetBundle), typeof(string)))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                string             arg2      = ToLua.ToString(L, 3);
                FairyGUI.UIPackage o         = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.AddPackage"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #31
0
        public static UIPackage AddPackage(string assetPath, UIPackage.LoadResource loadFunc)
        {
            if (_packageInstById.ContainsKey(assetPath))
                return _packageInstById[assetPath];

            TextAsset asset = (TextAsset)loadFunc(assetPath, ".bytes", typeof(TextAsset));
            if (asset == null)
            {
                if (Application.isPlaying)
                    throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'");
                else
                    Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'");
            }

            UIPackage pkg = new UIPackage();
            pkg._loadFunc = loadFunc;
            pkg.Create(asset.text, null, assetPath);
            _packageInstById[pkg.id] = pkg;
            _packageInstByName[pkg.name] = pkg;
            _packageInstById[assetPath] = pkg;
            _packageList.Add(pkg);
            pkg.assetPath = assetPath;

            return pkg;
        }
Example #32
0
 /// <summary>
 /// Add a UI package from a description text and a assetbundle, with a optional main asset name.
 /// </summary>
 /// <param name="desc">Description text.</param>
 /// <param name="res">A assetbundle contains resources.</param>
 /// <param name="mainAssetName">Main asset name.</param>
 /// <returns>UIPackage</returns>
 public static UIPackage AddPackage(string desc, AssetBundle res, string mainAssetName)
 {
     UIPackage pkg = new UIPackage();
     pkg.Create(desc, res, mainAssetName);
     _packageInstById[pkg.id] = pkg;
     _packageInstByName[pkg.name] = pkg;
     _packageList.Add(pkg);
     return pkg;
 }
Example #33
0
        public static UIPackage AddPackage(string descFilePath)
        {
            UIPackage pkg = new UIPackage();
            pkg.Create(descFilePath);
            _packageInstById[pkg.id] = pkg;
            _packageInstByName[pkg.name] = pkg;
            pkg.customId = descFilePath;

            return pkg;
        }
Example #34
0
 public static UIPackage AddPackage(byte[] desc, AssetBundle res, string resourceNamePrefix)
 {
     UIPackage pkg = new UIPackage();
     pkg.Create(desc, res, resourceNamePrefix);
     _packageInstById[pkg.id] = pkg;
     _packageInstByName[pkg.name] = pkg;
     return pkg;
 }
Example #35
0
    static int AddPackage(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
            {
                string             arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <UnityEngine.AssetBundle>(L, 1))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <string, FairyGUI.UIPackage.LoadResource>(L, 1))
            {
                string arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage.LoadResource arg1 = (FairyGUI.UIPackage.LoadResource)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage o = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <UnityEngine.AssetBundle, UnityEngine.AssetBundle>(L, 1))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <byte[], string, FairyGUI.UIPackage.LoadResource>(L, 1))
            {
                byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
                string arg1 = ToLua.ToString(L, 2);
                FairyGUI.UIPackage.LoadResource arg2 = (FairyGUI.UIPackage.LoadResource)ToLua.ToObject(L, 3);
                FairyGUI.UIPackage o = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <UnityEngine.AssetBundle, UnityEngine.AssetBundle, string>(L, 1))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                string             arg2      = ToLua.ToString(L, 3);
                FairyGUI.UIPackage o         = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.AddPackage"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }