浏览代码

Save Data when you add or remove an item

/UI
Bronson Zgeb 4 年前
当前提交
253267ff
共有 3 个文件被更改,包括 5 次插入1 次删除
  1. 1
      UOP1_Project/Assets/Prefabs/Managers/InventoryManager.prefab
  2. 1
      UOP1_Project/Assets/ScriptableObjects/SaveSystem/SaveSystem.asset
  3. 4
      UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs

1
UOP1_Project/Assets/Prefabs/Managers/InventoryManager.prefab


_giveItemEvent: {fileID: 11400000, guid: c54b320c4205f1c49b296b878daf2097, type: 2}
_addItemEvent: {fileID: 11400000, guid: f3027c4528b8e794f940a4696506f0c3, type: 2}
_removeItemEvent: {fileID: 11400000, guid: 4ed6ade94b85c452094b0147619e8b49, type: 2}
_saveSystem: {fileID: 11400000, guid: edc355c4a7d5028408d322b90814e19e, type: 2}

1
UOP1_Project/Assets/ScriptableObjects/SaveSystem/SaveSystem.asset


_loadLocation: {fileID: 11400000, guid: 00e3063edc5902e40832ea618644c597, type: 2}
_playerInventory: {fileID: 11400000, guid: 59c84467f7726dc4587a8373b0936f03, type: 2}
saveFilename: save.chop
backupSaveFilename: save.chop.bak
saveData:
_locationId: d102ba8fe3b291249aeb9de4b95c1904
_itemStacks:

4
UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs


[SerializeField] private ItemEventChannelSO _giveItemEvent = default;
[SerializeField] ItemEventChannelSO _addItemEvent = default;
[SerializeField] ItemEventChannelSO _removeItemEvent = default;
[SerializeField] private SaveSystem _saveSystem;
private void OnEnable()
{

void AddItem(Item item)
{
_currentInventory.Add(item);
_saveSystem.SaveDataToDisk();
_saveSystem.SaveDataToDisk();
}

正在加载...
取消
保存