feat: implement mappeduobject

This commit is contained in:
tresabhi committed 2025-02-01 22:01:06 -06:00
1 parent 09abbbadc9
commit 37b5d1c6e8
2 files changed
+42 -3

No files matched your search

+24
View File
@@ -16,6 +16,8 @@ namespace BlitzKit.CLI.Models
readonly Dictionary<string, BoolProperty> Booleans = [];
readonly Dictionary<string, FloatProperty> Floats = [];
readonly Dictionary<string, ArrayProperty> Arrays = [];
readonly Dictionary<string, TextProperty> Texts = [];
readonly Dictionary<string, IntProperty> Ints = [];
public MappedUObject(List<FPropertyTag> properties)
: base(properties)
@@ -66,6 +68,18 @@ namespace BlitzKit.CLI.Models
break;
}
case TextProperty text:
{
Texts.Add(property.Name.Text, text);
break;
}
case IntProperty integer:
{
Ints.Add(property.Name.Text, integer);
break;
}
default:
{
throw new Exception($"Unhandled property type: {property}");
@@ -78,5 +92,15 @@ namespace BlitzKit.CLI.Models
{
return Names[name].Value.Text;
}
public bool GetBool(string name)
{
return Booleans[name].Value;
}
public bool? TryGetBool(string name)
{
return Booleans.TryGetValue(name, out var entry) ? entry.Value : null;
}
}
}