当前位置: 首页>>代码示例>>C++>>正文


C++ FUniqueNetId类代码示例

本文整理汇总了C++中FUniqueNetId的典型用法代码示例。如果您正苦于以下问题:C++ FUniqueNetId类的具体用法?C++ FUniqueNetId怎么用?C++ FUniqueNetId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FUniqueNetId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetTeamForCurrentPlayer

int32 UPartyBeaconState::GetTeamForCurrentPlayer(const FUniqueNetId& PlayerId) const
{
    int32 TeamNum = INDEX_NONE;
    if (PlayerId.IsValid())
    {
        for (int32 ResIdx = 0; ResIdx < Reservations.Num(); ResIdx++)
        {
            const FPartyReservation& Reservation = Reservations[ResIdx];
            for (int32 PlayerIdx = 0; PlayerIdx < Reservation.PartyMembers.Num(); PlayerIdx++)
            {
                // find the player id in the existing list of reservations
                if (*Reservation.PartyMembers[PlayerIdx].UniqueId == PlayerId)
                {
                    TeamNum = Reservation.TeamNum;
                    break;
                }
            }
        }

        UE_LOG(LogBeacon, Display, TEXT("Assigning player %s to team %d"),
            *PlayerId.ToString(),
            TeamNum);
    }
    else
    {
        UE_LOG(LogBeacon, Display, TEXT("Invalid player when attempting to find team assignment"));
    }

    return TeamNum;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:30,代码来源:PartyBeaconState.cpp

示例2: FireEvent_FriendRemoved

    virtual void FireEvent_FriendRemoved(const FUniqueNetId& LocalUserId, const IFriendItem& Friend, const FString& RemoveReason) const override
    {
        static const FString EventName = TEXT("Social.FriendRemoved");
        if (AnalyticsProvider.IsValid())
        {
            if (LocalUserId.IsValid())
            {
                TArray<FAnalyticsEventAttribute> Attributes;
                Attributes.Add(FAnalyticsEventAttribute(TEXT("User"), LocalUserId.ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("Friend"), Friend.GetUniqueID()->ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("RemoveReason"), RemoveReason));
                AddPresenceAttributes(LocalUserId, Attributes);
                AnalyticsProvider->RecordEvent(EventName, Attributes);
            }
        }
    }
开发者ID:PopCap,项目名称:GameIdea,代码行数:16,代码来源:FriendsAndChatAnalytics.cpp

示例3: FireEvent_RecordToggleChat

    virtual void FireEvent_RecordToggleChat(const FUniqueNetId& LocalUserId, const FString& Channel, bool bEnabled) const override
    {
        static const FString EventName = TEXT("Social.Chat.Toggle");
        if (AnalyticsProvider.IsValid())
        {
            if (LocalUserId.IsValid())
            {
                TArray<FAnalyticsEventAttribute> Attributes;
                Attributes.Add(FAnalyticsEventAttribute(TEXT("User"), LocalUserId.ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("Channel"), Channel));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("bEnabled"), bEnabled));
                AddPresenceAttributes(LocalUserId, Attributes);
                AnalyticsProvider->RecordEvent(EventName, Attributes);
            }
        }
    }
开发者ID:PopCap,项目名称:GameIdea,代码行数:16,代码来源:FriendsAndChatAnalytics.cpp

示例4: FireEvent_SendGameInvite

    virtual void FireEvent_SendGameInvite(const FUniqueNetId& LocalUserId, const FUniqueNetId& ToUser) const override
    {
        static const FString EventName = TEXT("Social.GameInvite.Send");

        if (AnalyticsProvider.IsValid())
        {
            if (LocalUserId.IsValid())
            {
                TArray<FAnalyticsEventAttribute> Attributes;
                Attributes.Add(FAnalyticsEventAttribute(TEXT("User"), LocalUserId.ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("Friend"), ToUser.ToString()));
                AddPresenceAttributes(LocalUserId, Attributes);
                AnalyticsProvider->RecordEvent(EventName, Attributes);
            }
        }
    }
开发者ID:PopCap,项目名称:GameIdea,代码行数:16,代码来源:FriendsAndChatAnalytics.cpp

示例5: OnQueryRecentPlayersComplete

