简体   繁体   English

在虚幻引擎4中使用Steamworks

[英]Using Steamworks in Unreal Engine 4

So I've started implementing Steamworks functions for my game, and everything went perfectly fine. 因此,我开始为我的游戏实现Steamworks功能,一切都进行得非常顺利。 I managed to get sync with steam API ( i can do achievements and see that i'm playing game on my steam acc). 我设法与Steam API保持同步(我可以取得成就,并看到我在Steam acc上玩游戏)。 However when i wanted to start using some functions that they provided, my engine is saying: 但是,当我想开始使用它们提供的某些功能时,我的引擎在说:

error LNK2019: unresolved external symbol

Anyone can help me solve this problem? 有人可以帮助我解决这个问题吗? I'm aiming atm at reading and saving score in Leaderboards. 我的目标是要在排行榜中阅读并保存得分。 Any good advices for me ? 对我有什么好的建议吗? :D :d

Code sample that gives me error: 给我错误的代码示例:

    int MyCodeLibrary::TryGetScore()
{
    if (SteamAPI_Init())
    {
        CSteamLeaderboards obj();
        obj().FindLeaderboard("test");
        obj().DownloadScores();
        return 0;
    }
    else
    {
        return 0;
    }
}

Also tried to get to Steam with OnlineSubsystem like this: 还试图像这样通过OnlineSubsystem进入Steam:

void MyCodeLibrary::UpdateScoreInt(int score, FName board, APlayerController* PlayerController)
{
    OutputDebugStringA("Funkcja jest wywoływana");
    if (SteamAPI_Init())
    {
        OutputDebugStringA("Steam API działa");
        ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player);
        IOnlineSubsystem* ion = IOnlineSubsystem::Get(FName("Steam"));
        TSharedPtr<const FUniqueNetId> UserId = ion->GetIdentityInterface()->GetUniquePlayerId(LocalPlayer->GetControllerId());
        ion->GetLeaderboardsInterface();

        FOnlineLeaderboardWrite wrt;
        wrt.LeaderboardNames.Add(board);
        wrt.SetIntStat(TEXT("Score"), score);

        if (UserId.IsValid())
        {
            OutputDebugStringA("Mam UserID");
            ion->GetLeaderboardsInterface()->WriteLeaderboards(board, *UserId, wrt);
            printf("Odpalony score");
        }

    }
}

So, I've included library "steam_api64.lib" in my source, but after that i've recieved lots of error which suggest that everyting in steam_api.h is wrong :/ 因此,我在源文件中包含了库“ steam_api64.lib”,但此后我收到了很多错误,这些错误表明steam_api.h中的所有内容都是错误的:/

I'm pretty new to it, so would appreciate some furthere help with it. 我对它还很陌生,因此希望对它有所帮助。 Here are examples of errors showing: 以下是显示错误的示例:

error C2371: "S_CALLTYPE": redefinition; different basic types

error C4430: missing type specifier-int assumed. Note C++ does not support default-int

Did I included anything wrong or missing something? 我是否包含任何错误或遗漏的内容? Steam_api.h file is downloaded directly from steamworks and has not been modified. Steam_api.h文件是直接从steamworks下载的文件,尚未修改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM