mirror of
https://github.com/D4M13N-D3V/godot_grid_inventory.git
synced 2025-03-14 08:14:55 +00:00
chore: changed the inventory controller so it populated all of the inventory model fields
This commit is contained in:
parent
79472fa58e
commit
d8da370026
@ -1,18 +1,20 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotGridInventory.Code.UI;
|
||||||
|
|
||||||
namespace GodotGridInventory.Code.Grid;
|
namespace GodotGridInventory.Code.Grid;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
public class InventoryModel
|
public class InventoryModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; init; }
|
||||||
public string Name { get; set; }
|
public string Name { get; init; } = string.Empty;
|
||||||
public int GridWidth { get; set; }
|
public int GridWidth { get; set; }
|
||||||
public int GridHeight { get; set; }
|
public int GridHeight { get; set; }
|
||||||
|
public List<Item> Items { get; set; } = new List<Item>();
|
||||||
public List<Item> Items { get; set; }
|
|
||||||
|
|
||||||
public List<InventoryCell> Cells { get; set; } = new List<InventoryCell>();
|
public List<InventoryCell> Cells { get; set; } = new List<InventoryCell>();
|
||||||
public InventoryGrid? Grid { get; set; }
|
public InventoryGrid? Grid { get; set; } = null;
|
||||||
|
public InventoryGridInterface? GridInterface { get; set; } = null;
|
||||||
public bool Open { get; set; } = false;
|
public bool Open { get; set; } = false;
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
@ -58,7 +59,11 @@ public partial class InventoryController : Node
|
|||||||
Name = name,
|
Name = name,
|
||||||
Items = items.Select( item=> _itemDatabase.GetItemConfiguration(item)).ToList(),
|
Items = items.Select( item=> _itemDatabase.GetItemConfiguration(item)).ToList(),
|
||||||
Cells = inventoryGrid.GridCells,
|
Cells = inventoryGrid.GridCells,
|
||||||
Open = false
|
Open = false,
|
||||||
|
Grid = inventoryGrid,
|
||||||
|
GridInterface = null,
|
||||||
|
GridWidth = (int)Math.Round(size.X),
|
||||||
|
GridHeight = (int)Math.Round(size.Y)
|
||||||
});
|
});
|
||||||
|
|
||||||
_inventoryIdCounter++;
|
_inventoryIdCounter++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user