public UnityResourceHandle(string path, ResourcePriority priority) { ResourcePath = path; Priority = priority; LoadResourceIfNull(); }
public ResourceHandle <T> AddResource <T>(string path, T resource, ResourcePriority priority) where T : UnityEngine.Object //I think this is the only one that'll work on IL2CPP { var ro = RetrieveResourceObject(path); var rh = new RuntimeResourceHandle <T>(resource, priority); ro.AddResourceHandle(rh); return(rh); }
//WIP AddResourceX methods public ResourceHandle AddResource(string path, UnityEngine.Object resource, ResourcePriority priority) { var ro = RetrieveResourceObject(path); var handleType = typeof(RuntimeResourceHandle <>).MakeGenericType(resource.GetType()); var rh = (ResourceHandle)Activator.CreateInstance(handleType, resource, priority); ro.AddResourceHandle(rh, resource.GetType()); return(rh); }
public static T AddEmbeddedResources <T>(this T source, ResourcePriority resourcePriority, string assemblyString, string resourceNamespace, params string[] resourceNames) where T : Bundle { return(source.AddEmbeddedResources( resourcePriority, Assembly.Load(assemblyString), resourceNamespace, resourceNames )); }
public void AddResource(string path, ResourcePriority priority, ResourceType type, ResourceLocation location) { resources.Add(new Resource() { Path = path, Priority = priority, Type = type, Location = location }); }
public void AddStreamingResource(string path, string assetPath, ResourcePriority priority) { //will probably fail on IL2CPP but I don't think failure is guaranteed var type = ResourceLoader.DetermineResourceType(Path.Combine(CoreParams.StreamingAssetsPath, assetPath)); var handleType = typeof(StreamingResourceHandle <>).MakeGenericType(type); ResourceHandle resourceHandle = (ResourceHandle)Activator.CreateInstance(handleType, assetPath, priority); var ro = RetrieveResourceObject(path); ro.AddResourceHandle(resourceHandle, type); }
/// <summary> /// Checks if this object contains a resource of priority and type /// </summary> internal bool HasResourceOfPriority <T>(ResourcePriority priority) { if (ResourceHandleLists.TryGetValue(typeof(T), out var list)) { if (list.Count > 0) { foreach (var item in list) { if (item.Priority == priority) { return(true); } } } } return(false); }
public static T AddEmbeddedResources <T>(this T source, ResourcePriority resourcePriority, Assembly assembly, string resourceNamespace, params string[] resourceNames) where T : Bundle { if (resourceNames == null) { return(source); } var resourceAssets = resourceNames.Select(x => new ResourceAsset(x.TryToFix(resourceNamespace), assembly)); if (resourcePriority == ResourcePriority.High) { resourceAssets.Reverse().Each(x => source.Assets.Insert(0, x)); } else { resourceAssets.Each(x => source.Assets.Add(x)); } return(source); }
public static void RaiseWaifuEXP(ResourcePriority Kill, bool isAssist = false) { var currentWaifu = WaifuSelector.WaifuSelector.GetCurrentWaifu(); if (currentWaifu != null) { var currentExperience = currentWaifu.CurrentExp; var currentLevel = currentWaifu.CurrentLevel; var killNumbers = (int)Kill; var killExp = KillExp + (MultiKillAward * killNumbers - MultiKillAward); if (Game.Time - WaifuSharp.LastEventTick > 15000) { //To Award correct EXP to insta multikills killExp = KillExp * killNumbers + (MultiKillAward * killNumbers - MultiKillAward); } if (isAssist) { killExp = (int)(KillExp * 0.20f); } var nextLevelExp = baseExp * currentLevel * Step; if (currentExperience + killExp >= nextLevelExp) { var remainingExp = currentWaifu.CurrentExp + killExp - nextLevelExp; currentWaifu.CurrentExp = (int)remainingExp; currentWaifu.CurrentLevel += 1; } else { currentWaifu.CurrentExp += killExp; } UpdateWaifuStatistics(); } }
//WIP AddResourceX methods public void AddRuntimeResource <T>(string path, T resource, ResourcePriority priority) where T : UnityEngine.Object { var ro = RetrieveResourceObject(path); ro.AddResourceHandle(new RuntimeResourceHandle <T>(resource, priority)); }
public static void AddResource(this HtmlHelper htmlHelper, string path, ResourceType type, ResourcePriority priority = ResourcePriority.Normal, ResourceLocation location = ResourceLocation.Head) { GetPageBulider().AddResource(path, priority, type, location); }
public FileResourceHandle(T resource, string path, ResourcePriority priority) { Path = path; Priority = priority; _Resource = resource; }
public AssetBundleResourceHandle(T resource, string bundledName, AssetBundle bundle, ResourcePriority priority) { AssetBundle = bundle; AssetName = bundledName; _Resource = Resource; }
private static RedirectResourceHandle <T> GetRedirectResourceHandleIfExists <T>(string path, ResourcePriority priority) where T : UnityEngine.Object { var redirectResource = Resources.Load <RedirectAsset>(path); if (redirectResource != null) { var handle = new RedirectResourceHandle <T>(redirectResource.Path, CCBase.ResourceManager, priority); //TODO remove this weird backwards dependency, inject downwards on creation return(handle); } return(null); }
private static UnityResourceHandle <T> GetUnityResourceHandleIfExists <T>(string path, ResourcePriority priority) where T : UnityEngine.Object { var resource = Resources.Load <T>(path); if (resource != null) { var handle = new UnityResourceHandle <T>(path, priority); return(handle); } return(null); }
public StreamingResourceHandle(string path, ResourcePriority priority) { Path = path; Priority = priority; }
public void AddStreamingResource <T>(string path, string assetPath, ResourcePriority priority) where T : UnityEngine.Object { var ro = RetrieveResourceObject(path); ro.AddResourceHandle(new StreamingResourceHandle <T>(assetPath, priority)); }
public static void RaiseWaifuEXP(ResourcePriority Kill) { var currentWaifu = WaifuSelector.WaifuSelector.GetCurrentWaifu(); if (currentWaifu != null) { var currentExperience = currentWaifu.CurrentExp; var currentLevel = currentWaifu.CurrentLevel; var killNumbers = (int) Kill; var killExp = KillExp + (MultiKillAward * killNumbers - MultiKillAward); if (Game.Time - WaifuSharp.LastEventTick > 15000) { //To Award correct EXP to insta multikills killExp = KillExp * killNumbers + (MultiKillAward * killNumbers - MultiKillAward); } var nextLevelExp = baseExp * currentLevel * Step; if (currentExperience + killExp >= nextLevelExp) { var remainingExp = currentWaifu.CurrentExp + killExp - nextLevelExp; currentWaifu.CurrentExp = (int) remainingExp; currentWaifu.CurrentLevel += 1; } else { currentWaifu.CurrentExp += killExp; } UpdateWaifuStatistics(); } }
public ResourceHandle AddResourceFromAssetBundle(string targetPath, string bundledName, AssetBundle bundle, ResourcePriority priority) { //var resource = bundle.LoadAsset(bundledName); var resource = LoadAssetFromBundle(bundledName, bundle); Type resourceType = resource.GetType(); var handleType = typeof(AssetBundleResourceHandle <>).MakeGenericType(resourceType); var rh = (ResourceHandle)Activator.CreateInstance(handleType, resource, bundledName, bundle, priority); var ro = RetrieveResourceObject(targetPath); ro.AddResourceHandle(rh, resource.GetType()); return(rh); }
public async Task <ResourceHandle> AddResourceFromFileAsync(string targetPath, string filePath, ResourcePriority priority) { ResourceLoadContext context = new ResourceLoadContext() { AttemptingSyncLoad = false, ResourceManager = this, ResourceLoader = ResourceLoader, TargetPath = targetPath }; var resource = await ResourceLoader.LoadAsync(filePath, context); var ro = RetrieveResourceObject(targetPath); var handleType = typeof(FileResourceHandle <>).MakeGenericType(context.ResourceType); var rh = (ResourceHandle)Activator.CreateInstance(handleType, resource, filePath, priority, context); ro.AddResourceHandle(rh, resource.GetType()); return(rh); }
public FileResourceHandle(T resource, string path, ResourcePriority priority, ResourceLoadContext initialLoadContext) : this(resource, path, priority) { Importer = initialLoadContext.ResourceImporter; }
public async Task <ResourceHandle> AddResourceFromAssetBundleAsync(string targetPath, string bundledName, AssetBundle bundle, ResourcePriority priority) { /* * var bundleLoadRequest = bundle.LoadAssetAsync(bundledName); * * while (!bundleLoadRequest.isDone) * await Task.Yield(); * * var resource = bundleLoadRequest.asset; */ var resource = await LoadAssetFromBundleAsync(bundledName, bundle); Type resourceType = resource.GetType(); var handleType = typeof(AssetBundleResourceHandle <>).MakeGenericType(resourceType); var rh = (ResourceHandle)Activator.CreateInstance(handleType, resource, bundledName, bundle, priority); var ro = RetrieveResourceObject(targetPath); ro.AddResourceHandle(rh, resource.GetType()); return(rh); }
public RedirectResourceHandle(string path, ResourceManager resourceManager, ResourcePriority priority) { Path = path; Priority = priority; ResourceManagerReference = new WeakReference <ResourceManager>(resourceManager); }
internal void Init(string url, ResourcePriority priority) { this.url = url; this.priority = priority; }
public RuntimeResourceHandle(T resource, ResourcePriority priority) { _Resource = resource; Priority = priority; }
public static void AddResource(this HtmlHelper htmlHelper, string path, ResourcePriority priority = ResourcePriority.Normal) { var pageBulider = GetPageBulider(); AddResource(htmlHelper, path, pageBulider.GetResourceType(path), priority, pageBulider.GetResourceLocation(path)); }
public FileResourceHandle(string path, ResourcePriority priority) { Path = path; Priority = priority; }