public void ToNative(IntPtr address) { Native_FOnlineSessionSettings.Set_NumPublicConnections(address, NumPublicConnections); Native_FOnlineSessionSettings.Set_NumPrivateConnections(address, NumPrivateConnections); Native_FOnlineSessionSettings.Set_bShouldAdvertise(address, bShouldAdvertise); Native_FOnlineSessionSettings.Set_bAllowJoinInProgress(address, bAllowJoinInProgress); Native_FOnlineSessionSettings.Set_bIsLANMatch(address, bIsLANMatch); Native_FOnlineSessionSettings.Set_bIsDedicated(address, bIsDedicated); Native_FOnlineSessionSettings.Set_bUsesStats(address, bUsesStats); Native_FOnlineSessionSettings.Set_bAllowInvites(address, bAllowInvites); Native_FOnlineSessionSettings.Set_bUsesPresence(address, bUsesPresence); Native_FOnlineSessionSettings.Set_bAllowJoinViaPresence(address, bAllowJoinViaPresence); Native_FOnlineSessionSettings.Set_bAllowJoinViaPresenceFriendsOnly(address, bAllowJoinViaPresenceFriendsOnly); Native_FOnlineSessionSettings.Set_bAntiCheatProtected(address, bAntiCheatProtected); Native_FOnlineSessionSettings.Set_BuildUniqueId(address, BuildUniqueId); using (TArrayUnsafe <string> keysUnsafe = new TArrayUnsafe <string>()) using (TArrayUnsafe <string> valuesUnsafe = new TArrayUnsafe <string>()) { if (Settings != null) { foreach (KeyValuePair <string, FOnlineSessionSetting> setting in Settings) { keysUnsafe.Add(setting.Key); valuesUnsafe.Add((int)setting.Value.AdvertisementType + "|" + setting.Value.ID + "|" + setting.Value.Data.ToStringEx()); } } Native_FOnlineSessionSettings.Set_Settings(address, keysUnsafe.Address, valuesUnsafe.Address); } }
public static AActor[] GetAllActorsOfClass(UObject worldContextObject, UClass actorClass) { using (TArrayUnsafe <AActor> actorsUnsafe = new TArrayUnsafe <AActor>()) { Native_UGameplayStatics.GetAllActorsOfClass(worldContextObject.Address, actorClass.Address, actorsUnsafe.Address); return(actorsUnsafe.ToArray()); } }
/// <summary> /// Gets an array of all blueprints used to generate this class and its parents. 0th elements is the BP used to generate InClass /// </summary> /// <param name="inClass">The class to get the blueprint lineage for</param> /// <param name="outBlueprintParents">Array with the blueprints used to generate this class and its parents. 0th = this, Nth = least derived BP-based parent</param> /// <returns>true if there were no status errors in any of the parent blueprints, otherwise false</returns> public static bool GetBlueprintHierarchyFromClass(UClass inClass, UBlueprint[] outBlueprintParents) { using (TArrayUnsafe <UBlueprint> outBlueprintParentsUnsafe = new TArrayUnsafe <UBlueprint>()) { bool result = Native_UBlueprint.GetBlueprintHierarchyFromClass( inClass == null ? IntPtr.Zero : inClass.Address, outBlueprintParentsUnsafe.Address); outBlueprintParents = outBlueprintParentsUnsafe.ToArray(); return(result); } }
/// <summary> /// Builds a set of the UUIDs of pending latent actions on a specific object. /// </summary> /// <param name="obj">Object to query for latent actions.</param> /// <returns>An array UUIDs of the pending latent actions.</returns> public int[] GetActiveUUIDs(UObject obj) { #if WITH_EDITOR using (TArrayUnsafe <int> resultUnsafe = new TArrayUnsafe <int>()) { Native_FLatentActionManager.GetActiveUUIDs(Address, obj.Address, resultUnsafe.Address); return(resultUnsafe.ToArray()); } #else return(null); #endif }
public static T[] GetAllActorsOfClass <T>(UObject worldContextObject) where T : AActor { using (TArrayUnsafe <T> actorsUnsafe = new TArrayUnsafe <T>()) { UClass unrealClass = UClass.GetClass <T>(); if (unrealClass != null) { Native_UGameplayStatics.GetAllActorsOfClass(worldContextObject.Address, unrealClass.Address, actorsUnsafe.Address); } return(actorsUnsafe.ToArray()); } }
public T[] GetComponentsByTag <T>(FName tag) where T : UActorComponent { UClass unrealClass = UClass.GetClass <T>(); if (unrealClass == null) { return(null); } using (TArrayUnsafe <T> resultUnsafe = new TArrayUnsafe <T>()) { Native_AActor.GetComponentsByTag(Address, unrealClass.Address, ref tag, resultUnsafe.Address); return(resultUnsafe.ToArray()); } }
public void FromNative(IntPtr address) { if (Settings == null) { Settings = new Dictionary <string, FOnlineSessionSetting>(); } else { Settings.Clear(); } NumPublicConnections = Native_FOnlineSessionSettings.Get_NumPublicConnections(address); NumPrivateConnections = Native_FOnlineSessionSettings.Get_NumPrivateConnections(address); bShouldAdvertise = Native_FOnlineSessionSettings.Get_bShouldAdvertise(address); bAllowJoinInProgress = Native_FOnlineSessionSettings.Get_bAllowJoinInProgress(address); bIsLANMatch = Native_FOnlineSessionSettings.Get_bIsLANMatch(address); bIsDedicated = Native_FOnlineSessionSettings.Get_bIsDedicated(address); bUsesStats = Native_FOnlineSessionSettings.Get_bUsesStats(address); bAllowInvites = Native_FOnlineSessionSettings.Get_bAllowInvites(address); bUsesPresence = Native_FOnlineSessionSettings.Get_bUsesPresence(address); bAllowJoinViaPresence = Native_FOnlineSessionSettings.Get_bAllowJoinViaPresence(address); bAllowJoinViaPresenceFriendsOnly = Native_FOnlineSessionSettings.Get_bAllowJoinViaPresenceFriendsOnly(address); bAntiCheatProtected = Native_FOnlineSessionSettings.Get_bAntiCheatProtected(address); BuildUniqueId = Native_FOnlineSessionSettings.Get_BuildUniqueId(address); using (TArrayUnsafe <string> keysUnsafe = new TArrayUnsafe <string>()) using (TArrayUnsafe <string> valuesUnsafe = new TArrayUnsafe <string>()) { Native_FOnlineSessionSettings.Get_Settings(address, keysUnsafe.Address, valuesUnsafe.Address); if (keysUnsafe.Count == valuesUnsafe.Count) { int count = keysUnsafe.Count; for (int i = 0; i < count; i++) { FOnlineSessionSetting setting = default(FOnlineSessionSetting); string valueStr = valuesUnsafe[i]; int index = valueStr.IndexOf('|'); setting.AdvertisementType = (EOnlineDataAdvertisementType)int.Parse(valueStr.Substring(0, index)); valueStr = valueStr.Substring(index + 1); index = valueStr.IndexOf('|'); setting.ID = int.Parse(valueStr.Substring(0, index)); valueStr = valueStr.Substring(index + 1); setting.Data.FromStringEx(valueStr); Settings[keysUnsafe[i]] = setting; } } } }
public static FWorldContext[] GetWorldContexts() { using (TArrayUnsafe <IntPtr> resultUnsafe = new TArrayUnsafe <IntPtr>()) { Native_UEngine.GetWorldContexts(resultUnsafe.Address); int count = resultUnsafe.Count; FWorldContext[] result = new FWorldContext[count]; for (int i = 0; i < count; i++) { IntPtr worldContextPtr = resultUnsafe[i]; Debug.Assert(worldContextPtr != IntPtr.Zero); result[i] = new FWorldContext(worldContextPtr); } return(result); } }