목차 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
초기화 및 상태변화 이벤트 처리
...
SDK 초기화
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" /** * Unreal Editor에 설정한 정보로 초기화 수행 */ FKGTApplication::InitSDK(); |
스타트 (Start) 하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTApplication::Start(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 스타트가 성공 한 경우 // 자동로그인 여부 bool isLoggedIn = FKGTPlayer::IsLoggedIn(); if (isLoggedIn) { // 플랫폼에서 발급한 현재 Player의 ID FString playerId = FKGTPlayer::GetCurrentPlayer().GetPlayerId(); // 플랫폼 엑세스 토큰 FString accessToken = FKGTPlayer::GetAccessToken(); // 현재 IDP 인증 정보를 가져옴 FKGTIdpProfile idpProfile = FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); // [TODO] 게임 화면으로 이동 합니다. } else { // [TODO] 자동로그인이 안 된 경우 로그인 화면으로 이동 합니다. } } else { // 스타트가 실패 한 경우 - 초기화가 실패한 경우 이므로 스타트를 재시도 하거나 앱을 종료 하여야 합니다. int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NetworkFailure || resultCode == FKGTResultCode::ServerTimeout || resultCode == FKGTResultCode::ServerConnectionFailed) { // [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도 } else { // [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 스타트 재시도 요청 하여야 합니다. - 문제가 반복해서 발생하는 경우 에러코드 및 로그 확인 후 원인 파악이 필요합니다. } } })); |
Pause 하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임이 백그라운드 상태 일 때 호출됩니다 (예 : 다른 앱으로 전환하거나 홈 버튼을 통해 종료) // ApplicationWillEnterBackgroundDelegate를 이용하여 SDK Pause가 호출 될 수 있도록 등록합니다. FCoreDelegates::ApplicationWillEnterBackgroundDelegate.AddUObject(this, &UApplicationWidget::Pause); FKGTApplication::Pause(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { // result는 항상 성공(200) 응답을 반환합니다. })); |
Resume 하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임이 포그라운드로 돌아갈 때 호출됩니다 // ApplicationHasEnteredForegroundDelegate를 이용하여 SDK Resume이 호출 될 수 있도록 등록합니다. FCoreDelegates::ApplicationHasEnteredForegroundDelegate.AddUObject(this, &UApplicationWidget::Resume); FKGTApplication::Resume(FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // [TODO] resume이 성공 한 경우 게임 화면을 재개합니다. } else { // [TODO] resume이 실패 한 경우 인증 실패 면 로그인 화면으로, 그외의 경우는 에러 팝업을 띄우고 재시도 여부를 확인합니다. if (result.Code == FKGTResultCode::AuthFailure || result.Code == FKGTResultCode::IdpAuthFailure) { // [TODO] 인증 실패의 경우 시작 화면으로 이동해서 다시 신규 로그인 flow를 수행합니다. } else { // [TODO] 나머지 에러가 발생한 경우 경우 에러 안내 후 resume 을 재시도 합니다. - 반복해서 문제가 발생하는 경우 앱을 종료하도록 합니다. } } }); |
윈도우즈 환경에서 자동로그인 설정하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 자동로그인사용 유무를 세팅, 세팅하지 않으면 사용하지 않음 상태로 세팅 // 자동로그인사용설정으로 로그인이 성공하면 자동로그인정보가 생성됨 // 자동로그인정보가 존재하면 다음 KGTApplication의 start시에 자동로그인이 진행됨으로 자동로그인정보를 제거하려면 로그아웃을 진행해야함 bool useAutoLogin = true; FKGTApplication::SetUseAutoLogin(useAutoLogin); |
로그인
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
기본 로그인 UI를 사용하지 않는 로그인하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그인 하고자 하는 IdpCode 셋팅 EKGTIdpCode idpCode = EKGTIdpCode::Kakao; // 특정 idp로 로그인 하기 FKGTPlayer::Login(idpCode, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 플랫폼에서 발급한 현재 Player의 ID FString playerId = FKGTPlayer::GetCurrentPlayer().GetPlayerId(); // 플랫폼 엑세스 토큰 FString accessToken = FKGTPlayer::GetAccessToken(); // 현재 IDP 인증 정보를 가져옴 FKGTIdpProfile idpProfile = FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); // [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다. } else { // IDP 로그인 혹은 플랫폼 로그인 실패 // [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다. int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NetworkFailure || resultCode == FKGTResultCode::ServerTimeout || resultCode == FKGTResultCode::ServerConnectionFailed) { // [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도 } else if (resultCode == FKGTResultCode::Forbidden) { // [TODO] CBT기간동안 허용된 유저외에는 인증이 불가능 할 수 있습니다. 유저에게 안내메시지 처리가 필요합니다. } else if (resultCode == FKGTResultCode::UserCanceled) { // [TODO] 사용자가 로그인 진행 중 취소한 상황이므로 로그인 화면을 유지 하여야 합니다. } else { // [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 로그인 재시도 요청 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다. } } })); |
런처를 통해서 로그인하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
|
로그아웃
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
기본 로그아웃 UI를 사용하지 않는 로그아웃하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 런처를로그아웃 통해서 전달 받은 bridgeToken FString bridgeToken = ""; 요청 FKGTPlayer::LoginWithBridgeTokenLogout(bridgeToken, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 로그아웃 플랫폼에서성공 발급한 현재 Player의 ID // [TODO] 시작 화면으로 FString돌아가기 playerId = FKGTPlayer::GetCurrentPlayer().GetPlayerId(); } else //{ 플랫폼 엑세스 토큰 // 로그아웃 실패 FString accessToken = FKGTPlayer::GetAccessToken(); // 현재 IDP 인증 정보를 가져옴 FKGTIdpProfile idpProfile = FKGTPlayer::GetCurrentPlayer().GetIdpProfile(); } })); |
탈퇴
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
기본 탈퇴 UI를 사용하지 않는 탈퇴하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 탈퇴 요청 FKGTPlayer::Unregister(showUI, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 런처를 통해서 전달 받은 부가 정보 탈퇴 성공 TSharedPtr<FJsonObject> bridgeTokenPayload = FKGTPlayer::GetCurrentPlayer().GetBridgeTokenPayload(); // [TODO] 로그인이 성공하였으므로 게임시작 화면으로 이동합니다.돌아가기 } else { // IDP탈퇴 로그인실패 혹은 플랫폼 로그인 실패 // [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다. int32 resultCode = result.GetCode(); if (resultCode == FKGTResultCode::NetworkFailure || resultCode == FKGTResultCode::ServerTimeout || resultCode == FKGTResultCode::ServerConnectionFailed) { } })); |
계정 연결
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
기본 계정 연결 UI를 사용하지 않는 계정 연결하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그인 하고자 하는 IdpCode 셋팅 EKGTIdpCode idpCode = EKGTIdpCode:Kakao; // 특정 idp로 계정 연결 하기 FKGTPlayer::Connect(idpCode, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // IDP 연결 성공 // Player ID 는 변경되지 않습니다. } else { // [TODO]IDP 네트워크연결 에러가 발생한실패 경우에는 유저에게 네트워크 이슈로 스타트에int32 실패했음을resultCode 알리고 재시도= result.GetCode(); } else if (resultCode == FKGTResultCode::ForbiddenNotAuthorized) { // [TODO]현재 CBT기간동안로그인이 허용된안되어 유저외에는있는 인증이경우 불가능 할 수 있습니다. 유저에게 안내메시지 처리가 필요합니다. } else if (resultCode == FKGTResultCode::UserCanceledInvalidState) { // [TODO]현재 사용자가인증 로그인된 진행IDP 중가 취소한계정 상황이므로연결 로그인가능한 화면을idp가 유지 하여야 합니다.아닌 경우 } else if (resultCode == FKGTResultCode::AlreadyUsedIDPAccount) { // [TODO]이미 나머지연결되어 에러가있는 발생한계정이 경우에는있는 에러경우 안내 후 로그인 재시도 요청} 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다. else { // 기타 에러 발생 } } })); |
로그아웃
...
기본 로그아웃 UI를 사용하지 않는 로그아웃하기
프로필
...
내 정보 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그아웃 요청 bool showUI = false; FKGTPlayer player = FKGTPlayer::GetCurrentPlayer(); // UI를플랫폼 노출하지playerId 않도록FString 설정 FKGTPlayer::Logout(showUI, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 로그아웃 성공 // [TODO] 시작 화면으로 돌아가기 } else { // 로그아웃 실패 } })); |
탈퇴
계정 연결
...
기본 계정 연결 UI를 사용하지 않는 계정 연결하기
...
playerId = player.GetPlayerId();
// 플랫폼 AccessToken
FString accessToken = FKGTPlayer::GetAccessToken();
// idpProfile 정보
FKGTIdpProfile idpProfile = player.GetIdpProfile(); |
내 IDP 정보 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" //FKGTPlayer 로그인player 하고자 하는 IdpCode 셋팅 EKGTIdpCode idpCode = EKGTIdpCode:Kakao= FKGTPlayer::GetCurrentPlayer(); // 특정IDP 정보 idp로조회 계정FKGTIdpProfile 연결idpProfile 하기 FKGTPlayer::Connect(idpCode, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // IDP 연결 성공 // Player ID 는 변경되지 않습니다. } else { = player.GetIdpProfile(); EKGTIdpCode idpCode = idpProfile.GetIdpCode(); FString idpUserId = idpProfile.GetIdpUserId(); // 카카오 IDP 정보 조회 // 카카오 로그인 상태인 경우 if (idpCode == EKGTIdpCode::Kakao) { // 카카오 IDP 연결정보 실패조회 FKGTKakaoProfile *kakaoProfile int32 resultCode = result.GetCode(FKGTKakaoProfile*)&idpProfile; if// (resultCode카카오 == FKGTResultCode::NotAuthorized)UUID FString uuid {= kakaoProfile->GetUUID(); // 현재다른 앱에서 로그인이동일한 안되어카카오 있는유저인 경우 같은 그룹 유저 토큰을 }반환 FString groupUserToken else if (resultCode == FKGTResultCode::InvalidState)= kakaoProfile->GetGroupUserToken(); { // 오늘 보낼 수 //있는 현재남은 인증초대 된수 IDP 가 계정int32 연결remainingInviteCount 가능한 idp가 아닌 경우= kakaoProfile->GetRemainingInviteCount(); // }앱 가입 여부 elsebool ifisAppRegistered (resultCode == FKGTResultCode::AlreadyUsedIDPAccount) kakaoProfile->IsAppRegistered(); { // 이미메시지 연결되어수신 있는여부 계정이 있는 경우bool isAllowedMessage = kakaoProfile->IsAllowedMessage(); } else { // 기타 에러 발생 } } })); |
프로필
내 정보 조회하기
...
} |
시스템 정보
...
언어 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString languageCode = FKGTSystem::GetLanguageCode(); |
국가 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTPlayerFString playercountryCode = FKGTPlayerFKGTSystem::GetCurrentPlayer(); // 플랫폼 playerId FString playerId = player.GetPlayerId(); // 플랫폼 AccessToken FString accessToken = FKGTPlayer::GetAccessToken(); // idpProfile 정보 FKGTIdpProfile idpProfile = player.GetIdpProfile(); |
내 IDP 정보 조회하기
GetCountryCode(); |
IP 기반 국가 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTPlayerFString playergeoCountryCode = FKGTPlayer::GetCurrentPlayer(); // IDP 정보 조회 FKGTIdpProfile idpProfile = player.GetIdpProfile(); EKGTIdpCode idpCode = idpProfile.GetIdpCode(); FString idpUserId = idpProfile.GetIdpUserIdFKGTSystem::GetGeoCountryCode(); |
시스템 정보
...
기기 아이디 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString languageCodedeviceId = FKGTSystem::GetLanguageCodeGetDeviceId(); |
...
기기 모델 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString countryCodedeviceModel = FKGTSystem::GetCountryCodeGetDeviceModel(); |
...
OS 이름 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString geoCountryCodeosName = FKGTSystem::GetGeoCountryCodeGetOSName(); |
...
네트워크 연결 여부 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FStringbool deviceIdisNetworkConnected = FKGTSystem::GetDeviceIdIsNetworkConnected(); |
...
연결된 네트워크 타입 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString deviceModelnetworkType = FKGTSystem::GetDeviceModelGetNetworkType(); |
...
카카오 연동 기능
...
카카오톡 게임 메시지 수신 여부 설정하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString// osName = FKGTSystem::GetOSName(); |
네트워크 연결 여부 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
bool isNetworkConnected = FKGTSystem::IsNetworkConnected(); |
연결된 네트워크 타입 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString networkType = FKGTSystem::GetNetworkType(); |
설정된 게임 언어 코드 가져오기
...
카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기
FKGTKakaoTalk::ShowSetting(FKGTResultWithIsAllowMeDelegate::CreateLambda([=](FKGTResult result, bool isAllowMe)
{
if (result.IsSuccess())
{
// 카카오톡 게임 메시지 수신 여부 설정 성공
// isAllowMe - 설정된 메시지 수신 허용 여부
}
else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)
}
else
{
// 카카오톡 게임 메시지 수신 여부 설정 실패
}
})); |
카카오톡 프로필 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString gameLanguageCode = FKGTSystem::GetGameLanguageCode(); |
게임 언어 코드 설정하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// EKGTLanguageCode languageCode = EKGTLanguageCode::EN; // 영어
// EKGTLanguageCode languageCode = EKGTLanguageCode::KO; // 한국어
// EKGTLanguageCode languageCode = EKGTLanguageCode::JA; // 일어
// EKGTLanguageCode languageCode = EKGTLanguageCode::ZH_HANT; // 중국어 (번체)
// EKGTLanguageCode languageCode = EKGTLanguageCode::ZH_HANS; // 중국어 (간체)
EKGTLanguageCode languageCode = EKGTLanguageCode::Device; // 디바이스 설정 값
FKGTSystem::SetGameLanguageCode(languageCode) |
카카오 연동 기능
...
// 카카오톡 프로필 조회하기
FKGTKakaoTalk::TalkProfile(FKGTResultWithKakaoTalkProfileDelegate::CreateLambda([=](FKGTResult result, FKGTKakaoTalkProfile profile)
{
if (result.IsSuccess())
{
// 카카오톡 프로필 조회 성공
// profile - 로그인한 유저의 카카오톡 프로필 정보
}
else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)
}
else
{
// 카카오톡 프로필 조회 실패
}
})); |
카카오톡 게임 친구 목록 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡 게임 메시지친구 수신 여부 설정 뷰 띄우기목록 조회하기 FKGTKakaoTalk::ShowSettingFriends(FKGTResultWithIsAllowMeDelegateFKGTResultWithPlayerListDelegate::CreateLambda([=](FKGTResult result, boolTArray<FKGTPlayer> isAllowMeplayerList) { if (result.IsSuccess()) { // 카카오톡 게임 메시지 수신 여부 설정 성공 // isAllowMe - 설정된 메시지 수신 허용 여부 }친구 목록 조회 성공. else iffor (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)FKGTPlayer player : playerList) { // 로그인 한FKGTIdpProfile 유저가idpProfile '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 게임 메시지 수신 여부 설정 실패 } })); |
카카오톡 프로필 조회하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡 프로필 조회하기 FKGTKakaoTalk::TalkProfile(FKGTResultWithKakaoTalkProfileDelegate::CreateLambda([=](FKGTResult result, FKGTKakaoTalkProfile profile) { if (result.IsSuccess())= player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoFriendProfile = (FKGTKakaoFriendProfile*)&idpProfile; } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 프로필게임 조회친구 성공목록 조회 실패 // profile - 로그인한 유저의 카카오톡 프로필 정보 } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 프로필 조회 실패 } })); |
카카오톡 게임 친구 목록 조회하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임 친구 목록 조회하기 FKGTKakaoTalk::Friends(FKGTResultWithPlayerListDelegate} })); |
카카오톡 게임 메시지 보내기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // friends API를 통해 가져온 카카오 친구 프로필 FKGTKakaoFriendProfile *kakaoFriendProfile; // [TODO] 템플릿 Id 설정 FString templateId = TEXT(""); // [TODO] 메시지 템플릿에 설정한 인자 설정 TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), kakaoFriendProfile->GetNickname()) argumentDic.Add(TEXT("rog_link"), TEXT("test=100&hello=20111")); // 카카오톡 게임 메시지 보내기 FKGTKakaoTalk::SendGameMessage((*kakaoFriendProfile), templateId, argumentDic, FKGTResultDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> playerList) { if (result.IsSuccess()) { // 카카오톡 게임채팅 친구 목록메시지 조회보내기 성공. } forelse (FKGTPlayer player :{ playerList) { if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) FKGTIdpProfile{ idpProfile = player.GetIdpProfile(); // 받은이가 메시지 FKGTKakaoFriendProfile수신 *kakaoFriendProfile거부를 = (FKGTKakaoFriendProfile*)&idpProfile;설정한 경우 } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 게임 친구 목록 조회 실패 } })); |
카카오톡 게임 메시지 보내기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // friends API를 통해 가져온 카카오 친구 프로필 FKGTKakaoFriendProfile *kakaoFriendProfile; // [TODO] 템플릿 Id 설정 FString templateId = TEXT(""); // [TODO] 메시지 템플릿에 설정한 인자 설정 TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), kakaoFriendProfile->GetNickname()) argumentDic.Add(TEXT("rog_link"), TEXT("test=100&hello=20111"));ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 } else { // 카카오톡 게임채팅 메시지 보내기 FKGTKakaoTalk::SendGameMessage((*kakaoFriendProfile), templateId, argumentDic, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { 실패 } if (result.IsSuccess()) { } })); |
카카오톡 친구 초대 메시지 전송하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡[TODO] 채팅팝업창으로 메시지띄울지 보내기여부 성공설정 } else { if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // 받은이가 메시지 수신 거부를 설정한 경우 } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 } elsebool isSingle = true; // [TODO] 팝업창으로 띄울지 여부 설정 bool isPopup = true; // [TODO] 템플릿 Id 설정 FString templateId = TEXT(""); // [TODO] 메시지 템플릿에 설정한 인자 설정 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.GetCodeIsSuccess()) == FKGTResultCode::ExceedMonthlyUsage){ { // 카카오톡 초대 메시지 보내기 성공 //for 한명이(FKGTKakaoUser 특정user 앱에: 대해users) 특정인에게 보낼 수 있는 한달{ 쿼터 초과시 발생 // }유저가 초대 메시지를 전송한 유저 else목록 확인 { } } //else 카카오톡 채팅 메시지{ 보내기 실패 // 전부 }실패한 경우(공통된 원인 }리턴해주기 })); |
카카오톡 친구 초대 메시지 전송하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"필요) if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // [TODO]받은이가 팝업창으로메시지 띄울지수신 여부거부를 설정설정한 bool경우 isSingle = true; //} [TODO] 팝업창으로 띄울지 여부 설정else bool isPopupif (result.GetCode() = true;= FKGTResultCode::ExceedDailyUsage) // [TODO]{ 템플릿 Id 설정 FString templateId = TEXT(""); // [TODO]한명이 메시지특정 템플릿에앱에 설정한대해 인자보낼 설정수 TMap<FString,있는 FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), TEXT("nickname")); FKGTKakaoTalk::SendInviteMessage(isSingle, isPopup, templateId, argumentDic, FKGTResultWithKakaoUserListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTKakaoUser> users) { 하루 쿼터(받는 사람 관계없이) 초과시 발생 } else if (result.IsSuccessGetCode() == FKGTResultCode::ExceedMonthlyUsage) { // 카카오톡 초대 메시지 보내기 성공 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 } else { // for카카오톡 (FKGTKakaoUser채팅 user메시지 :보내기 users)실패 {} } })); |
카카오톡 채널 추가하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 유저가[TODO] 초대채널 메시지를Id 전송한설정 유저int32 목록 확인channelId = 0; } } elseFKGTKakaoTalk::AddChannel(channelId, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 전부채널 실패한추가 경우(공통된성공 원인 리턴해주기 필요)} else if (result.GetCode() == FKGTResultCode::MessageSettingDisabledNotKakaoTalkUser) { { // 로그인 한 유저가 // 받은이가 메시지 수신 거부를 설정한 경우 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) {{ // 채널 추가 실패 } })); |
내 초대 메시지로 가입한 친구 목록 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 한명이[TODO] 특정이벤트 앱에Id 대해설정 보낼int32 수eventId 있는= 하루0; 쿼터(받는 사람// 관계없이)내가 초과시초대한 발생플레이어 목록 조회하기 FKGTKakaoInvitation::Joiners(eventId, } elseFKGTResultWithJoinersDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> players) { if (result.GetCodeIsSuccess() == FKGTResultCode::ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 내가 초대한 플레이어 목록 가져오기 } for (FKGTPlayer player : elseplayers) { // 카카오톡수신자의 채팅플레이어 메시지아이디 보내기 실패 }FString playerId } })); |
카카오톡 채널 추가하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 채널 Id 설정 int32 channelId = 0; FKGTKakaoTalk::AddChannel(channelId, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 채널 추가 성공 } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) {= player.GetPlayerId(); FKGTIdpProfile idpProfile = player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoProfile = (FKGTKakaoFriendProfile*)&idpProfile; // 수신자의 닉네임 FString nickname = kakaoProfile->GetNickname(); // 수신자의 프로필 썸네일 이미지 FString thumbnailImageUrl = kakaoProfile->GetThumbnailImageUrl(); // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 채널 추가 실패 } })); |
구글 게임
업적 달성 화면 보여주기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// 구글 게임 업적 정보 화면 보여주기
FKGTGoogleGamesAchievements::ShowAchievementView(); |
업적 달성
...
수신지의 탈퇴 이력 조회. UI상에서 탈퇴 여부 정보를 표시할 경우 해당 flag를 사용.
bool isUnregistered = kakaoProfile->IsUnregistered();
}
}
else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)
}
else
{
// 호출 실패
}
})); |
내가 초대 메시지를 보낸 친구 숫자 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 업적 아이디 설정 FString id = TEXT("");#include "KakaoGameV4.h" // [TODO] 이벤트 Id 설정 int32 eventId = 0; // 내가 초대한 플레이어 목록 조회하기 FKGTKakaoInvitation::ReceiversCount(eventId, FKGTResultWithReceiversCountDelegate::CreateLambda([=](FKGTResult result, int32 totalReceiversCount, int32 joinersCount) { if (result.IsSuccess()) { // 업적호출 달성 FKGTGoogleGamesAchievements::Unlock(id); |
업적 노출하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"성공 // [TODO] 업적 아이디 설정 FString id = TEXT(""); FKGTGoogleGamesAchievements::Reveal(id); |
업적 단계 증가
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// [TODO] 업적 아이디 설정
FString id = TEXT("");
int32 numSteps = 0;
FKGTGoogleGamesAchievements::SetSteps(id, numSteps); |
업적 단계 설정
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 업적 아이디 설정 FString id = TEXT(""); int32 numSteps = 0; FKGTGoogleGamesAchievements::Increment(id, numStepstotalReceiversCount - 전체 친구 수 // joinersCount - 게임에 가입한 친구 수 } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 호출 실패 } })); |