void FTestFriendsInterface::OnQueryRecentPlayersComplete(const FUniqueNetId& UserId, const FString& Namespace, bool bWasSuccessful, const FString& ErrorStr)
{
    UE_LOG(LogOnline, Log,
        TEXT("QueryRecentPlayers() for player (%s) was success=%d error=%s"), *UserId.ToDebugString(), bWasSuccessful, *ErrorStr);

    if (bWasSuccessful)
    {
        TArray< TSharedRef<FOnlineRecentPlayer> > Players;
        // Grab the friends data so we can print it out
        if (OnlineSub->GetFriendsInterface()->GetRecentPlayers(UserId, Namespace, Players))
        {
            UE_LOG(LogOnline, Log,
                TEXT("GetRecentPlayers returned %d players"), Players.Num());

            // Log each friend's data out
            for (auto RecentPlayer : Players)
            {
                UE_LOG(LogOnline, Log,
                    TEXT("\t%s has unique id (%s)"), *RecentPlayer->GetDisplayName(), *RecentPlayer->GetUserId()->ToDebugString());
                UE_LOG(LogOnline, Log,
                    TEXT("\t LastSeen (%s)"), *RecentPlayer->GetLastSeen().ToString());
            }
        }
    }

    // done with this part of the test
    bQueryRecentPlayers = false;
    // kick off next test
    StartNextTest();
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:30,代码来源:TestFriendsInterface.cpp

示例6: UE_LOG_ONLINE

bool FOnlineAchievementsNull::ResetAchievements(const FUniqueNetId& PlayerId)
{
    if (!ReadAchievementsFromConfig())
    {
        // we don't have achievements
        UE_LOG_ONLINE(Warning, TEXT("No achievements have been configured"));
        return false;
    }

    FUniqueNetIdString NullId(PlayerId);
    TArray<FOnlineAchievement> * PlayerAch = PlayerAchievements.Find(NullId);
    if (NULL == PlayerAch)
    {
        // achievements haven't been read for a player
        UE_LOG_ONLINE(Warning, TEXT("Could not find achievements for player %s"), *PlayerId.ToString());
        return false;
    }

    // treat each achievement as unlocked
    const int32 AchNum = PlayerAch->Num();
    for (int32 AchIdx = 0; AchIdx < AchNum; ++AchIdx)
    {
        (*PlayerAch)[ AchIdx ].Progress = 0.0;
    }

    return true;
};
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:27,代码来源:OnlineAchievementsInterfaceNull.cpp

示例7: FindRemoteTalker

bool FOnlineVoiceImpl::UnmuteRemoteTalker(uint8 LocalUserNum, const FUniqueNetId& PlayerId, bool bIsSystemWide)
{
    uint32 Return = E_FAIL;
    if (LocalUserNum >= 0 && LocalUserNum < MAX_LOCAL_PLAYERS)
    {
        // Skip this if the session isn't active
        if (SessionInt && SessionInt->GetNumSessions() > 0 &&
            // Or if voice is disabled
            VoiceEngine != NULL)
        {
            // Find the specified talker
            FRemoteTalker* Talker = FindRemoteTalker(PlayerId);
            if (Talker != NULL)
            {
                // Remove them from the mute list
                MuteList.RemoveSingleSwap((const FUniqueNetIdString&)PlayerId);
                UE_LOG(LogVoice, Log, TEXT("Unmuting remote talker (%s)"), *PlayerId.ToDebugString());
            }
            else
            {
                UE_LOG(LogVoice, Warning, TEXT("Unknown remote talker (%s) specified to UnmuteRemoteTalker()"), *PlayerId.ToDebugString());
            }
        }
    }
    else
    {
        UE_LOG(LogVoice, Warning, TEXT("Invalid user specified in UnmuteRemoteTalker(%d)"), LocalUserNum);
    }

    return Return == S_OK;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:31,代码来源:VoiceInterfaceImpl.cpp

示例8: ResetPlayerNotificationBindings

/** Resets a player's notification handlers */
void FOnlineNotificationHandler::ResetPlayerNotificationBindings(const FUniqueNetId& PlayerId)
{
    NotificationTypeBindingsMap* FoundPlayerBindings = PlayerBindingMap.Find(PlayerId.ToString());
    if (FoundPlayerBindings)
    {
        FoundPlayerBindings->Reset();
    }
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:9,代码来源:OnlineNotificationHandler.cpp

示例9: UE_LOG

void ATitleFileSubsystemTestActor::LoginCallback(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
    UE_LOG(LogTemp, Log, TEXT("%s"), (_identity->GetLoginStatus(0) == ELoginStatus::LoggedIn) ? TEXT("true") : TEXT("false"));

    TArray<TSharedRef<const FUniqueNetId>> ids;
    ids.Add(UserId.AsShared());

    _titleFile->EnumerateFiles();
}
开发者ID:getbraincloud,项目名称:braincloud-unreal,代码行数:9,代码来源:TitleFileSubsystemTestActor.cpp

示例10: GetPlayerNickname

FString FOnlineIdentityFacebook::GetPlayerNickname(const FUniqueNetId& UserId) const
{
    const TSharedRef<FUserOnlineAccountFacebook>* FoundUserAccount = UserAccounts.Find(UserId.ToString());
    if (FoundUserAccount != NULL)
    {
        const TSharedRef<FUserOnlineAccountFacebook>& UserAccount = *FoundUserAccount;
        return UserAccount->RealName;
    }
    return TEXT("");
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:10,代码来源:OnlineIdentityFacebook.cpp

示例11: FireEvent_AddFriend

    virtual void FireEvent_AddFriend(const FUniqueNetId& LocalUserId, const FString& FriendName, const FUniqueNetId& FriendId, EFindFriendResult::Type Result, bool bRecentPlayer) const override
    {
        static const FString EventName = TEXT("Social.AddFriend");

        if (AnalyticsProvider.IsValid())
        {
            if (LocalUserId.IsValid())
            {
                TArray<FAnalyticsEventAttribute> Attributes;
                Attributes.Add(FAnalyticsEventAttribute(TEXT("User"), LocalUserId.ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("Friend"), FriendId.ToString()));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("FriendName"), FriendName));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("Result"), EFindFriendResult::ToString(Result)));
                Attributes.Add(FAnalyticsEventAttribute(TEXT("bRecentPlayer"), bRecentPlayer));
                AddPresenceAttributes(LocalUserId, Attributes);
                AnalyticsProvider->RecordEvent(EventName, Attributes);
            }
        }
    }
