Ejemplo n.º 1
0
 private void LoadImagesFromPrefab(ulong workshopId, string directoryPath, PrefabInfo info)
 {
     if (workshopId > 0 && workshopId != ~0UL && !AssetAtlases.ContainsKey(workshopId))
     {
         CreateAtlasEntry(AssetAtlases, workshopId, directoryPath, false);
     }
 }
Ejemplo n.º 2
0
        public BasicRenderInformation GetFromAssetAtlases(ulong assetId, string spriteName, bool fallbackOnInvalid = false)
        {
            if (spriteName.IsNullOrWhiteSpace() || !AssetAtlases.ContainsKey(assetId))
            {
                return(null);
            }
            if (AssetAtlasesCache.TryGetValue(assetId, out Dictionary <string, BasicRenderInformation> resultDicCache) && resultDicCache.TryGetValue(spriteName ?? "", out BasicRenderInformation cachedInfo))
            {
                return(cachedInfo);
            }
            if (!AssetAtlases.TryGetValue(assetId, out UITextureAtlas atlas) || !atlas.spriteNames.Contains(spriteName))
            {
                return(fallbackOnInvalid ? GetFromLocalAtlases(null, "K45_WTS FrameParamsInvalidImageAsset") : null);
            }
            if (resultDicCache == null)
            {
                AssetAtlasesCache[assetId] = new Dictionary <string, BasicRenderInformation>();
            }

            AssetAtlasesCache[assetId][spriteName] = null;
            StartCoroutine(CreateItemAtlasCoroutine(AssetAtlases, AssetRenderMaterial, AssetAtlasesCache, assetId, spriteName));
            return(null);
        }