public IEnumerable <ActiveExternalContentInfo> GetActiveExternalContent() { string downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.World, DirectoryName); if (!string.IsNullOrEmpty(downloadedContentAddress)) { yield return(new ActiveExternalContentInfo { Address = downloadedContentAddress, DisplayName = WorldSettings.Name, Type = ExternalContentType.World }); } if (!BlocksTexturesManager.IsBuiltIn(WorldSettings.BlocksTextureName)) { downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.BlocksTexture, WorldSettings.BlocksTextureName); if (!string.IsNullOrEmpty(downloadedContentAddress)) { yield return(new ActiveExternalContentInfo { Address = downloadedContentAddress, DisplayName = BlocksTexturesManager.GetDisplayName(WorldSettings.BlocksTextureName), Type = ExternalContentType.BlocksTexture }); } } SubsystemPlayers subsystemPlayers = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true); foreach (PlayerData playersDatum in subsystemPlayers.PlayersData) { if (!CharacterSkinsManager.IsBuiltIn(playersDatum.CharacterSkinName)) { downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.CharacterSkin, playersDatum.CharacterSkinName); yield return(new ActiveExternalContentInfo { Address = downloadedContentAddress, DisplayName = CharacterSkinsManager.GetDisplayName(playersDatum.CharacterSkinName), Type = ExternalContentType.CharacterSkin }); } } SubsystemFurnitureBlockBehavior subsystemFurnitureBlockBehavior = base.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true); foreach (FurnitureSet furnitureSet in subsystemFurnitureBlockBehavior.FurnitureSets) { if (furnitureSet.ImportedFrom != null) { downloadedContentAddress = CommunityContentManager.GetDownloadedContentAddress(ExternalContentType.FurniturePack, furnitureSet.ImportedFrom); yield return(new ActiveExternalContentInfo { Address = downloadedContentAddress, DisplayName = FurniturePacksManager.GetDisplayName(furnitureSet.ImportedFrom), Type = ExternalContentType.FurniturePack }); } } }
public void ExportFurnitureSet() { try { FurnitureDesign[] designs = SubsystemFurnitureBlockBehavior.GetFurnitureSetDesigns(ComponentFurnitureInventory.FurnitureSet).ToArray(); string displayName = FurniturePacksManager.GetDisplayName(FurniturePacksManager.CreateFurniturePack(ComponentFurnitureInventory.FurnitureSet.Name, designs)); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 21), string.Format(LanguageControl.Get(fName, 22), displayName), LanguageControl.Get("Usual", "ok"), null, null)); } catch (Exception ex) { DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 23), ex.Message, LanguageControl.Get("Usual", "ok"), null, null)); } }
public void ImportFurnitureSet(SubsystemTerrain subsystemTerrain) { FurniturePacksManager.UpdateFurniturePacksList(); if (FurniturePacksManager.FurniturePackNames.Count() == 0) { DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 18), LanguageControl.Get(fName, 19), LanguageControl.Get("Usual", "ok"), null, null)); } else { DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new ListSelectionDialog(LanguageControl.Get(fName, 20), FurniturePacksManager.FurniturePackNames, 64f, (object s) => FurniturePacksManager.GetDisplayName((string)s), delegate(object s) { try { int num = 0; int num2 = 0; string text = (string)s; List <List <FurnitureDesign> > list = FurnitureDesign.ListChains(FurniturePacksManager.LoadFurniturePack(subsystemTerrain, text)); List <FurnitureDesign> list2 = new List <FurnitureDesign>(); SubsystemFurnitureBlockBehavior.GarbageCollectDesigns(); foreach (List <FurnitureDesign> item in list) { FurnitureDesign furnitureDesign = SubsystemFurnitureBlockBehavior.TryAddDesignChain(item[0], garbageCollectIfNeeded: false); if (furnitureDesign == item[0]) { list2.Add(furnitureDesign); } else if (furnitureDesign == null) { num2++; } else { num++; } } if (list2.Count > 0) { FurnitureSet furnitureSet = SubsystemFurnitureBlockBehavior.NewFurnitureSet(FurniturePacksManager.GetDisplayName(text), text); foreach (FurnitureDesign item2 in list2) { SubsystemFurnitureBlockBehavior.AddToFurnitureSet(item2, furnitureSet); } ComponentFurnitureInventory.FurnitureSet = furnitureSet; } Invalidate(); string text2 = string.Format(LanguageControl.Get(fName, 1), list2.Count); if (num > 0) { text2 += string.Format(LanguageControl.Get(fName, 2), num); } if (num2 > 0) { text2 += string.Format(LanguageControl.Get(fName, 3), num2, 65535); } DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 4), text2.Trim(), LanguageControl.Get("Usual", "ok"), null, null)); } catch (Exception ex) { DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(LanguageControl.Get(fName, 5), ex.Message, LanguageControl.Get("Usual", "ok"), null, null)); } })); } }