public void DeleteFurnitureSet() { FurnitureSet furnitureSet = m_furnitureSetList.SelectedItem as FurnitureSet; if (furnitureSet != null) { int num = SubsystemFurnitureBlockBehavior.FurnitureSets.IndexOf(furnitureSet); SubsystemFurnitureBlockBehavior.DeleteFurnitureSet(furnitureSet); SubsystemFurnitureBlockBehavior.GarbageCollectDesigns(); ComponentFurnitureInventory.FurnitureSet = ((num > 0) ? SubsystemFurnitureBlockBehavior.FurnitureSets[num - 1] : null); Invalidate(); } }
public void FillSlots() { m_subsystemFurnitureBlockBehavior.GarbageCollectDesigns(); m_slots.Clear(); for (int i = 0; i < maxDesign; i++) { FurnitureDesign design = m_subsystemFurnitureBlockBehavior.GetDesign(i); if (design != null) { int num = (from f in design.ListChain() select f.Index).Min(); if (design.Index == num) { int data = FurnitureBlock.SetDesignIndex(0, i, design.ShadowStrengthFactor, design.IsLightEmitter); int item = Terrain.MakeBlockValue(227, 0, data); m_slots.Add(item); } } } }
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)); } })); } }