예제 #1
0
 public static IReadOnlyList <T> FindAllObjects()
 {
     if (!all.TryGetTarget(out T[] value))
     {
         value = UnityResources.FindObjectsOfTypeAll <T>();
         all.SetTarget(value);
     }
     return(value);
 }
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *__ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new UnityEngine.Resources();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
예제 #3
0
        private T NativeLoad <T>(string fileName) where T : class
        {
            var res = UnityResources.Load(fileName, typeof(T)) as T;

            if (res == null)
            {
                throw new Exception("Failed to load " + fileName + " as " + typeof(T));
            }
            return(res);
        }
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    UnityEngine.Resources __cl_gen_ret = new UnityEngine.Resources();
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Resources constructor!"));
        }
예제 #5
0
 public static IReadOnlyList <T> LoadAll(string path)
 {
     if (!tableAll.TryGetValue(path, out WeakReference <T[]> reference))
     {
         if (!reference.TryGetTarget(out T[] value))
         {
             value = UnityResources.LoadAll <T>(path);
             reference.SetTarget(value);
         }
         return(value);
     }
     else
     {
         T[] value = UnityResources.LoadAll <T>(path);
         tableAll[path] = new WeakReference <T[]>(value);
         return(value);
     }
 }
예제 #6
0
 public static T Load(string path)
 {
     if (table.TryGetValue(path, out WeakReference <T> reference))
     {
         if (!reference.TryGetTarget(out T value))
         {
             value = UnityResources.Load <T>(path);
             reference.SetTarget(value);
         }
         return(value);
     }
     else
     {
         T value = UnityResources.Load <T>(path);
         table[path] = new WeakReference <T>(value);
         return(value);
     }
 }
예제 #7
0
        private static IntPtr Constructor(IntPtr isolate, IntPtr info, int paramLen, long data)
        {
            try
            {
                {
                    {
                        var result = new UnityEngine.Resources();


                        return(Puerts.Utils.GetObjectPtr((int)data, typeof(UnityEngine.Resources), result));
                    }
                }
            }
            catch (Exception e)
            {
                Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace);
            }
            return(IntPtr.Zero);
        }
예제 #8
0
 public static ResourceRequest <T> LoadAsync(string path)
 {
     if (table.TryGetValue(path, out WeakReference <T> reference))
     {
         if (reference.TryGetTarget(out T value))
         {
             return(new ResourceRequest <T>(value));
         }
         else
         {
             if (tableAsync.TryGetValue(path, out ResourceRequest <T> request))
             {
                 return(request);
             }
             else
             {
                 request          = new ResourceRequest <T>(UnityResources.LoadAsync <T>(path));
                 tableAsync[path] = request;
                 return(request);
             }
         }
     }
     else
     {
         if (tableAsync.TryGetValue(path, out ResourceRequest <T> request))
         {
             return(request);
         }
         else
         {
             request          = new ResourceRequest <T>(UnityResources.LoadAsync <T>(path));
             tableAsync[path] = request;
             return(request);
         }
     }
 }