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"); }
protected override void OnLevelLoadingInternal() { if (!ZMController.m_ghostMode) { ZoneManager.instance.m_properties.m_zoneColors = new Color[0x10].Select((x, i) => ZoneManager.instance.m_properties.m_zoneColors.ElementAtOrDefault(i)).ToArray(); ZoneManager.instance.m_properties.m_zoneColors[0x8] = new Color32(0x99, 0x20, 0x21, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0x9] = new Color32(0xcc, 0x40, 0x41, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0xA] = new Color32(0x00, 0xFF, 0x00, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0xB] = new Color32(0xFF, 0x00, 0xFF, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0xC] = new Color32(0x00, 0xFF, 0xFF, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0xD] = new Color32(0x88, 0x88, 0x88, 0xff); ZoneManager.instance.m_properties.m_zoneColors[0xE] = new Color32(0xFF, 0xFF, 0x00, 0xff); ZoneManager.instance.m_zoneNotUsed = new ZoneTypeGuide[0x10].Select((x, i) => ZoneManager.instance.m_zoneNotUsed.ElementAtOrDefault(i) ?? new ZoneTypeGuide()).ToArray(); ZoneManager.instance.m_goodAreaFound = new short[0x10].Select((x, i) => ZoneManager.instance.m_goodAreaFound.ElementAtOrDefault(i)).ToArray(); typeof(ZoneProperties).GetMethod("InitializeProperties", RedirectorUtils.allFlags).Invoke(ZoneManager.instance.m_properties, new object[0]); var newSprites = new List <SpriteInfo>(); TextureAtlasUtils.LoadImagesFromResources("UI.Images.InfoTooltip", ref newSprites); TextureAtlasUtils.RegenerateTextureAtlas(GeneratedScrollPanel.tooltipBox.Find <UISprite>("Sprite").atlas, newSprites); } }
public void LoadImagesFromLocalFolders() { LocalAtlases.Clear(); var errors = new List <string>(); var folders = new string[] { WTSController.ExtraSpritesFolder }.Concat(Directory.GetDirectories(WTSController.ExtraSpritesFolder)); foreach (var dir in folders) { bool isRoot = dir == WTSController.ExtraSpritesFolder; var spritesToAdd = new List <SpriteInfo>(); WTSAtlasLoadingUtils.LoadAllImagesFromFolderRef(dir, ref spritesToAdd, ref errors, isRoot); if (isRoot || spritesToAdd.Count > 0) { var atlasName = isRoot ? string.Empty : Path.GetFileNameWithoutExtension(dir); LocalAtlases[atlasName] = new UITextureAtlas { material = new Material(UIView.GetAView().defaultAtlas.material.shader) }; if (isRoot) { spritesToAdd.AddRange(UIView.GetAView().defaultAtlas.sprites.Select(x => CloneSpriteInfo(x)).ToList()); TextureAtlasUtils.LoadImagesFromResources("commons.UI.Images", ref spritesToAdd); TextureAtlasUtils.LoadImagesFromResources("UI.Images", ref spritesToAdd); } TextureAtlasUtils.RegenerateTextureAtlas(LocalAtlases[atlasName], spritesToAdd); } } LocalAtlasesCache.Clear(); LocalRenderMaterial.Clear(); if (errors.Count > 0) { K45DialogControl.ShowModal(new K45DialogControl.BindProperties { message = $"{Locale.Get("K45_WTS_CUSTOMSPRITE_ERRORHEADER")}:\n\t{string.Join("\n\t", errors.ToArray())}" }, (x) => true); } }