コード例 #1
0
        public NewChestWidget(IInventory inventory, ComponentInventoryBase component, string text = null)
        {
            Component = component;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/NewChestWidget"));
            if (text != null)
            {
                Children.Find <LabelWidget>("ChestLabel").Text = text;
            }
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_chestNewGrid  = Children.Find <GridPanelWidget>("ChestGrid");
            int num = 0, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_chestNewGrid.RowsCount; y++)
            {
                for (x = 0; x < m_chestNewGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(component, num++);
                    m_chestNewGrid.Children.Add(inventorySlotWidget);
                    m_chestNewGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 6;
            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
        }
コード例 #2
0
        public PresserWidget(IInventory inventory, T component, string path)
        {
            m_componentFurnace = component;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>(path));
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid   = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_fire          = Children.Find <FireWidget>("Fire");
            m_progress      = Children.Find <ValueBarWidget>("Progress");
            m_resultSlot    = Children.Find <InventorySlotWidget>("ResultSlot");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(component, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_resultSlot.AssignInventorySlot(component, component.ResultSlotIndex);
        }
コード例 #3
0
ファイル: Musket2Widget.cs プロジェクト: Lixue9jiu/SCIE
        public Musket2Widget(IInventory inventory, int slotIndex)
        {
            m_inventory = inventory;
            m_slotIndex = slotIndex;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/Musket2Widget"));
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_inventorySlotWidget = Children.Find <InventorySlotWidget>("InventorySlot");
            m_instructionsLabel   = Children.Find <LabelWidget>("InstructionsLabel");
            int i = 0, num;

            for (; i < m_inventoryGrid.RowsCount; i++)
            {
                for (num = 0; num < m_inventoryGrid.ColumnsCount; num++)
                {
                    var widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(num, i));
                }
            }
            num = 6;
            i   = 0;
            for (int count = m_inventoryGrid.Children.Count; i < count; i++)
            {
                if (m_inventoryGrid.Children[i] is InventorySlotWidget inventorySlotWidget)
                {
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                }
            }
            m_inventorySlotWidget.AssignInventorySlot(inventory, slotIndex);
            m_inventorySlotWidget.CustomViewMatrix = Matrix.CreateLookAt(new Vector3(1f, 0f, 0f), new Vector3(0f, 0f, 0f), -Vector3.UnitZ);
        }
コード例 #4
0
        public FullInventoryWidget(IInventory inventory, ComponentCraftingTable componentCraftingTable)
        {
            XElement node = ContentManager.Get <XElement>("Widgets/FullInventoryWidget");

            LoadContents(this, node);
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_craftingGrid        = Children.Find <GridPanelWidget>("CraftingGrid");
            m_craftingResultSlot  = Children.Find <InventorySlotWidget>("CraftingResultSlot");
            m_craftingRemainsSlot = Children.Find <InventorySlotWidget>("CraftingRemainsSlot");
            int num = 10;

            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
                }
            }
            num = 0;
            for (int k = 0; k < m_craftingGrid.RowsCount; k++)
            {
                for (int l = 0; l < m_craftingGrid.ColumnsCount; l++)
                {
                    InventorySlotWidget inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(componentCraftingTable, num++);
                    m_craftingGrid.Children.Add(inventorySlotWidget2);
                    m_craftingGrid.SetWidgetCell(inventorySlotWidget2, new Point2(l, k));
                }
            }
            m_craftingResultSlot.AssignInventorySlot(componentCraftingTable, componentCraftingTable.ResultSlotIndex);
            m_craftingRemainsSlot.AssignInventorySlot(componentCraftingTable, componentCraftingTable.RemainsSlotIndex);
        }
コード例 #5
0
        public CrossbowWidget(IInventory inventory, int slotIndex)
        {
            m_inventory = inventory;
            m_slotIndex = slotIndex;
            XElement node = ContentManager.Get <XElement>("Widgets/CrossbowWidget");

            LoadContents(this, node);
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_inventorySlotWidget = Children.Find <InventorySlotWidget>("InventorySlot");
            m_instructionsLabel   = Children.Find <LabelWidget>("InstructionsLabel");
            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(j, i));
                }
            }
            int num = 10;

            foreach (Widget child in m_inventoryGrid.Children)
            {
                (child as InventorySlotWidget)?.AssignInventorySlot(inventory, num++);
            }
            m_inventorySlotWidget.AssignInventorySlot(inventory, slotIndex);
            m_inventorySlotWidget.CustomViewMatrix = Matrix.CreateLookAt(new Vector3(0f, 1f, 0.2f), new Vector3(0f, 0f, 0.2f), -Vector3.UnitZ);
        }
