Пример #1
0
        private void DoWithSettingsUI(UIHelperExtension helper)
        {
            foreach (Transform child in helper.Self?.transform)
            {
                GameObject.Destroy(child?.gameObject);
            }

            var newSprites = new List <SpriteInfo>();

            TextureAtlasUtils.LoadImagesFromResources("commons.UI.Images", ref newSprites);
            TextureAtlasUtils.LoadImagesFromResources("UI.Images", ref newSprites);
            LogUtils.DoLog($"ADDING {newSprites.Count} sprites!");
            TextureAtlasUtils.RegenerateDefaultTextureAtlas(newSprites);


            helper.Self.eventVisibilityChanged += delegate(UIComponent component, bool b)
            {
                if (b)
                {
                    ShowVersionInfoPopup();
                }
            };

            TopSettingsUI(helper);

            if (UseGroup9)
            {
                CreateGroup9(helper);
            }

            ShowVersionInfoPopup();
            SearchIncompatibilitiesModal();
            LogUtils.DoLog("End Loading Options");
        }
Пример #2
0
        private void ScanImagesForTextureAtlas()
        {
            var newSprites = new List <SpriteInfo>();

            FileUtils.ScanPrefabsFoldersDirectoryNoLoad("kf_imageFiles", (path, pack, asset) =>
            {
                try
                {
                    TextureAtlasUtils.LoadPathTexturesIntoInGameTextureAtlas($"PACK.{(asset.isWorkshopAsset ? $"{(pack.GetPublishedFileID().AsUInt64).ToString("00000000000000000")}" : asset.name)}", path, ref newSprites);
                }
                catch (Exception e)
                {
                    LogUtils.DoErrorLog($"An error occurred trying to load path \"{path}\": {e.GetType()} => {e.Message}");
                }
            });
            FileUtils.EnsureFolderCreation(m_localImageFilesPath);
            TextureAtlasUtils.LoadPathTexturesIntoInGameTextureAtlas($"KF_LOCAL", m_localImageFilesPath, ref newSprites);
            if (newSprites.Count > 0)
            {
                TextureAtlasUtils.RegenerateDefaultTextureAtlas(newSprites);
            }
        }