private static bool TryLoadNewTexture(string section, U::UnityEngine.Texture2D texture2D, string path, ref Texture2DOverrideData overrideData, bool flip = false) { U::UnityEngine.Texture2D texture2D1; bool flag; object dataLock = Texture2DOverride.DataLock; Monitor.Enter(dataLock); try { if (!Texture2DOverride.LoadTextureData(path, out texture2D1)) { flag = false; } else { if (flip) { texture2D1 = Texture2DOverride.FlipTextureY(texture2D1); } texture2D1.name = texture2D.name; texture2D1.anisoLevel = texture2D.anisoLevel; texture2D1.filterMode = texture2D.filterMode; texture2D1.mipMapBias = texture2D.mipMapBias; texture2D1.wrapMode = texture2D.wrapMode; overrideData = new Texture2DOverrideData(texture2D, path, texture2D1); Texture2DOverride.loaded.Add(texture2D.GetInstanceID(), new Texture2DCacheData(section, overrideData)); flag = true; } } finally { Monitor.Exit(dataLock); } return(flag); }
private static bool TryLoadCacheTexture(U::UnityEngine.Texture2D texture2D, ref Texture2DOverrideData overrideData) { Texture2DCacheData texture2DCacheDatum; bool flag; object dataLock = Texture2DOverride.DataLock; Monitor.Enter(dataLock); try { int instanceID = texture2D.GetInstanceID(); if (!Texture2DOverride.loaded.TryGetValue(instanceID, out texture2DCacheDatum)) { flag = false; } else { if (!Texture2DOverride.unused.Remove(instanceID)) { texture2DCacheDatum.IncreaseAmount((long)1); } overrideData = texture2DCacheDatum.OverrideData; flag = true; } } finally { Monitor.Exit(dataLock); } return(flag); }