Ejemplo n.º 1
0
        public CreativeInventoryWidget(Entity entity)
        {
            m_componentCreativeInventory = entity.FindComponent <ComponentCreativeInventory>(throwOnError: true);
            XElement node = ContentManager.Get <XElement>("Widgets/CreativeInventoryWidget");

            LoadContents(this, node);
            m_categoryLeftButton  = Children.Find <ButtonWidget>("CategoryLeftButton");
            m_categoryRightButton = Children.Find <ButtonWidget>("CategoryRightButton");
            m_categoryButton      = Children.Find <ButtonWidget>("CategoryButton");
            m_pageUpButton        = Children.Find <ButtonWidget>("PageUpButton");
            m_pageDownButton      = Children.Find <ButtonWidget>("PageDownButton");
            m_pageLabel           = Children.Find <LabelWidget>("PageLabel");
            m_panelContainer      = Children.Find <ContainerWidget>("PanelContainer");
            CreativeInventoryPanel creativeInventoryPanel = new CreativeInventoryPanel(this)
            {
                IsVisible = false
            };

            m_panelContainer.Children.Add(creativeInventoryPanel);
            FurnitureInventoryPanel furnitureInventoryPanel = new FurnitureInventoryPanel(this)
            {
                IsVisible = false
            };

            m_panelContainer.Children.Add(furnitureInventoryPanel);
            foreach (string category in BlocksManager.Categories)
            {
                m_categories.Add(new Category
                {
                    Name  = category,
                    Panel = creativeInventoryPanel
                });
            }
            m_categories.Add(new Category
            {
                Name  = LanguageControl.Get(fName, 1),
                Panel = furnitureInventoryPanel
            });
            m_categories.Add(new Category
            {
                Name  = LanguageControl.Get(fName, 2),
                Panel = creativeInventoryPanel
            });

            for (int i = 0; i < m_categories.Count; i++)
            {
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Electrics"))
                {
                    m_categories[i].Color = new Color(128, 140, 255);
                }
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Plants"))
                {
                    m_categories[i].Color = new Color(64, 160, 64);
                }
                if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Weapons"))
                {
                    m_categories[i].Color = new Color(255, 128, 112);
                }
            }
        }
Ejemplo n.º 2
0
        public FurnitureSetItemWidget(FurnitureInventoryPanel furnitureInventoryWidget, FurnitureSet furnitureSet)
        {
            m_furnitureInventoryPanel = furnitureInventoryWidget;
            m_furnitureSet            = furnitureSet;
            XElement node = ContentManager.Get <XElement>("Widgets/FurnitureSetItemWidget");

            LoadContents(this, node);
            LabelWidget labelWidget  = Children.Find <LabelWidget>("FurnitureSetItem.Name");
            LabelWidget labelWidget2 = Children.Find <LabelWidget>("FurnitureSetItem.DesignsCount");

            labelWidget.Text  = ((furnitureSet == null) ? "Uncategorized" : furnitureSet.Name);
            labelWidget2.Text = $"{CountFurnitureDesigns()} design(s)";
        }