Merge pull request #43373 from Chaosus/mono_array_shuffle
[Mono] Added Shuffle method to Array
This commit is contained in:
commit
df6fa6c306
|
@ -81,6 +81,11 @@ namespace Godot.Collections
|
|||
return godot_icall_Array_Resize(GetPtr(), newSize);
|
||||
}
|
||||
|
||||
public void Shuffle()
|
||||
{
|
||||
godot_icall_Array_Shuffle(GetPtr());
|
||||
}
|
||||
|
||||
public static Array operator +(Array left, Array right)
|
||||
{
|
||||
return new Array(godot_icall_Array_Concatenate(left.GetPtr(), right.GetPtr()));
|
||||
|
@ -219,6 +224,9 @@ namespace Godot.Collections
|
|||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
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)]
|
||||
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);
|
||||
}
|
||||
|
||||
public void Shuffle()
|
||||
{
|
||||
objectArray.Shuffle();
|
||||
}
|
||||
|
||||
public static Array<T> operator +(Array<T> left, Array<T> right)
|
||||
{
|
||||
return new Array<T>(left.objectArray + right.objectArray);
|
||||
|
|
|
@ -162,6 +162,10 @@ Error godot_icall_Array_Resize(Array *ptr, int 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) {
|
||||
MonoType *elem_type = mono_reflection_type_get_type(refltype);
|
||||
|
||||
|
@ -322,6 +326,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_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_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_ToString", (void *)godot_icall_Array_ToString);
|
||||
|
||||
|
|
Loading…
Reference in New Issue