Esempio n. 1
0
        public static void SetExtension(string url, System.Type baseType, LuaTable luaTable)
        {
            SetPackageItemExtension(url, () =>
            {
                GComponent gcom = (GComponent)Activator.CreateInstance(baseType);
                if (baseType != null)
                {
                    LuaFunction func = luaTable.Get <LuaFunction>("create");
                    if (func != null)
                    {
                        try
                        {
                            object[] table       = func.Call(luaTable, gcom);
                            LuaTable newLuaClass = (LuaTable)table[0];
                            gcom.SetLuaTable(newLuaClass);
                        }
                        catch (Exception err)
                        {
                            Debug.LogError(err);
                        }

                        func.Dispose();
                    }
                }

                return(gcom);
            });
        }