Add support for strings and BoolX in script engine, show strings as textfields in editor

This commit is contained in:
Simon Lübeß
2023-12-01 23:13:30 +01:00
parent b68bad5bda
commit df446188b6
4 changed files with 66 additions and 2 deletions
@@ -14,6 +14,8 @@ static sealed class ScriptEngineHelper
{
private static Dictionary<StringView, ScriptFieldType> _scriptFieldTypes = new Dictionary<StringView, ScriptFieldType>()
{
("System.String", .String),
("System.Boolean", .Bool),
("System.Char", .Char),
@@ -382,6 +384,8 @@ static class ScriptEngine
// TODO: Handle Structs when copying fields to instance.
case .Class:
// TODO: Handle Class when copying fields to instance.
case .String:
// TODO: Handle String when copying fields to instance.
default:
script.Instance.SetFieldValue(scriptField, field._data);
}
+16 -2
View File
@@ -15,7 +15,9 @@ enum ScriptFieldType
case GenericClass;
case Array;
case Bool;
case String;
case Bool, Bool2, Bool3, Bool4;
case Char;
case SByte;
@@ -29,7 +31,7 @@ enum ScriptFieldType
case Float, float2, float3, float4;
case Double, Double2, Double3, Double4;
case Entity;
case Component;
@@ -37,8 +39,20 @@ enum ScriptFieldType
{
switch(this)
{
case .String:
return typeof(String);
case .Bool:
return typeof(bool);
case .Bool2:
return typeof(bool2);
case .Bool3:
return typeof(bool3);
case .Bool4:
return typeof(bool4);
case .Char:
return typeof(char16);
case .SByte:
return typeof(int8);