목차 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
초기화 및 상태변화 이벤트 처리
...
Initialization and Status Change Event Processing
...
SDK Initialization
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" /** * Unreal Editor에 설정한 정보로 초기화 수행Perform initialization using the information set in Unreal Editor */ FKGTApplication::InitSDK(); |
...
Start
...
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTApplication::Start(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 스타트가If the 성공start 한is 경우successful // 자동로그인 여부Check if auto-login is enabled bool isLoggedIn = FKGTPlayer::IsLoggedIn(); if (isLoggedIn) { // 플랫폼에서 발급한 현재 Player의 ID 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] 게임Move to 화면으로the 이동game 합니다screen. } else { // [TODO] 자동로그인이 안 된 경우 로그인 화면으로 이동 합니다If auto-login is not enabled, move to the login screen. } } else { // 스타트가If 실패the 한start 경우fails - 초기화가since 실패한initialization 경우failed, 이므로retry 스타트를the 재시도start 하거나or 앱을close 종료the 하여야 합니다app. 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 retry. } else { // [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 스타트 재시도 요청 하여야 합니다. - 문제가 반복해서 발생하는 경우 에러코드 및 로그 확인 후 원인 파악이 필요합니다 If other errors occur, notify the user and request a retry of the start process. If the issue persists, check the error code and logs to determine the cause. } } })); |
Pause
...
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // Called when 게임이the 백그라운드game 상태enters 일a 때background 호출됩니다state (예 : 다른 앱으로 전환하거나 홈 버튼을 통해 종료)e.g., switching to another app or exiting via the home button). // ApplicationWillEnterBackgroundDelegate를Register with 이용하여ApplicationWillEnterBackgroundDelegate SDKso Pause가that 호출SDK 될Pause 수can 있도록be 등록합니다called. FCoreDelegates::ApplicationWillEnterBackgroundDelegate.AddUObject(this, &UApplicationWidget::Pause); FKGTApplication::Pause(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { // result는The 항상 성공(200) 응답을 반환합니다result always returns a success (200) response. })); |
Resume
...
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임이 포그라운드로 돌아갈 때 호출됩니다 Called when the game returns to the foreground // ApplicationHasEnteredForegroundDelegate를Register with 이용하여ApplicationHasEnteredForegroundDelegate SDKso Resume이that 호출SDK 될Resume 수can 있도록be 등록합니다called. FCoreDelegates::ApplicationHasEnteredForegroundDelegate.AddUObject(this, &UApplicationWidget::Resume); FKGTApplication::Resume(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // [TODO] resume이If 성공the 한resume 경우is 게임 화면을 재개합니다successful, resume the game screen. } else { // [TODO] resume이 실패 한 경우 인증 실패 면 로그인 화면으로, 그외의 경우는 에러 팝업을 띄우고 재시도 여부를 확인합니다 If resume fails, navigate to the login screen if it’s an authentication failure; otherwise, show an error popup and check if the user wants to retry. if (result.Code == FKGTResultCode::AuthFailure || result.Code == FKGTResultCode::IdpAuthFailure) { // [TODO] 인증If 실패의the 경우start 시작fails 화면으로- 이동해서Initialization 다시failed, 신규so 로그인you flow를 수행합니다should either retry the start or close the app. } else { // [TODO] 나머지If 에러가other 발생한errors 경우occur, 경우provide 에러an 안내error 후notification resumeand 을retry 재시도the 합니다resume. -If 반복해서the 문제가issue 발생하는persists, 경우close 앱을the 종료하도록 합니다app. } } }); |
...
Setting Up Auto Login in a Windows Environment
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 자동로그인사용Set 유무를whether 세팅,to 세팅하지 않으면 사용하지 않음 상태로 세팅 // 자동로그인사용설정으로 로그인이 성공하면 자동로그인정보가 생성됨use auto-login; if not set, it defaults to not using auto-login // 자동로그인정보가When 존재하면auto-login 다음is KGTApplication의enabled start시에and 자동로그인이login 진행됨으로is 자동로그인정보를 제거하려면 로그아웃을 진행해야함 bool useAutoLogin = true; FKGTApplication::SetUseAutoLogin(useAutoLogin); |
로그인
...
기본 로그인 UI를 사용하지 않는 로그인하기
...
코드 블럭 | ||
---|---|---|
| ||
successful, auto-login information is generated
// If auto-login information exists, auto-login will proceed automatically during the next KGTApplication start, so to remove the auto-login information, you need to log out
bool useAutoLogin = true;
FKGTApplication::SetUseAutoLogin(useAutoLogin); |
Login
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Logging In Without Using the Default Login UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#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 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, 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.
}
}
})); |
Logging In Through the Launcher
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 |
---|
#include "KakaoGameV4.h" // 로그인The 하고자bridgeToken 하는received IdpCode 셋팅 EKGTIdpCode idpCode = EKGTIdpCode::Kakao; // 특정 idp로 로그인 하기through the launcher FString bridgeToken = ""; FKGTPlayer::LoginLoginWithBridgeToken(idpCodebridgeToken, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 플랫폼에서 발급한 현재 Player의 IDThe 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 = // 현재 IDP 인증 정보를 가져옴FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); // Additional information received through the launcher FKGTIdpProfileTSharedPtr<FJsonObject> idpProfilebridgeTokenPayload = FKGTPlayer::GetCurrentPlayer().GetIdpProfileGetBridgeTokenPayload(); // [TODO] Log in to the // [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다.game server and proceed to the game screen } else { // IDPHandle 로그인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] CBT기간동안 허용된 유저외에는 인증이 불가능 할 수 있습니다. 유저에게 안내메시지 처리가 필요합니다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. } } })); |
...
Logout
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Logging Out Without Using the Default Logout UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그아웃Logout 요청request FKGTPlayer::Logout(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 로그아웃Logout 성공successful // [TODO] Return to 시작the 화면으로start 돌아가기screen } else { // 로그아웃Logout 실패failed } })); |
...
Unregistration
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Unregistering Without Using the Default Unregistration UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 탈퇴 요청Unregistration (account deletion) request FKGTPlayer::Unregister(showUI, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 탈퇴Unregistration 성공successful // [TODO] Return to 시작the 화면으로start 돌아가기screen } else { // 탈퇴Unregistration 실패failed } })); |
...
Account Linking
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Linking Accounts Without Using the Default Account Linking UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그인Set the 하고자IdpCode 하는for IdpCodethe 셋팅login EKGTIdpCode idpCode = EKGTIdpCode::Kakao; // 특정 idp로 계정 연결 하기Connect the account with a specific IDP FKGTPlayer::Connect(idpCode, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // IDP 연결 성공 // connection successful // The Player ID 는does 변경되지not 않습니다change. } else { // IDP 연결connection 실패failed int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NotAuthorized) { // 현재 로그인이 안되어 있는 경우 If the current session is not logged in } else if (resultCode == FKGTResultCode::InvalidState) { // 현재If the 인증currently 된authenticated IDP 가is 계정 연결not 가능한eligible idp가for 아닌account 경우connection } else if (resultCode == FKGTResultCode::AlreadyUsedIDPAccount) { // 이미 연결되어 있는 계정이 있는 경우 If the account is already connected to another IDP } else { // 기타Other 에러errors 발생occurred } } })); |
프로필
...
Profile
...
Retrieve My Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTPlayer player = FKGTPlayer::GetCurrentPlayer(); // 플랫폼Platform playerId FString playerId = player.GetPlayerId(); // 플랫폼Platform AccessToken FString accessToken = FKGTPlayer::GetAccessToken(); // idpProfile 정보information FKGTIdpProfile idpProfile = player.GetIdpProfile(); |
...
Retrieve My IDP
...
Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTPlayer player = FKGTPlayer::GetCurrentPlayer(); // Retrieve IDP 정보information 조회 FKGTIdpProfile idpProfile = player.GetIdpProfile(); EKGTIdpCode idpCode = idpProfile.GetIdpCode(); FString idpUserId = idpProfile.GetIdpUserId(); // Retrieve Kakao IDP information // 카카오If IDPthe 정보login 조회state //is 카카오with 로그인Kakao 상태인 경우 if (idpCode == EKGTIdpCode::Kakao) { // 카카오Retrieve Kakao IDP 정보information 조회 FKGTKakaoProfile *kakaoProfile = (FKGTKakaoProfile*)&idpProfile; // 카카오Kakao UUID FString uuid = kakaoProfile->GetUUID(); // 다른 앱에서 동일한 카카오 유저인 경우 같은 그룹 유저 토큰을 반환If the same Kakao user is using a different app, return the same group user token FString groupUserToken = kakaoProfile->GetGroupUserToken(); // Remaining number 오늘of 보낼invites 수that 있는can 남은be 초대sent 수today int32 remainingInviteCount = kakaoProfile->GetRemainingInviteCount(); // 앱 가입 여부/ Whether the app is registered bool isAppRegistered = kakaoProfile->IsAppRegistered(); // Whether message 메시지reception 수신is 여부allowed bool isAllowedMessage = kakaoProfile->IsAllowedMessage(); } |
시스템 정보
...
System Information
...
Retrieve Language Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString languageCode = FKGTSystem::GetLanguageCode(); |
...
Retrieve Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString countryCode = FKGTSystem::GetCountryCode(); |
...
Retrieve IP-based Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString geoCountryCode = FKGTSystem::GetGeoCountryCode(); |
...
Retrieve Device ID
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString deviceId = FKGTSystem::GetDeviceId(); |
...
Retrieve Device Model
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString deviceModel = FKGTSystem::GetDeviceModel(); |
Retrieve OS
...
Name
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString osName = FKGTSystem::GetOSName(); |
...
Retrieve Network Connection Status
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" bool isNetworkConnected = FKGTSystem::IsNetworkConnected(); |
...
Retrieve Connected Network Type
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString networkType = FKGTSystem::GetNetworkType(); |
카카오 연동 기능
...
Kakao Integration Feature
...
Setting Up KakaoTalk Game Message Reception
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#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 성공settings // 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 실패settings } })); |
...
Retrieve KakaoTalk Profile
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡Retrieve 프로필KakaoTalk 조회하기profile FKGTKakaoTalk::TalkProfile(FKGTResultWithKakaoTalkProfileDelegate::CreateLambda([=](FKGTResult result, FKGTKakaoTalkProfile profile) { if (result.IsSuccess()) { // 카카오톡Successfully 프로필retrieved 조회KakaoTalk 성공profile // profile - 로그인한 유저의 카카오톡 프로필 정보 The KakaoTalk profile information of the logged-in user } 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 실패profile } })); |
...
Retrieve KakaoTalk Game Friend List
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임Retrieve 친구game 목록friend 조회하기list FKGTKakaoTalk::Friends(FKGTResultWithPlayerListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> playerList) { if (result.IsSuccess()) { // 카카오톡Successfully 게임retrieved 친구KakaoTalk 목록game 조회friends 성공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 조회friends 실패list } })); |
...
Sending KakaoTalk Game Messages
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // friendsKakao friend API를profile 통해retrieved 가져온through 카카오the 친구friends 프로필API FKGTKakaoFriendProfile *kakaoFriendProfile; // [TODO] 템플릿Set the Idtemplate 설정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 message reception to be disabled } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded. } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 Occurs when the monthly quota for sending messages to a specific person for a specific app is exceeded. } else { // 카카오톡Failed to 채팅send 메시지KakaoTalk 보내기chat 실패message } } })); |
...
Sending KakaoTalk Friend Invitation Messages
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 팝업창으로 띄울지 여부 설정Set whether to display as a popup window bool isSingle = true; // [TODO] 팝업창으로 띄울지 여부 설정Set whether to display as a popup window bool isPopup = true; // [TODO] Set 템플릿the Idtemplate 설정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 message reception to be disabled } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded. } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 Occurs when the monthly quota for sending messages to a specific person for a specific app is exceeded. } else { // Failed 카카오톡to 채팅send 메시지KakaoTalk 보내기chat 실패message } } })); |
...
Adding a KakaoTalk Channel
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 채널Set the Idchannel 설정ID int32 channelId = 0; FKGTKakaoTalk::AddChannel(channelId, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 채널Successfully added 추가the 성공channel } 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 add the channel } })); |
...
Retrieve the list of friends to whom I sent an invite message
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 이벤트Set the Idevent 설정ID int32 eventId = 0; // Retrieve the 내가list 초대한of 플레이어players 목록I 조회하기invited FKGTKakaoInvitation::Joiners(eventId, FKGTResultWithJoinersDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> players) { if (result.IsSuccess()) { // 내가 초대한 플레이어 목록 가져오기Successfully retrieved the list of players I invited for (FKGTPlayer player : players) { // 수신자의Recipient's 플레이어player 아이디ID FString playerId = player.GetPlayerId(); FKGTIdpProfile idpProfile = player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoProfile = (FKGTKakaoFriendProfile*)&idpProfile; // 수신자의Recipient's 닉네임nickname FString nickname = kakaoProfile->GetNickname(); // 수신자의Recipient's 프로필profile 썸네일thumbnail 이미지image FString thumbnailImageUrl = kakaoProfile->GetThumbnailImageUrl(); // 수신지의 탈퇴 이력 조회. UI상에서 탈퇴 여부 정보를 표시할 경우 해당 flag를 사용Check if the recipient has a withdrawal history. Use this flag to display withdrawal information in the UI. bool isUnregistered = kakaoProfile->IsUnregistered(); } } 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 the list } })); |
...
Retrieve the count of friends to whom I sent an invite message
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 이벤트Set the Idevent 설정ID int32 eventId = 0; // Retrieve the 내가count 초대한of 플레이어players 목록I 조회하기invited FKGTKakaoInvitation::ReceiversCount(eventId, FKGTResultWithReceiversCountDelegate::CreateLambda([=](FKGTResult result, int32 totalReceiversCount, int32 joinersCount) { if (result.IsSuccess()) { // 호출 성공Successfully retrieved the counts // totalReceiversCount - Total 전체number 친구of 수friends // joinersCount - 게임에 가입한 친구 수Number of friends who joined the game } 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 the counts } })); |