Пример #1
0
    static int Load(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string             arg0 = ToLua.ToString(L, 1);
                UnityEngine.Object o    = UnGfx.Load(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(System.Type)))
            {
                string             arg0 = ToLua.ToString(L, 1);
                System.Type        arg1 = (System.Type)ToLua.ToObject(L, 2);
                UnityEngine.Object o    = UnGfx.Load(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnGfx.Load"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #2
0
    public static string LoadTextAsset(string path)
    {
        string    str  = null;
        TextAsset text = UnGfx.Load(path) as TextAsset;

        if (text != null)
        {
            str = text.ToString();
            Resources.UnloadAsset(text);
        }

        return(str);
    }