Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
FullInventoryWidget.cs
浏览该文件的文档.
1using System.Xml.Linq;
2using Engine;
3
4namespace Game {
7
9
11
13
14 public FullInventoryWidget(IInventory inventory, ComponentCraftingTable componentCraftingTable) {
15 XElement node = ContentManager.Get<XElement>("Widgets/FullInventoryWidget");
16 LoadContents(this, node);
17 m_inventoryGrid = Children.Find<GridPanelWidget>("InventoryGrid");
18 m_craftingGrid = Children.Find<GridPanelWidget>("CraftingGrid");
19 m_craftingResultSlot = Children.Find<InventorySlotWidget>("CraftingResultSlot");
20 m_craftingRemainsSlot = Children.Find<InventorySlotWidget>("CraftingRemainsSlot");
21 int num = 10;
22 for (int i = 0; i < m_inventoryGrid.RowsCount; i++) {
23 for (int j = 0; j < m_inventoryGrid.ColumnsCount; j++) {
24 InventorySlotWidget inventorySlotWidget = new();
25 inventorySlotWidget.AssignInventorySlot(inventory, num++);
26 m_inventoryGrid.Children.Add(inventorySlotWidget);
27 m_inventoryGrid.SetWidgetCell(inventorySlotWidget, new Point2(j, i));
28 }
29 }
30 num = 0;
31 for (int k = 0; k < m_craftingGrid.RowsCount; k++) {
32 for (int l = 0; l < m_craftingGrid.ColumnsCount; l++) {
33 InventorySlotWidget inventorySlotWidget2 = new();
34 inventorySlotWidget2.AssignInventorySlot(componentCraftingTable, num++);
35 m_craftingGrid.Children.Add(inventorySlotWidget2);
36 m_craftingGrid.SetWidgetCell(inventorySlotWidget2, new Point2(l, k));
37 }
38 }
39 m_craftingResultSlot.AssignInventorySlot(componentCraftingTable, componentCraftingTable.ResultSlotIndex);
40 m_craftingRemainsSlot.AssignInventorySlot(componentCraftingTable, componentCraftingTable.RemainsSlotIndex);
41 }
42 }
43}
readonly WidgetsList Children
static object Get(Type type, string name)
FullInventoryWidget(IInventory inventory, ComponentCraftingTable componentCraftingTable)
InventorySlotWidget m_craftingRemainsSlot
InventorySlotWidget m_craftingResultSlot
virtual void AssignInventorySlot(IInventory inventory, int slotIndex)
virtual void LoadContents(object eventsTarget, XElement node)