Laying down the groundwork for data
This commit is contained in:
8
SessionZero/Data/Datapack.cs
Normal file
8
SessionZero/Data/Datapack.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace SessionZero.Data;
|
||||||
|
|
||||||
|
public class Datapack
|
||||||
|
{
|
||||||
|
public required DatapackMetadata Metadata { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
13
SessionZero/Data/DatapackMetadata.cs
Normal file
13
SessionZero/Data/DatapackMetadata.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionZero.Data;
|
||||||
|
|
||||||
|
public class DatapackMetadata
|
||||||
|
{
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public required string Id { get; set; }
|
||||||
|
public required string Description { get; set; }
|
||||||
|
public required string Version { get; set; }
|
||||||
|
public required string[] CompatibleSystems { get; set; }
|
||||||
|
public string Uuid { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -1,6 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using SessionZero.Data.Sztl;
|
||||||
|
|
||||||
namespace SessionZero.Data;
|
namespace SessionZero.Data;
|
||||||
|
|
||||||
public class Dataset
|
public class Dataset
|
||||||
{
|
{
|
||||||
|
public required DatasetMetadata Metadata { get; set; }
|
||||||
|
public Dictionary<string, SztlField> Fields { get; set; } = [];
|
||||||
|
public Dictionary<string, SztlFieldGroup> Groups { get; set; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an SzfField from a string path (use dot notation, eg 'stats.damage')
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldPath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public SztlField? GetField(string fieldPath)
|
||||||
|
{
|
||||||
|
var split = fieldPath.Split('.');
|
||||||
|
var fieldName = split[0];
|
||||||
|
|
||||||
|
if (split.Length == 1)
|
||||||
|
{
|
||||||
|
return Fields.GetValueOrDefault(fieldName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Todo: Recurse into Groups.Fields to find the path
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
11
SessionZero/Data/DatasetMetadata.cs
Normal file
11
SessionZero/Data/DatasetMetadata.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace SessionZero.Data;
|
||||||
|
|
||||||
|
public class DatasetMetadata
|
||||||
|
{
|
||||||
|
public required string Name { get; set; }
|
||||||
|
public required string Id { get; set; }
|
||||||
|
public required string Description { get; set; }
|
||||||
|
public required string DatasetType { get; set; }
|
||||||
|
public required string Icon { get; set; }
|
||||||
|
public required string ObjectTemplate { get; set; }
|
||||||
|
}
|
||||||
@@ -6,6 +6,17 @@ public class SztlField
|
|||||||
{
|
{
|
||||||
public required string Id { get; set; }
|
public required string Id { get; set; }
|
||||||
public required SztlFieldType FieldType { get; set; }
|
public required SztlFieldType FieldType { get; set; }
|
||||||
|
public object? Value { get; set; } = null;
|
||||||
|
|
||||||
|
public bool TrySetValue()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T TryGetValue<T>()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SztlFieldType
|
public enum SztlFieldType
|
||||||
|
|||||||
9
SessionZero/Data/Sztl/SztlFieldGroup.cs
Normal file
9
SessionZero/Data/Sztl/SztlFieldGroup.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionZero.Data.Sztl;
|
||||||
|
|
||||||
|
public class SztlFieldGroup
|
||||||
|
{
|
||||||
|
public List<SztlField> Fields { get; set; } = [];
|
||||||
|
public List<SztlFieldGroup> SubGroups { get; set; } = [];
|
||||||
|
}
|
||||||
7
SessionZero/Data/Sztl/SztlTemplate.cs
Normal file
7
SessionZero/Data/Sztl/SztlTemplate.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace SessionZero.Data.Sztl;
|
||||||
|
|
||||||
|
public class SztlTemplate
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
9
SessionZero/Data/Sztl/SztlTokenizer.cs
Normal file
9
SessionZero/Data/Sztl/SztlTokenizer.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SessionZero.Data.Sztl;
|
||||||
|
|
||||||
|
public class SztlTokenizer
|
||||||
|
{
|
||||||
|
enum TokenType
|
||||||
|
{
|
||||||
|
// TODO: Add token types
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user