mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: implement mappeduobject
This commit is contained in:
1 parent
09abbbadc9
commit
37b5d1c6e8
2 files changed
+42
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user