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.Linq;
|
||||
using Godot;
|
||||
using GodotGridInventory.Code.UI;
|
||||
|
||||
namespace GodotGridInventory.Code.Grid;
|
||||
|
||||
#nullable enable
|
||||
public class InventoryModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Id { get; init; }
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public int GridWidth { get; set; }
|
||||
public int GridHeight { get; set; }
|
||||
|
||||
public List<Item> Items { get; set; }
|
||||
|
||||
public List<Item> Items { get; set; } = new List<Item>();
|
||||
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;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
@ -58,7 +59,11 @@ public partial class InventoryController : Node
|
||||
Name = name,
|
||||
Items = items.Select( item=> _itemDatabase.GetItemConfiguration(item)).ToList(),
|
||||
Cells = inventoryGrid.GridCells,
|
||||
Open = false
|
||||
Open = false,
|
||||
Grid = inventoryGrid,
|
||||
GridInterface = null,
|
||||
GridWidth = (int)Math.Round(size.X),
|
||||
GridHeight = (int)Math.Round(size.Y)
|
||||
});
|
||||
|
||||
_inventoryIdCounter++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user