Ejemplo n.º 1
0
        internal static bool Prefix(string path, ref UnityEngine.Object __result)
        {
            if (!ModAssetBundleManager.IsKnownAsset(path))
            {
                return(true);
            }

            __result = ModAssetBundleManager.LoadAsset(path);
            return(false);
        }
Ejemplo n.º 2
0
        internal static bool Prefix(string name, ref Texture2D __result)
        {
            if (!ModAssetBundleManager.IsKnownAsset(name))
            {
                return(true);
            }

            __result = ModAssetBundleManager.LoadAsset(name) as Texture2D;
            return(__result == null);
        }
Ejemplo n.º 3
0
 /*static MethodBase TargetMethod()
  * {
  *  MethodInfo[] methods = typeof(UnityEngine.AssetBundle).GetMethods();
  *  foreach (MethodInfo m in methods)
  *  {
  *      if (m.Name == "LoadAsset" && !m.IsGenericMethod && m.GetParameters().Length == 2)
  *      {
  *          //Implementation.Log("Found it");
  *          return m;
  *      }
  *
  *  }
  *  Implementation.Log("AssetBundle.LoadAsset not found for patch.");
  *  return null;
  * }*/
 private static bool Prefix(string name, ref UnityEngine.Object __result)
 {
     if (Implementation.LOG_ALL_ASSET_CALLS)
     {
         Implementation.Log("AssetBundle.Load: '{0}'", name);
     }
     if (ModAssetBundleManager.loadingFromExternalBundle || !ModAssetBundleManager.IsKnownAsset(name))
     {
         //Implementation.Log("AssetBundle.Load skipping '{0}'", name);
         return(true);
     }
     //Implementation.Log("AssetBundle.Load loading '{0}'", name);
     __result = ModAssetBundleManager.LoadAsset(name);
     if (__result == null)
     {
         Implementation.LogWarning("AssetBundle.LoadAsset failed to load the external asset '{0}'", name);
     }
     return(false);
 }
Ejemplo n.º 4
0
 internal static bool Prefix(string path, ref UnityEngine.Object __result)
 {
     if (Implementation.LOG_ALL_ASSET_CALLS && !path.ToLower().StartsWith("gear"))
     {
         Implementation.Log("Resources.Load is loading '{0}'", path);
     }
     if (!ModAssetBundleManager.IsKnownAsset(path))
     {
         //Implementation.Log(path);
         return(true);
     }
     //Implementation.Log("Resources.Load is loading '{0}'", path);
     __result = ModAssetBundleManager.LoadAsset(path);
     if (__result == null)
     {
         Implementation.Log("Resources.Load failed to load the external asset");
     }
     return(false);
 }