Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 470c539

Browse files
author
serg.morozov
committed
fix: change signature of DataNode.AfterLoad
1 parent bf9b019 commit 470c539

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Assets/Example/Example1/Example1DataNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public class Example1DataNode : DataNode, IExample1DataNode
2424
[JsonProperty, ShowInInspector]
2525
private IExample1DataNode2 _interface2;
2626

27-
public override void AfterLoad()
27+
public override void AfterLoad(ISODatabase soDatabase)
2828
{
29-
base.AfterLoad();
29+
base.AfterLoad(soDatabase);
3030
_interface2 = _interface;
3131
}
3232
}

Assets/com.nuclearband.sodatabase/Runtime/DataNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class DataNode : SerializedScriptableObject
1414

1515
public virtual void BeforeSave() { }
1616

17-
public virtual void AfterLoad() { }
17+
public virtual void AfterLoad(ISODatabase soDatabase) { }
1818

1919
#if UNITY_EDITOR
2020
public void SetFullPath(string fullPath) => _fullPath = fullPath;

Assets/com.nuclearband.sodatabase/Runtime/SODatabaseSaver.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ internal class SODatabaseSaver : ISODatabaseSaver
1313
// ReSharper disable once MemberCanBePrivate.Global
1414
internal static string SaveBakPath => Application.persistentDataPath + @"/save.bak";
1515

16+
private readonly ISODatabase _database;
1617
private readonly FolderHolder _root;
1718
private readonly Dictionary<string, object> _runtimeModels;
1819

@@ -23,6 +24,7 @@ internal class SODatabaseSaver : ISODatabaseSaver
2324

2425
public SODatabaseSaver(ISODatabase database, FolderHolder root, Dictionary<string, object> runtimeModels)
2526
{
27+
_database = database;
2628
_root = root;
2729
_runtimeModels = runtimeModels;
2830

@@ -78,7 +80,7 @@ async Awaitable ISODatabaseSaver.LoadAsync()
7880
{
7981
if (!File.Exists(SavePath)) {
8082
foreach (var dataNode in DataNodes(_root))
81-
dataNode.AfterLoad();
83+
dataNode.AfterLoad(_database);
8284
return;
8385
}
8486

@@ -127,7 +129,7 @@ async Awaitable ISODatabaseSaver.LoadAsync()
127129
} while (true);
128130

129131
foreach (var dataNode in DataNodes(_root))
130-
dataNode.AfterLoad();
132+
dataNode.AfterLoad(_database);
131133
}
132134

133135
private IEnumerable<DataNode> DataNodes(FolderHolder folderHolder)

0 commit comments

Comments
 (0)