コード例 #6
0
ファイル: ChestWidget.cs プロジェクト: 1144822034/sc2.2mobile
        public ChestWidget(IInventory inventory, ComponentChest componentChest)
        {
            m_componentChest = componentChest;
            XElement node = ContentManager.Get <XElement>("Widgets/ChestWidget");

            LoadContents(this, node);
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_chestGrid     = Children.Find <GridPanelWidget>("ChestGrid");
            int num = 0;

            for (int i = 0; i < m_chestGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_chestGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentChest, num++);
                    m_chestGrid.Children.Add(inventorySlotWidget);
                    m_chestGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
                }
            }
            num = 10;
            for (int k = 0; k < m_inventoryGrid.RowsCount; k++)
            {
                for (int l = 0; l < m_inventoryGrid.ColumnsCount; l++)
                {
                    InventorySlotWidget inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget2);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget2, new Point2(l, k));
                }
            }
        }
コード例 #7
0
        public ClothingWidget(ComponentPlayer componentPlayer)
        {
            m_componentPlayer = componentPlayer;
            XElement node = ContentManager.Get <XElement>("Widgets/ClothingWidget");

            LoadContents(this, node);
            m_clothingStack            = Children.Find <StackPanelWidget>("ClothingStack");
            m_inventoryGrid            = Children.Find <GridPanelWidget>("InventoryGrid");
            m_vitalStatsButton         = Children.Find <ButtonWidget>("VitalStatsButton");
            m_sleepButton              = Children.Find <ButtonWidget>("SleepButton");
            m_innerClothingModelWidget = Children.Find <PlayerModelWidget>("InnerClothingModel");
            m_outerClothingModelWidget = Children.Find <PlayerModelWidget>("OuterClothingModel");
            for (int i = 0; i < 4; i++)
            {
                InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                float y = float.PositiveInfinity;
                if (i == 0)
                {
                    y = 68f;
                }
                if (i == 3)
                {
                    y = 54f;
                }
                inventorySlotWidget.Size        = new Vector2(float.PositiveInfinity, y);
                inventorySlotWidget.BevelColor  = Color.Transparent;
                inventorySlotWidget.CenterColor = Color.Transparent;
                inventorySlotWidget.AssignInventorySlot(m_componentPlayer.ComponentClothing, i);
                inventorySlotWidget.HideEditOverlay        = true;
                inventorySlotWidget.HideInteractiveOverlay = true;
                inventorySlotWidget.HideFoodOverlay        = true;
                inventorySlotWidget.HideHighlightRectangle = true;
                inventorySlotWidget.HideBlockIcon          = true;
                inventorySlotWidget.HideHealthBar          = (m_componentPlayer.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true).WorldSettings.GameMode == GameMode.Creative);
                m_clothingStack.Children.Add(inventorySlotWidget);
            }
            int num = 10;

            for (int j = 0; j < m_inventoryGrid.RowsCount; j++)
            {
                for (int k = 0; k < m_inventoryGrid.ColumnsCount; k++)
                {
                    InventorySlotWidget inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(componentPlayer.ComponentMiner.Inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget2);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget2, new Point2(k, j));
                }
            }
            m_innerClothingModelWidget.PlayerClass          = componentPlayer.PlayerData.PlayerClass;
            m_innerClothingModelWidget.CharacterSkinTexture = m_componentPlayer.ComponentClothing.InnerClothedTexture;
            m_outerClothingModelWidget.PlayerClass          = componentPlayer.PlayerData.PlayerClass;
            m_outerClothingModelWidget.OuterClothingTexture = m_componentPlayer.ComponentClothing.OuterClothedTexture;
        }
