本文整理汇总了C++中UE_LOG_ONLINE函数的典型用法代码示例。如果您正苦于以下问题:C++ UE_LOG_ONLINE函数的具体用法?C++ UE_LOG_ONLINE怎么用?C++ UE_LOG_ONLINE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UE_LOG_ONLINE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetConnectStringFromSessionInfo
bool FOnlineSessionNull::GetResolvedConnectString(const class FOnlineSessionSearchResult& SearchResult, FName PortType, FString& ConnectInfo)
{
bool bSuccess = false;
if (SearchResult.Session.SessionInfo.IsValid())
{
TSharedPtr<FOnlineSessionInfoNull> SessionInfo = StaticCastSharedPtr<FOnlineSessionInfoNull>(SearchResult.Session.SessionInfo);
if (PortType == BeaconPort)
{
int32 BeaconListenPort = 15000;
if (SearchResult.Session.SessionSettings.Get(SETTING_BEACONPORT, BeaconListenPort) && BeaconListenPort > 0)
{
bSuccess = GetConnectStringFromSessionInfo(SessionInfo, ConnectInfo, BeaconListenPort);
}
}
else if (PortType == GamePort)
{
bSuccess = GetConnectStringFromSessionInfo(SessionInfo, ConnectInfo);
}
}
if (!bSuccess || ConnectInfo.IsEmpty())
{
UE_LOG_ONLINE(Warning, TEXT("Invalid session info in search result to GetResolvedConnectString()"));
}
return bSuccess;
}
示例2: ConnectURL
bool APartyBeaconClient::RequestReservation(const FString& ConnectInfoStr, const FString& InSessionId, const FUniqueNetIdRepl& RequestingPartyLeader, const TArray<FPlayerReservation>& PartyMembers)
{
bool bSuccess = false;
FURL ConnectURL(NULL, *ConnectInfoStr, TRAVEL_Absolute);
if (InitClient(ConnectURL))
{
DestSessionId = InSessionId;
PendingReservation.PartyLeader = RequestingPartyLeader;
PendingReservation.PartyMembers = PartyMembers;
bPendingReservationSent = false;
RequestType = EClientRequestType::ExistingSessionReservation;
bSuccess = true;
}
else
{
UE_LOG_ONLINE(Warning, TEXT("RequestReservation: Failure to init client beacon with %s."), *ConnectURL.ToString());
RequestType = EClientRequestType::NonePending;
}
if (!bSuccess)
{
OnFailure();
}
return bSuccess;
}
示例3: WriteSteamAppIdToDisk
/**
* Write out the steam app id to the steam_appid.txt file before initializing the API
* @param SteamAppId id assigned to the application by Steam
*/
static void WriteSteamAppIdToDisk(int32 SteamAppId)
{
if (SteamAppId > 0)
{
// Turn off sandbox temporarily to make sure file is where it's always expected
FScopeSandboxContext ScopedSandbox(false);
// Access the physical file writer directly so that we still write next to the executable in CotF builds.
FString SteamAppIdFilename = GetSteamAppIdFilename();
IFileHandle* Handle = IPlatformFile::GetPlatformPhysical().OpenWrite(*SteamAppIdFilename, false, false);
if (!Handle)
{
UE_LOG_ONLINE(Fatal, TEXT("Failed to create file: %s"), *SteamAppIdFilename);
}
else
{
FString AppId = FString::Printf(TEXT("%d"), SteamAppId);
FBufferArchive Archive;
Archive.Serialize((void*)TCHAR_TO_ANSI(*AppId), AppId.Len());
Handle->Write(Archive.GetData(), Archive.Num());
delete Handle;
Handle = nullptr;
}
}
}
示例4: FinalizeLANSearch
bool FOnlineSessionNull::CancelFindSessions()
{
uint32 Return = E_FAIL;
if (CurrentSessionSearch->SearchState == EOnlineAsyncTaskState::InProgress)
{
// Make sure it's the right type
Return = ERROR_SUCCESS;
FinalizeLANSearch();
CurrentSessionSearch->SearchState = EOnlineAsyncTaskState::Failed;
CurrentSessionSearch = NULL;
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Can't cancel a search that isn't in progress"));
}
if (Return != ERROR_IO_PENDING)
{
TriggerOnCancelFindSessionsCompleteDelegates(true);
}
return Return == ERROR_SUCCESS || Return == ERROR_IO_PENDING;
}
示例5: LoadSteamModules
void FOnlineSubsystemSteamModule::StartupModule()
{
bool bSuccess = false;
// Load the Steam modules before first call to API
LoadSteamModules();
if (AreSteamDllsLoaded())
{
// Create and register our singleton factory with the main online subsystem for easy access
SteamFactory = new FOnlineFactorySteam();
FOnlineSubsystemModule& OSS = FModuleManager::GetModuleChecked<FOnlineSubsystemModule>("OnlineSubsystem");
OSS.RegisterPlatformService(STEAM_SUBSYSTEM, SteamFactory);
bSuccess = true;
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Steam SDK %s libraries not present at %s or failed to load!"), STEAM_SDK_VER, *GetSteamModulePath());
}
if (!bSuccess)
{
UnloadSteamModules();
}
}
示例6: FindLANSession
bool FOnlineSessionNull::FindSessions(int32 SearchingPlayerNum, const TSharedRef<FOnlineSessionSearch>& SearchSettings)
{
uint32 Return = E_FAIL;
// Don't start another search while one is in progress
if (!CurrentSessionSearch.IsValid() && SearchSettings->SearchState != EOnlineAsyncTaskState::InProgress)
{
// Free up previous results
SearchSettings->SearchResults.Empty();
// Copy the search pointer so we can keep it around
CurrentSessionSearch = SearchSettings;
// remember the time at which we started search, as this will be used for a "good enough" ping estimation
SessionSearchStartInSeconds = FPlatformTime::Seconds();
// Check if its a LAN query
Return = FindLANSession();
if (Return == ERROR_IO_PENDING)
{
SearchSettings->SearchState = EOnlineAsyncTaskState::InProgress;
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Ignoring game search request while one is pending"));
Return = ERROR_IO_PENDING;
}
return Return == ERROR_SUCCESS || Return == ERROR_IO_PENDING;
}
示例7: UE_LOG_ONLINE
void FOnlineSubsystemSteamModule::LoadSteamModules()
{
UE_LOG_ONLINE(Display, TEXT("Loading Steam SDK %s"), STEAM_SDK_VER);
#if PLATFORM_WINDOWS
#if PLATFORM_64BITS
FString RootSteamPath = GetSteamModulePath();
FPlatformProcess::PushDllDirectory(*RootSteamPath);
SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api64.dll"));
#if 0 //64 bit not supported well at present, use Steam Client dlls
// Load the Steam dedicated server dlls (assumes no Steam Client running)
if (IsRunningDedicatedServer())
{
SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient64.dll"));
}
#endif
FPlatformProcess::PopDllDirectory(*RootSteamPath);
#else //PLATFORM_64BITS
FString RootSteamPath = GetSteamModulePath();
FPlatformProcess::PushDllDirectory(*RootSteamPath);
SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api.dll"));
if (IsRunningDedicatedServer())
{
SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient.dll"));
}
FPlatformProcess::PopDllDirectory(*RootSteamPath);
#endif //PLATFORM_64BITS
#elif PLATFORM_MAC
SteamDLLHandle = FPlatformProcess::GetDllHandle(TEXT("libsteam_api.dylib"));
#endif //PLATFORM_WINDOWS
}
示例8: check
/**
* ** INTERNAL **
* Called by an async task after completing an achievement read.
*
* @param PlayerId - id of a player we were making read for
* @param bReadSuccessfully - whether the read completed successfully
*/
void FOnlineAchievementsSteam::UpdateAchievementsForUser(const FUniqueNetIdSteam& PlayerId, bool bReadSuccessfully)
{
// shouldn't get this far if no achievements are configured
check(bHaveConfiguredAchievements);
ISteamUserStats* SteamUserStatsPtr = SteamUserStats();
check(SteamUserStatsPtr);
CSteamID SteamUserId = PlayerId;
// new array
TArray<FOnlineAchievement> AchievementsForPlayer;
const int32 AchNum = Achievements.Num();
for (int32 AchIdx = 0; AchIdx < AchNum; ++AchIdx)
{
// get the info
bool bUnlocked;
uint32 UnlockUnixTime;
if (!SteamUserStatsPtr->GetAchievementAndUnlockTime(TCHAR_TO_UTF8(*Achievements[AchIdx].Id), &bUnlocked, &UnlockUnixTime))
{
UE_LOG_ONLINE(Warning, TEXT("GetAchievementAndUnlockTime() failed for achievement '%s'"), *Achievements[AchIdx].Id);
// skip this achievement
continue;
}
FOnlineAchievementSteam NewAch = Achievements[ AchIdx ];
NewAch.bReadFromSteam = true;
NewAch.Progress = bUnlocked ? 100.0 : 0.0; // TODO: we may want to support more fine-grained progress based on associated stat and min/max,
// although we can only map it one-way (i.e. when reading, but not when writing)
NewAch.UnlockTime = FDateTime::FromUnixTimestamp(UnlockUnixTime);
NewAch.Title = FText::FromString( UTF8_TO_TCHAR( SteamUserStatsPtr->GetAchievementDisplayAttribute(TCHAR_TO_UTF8(*Achievements[AchIdx].Id), "name") ) );
NewAch.LockedDesc = FText::FromString( UTF8_TO_TCHAR( SteamUserStatsPtr->GetAchievementDisplayAttribute(TCHAR_TO_UTF8(*Achievements[AchIdx].Id), "desc") ) );
NewAch.UnlockedDesc = NewAch.LockedDesc;
NewAch.bIsHidden = FCString::Atoi( UTF8_TO_TCHAR( SteamUserStatsPtr->GetAchievementDisplayAttribute(TCHAR_TO_UTF8(*Achievements[AchIdx].Id), "desc") ) ) != 0;
UE_LOG_ONLINE(Verbose, TEXT("Read achievement %d: %s"), AchIdx, *NewAch.ToDebugString());
AchievementsForPlayer.Add( NewAch );
// add mapping (should replace any existing one)
AchievementDescriptions.Add(NewAch.Id, NewAch);
}
// should replace any already existing values
PlayerAchievements.Add(PlayerId, AchievementsForPlayer);
}
示例9: UE_LOG_ONLINE
void FOnlineSessionNull::AppendSessionSettingsToPacket(FNboSerializeToBufferNull& Packet, FOnlineSessionSettings* SessionSettings)
{
#if DEBUG_LAN_BEACON
UE_LOG_ONLINE(Verbose, TEXT("Sending session settings to client"));
#endif
// Members of the session settings class
Packet << SessionSettings->NumPublicConnections
<< SessionSettings->NumPrivateConnections
<< (uint8)SessionSettings->bShouldAdvertise
<< (uint8)SessionSettings->bIsLANMatch
<< (uint8)SessionSettings->bIsDedicated
<< (uint8)SessionSettings->bUsesStats
<< (uint8)SessionSettings->bAllowJoinInProgress
<< (uint8)SessionSettings->bAllowInvites
<< (uint8)SessionSettings->bUsesPresence
<< (uint8)SessionSettings->bAllowJoinViaPresence
<< (uint8)SessionSettings->bAllowJoinViaPresenceFriendsOnly
<< (uint8)SessionSettings->bAntiCheatProtected
<< SessionSettings->BuildUniqueId;
// First count number of advertised keys
int32 NumAdvertisedProperties = 0;
for (FSessionSettings::TConstIterator It(SessionSettings->Settings); It; ++It)
{
const FOnlineSessionSetting& Setting = It.Value();
if (Setting.AdvertisementType >= EOnlineDataAdvertisementType::ViaOnlineService)
{
NumAdvertisedProperties++;
}
}
// Add count of advertised keys and the data
Packet << (int32)NumAdvertisedProperties;
for (FSessionSettings::TConstIterator It(SessionSettings->Settings); It; ++It)
{
const FOnlineSessionSetting& Setting = It.Value();
if (Setting.AdvertisementType >= EOnlineDataAdvertisementType::ViaOnlineService)
{
Packet << It.Key();
Packet << Setting;
#if DEBUG_LAN_BEACON
UE_LOG_ONLINE(Verbose, TEXT("%s"), *Setting.ToString());
#endif
}
}
}
示例10: UE_LOG_ONLINE
bool FOnlineIdentityLeet::Login(int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials)
{
UE_LOG_ONLINE(Display, TEXT("FOnlineIdentityLeet::Login"));
FString ErrorStr;
if (bHasLoginOutstanding)
{
ErrorStr = FString::Printf(TEXT("Registration already pending for user %d"),
LocalUserNumPendingLogin);
}
else if (!(LoginUrl.Len() && LoginRedirectUrl.Len() && ClientId.Len()))
{
ErrorStr = FString::Printf(TEXT("OnlineSubsystemLeet is improperly configured in DefaultEngine.ini LeetEndpoint=%s RedirectUrl=%s ClientId=%s"),
*LoginUrl, *LoginRedirectUrl, *ClientId);
}
else
{
// random number to represent client generated state for verification on login
State = FString::FromInt(FMath::Rand() % 100000);
// auth url to spawn in browser
const FString& Command = FString::Printf(TEXT("%s?redirect_uri=%s&client_id=%s&state=%s&response_type=token"),
*LoginUrl, *LoginRedirectUrl, *ClientId, *State);
UE_LOG_ONLINE(Display, TEXT("FOnlineIdentityLeet::Login - %s"), *LoginUrl);
// This should open the browser with the command as the URL
if (FPlatformMisc::OsExecute(TEXT("open"), *Command))
{
// keep track of local user requesting registration
LocalUserNumPendingLogin = LocalUserNum;
bHasLoginOutstanding = true;
}
else
{
ErrorStr = FString::Printf(TEXT("Failed to execute command %s"),
*Command);
}
}
if (!ErrorStr.IsEmpty())
{
UE_LOG(LogOnline, Error, TEXT("RegisterUser() failed: %s"),
*ErrorStr);
TriggerOnLoginCompleteDelegates(LocalUserNum, false, FUniqueNetIdString(TEXT("")), ErrorStr);
return false;
}
return true;
}
示例11: SteamId
void FOnlineAsyncTaskSteamDeleteUserFile::Tick()
{
bWasSuccessful = false;
if (SteamRemoteStorage() && FileName.Len() > 0)
{
CSteamID SteamId(*(uint64*)UserId.GetBytes());
if (SteamUser()->BLoggedOn() && SteamUser()->GetSteamID() == SteamId)
{
bool bCloudDeleteSuccess = true;
if (bShouldCloudDelete)
{
// Remove the cloud flag, the file remains safely available on the local machine
bCloudDeleteSuccess = SteamRemoteStorage()->FileForget(TCHAR_TO_UTF8(*FileName));
}
bool bLocalDeleteSuccess = true;
if (bShouldLocallyDelete)
{
bLocalDeleteSuccess = false;
// Only clear the tables if we're permanently deleting the file
// Need to make sure nothing async is happening first (this is a formality as nothing in Steam actually is)
IOnlineUserCloudPtr UserCloud = Subsystem->GetUserCloudInterface();
if (UserCloud->ClearFile(UserId, FileName))
{
// Permanent delete
bLocalDeleteSuccess = SteamRemoteStorage()->FileDelete(TCHAR_TO_UTF8(*FileName));
Subsystem->ClearUserCloudMetadata(UserId, FileName);
}
}
bWasSuccessful = bCloudDeleteSuccess && bLocalDeleteSuccess;
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Can only delete cloud files for logged in user."));
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Steam remote storage API disabled."));
}
bIsComplete = true;
}
示例12: UE_LOG_ONLINE
bool FOnlineUserCloudOculus::DeleteUserFile(const FUniqueNetId& UserId, const FString& FileName, bool bShouldCloudDelete, bool bShouldLocallyDelete)
{
auto LoggedInPlayerId = OculusSubsystem.GetIdentityInterface()->GetUniquePlayerId(0);
if (!LoggedInPlayerId.IsValid() || UserId != *LoggedInPlayerId)
{
UE_LOG_ONLINE(Warning, TEXT("Can only save data for logged in player"));
return false;
}
if (bShouldLocallyDelete && ReadCache.Contains(FileName))
{
ReadCache.FindAndRemoveChecked(FileName);
}
if (bShouldCloudDelete)
{
FString BucketName;
FString Key;
if (!(FileName.Split(SEPARATOR, &BucketName, &Key)))
{
BucketName = DefaultBucket;
Key = FileName;
}
auto DelegateLambda = FOculusMessageOnCompleteDelegate::CreateLambda([this, BucketName, Key, LoggedInPlayerId, FileName](ovrMessageHandle Message, bool bIsError)
{
if (bIsError)
{
UE_LOG_ONLINE(Warning, TEXT("Failed to Delete: %s%s%s"), *BucketName, *SEPARATOR, *Key);
}
TriggerOnDeleteUserFileCompleteDelegates(!bIsError, *LoggedInPlayerId, FileName);
});
OculusSubsystem.AddRequestDelegate(
ovr_CloudStorage_Delete(TCHAR_TO_UTF8(*BucketName), TCHAR_TO_UTF8(*Key)),
std::move(DelegateLambda));
}
else
{
TriggerOnDeleteUserFileCompleteDelegates(false, *LoggedInPlayerId, FileName);
}
return true;
}
示例13: MakeShareable
/**
* Give the async task a chance to marshal its data back to the game thread
* Can only be called on the game thread by the async task manager
*/
void FOnlineAsyncEventSteamInviteAccepted::Finalize()
{
FOnlineSessionSteamPtr SessionInt = StaticCastSharedPtr<FOnlineSessionSteam>(Subsystem->GetSessionInterface());
if (SessionInt.IsValid() && !SessionInt->CurrentSessionSearch.IsValid())
{
// Create a search settings object
TSharedRef<FOnlineSessionSearch> SearchSettings = MakeShareable(new FOnlineSessionSearch());
SessionInt->CurrentSessionSearch = SearchSettings;
SessionInt->CurrentSessionSearch->SearchState = EOnlineAsyncTaskState::InProgress;
TCHAR ParsedURL[1024];
if (!FParse::Value(*ConnectionURL, TEXT("SteamConnectIP="), ParsedURL, ARRAY_COUNT(ParsedURL)))
{
UE_LOG_ONLINE(Warning, TEXT("FOnlineAsyncEventSteamInviteAccepted: Failed to parse connection URL"));
return;
}
// Determine the port
int32 Port = 0;
TCHAR* PortToken = FCString::Strchr(ParsedURL, ':');
if (PortToken)
{
Port = FCString::Atoi(PortToken+1);
PortToken[0] = '\0';
}
Port = (Port > 0) ? Port : Subsystem->GetGameServerGamePort();
// Parse the address
bool bIsValid;
TSharedRef<FInternetAddr> IpAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
IpAddr->SetIp(ParsedURL, bIsValid);
if (bIsValid)
{
SessionInt->CurrentSessionSearch->QuerySettings.Set(FName(SEARCH_STEAM_HOSTIP), IpAddr->ToString(false), EOnlineComparisonOp::Equals);
FOnlineAsyncTaskSteamFindServer* NewTask = new FOnlineAsyncTaskSteamFindServer(Subsystem, SearchSettings, LocalUserNum, SessionInt->OnSessionUserInviteAcceptedDelegates);
Subsystem->QueueAsyncTask(NewTask);
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Invalid session or search already in progress when accepting invite. Ignoring invite request."));
}
}
示例14: BucketName
void FOnlineUserCloudOculus::RequestEnumeratePagedBuckets(TSharedPtr<const FUniqueNetId> UserId, ovrCloudStorageMetadataArrayHandle previousPage)
{
auto Delegate = FOculusMessageOnCompleteDelegate::CreateLambda([this, UserId](ovrMessageHandle Message, bool bIsError)
{
const FString& BucketName(Buckets[EnumerateBucketsCounter]);
if (bIsError)
{
// NOTE: this may be too harsh. depending on the error we might be able to keep going.
// check when better error handling is enabled in t11136437
UE_LOG_ONLINE(Warning, TEXT("Failed to Enumerate bucket: %s"), *BucketName);
EnumerateBucketsCounter = -1;
EnumerateCache.Reset();
TriggerOnEnumerateUserFilesCompleteDelegates(false, *UserId);
return;
}
ovrCloudStorageMetadataArrayHandle response = ovr_Message_GetCloudStorageMetadataArray(Message);
// adds all the keys to the cache in the format: BucketName / Key
for (size_t i = 0; i < ovr_CloudStorageMetadataArray_GetSize(response); i++) {
ovrCloudStorageMetadataHandle Metadatum = ovr_CloudStorageMetadataArray_GetElement(response, i);
FString Key = ovr_CloudStorageMetadata_GetKey(Metadatum);
FString Filename = FString::Printf(TEXT("%s%s%s"), *BucketName, *SEPARATOR, *Key);
unsigned int Size = ovr_CloudStorageMetadata_GetDataSize(Metadatum);
EnumerateCache.Add(FCloudFileHeader("", Filename, Size));
}
// First check to see if we need to get another page of entires for this Bucket
if (ovr_CloudStorageMetadataArray_HasNextPage(response))
{
RequestEnumeratePagedBuckets(UserId, response);
}
// see if we need to move on to the next bucket
else if (EnumerateBucketsCounter < (Buckets.Num() - 1))
{
EnumerateBucketsCounter++;
RequestEnumeratePagedBuckets(UserId, nullptr);
}
// Otherwise we are done - notify the App
else
{
EnumerateBucketsCounter = -1;
TriggerOnEnumerateUserFilesCompleteDelegates(true, *UserId);
}
});
if (previousPage)
{
OculusSubsystem.AddRequestDelegate(ovr_CloudStorage_GetNextCloudStorageMetadataArrayPage(previousPage), std::move(Delegate));
}
else
{
OculusSubsystem.AddRequestDelegate(ovr_CloudStorage_LoadBucketMetadata(TCHAR_TO_UTF8(*Buckets[EnumerateBucketsCounter])), std::move(Delegate));
}
}
示例15: UE_LOG_ONLINE
void FOnlineSubsystemOculusModule::ShutdownModule()
{
UE_LOG_ONLINE(Log, TEXT("Oculus Shutdown!"));
FOnlineSubsystemModule& OSS = FModuleManager::GetModuleChecked<FOnlineSubsystemModule>("OnlineSubsystem");
OSS.UnregisterPlatformService(OCULUS_SUBSYSTEM);
delete OculusFactory;
OculusFactory = nullptr;
}