...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Called when the game returns to the foreground // Register with ApplicationHasEnteredForegroundDelegate so that SDK Resume can be called. FCoreDelegates::ApplicationHasEnteredForegroundDelegate.AddUObject(this, &UApplicationWidget::Resume); FKGTApplication::Resume(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // [TODO] If the resume is successful, resume the game screen. } else { // [TODO] If the resume fails, ifnavigate it'sto anthe authenticationlogin failure,screen goif toit’s thean loginauthentication screenfailure; otherwise, show an error popup and check whether if the user wants to retry. if (result.Code == FKGTResultCode::AuthFailure || result.Code == FKGTResultCode::IdpAuthFailure) { // [TODO] InIf casethe ofstart authenticationfails failure,- moveInitialization tofailed, theso startyou screenshould andeither performretry the start newor loginclose flowthe againapp. } else { // [TODO] If other errors occur, provide an error notification and retry the resume. If the issue persists, close the app. } } }); |
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Set the IdpCode for the login EKGTIdpCode idpCode = EKGTIdpCode::Kakao; // Log in with a specific IDP FKGTPlayer::Login(idpCode, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // The current Player's ID issued by the platform FString playerId = FKGTPlayer::GetCurrentPlayer().GetPlayerId(); // Platform access token FString accessToken = FKGTPlayer::GetAccessToken(); // Retrieve the current IDP authentication information FKGTIdpProfile idpProfile = FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); // [TODO] Since the login was successful, proceed to the game screen. } else { // IDP login or platform login failed // [TODO] If login fails, inform the user and prompt them to retry. int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NetworkFailure || resultCode == FKGTResultCode::ServerTimeout || resultCode == FKGTResultCode::ServerConnectionFailed) { // [TODO] If a network error occurs, notify the user that the start failed due to a network issue and prompt to retry. } else if (resultCode == FKGTResultCode::Forbidden) { // [TODO] During the CBT period, authentication may not be possible for users who are not allowed. Provide an appropriate notification to the user. } else if (resultCode == FKGTResultCode::UserCanceled) { // [TODO] Since the user canceled during the login process, the login screen should be maintained. } else { // [TODO] If other errors occur, notifyprovide an theerror usernotification and prompt the themuser to retry thelogging loginin. It is necessary to check the error code and logs to determine the cause. } } })); |
...
코드 블럭 |
---|
#include "KakaoGameV4.h" // The bridgeToken received through the launcher FString bridgeToken = ""; FKGTPlayer::LoginWithBridgeToken(bridgeToken, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // The current Player's ID issued by the platform FString playerId = FKGTPlayer::GetCurrentPlayer().GetPlayerId(); // Platform access token FString accessToken = FKGTPlayer::GetAccessToken(); // Retrieve the current IDP authentication information FKGTIdpProfile idpProfile = FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); // Additional information received through the launcher TSharedPtr<FJsonObject> bridgeTokenPayload = FKGTPlayer::GetCurrentPlayer().GetBridgeTokenPayload(); // [TODO] Log in to the game server and proceed to the game screen } else { // Handle login failure. // [TODO] 로그인If 실패login 시fails, 사용자inform 안내the 후user 재and 시도prompt 하도록them 하여야to 합니다retry. int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NetworkFailure || resultCode == FKGTResultCode::ServerTimeout || resultCode == FKGTResultCode::ServerConnectionFailed) { // [TODO] If a network error occurs, prompt the user to retry logging in. } else if (resultCode == FKGTResultCode::Forbidden) { // [TODO] During the CBT period, authentication may not be possible for users who are not allowed. Display a notification to the user, and after clicking confirm, implement the app to exit. } else if (resultCode == FKGTResultCode::UserCanceled) { // [TODO] Since the user canceled during the login process, the login screen should be maintained. } else { // [TODO] If other errors occur, provide an error notification and prompt the user to retry logging in. // It is necessary to check the error code and logs to determine the cause. } } })); |
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Display the view to set KakaoTalk game message reception preferences FKGTKakaoTalk::ShowSetting(FKGTResultWithIsAllowMeDelegate::CreateLambda([=](FKGTResult result, bool isAllowMe) { if (result.IsSuccess()) { // Successfully set KakaoTalk game message reception preferencessettings // isAllowMe - Whether message reception is allowed as per the settings } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // The logged-in user is not a 'KakaoTalk' user. (For cases where the user is not a KakaoTalk user) } else { // Failed to set KakaoTalk game message reception preferencessettings } })); |
Retrieve KakaoTalk Profile
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Retrieve game friend list FKGTKakaoTalk::Friends(FKGTResultWithPlayerListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> playerList) { if (result.IsSuccess()) { // Successfully retrieved KakaoTalk game friendfriends list. for (FKGTPlayer player : playerList) { FKGTIdpProfile idpProfile = player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoFriendProfile = (FKGTKakaoFriendProfile*)&idpProfile; } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // The logged-in user is not a 'KakaoTalk' user. (For cases where the user is not a KakaoTalk user) } else { // Failed to retrieve KakaoTalk game friendfriends list } })); |
Sending KakaoTalk Game Messages
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Kakao friend profile retrieved through the friends API FKGTKakaoFriendProfile *kakaoFriendProfile; // [TODO] Set the template ID FString templateId = TEXT(""); // [TODO] Set the parameters for the message template TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), kakaoFriendProfile->GetNickname()); argumentDic.Add(TEXT("rog_link"), TEXT("test=100&hello=20111")); // Send a KakaoTalk game message FKGTKakaoTalk::SendGameMessage((*kakaoFriendProfile), templateId, argumentDic, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // Successfully sent the KakaoTalk chat message } else { if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // The recipient has set up message reception to be disabled } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // ExceededOccurs when the daily quota for ofsending messages that can be sent by one person forto a specific app (regardless of the recipient) is exceeded. } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // ExceededOccurs when the monthly quota offor sending messages that can be sent by one person to a specific recipientperson for a specific app is exceeded. } else { // Failed to send the KakaoTalk chat message } } })); |
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] Set whether to display inas a popup window bool isSingle = true; // [TODO] Set whether to display inas a popup window bool isPopup = true; // [TODO] Set the template ID FString templateId = TEXT(""); // [TODO] Set the parameters for the message template TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), TEXT("nickname")); FKGTKakaoTalk::SendInviteMessage(isSingle, isPopup, templateId, argumentDic, FKGTResultWithKakaoUserListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTKakaoUser> users) { if (result.IsSuccess()) { // Successfully sent KakaoTalk invite message for (FKGTKakaoUser user : users) { // Check the list of users to whom the invite message was sent } } else { // If all failed (need to return a common cause) if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // The recipient has set up message reception to be disabled } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // ExceededOccurs when the daily quota for ofsending messages that can be sent by one person forto a specific app (regardless of the recipient) is exceeded. } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // Occurs Exceededwhen the monthly quota for ofsending messages that can be sent by one person to a specific recipientperson for a specific app is exceeded. } else { // Failed to send KakaoTalk chat message } } })); |
...