コード例 #8
0
        public FractionalTowerWidget(IInventory inventory, ComponentMachine componentFurnace)
        {
            m_componentFurnace = componentFurnace;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/FractionalTowerWidget"));
            m_inventoryGrid   = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid     = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_result1         = Children.Find <InventorySlotWidget>("ResultSlot1");
            m_result2         = Children.Find <InventorySlotWidget>("ResultSlot2");
            m_result3         = Children.Find <InventorySlotWidget>("ResultSlot3");
            m_cir1            = Children.Find <InventorySlotWidget>("CircuitSlot1");
            m_cir2            = Children.Find <InventorySlotWidget>("CircuitSlot2");
            m_acceptsDropsBox = Children.Find <CheckboxWidget>("AcceptsElectBox");
            m_progress        = Children.Find <ValueBarWidget>("Progress");

            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }

            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentFurnace, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_result1.AssignInventorySlot(componentFurnace, num++);
            m_result2.AssignInventorySlot(componentFurnace, num++);
            m_result3.AssignInventorySlot(componentFurnace, num++);
            m_cir1.AssignInventorySlot(componentFurnace, num++);
            m_cir2.AssignInventorySlot(componentFurnace, num++);
        }
コード例 #9
0
ファイル: LiquidPumpWidget.cs プロジェクト: Lixue9jiu/SCIE
        public LiquidPumpWidget(IInventory inventory, ComponentInventoryBase componentDispenser)
        {
            m_componentDispenser   = componentDispenser;
            m_componentBlockEntity = componentDispenser.Entity.FindComponent <ComponentBlockEntity>(true);
            m_subsystemTerrain     = componentDispenser.Project.FindSubsystem <SubsystemTerrain>(true);
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/LiquidPumpWidget"));
            m_inventoryGrid  = Children.Find <GridPanelWidget>("InventoryGrid");
            m_dispenserGrid  = Children.Find <GridPanelWidget>("DispenserGrid");
            m_dispenserGrid2 = Children.Find <GridPanelWidget>("DispenserGrid2");
            m_drillSlot      = Children.Find <InventorySlotWidget>("DrillSlot");
            int num = 0, y, x;

            for (y = 0; y < m_dispenserGrid.RowsCount; y++)
            {
                for (x = 0; x < m_dispenserGrid.ColumnsCount; x++)
                {
                    var inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid.Children.Add(inventorySlotWidget);
                    m_dispenserGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            for (y = 0; y < m_dispenserGrid2.RowsCount; y++)
            {
                for (x = 0; x < m_dispenserGrid2.ColumnsCount; x++)
                {
                    var inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid2.Children.Add(inventorySlotWidget2);
                    m_dispenserGrid2.SetWidgetCell(inventorySlotWidget2, new Point2(x, y));
                }
            }
            num = 6;
            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    var inventorySlotWidget3 = new InventorySlotWidget();
                    inventorySlotWidget3.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget3);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget3, new Point2(x, y));
                }
            }
            m_drillSlot.AssignInventorySlot(componentDispenser, 8);
        }
コード例 #10
0
        public CraftingRecipeWidget()
        {
            XElement node = ContentManager.Get <XElement>("Widgets/CraftingRecipe");

            LoadContents(this, node);
            m_nameWidget        = Children.Find <LabelWidget>("CraftingRecipeWidget.Name");
            m_descriptionWidget = Children.Find <LabelWidget>("CraftingRecipeWidget.Description");
            m_gridWidget        = Children.Find <GridPanelWidget>("CraftingRecipeWidget.Ingredients");
            m_resultWidget      = Children.Find <CraftingRecipeSlotWidget>("CraftingRecipeWidget.Result");
            for (int i = 0; i < m_gridWidget.RowsCount; i++)
            {
                for (int j = 0; j < m_gridWidget.ColumnsCount; j++)
                {
                    CraftingRecipeSlotWidget widget = new CraftingRecipeSlotWidget();
                    m_gridWidget.Children.Add(widget);
                    m_gridWidget.SetWidgetCell(widget, new Point2(j, i));
                }
            }
        }
コード例 #11
0
        public ElectricFurnaceWidget(IInventory inventory, ComponentElectricFurnace componentFurnace)
        {
            m_componentFurnace = componentFurnace;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/ElectricFurnaceWidget"));
            m_inventoryGrid   = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid     = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_fire            = Children.Find <FireWidget>("Fire");
            m_progress        = Children.Find <ValueBarWidget>("Progress");
            m_resultSlot      = Children.Find <InventorySlotWidget>("ResultSlot");
            m_remainsSlot     = Children.Find <InventorySlotWidget>("RemainsSlot");
            m_circuitSlot     = Children.Find <InventorySlotWidget>("CircuitSlot");
            m_acceptsDropsBox = Children.Find <CheckboxWidget>("AcceptsElectBox");
            m_circuit2Slot    = Children.Find <InventorySlotWidget>("Circuit2Slot");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentFurnace, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_resultSlot.AssignInventorySlot(componentFurnace, componentFurnace.ResultSlotIndex);
            m_remainsSlot.AssignInventorySlot(componentFurnace, componentFurnace.RemainsSlotIndex);
            m_circuitSlot.AssignInventorySlot(componentFurnace, componentFurnace.Cir1SlotIndex);
            m_circuit2Slot.AssignInventorySlot(componentFurnace, componentFurnace.Cir2SlotIndex);
        }