开发者ID:PopCap,项目名称:GameIdea,代码行数:19,代码来源:FriendsAndChatAnalytics.cpp

示例12:

TSharedPtr<FUserOnlineAccount> FOnlineIdentityAmazon::GetUserAccount(const FUniqueNetId& UserId) const
{
    TSharedPtr<FUserOnlineAccount> Result;

    const TSharedRef<FUserOnlineAccountAmazon>* FoundUserAccount = UserAccounts.Find(UserId.ToString());
    if (FoundUserAccount != NULL)
    {
        Result = *FoundUserAccount;
    }

    return Result;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:12,代码来源:OnlineIdentityAmazon.cpp

示例13: FindRemoteTalker

bool FOnlineVoiceSteam::RegisterRemoteTalker(const FUniqueNetId& UniqueId) 
{
    uint32 Return = E_FAIL;
    if (SteamSubsystem)
    {
        // Skip this if the session isn't active
        if (SessionInt && SessionInt->GetNumSessions() > 0 &&
            // Or when voice is disabled
            VoiceEngine.IsValid())
        {
            // See if this talker has already been registered or not
            FRemoteTalker* Talker = FindRemoteTalker(UniqueId);
            if (Talker == NULL)
            {
                // Add a new talker to our list
                int32 AddIndex = RemoteTalkers.AddZeroed();
                Talker = &RemoteTalkers[AddIndex];
                // Copy the UniqueId
                const FUniqueNetIdSteam& UniqueIdSteam = (const FUniqueNetIdSteam&)UniqueId;
                Talker->TalkerId = MakeShareable(new FUniqueNetIdSteam(UniqueIdSteam));
                // Register the remote talker locally
                Return = VoiceEngine->RegisterRemoteTalker(UniqueId);
                UE_LOG(LogVoice, Log, TEXT("RegisterRemoteTalker(%s) returned 0x%08X"),
                    *UniqueId.ToDebugString(), Return);
            }
            else
            {
                UE_LOG(LogVoice, Verbose, TEXT("Remote talker %s is being re-registered"), *UniqueId.ToDebugString());
                Return = S_OK;
            }
            
            // Update muting all of the local talkers with this remote talker
            ProcessMuteChangeNotification();
            // Now start processing the remote voices
            Return = VoiceEngine->StartRemoteVoiceProcessing(UniqueId);
            UE_LOG(LogVoice, Log, TEXT("StartRemoteVoiceProcessing(%s) returned 0x%08X"), *UniqueId.ToDebugString(), Return);
        }
    }
    return Return == S_OK;
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:40,代码来源:VoiceInterfaceSteam.cpp

示例14: AddPlayerNotificationBinding_Handle

FDelegateHandle FOnlineNotificationHandler::AddPlayerNotificationBinding_Handle(const FUniqueNetId& PlayerId, FString NotificationType, const FOnlineNotificationBinding& NewBinding)
{
    if (!NewBinding.NotificationDelegate.IsBound())
    {
        UE_LOG(LogOnline, Error, TEXT("Adding empty notification binding for type %s"), *NotificationType);
        return FDelegateHandle();
    }

    NotificationTypeBindingsMap& FoundPlayerBindings = PlayerBindingMap.FindOrAdd(PlayerId.ToString());
    TArray<FOnlineNotificationBinding>& FoundPlayerTypeBindings = FoundPlayerBindings.FindOrAdd(NotificationType);
    FoundPlayerTypeBindings.Add(NewBinding);
    return FoundPlayerTypeBindings.Last().NotificationDelegate.GetHandle();
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:13,代码来源:OnlineNotificationHandler.cpp

示例15: UE_LOG

void AMessageSubsystemTestActor::LoginCallback(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
    UE_LOG(LogTemp, Log, TEXT("%s"), (_identity->GetLoginStatus(0) == ELoginStatus::LoggedIn) ? TEXT("true") : TEXT("false"));

    TArray<TSharedRef<const FUniqueNetId>> ids;
    ids.Add(UserId.AsShared());

    FOnlineMessagePayload payload = FOnlineMessagePayload();
    FVariantData data = FVariantData();
    data.SetValue(true);
    payload.SetAttribute("test", data);

    _message->SendMessage(0, ids, TEXT("testMessage"), payload);
}
开发者ID:getbraincloud,项目名称:braincloud-unreal,代码行数:14,代码来源:MessageSubsystemTestActor.cpp


注:本文中的FUniqueNetId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。