[Mono] Added Shuffle method to Array
(cherry picked from commit 156e4043b4
)
This commit is contained in:
parent
1bb81488bb
commit
23620ff046
2 changed files with 18 additions and 0 deletions
|
@ -81,6 +81,11 @@ namespace Godot.Collections
|
||||||
return godot_icall_Array_Resize(GetPtr(), newSize);
|
return godot_icall_Array_Resize(GetPtr(), newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Shuffle()
|
||||||
|
{
|
||||||
|
godot_icall_Array_Shuffle(GetPtr());
|
||||||
|
}
|
||||||
|
|
||||||
public static Array operator +(Array left, Array right)
|
public static Array operator +(Array left, Array right)
|
||||||
{
|
{
|
||||||
return new Array(godot_icall_Array_Concatenate(left.GetPtr(), right.GetPtr()));
|
return new Array(godot_icall_Array_Concatenate(left.GetPtr(), right.GetPtr()));
|
||||||
|
@ -219,6 +224,9 @@ namespace Godot.Collections
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal extern static Error godot_icall_Array_Resize(IntPtr ptr, int newSize);
|
internal extern static Error godot_icall_Array_Resize(IntPtr ptr, int newSize);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
|
internal extern static Error godot_icall_Array_Shuffle(IntPtr ptr);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal extern static void godot_icall_Array_Generic_GetElementTypeInfo(Type elemType, out int elemTypeEncoding, out IntPtr elemTypeClass);
|
internal extern static void godot_icall_Array_Generic_GetElementTypeInfo(Type elemType, out int elemTypeEncoding, out IntPtr elemTypeClass);
|
||||||
|
|
||||||
|
@ -295,6 +303,11 @@ namespace Godot.Collections
|
||||||
return objectArray.Resize(newSize);
|
return objectArray.Resize(newSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Shuffle()
|
||||||
|
{
|
||||||
|
objectArray.Shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
public static Array<T> operator +(Array<T> left, Array<T> right)
|
public static Array<T> operator +(Array<T> left, Array<T> right)
|
||||||
{
|
{
|
||||||
return new Array<T>(left.objectArray + right.objectArray);
|
return new Array<T>(left.objectArray + right.objectArray);
|
||||||
|
|
|
@ -161,6 +161,10 @@ Error godot_icall_Array_Resize(Array *ptr, int new_size) {
|
||||||
return ptr->resize(new_size);
|
return ptr->resize(new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void godot_icall_Array_Shuffle(Array *ptr) {
|
||||||
|
ptr->shuffle();
|
||||||
|
}
|
||||||
|
|
||||||
void godot_icall_Array_Generic_GetElementTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class) {
|
void godot_icall_Array_Generic_GetElementTypeInfo(MonoReflectionType *refltype, uint32_t *type_encoding, GDMonoClass **type_class) {
|
||||||
MonoType *elem_type = mono_reflection_type_get_type(refltype);
|
MonoType *elem_type = mono_reflection_type_get_type(refltype);
|
||||||
|
|
||||||
|
@ -321,6 +325,7 @@ void godot_register_collections_icalls() {
|
||||||
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Remove", (void *)godot_icall_Array_Remove);
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Remove", (void *)godot_icall_Array_Remove);
|
||||||
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_RemoveAt", (void *)godot_icall_Array_RemoveAt);
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_RemoveAt", (void *)godot_icall_Array_RemoveAt);
|
||||||
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Resize", (void *)godot_icall_Array_Resize);
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Resize", (void *)godot_icall_Array_Resize);
|
||||||
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Shuffle", (void *)godot_icall_Array_Shuffle);
|
||||||
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Generic_GetElementTypeInfo", (void *)godot_icall_Array_Generic_GetElementTypeInfo);
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_Generic_GetElementTypeInfo", (void *)godot_icall_Array_Generic_GetElementTypeInfo);
|
||||||
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_ToString", (void *)godot_icall_Array_ToString);
|
mono_add_internal_call("Godot.Collections.Array::godot_icall_Array_ToString", (void *)godot_icall_Array_ToString);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue