Working on data and sztl
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class Datapack
|
||||
{
|
||||
public required DatapackMetadata Metadata { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using SessionZero.Data.Sztl;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class DatasetObjectTemplate
|
||||
{
|
||||
|
||||
}
|
||||
11
SessionZero/Data/SzField.cs
Normal file
11
SessionZero/Data/SzField.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using SessionZero.Data.Sztl;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class SzField
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public object? Value { get; set; }
|
||||
public SzFieldType Type { get; set; }
|
||||
public bool IsTextBlock { get; set; }
|
||||
}
|
||||
34
SessionZero/Data/SzObject.cs
Normal file
34
SessionZero/Data/SzObject.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using SessionZero.Data.Sztl;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class SzObject
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
public string TemplateId { get; set; }
|
||||
|
||||
public Dictionary<string, SzField> Fields { get; set; } = new();
|
||||
public Dictionary<string, SzFieldGroup> FieldGroups { get; set; } = new();
|
||||
|
||||
public virtual object? GetFieldValue(string fieldPath)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual T GetFieldValue<T>(string fieldPath)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual string GetFieldValueAsString(string fieldPath)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual string SetFieldValue(string fieldPath, object value)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
14
SessionZero/Data/SzTemplate.cs
Normal file
14
SessionZero/Data/SzTemplate.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using SessionZero.Data.Sztl;
|
||||
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class SzTemplate
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string DataType { get; set; }
|
||||
public Dictionary<string, SztlField> Fields { get; set; } = new();
|
||||
public Dictionary<string, SztlFieldGroup> SubGroups { get; set; } = new();
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace SessionZero.Data;
|
||||
|
||||
public class DatasetObject
|
||||
public class SzoFileHandler
|
||||
{
|
||||
|
||||
}
|
||||
10
SessionZero/Data/Sztl/SzFieldGroup.cs
Normal file
10
SessionZero/Data/Sztl/SzFieldGroup.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SzFieldGroup
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public Dictionary<string, SzField> Fields { get; set; } = new();
|
||||
public Dictionary<string, SzFieldGroup> SubGroups { get; set; } = new();
|
||||
}
|
||||
11
SessionZero/Data/Sztl/SzFieldType.cs
Normal file
11
SessionZero/Data/Sztl/SzFieldType.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public enum SzFieldType
|
||||
{
|
||||
Text,
|
||||
Textblock,
|
||||
Number,
|
||||
Bool,
|
||||
Formula,
|
||||
Object
|
||||
}
|
||||
@@ -1,25 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SztlField
|
||||
{
|
||||
public required string Id { 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
|
||||
{
|
||||
Number, Text, Textbox, Bool, Object, Formula
|
||||
public required SzFieldType Type { get; set; }
|
||||
public object? DefaultValue { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public bool IsList { get; set; }
|
||||
public bool IsTextBlock { get; set; }
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SztlFieldGroup
|
||||
{
|
||||
public List<SztlField> Fields { get; set; } = [];
|
||||
public List<SztlFieldGroup> SubGroups { get; set; } = [];
|
||||
public string Id { get; set; }
|
||||
public Dictionary<string, SztlField> Fields { get; set; } = new();
|
||||
public Dictionary<string, SztlFieldGroup> SubGroups { get; set; } = new();
|
||||
}
|
||||
6
SessionZero/Data/Sztl/SztlFileHandler.cs
Normal file
6
SessionZero/Data/Sztl/SztlFileHandler.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SztlFileHandler
|
||||
{
|
||||
|
||||
}
|
||||
6
SessionZero/Data/Sztl/SztlParser.cs
Normal file
6
SessionZero/Data/Sztl/SztlParser.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public static class SztlParser
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SztlTemplate
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace SessionZero.Data.Sztl;
|
||||
|
||||
public class SztlTokenizer
|
||||
{
|
||||
enum TokenType
|
||||
{
|
||||
// TODO: Add token types
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user