コード例 #12
0
        public BlastFurnaceWidget(IInventory inventory, ComponentBlastFurnace componentFurnace)
        {
            m_componentFurnace = componentFurnace;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/BlastFurnaceWidget"));
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid   = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_fire          = Children.Find <FireWidget>("Fire");
            m_progress      = Children.Find <ValueBarWidget>("Progress");
            m_resultSlot    = Children.Find <InventorySlotWidget>("ResultSlot");
            m_remainsSlot   = Children.Find <InventorySlotWidget>("RemainsSlot");
            m_remainsSlot2  = Children.Find <InventorySlotWidget>("RemainsSlot2");
            m_remainsSlot3  = Children.Find <InventorySlotWidget>("RemainsSlot3");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_furnaceGrid.RowsCount; y++)
            {
                for (x = 0; x < m_furnaceGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentFurnace, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_resultSlot.AssignInventorySlot(componentFurnace, 8);
            m_remainsSlot.AssignInventorySlot(componentFurnace, 9);
            m_remainsSlot2.AssignInventorySlot(componentFurnace, 10);
            m_remainsSlot3.AssignInventorySlot(componentFurnace, 11);
        }
コード例 #13
0
        public FurnitureInventoryPanel(CreativeInventoryWidget creativeInventoryWidget)
        {
            m_creativeInventoryWidget       = creativeInventoryWidget;
            ComponentFurnitureInventory     = creativeInventoryWidget.Entity.FindComponent <ComponentFurnitureInventory>(throwOnError: true);
            m_componentPlayer               = creativeInventoryWidget.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            SubsystemFurnitureBlockBehavior = ComponentFurnitureInventory.Project.FindSubsystem <SubsystemFurnitureBlockBehavior>(throwOnError: true);
            SubsystemTerrain = ComponentFurnitureInventory.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            XElement node = ContentManager.Get <XElement>("Widgets/FurnitureInventoryPanel");

            LoadContents(this, node);
            m_furnitureSetList = Children.Find <ListPanelWidget>("FurnitureSetList");
            m_inventoryGrid    = Children.Find <GridPanelWidget>("InventoryGrid");
            m_addButton        = Children.Find <ButtonWidget>("AddButton");
            m_moreButton       = Children.Find <ButtonWidget>("MoreButton");
            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget widget = new InventorySlotWidget();
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(j, i));
                }
            }
            ListPanelWidget furnitureSetList = m_furnitureSetList;

            furnitureSetList.ItemWidgetFactory   = (Func <object, Widget>)Delegate.Combine(furnitureSetList.ItemWidgetFactory, (Func <object, Widget>)((object item) => new FurnitureSetItemWidget(this, (FurnitureSet)item)));
            m_furnitureSetList.SelectionChanged += delegate
            {
                if (!m_ignoreSelectionChanged && ComponentFurnitureInventory.FurnitureSet != m_furnitureSetList.SelectedItem as FurnitureSet)
                {
                    ComponentFurnitureInventory.PageIndex    = 0;
                    ComponentFurnitureInventory.FurnitureSet = (m_furnitureSetList.SelectedItem as FurnitureSet);
                    if (ComponentFurnitureInventory.FurnitureSet == null)
                    {
                        m_furnitureSetList.SelectedIndex = 0;
                    }
                    AssignInventorySlots();
                }
            };
            m_populateNeeded = true;
        }
