diff --git a/BakingSheet/Src/SheetRow.cs b/BakingSheet/Src/SheetRow.cs index 9851818..d34c121 100644 --- a/BakingSheet/Src/SheetRow.cs +++ b/BakingSheet/Src/SheetRow.cs @@ -7,7 +7,7 @@ namespace Cathei.BakingSheet { public abstract class SheetRow { - public TKey Id { get; set; } + public TKey Id { get; internal set; } public virtual void ConvertFromRaw(SheetConvertingContext context, RawSheetRow row) { @@ -31,7 +31,7 @@ public virtual void VerifyAssets(SheetConvertingContext context) public abstract class SheetRowElem { [JsonIgnore] - public int Index { get; set; } + public int Index { get; internal set; } public virtual void PostLoad(SheetConvertingContext context) { @@ -51,7 +51,7 @@ public abstract class SheetRowArray : SheetRow, IEnumerable Arr { get; set; } + protected List Arr { get; private set; } [JsonIgnore] public int Count => Arr.Count; diff --git a/BakingSheet/Src/SheetUtility.cs b/BakingSheet/Src/SheetUtility.cs index 09f1baa..a4e13f9 100644 --- a/BakingSheet/Src/SheetUtility.cs +++ b/BakingSheet/Src/SheetUtility.cs @@ -130,7 +130,9 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ if (member is PropertyInfo pi) { - var hasSetMethod = pi.SetMethod != null; + var hasSetMethod = pi.GetSetMethod(true) != null; + + property.Writable = hasSetMethod; property.ShouldSerialize = property.ShouldDeserialize = _ => hasSetMethod; } diff --git a/UnityProject/Assets/Plugins/BakingSheet/BakingSheet.dll b/UnityProject/Assets/Plugins/BakingSheet/BakingSheet.dll index 111f65f..b2d7bb1 100644 Binary files a/UnityProject/Assets/Plugins/BakingSheet/BakingSheet.dll and b/UnityProject/Assets/Plugins/BakingSheet/BakingSheet.dll differ diff --git a/UnityProject/Assets/Plugins/BakingSheet/Editor/Excel/BakingSheet.Importers.Excel.dll b/UnityProject/Assets/Plugins/BakingSheet/Editor/Excel/BakingSheet.Importers.Excel.dll index d8b96fa..29291ff 100644 Binary files a/UnityProject/Assets/Plugins/BakingSheet/Editor/Excel/BakingSheet.Importers.Excel.dll and b/UnityProject/Assets/Plugins/BakingSheet/Editor/Excel/BakingSheet.Importers.Excel.dll differ diff --git a/UnityProject/Assets/Plugins/BakingSheet/Editor/Google/BakingSheet.Importers.Google.dll b/UnityProject/Assets/Plugins/BakingSheet/Editor/Google/BakingSheet.Importers.Google.dll index 8d28283..b2a6e87 100644 Binary files a/UnityProject/Assets/Plugins/BakingSheet/Editor/Google/BakingSheet.Importers.Google.dll and b/UnityProject/Assets/Plugins/BakingSheet/Editor/Google/BakingSheet.Importers.Google.dll differ diff --git a/UnityProject/Assets/Plugins/BakingSheet/Examples/004 - Runtime Usage/SheetLoader.cs b/UnityProject/Assets/Plugins/BakingSheet/Examples/004 - Runtime Usage/SheetLoader.cs index dfada8d..6ee56f5 100644 --- a/UnityProject/Assets/Plugins/BakingSheet/Examples/004 - Runtime Usage/SheetLoader.cs +++ b/UnityProject/Assets/Plugins/BakingSheet/Examples/004 - Runtime Usage/SheetLoader.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; +using System.Linq; using UnityEngine; namespace Cathei.BakingSheet.Examples @@ -9,12 +10,14 @@ public class SheetLoader : MonoBehaviour { public SheetContainer Sheet { get; private set; } - private void Start() + private async void Start() { Sheet = new SheetContainer(new UnityLogger()); - Sheet.Load(Path.Combine(Application.streamingAssetsPath, "Excel")); - } + await Sheet.Load(Path.Combine(Application.streamingAssetsPath, "Excel")); + Debug.Log(Sheet.Constants.Count); + Debug.Log(Sheet.Heroes["HERO001"].Count); + Debug.Log(Sheet.Items["ITEM_POTION001"].Name); + } } - } \ No newline at end of file