diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-03-05 21:39:50 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-04-06 12:14:43 +0200 |
commit | 480d4c6fbabc65a0822cd3954e488bf64d04b45c (patch) | |
tree | b40baf5d0adc24245d0670239a162f9da0988ba2 /modules/mono/glue/Managed/Files | |
parent | 187e6ae26d88ab0975de6011d00e41a846bcb6fa (diff) |
C#: Support type hints for exported Arrays
Added the code for Dictionary as well, but it's not yet supported by the Godot inspector.
Diffstat (limited to 'modules/mono/glue/Managed/Files')
-rw-r--r-- | modules/mono/glue/Managed/Files/MarshalUtils.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/mono/glue/Managed/Files/MarshalUtils.cs b/modules/mono/glue/Managed/Files/MarshalUtils.cs index c67cda55bf..7e72b0edb5 100644 --- a/modules/mono/glue/Managed/Files/MarshalUtils.cs +++ b/modules/mono/glue/Managed/Files/MarshalUtils.cs @@ -18,6 +18,20 @@ namespace Godot return type.GetGenericTypeDefinition() == typeof(Godot.Collections.Dictionary<,>); } + static void ArrayGetElementType(Type type, out Type elementType) + { + elementType = type.GetGenericArguments()[0]; + } + + static void DictionaryGetKeyValueTypes(Type type, out Type keyType, out Type valueType) + { + var genericArgs = type.GetGenericArguments(); + + keyType = genericArgs[0]; + valueType = genericArgs[1]; + } + + // TODO Add support for IEnumerable<T> and IDictionary<TKey, TValue> // TODO: EnumerableToArray and IDictionaryToDictionary can be optimized internal static void EnumerableToArray(IEnumerable enumerable, IntPtr godotArrayPtr) |