コード例 #14
0
        public FurnaceWidget(IInventory inventory, ComponentFurnace componentFurnace)
        {
            m_componentFurnace = componentFurnace;
            XElement node = ContentManager.Get <XElement>("Widgets/FurnaceWidget");

            LoadContents(this, node);
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_furnaceGrid   = Children.Find <GridPanelWidget>("FurnaceGrid");
            m_fire          = Children.Find <FireWidget>("Fire");
            m_progress      = Children.Find <ValueBarWidget>("Progress");
            m_resultSlot    = Children.Find <InventorySlotWidget>("ResultSlot");
            m_remainsSlot   = Children.Find <InventorySlotWidget>("RemainsSlot");
            m_fuelSlot      = Children.Find <InventorySlotWidget>("FuelSlot");
            int num = 10;

            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
                }
            }
            num = 0;
            for (int k = 0; k < m_furnaceGrid.RowsCount; k++)
            {
                for (int l = 0; l < m_furnaceGrid.ColumnsCount; l++)
                {
                    InventorySlotWidget inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(componentFurnace, num++);
                    m_furnaceGrid.Children.Add(inventorySlotWidget2);
                    m_furnaceGrid.SetWidgetCell(inventorySlotWidget2, new Point2(l, k));
                }
            }
            m_fuelSlot.AssignInventorySlot(componentFurnace, componentFurnace.FuelSlotIndex);
            m_resultSlot.AssignInventorySlot(componentFurnace, componentFurnace.ResultSlotIndex);
            m_remainsSlot.AssignInventorySlot(componentFurnace, componentFurnace.RemainsSlotIndex);
        }
コード例 #15
0
ファイル: FireBoxWidget.cs プロジェクト: Lixue9jiu/SCIE
        //protected readonly InventorySlotWidget m_remainsSlot;

        //protected readonly InventorySlotWidget m_resultSlot;

        public FireBoxWidget(IInventory inventory, T component, string path)
        {
            m_componentFurnace = component;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>(path));
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            m_fire          = Children.Find <FireWidget>("Fire");
            m_progress      = Children.Find <ValueBarWidget>("Progress");
            m_fuelSlot      = Children.Find <InventorySlotWidget>("FuelSlot");
            int num = 6;

            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    var inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
                }
            }
            m_fuelSlot.AssignInventorySlot(component, component.FuelSlotIndex);
        }
コード例 #16
0
        public override void MeasureOverride(Vector2 parentAvailableSize)
        {
            int max = (m_inventory is ComponentCreativeInventory) ? 10 : 7;

            m_inventory.VisibleSlotsCount = MathUtils.Clamp((int)((parentAvailableSize.X - 320f - 25f) / 72f), 7, max);
            if (m_inventory.VisibleSlotsCount != m_inventoryGrid.Children.Count)
            {
                m_inventoryGrid.Children.Clear();
                m_inventoryGrid.RowsCount    = 1;
                m_inventoryGrid.ColumnsCount = m_inventory.VisibleSlotsCount;
                for (int i = 0; i < m_inventoryGrid.ColumnsCount; i++)
                {
                    InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(m_inventory, i);
                    inventorySlotWidget.BevelColor  = new Color(181, 172, 154) * 0.6f;
                    inventorySlotWidget.CenterColor = new Color(181, 172, 154) * 0.33f;
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(i, 0));
                }
            }
            base.MeasureOverride(parentAvailableSize);
        }
コード例 #17
0
ファイル: DrillerWidget.cs プロジェクト: Lixue9jiu/SCIE
        public DrillerWidget(IInventory inventory, ComponentInventoryBase componentDispenser)
        {
            m_componentDispenser   = componentDispenser;
            m_componentBlockEntity = componentDispenser.Entity.FindComponent <ComponentBlockEntity>(true);
            m_subsystemTerrain     = componentDispenser.Project.FindSubsystem <SubsystemTerrain>(true);
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/DrillerWidget"));
            m_inventoryGrid   = Children.Find <GridPanelWidget>("InventoryGrid");
            m_dispenserGrid   = Children.Find <GridPanelWidget>("DispenserGrid");
            m_dispenseButton  = Children.Find <ButtonWidget>("DispenseButton");
            m_shootButton     = Children.Find <ButtonWidget>("ShootButton");
            m_acceptsDropsBox = Children.Find <CheckboxWidget>("AcceptsDropsBox");
            m_drillSlot       = Children.Find <InventorySlotWidget>("DrillSlot");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_dispenserGrid.RowsCount; y++)
            {
                for (x = 0; x < m_dispenserGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid.Children.Add(inventorySlotWidget);
                    m_dispenserGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_drillSlot.AssignInventorySlot(componentDispenser, 8);
        }
コード例 #18
0
ファイル: MachineToolWidget.cs プロジェクト: Lixue9jiu/SCIE
        public MachineToolWidget(IInventory inventory, ComponentLargeCraftingTable componentCraftingTable)
        {
            m_componentCraftingTable = componentCraftingTable;
            WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Widgets/MachineToolWidget"));
            m_inventoryGrid       = Children.Find <GridPanelWidget>("InventoryGrid");
            m_craftingGrid        = Children.Find <GridPanelWidget>("CraftingGrid");
            m_craftingResultSlot  = Children.Find <InventorySlotWidget>("CraftingResultSlot");
            m_craftingRemainsSlot = Children.Find <InventorySlotWidget>("CraftingRemainsSlot");
            int num = 6, y, x;
            InventorySlotWidget inventorySlotWidget;

            for (y = 0; y < m_inventoryGrid.RowsCount; y++)
            {
                for (x = 0; x < m_inventoryGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            num = 0;
            for (y = 0; y < m_craftingGrid.RowsCount; y++)
            {
                for (x = 0; x < m_craftingGrid.ColumnsCount; x++)
                {
                    inventorySlotWidget = new InventorySlotWidget();                    /*
                                                                                         * {
                                                                                         * Size = new Vector2(48f)
                                                                                         * };*/
                    inventorySlotWidget.AssignInventorySlot(m_componentCraftingTable, num++);
                    m_craftingGrid.Children.Add(inventorySlotWidget);
                    m_craftingGrid.SetWidgetCell(inventorySlotWidget, new Point2(x, y));
                }
            }
            m_craftingResultSlot.AssignInventorySlot(m_componentCraftingTable, m_componentCraftingTable.ResultSlotIndex);
            m_craftingRemainsSlot.AssignInventorySlot(m_componentCraftingTable, m_componentCraftingTable.RemainsSlotIndex);
        }
コード例 #19
0
        public CreativeInventoryPanel(CreativeInventoryWidget creativeInventoryWidget)
        {
            m_creativeInventoryWidget    = creativeInventoryWidget;
            m_componentCreativeInventory = creativeInventoryWidget.Entity.FindComponent <ComponentCreativeInventory>(throwOnError: true);
            XElement node = ContentManager.Get <XElement>("Widgets/CreativeInventoryPanel");

            LoadContents(this, node);
            m_inventoryGrid = Children.Find <GridPanelWidget>("InventoryGrid");
            for (int i = 0; i < m_inventoryGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget widget = new InventorySlotWidget
                    {
                        HideEditOverlay        = true,
                        HideInteractiveOverlay = true,
                        HideFoodOverlay        = true
                    };
                    m_inventoryGrid.Children.Add(widget);
                    m_inventoryGrid.SetWidgetCell(widget, new Point2(j, i));
                }
            }
        }
コード例 #20
0
        public DispenserWidget(IInventory inventory, ComponentDispenser componentDispenser)
        {
            m_componentDispenser   = componentDispenser;
            m_componentBlockEntity = componentDispenser.Entity.FindComponent <ComponentBlockEntity>(throwOnError: true);
            m_subsystemTerrain     = componentDispenser.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            XElement node = ContentManager.Get <XElement>("Widgets/DispenserWidget");

            LoadContents(this, node);
            m_inventoryGrid   = Children.Find <GridPanelWidget>("InventoryGrid");
            m_dispenserGrid   = Children.Find <GridPanelWidget>("DispenserGrid");
            m_dispenseButton  = Children.Find <ButtonWidget>("DispenseButton");
            m_shootButton     = Children.Find <ButtonWidget>("ShootButton");
            m_acceptsDropsBox = Children.Find <CheckboxWidget>("AcceptsDropsBox");
            int num = 0;

            for (int i = 0; i < m_dispenserGrid.RowsCount; i++)
            {
                for (int j = 0; j < m_dispenserGrid.ColumnsCount; j++)
                {
                    InventorySlotWidget inventorySlotWidget = new InventorySlotWidget();
                    inventorySlotWidget.AssignInventorySlot(componentDispenser, num++);
                    m_dispenserGrid.Children.Add(inventorySlotWidget);
                    m_dispenserGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
                }
            }
            num = 10;
            for (int k = 0; k < m_inventoryGrid.RowsCount; k++)
            {
                for (int l = 0; l < m_inventoryGrid.ColumnsCount; l++)
                {
                    InventorySlotWidget inventorySlotWidget2 = new InventorySlotWidget();
                    inventorySlotWidget2.AssignInventorySlot(inventory, num++);
                    m_inventoryGrid.Children.Add(inventorySlotWidget2);
                    m_inventoryGrid.SetWidgetCell(inventorySlotWidget2, new Point2(l, k));
                }
            }
        }