...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 로그아웃 요청 bool showUI = false; // UI를 노출하지 않도록 설정 FKGTPlayer::Logout(showUI, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 로그아웃 성공 // [TODO] 시작 화면으로 돌아가기 } else { // 로그아웃 실패 } })); |
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// 탈퇴 요청
bool showUI = false; // UI를 노출하지 않도록 설정
FKGTPlayer::Unregister(showUI, FKGTResultDelegate::CreateLambda([=](FKGTResult result)
{
if (result.IsSuccess())
{
// 탈퇴 성공
// [TODO] 시작 화면으로 돌아가기
}
else
{
// 탈퇴 실패
}
})); |
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FKGTPlayer player = FKGTPlayer::GetCurrentPlayer(); // IDP 정보 조회 FKGTIdpProfile idpProfile = player.GetIdpProfile(); EKGTIdpCode idpCode = idpProfile.GetIdpCode(); FString idpUserId = idpProfile.GetIdpUserId(); |
시스템 정보
언어 코드 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString languageCode = FKGTSystem::GetLanguageCode(); |
국가 코드 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString countryCode = FKGTSystem::GetCountryCode(); |
IP 기반 국가 코드 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString geoCountryCode = FKGTSystem::GetGeoCountryCode(); |
기기 아이디 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString deviceId = FKGTSystem::GetDeviceId(); |
기기 모델 가져오기
// 카카오 IDP 정보 조회
// 카카오 로그인 상태인 경우
if (idpCode == EKGTIdpCode::Kakao)
{
// 카카오 IDP 정보 조회
FKGTKakaoProfile *kakaoProfile = (FKGTKakaoProfile*)&idpProfile;
// 카카오 UUID
FString uuid = kakaoProfile->GetUUID();
// 다른 앱에서 동일한 카카오 유저인 경우 같은 그룹 유저 토큰을 반환
FString groupUserToken = kakaoProfile->GetGroupUserToken();
// 오늘 보낼 수 있는 남은 초대 수
int32 remainingInviteCount = kakaoProfile->GetRemainingInviteCount();
// 앱 가입 여부
bool isAppRegistered = kakaoProfile->IsAppRegistered();
// 메시지 수신 여부
bool isAllowedMessage = kakaoProfile->IsAllowedMessage();
} |
시스템 정보
...
언어 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString deviceModellanguageCode = FKGTSystem::GetDeviceModelGetLanguageCode(); |
...
국가 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString countryCode = FKGTSystem::GetCountryCode(); |
IP 기반 국가 코드 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" FString osNamegeoCountryCode = FKGTSystem::GetOSNameGetGeoCountryCode(); |
...
기기 아이디 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString deviceId = FKGTSystem::GetDeviceId(); |
기기 모델 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString deviceModel = FKGTSystem::GetDeviceModel(); |
OS 이름 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString osName = FKGTSystem::GetOSName(); |
네트워크 연결 여부 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
bool isNetworkConnected = FKGTSystem::IsNetworkConnected(); |
연결된 네트워크 타입 가져오기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString networkType = FKGTSystem::GetNetworkType(); |
카카오 연동 기능
...
카카오톡 게임 메시지 수신 여부 설정하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// 카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기
FKGTKakaoTalk::ShowSetting(FKGTResultWithIsAllowMeDelegate::CreateLambda([=](FKGTResult result, bool isAllowMe)
{
if (result.IsSuccess())
{
// 카카오톡 게임 메시지 수신 여부 설정 성공
// isAllowMe - 설정된 메시지 수신 허용 여부
}
else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)
}
else
{
// 카카오톡 게임 메시지 수신 여부 설정 실패
}
})); |
카카오톡 프로필 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
// 카카오톡 프로필 조회하기
FKGTKakaoTalk::TalkProfile(FKGTResultWithKakaoTalkProfileDelegate::CreateLambda([=](FKGTResult result, FKGTKakaoTalkProfile profile)
{
if (result.IsSuccess())
{
// 카카오톡 프로필 조회 성공
// profile - 로그인한 유저의 카카오톡 프로필 정보
}
else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)
}
else
{
// 카카오톡 프로필 조회 실패
}
})); |
카카오톡 게임 친구 목록 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임 친구 목록 조회하기 FKGTKakaoTalk::Friends(FKGTResultWithPlayerListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> playerList) { if (result.IsSuccess()) { // 카카오톡 게임 친구 목록 조회 성공. for (FKGTPlayer player : playerList) { FKGTIdpProfile idpProfile = player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoFriendProfile = (FKGTKakaoFriendProfile*)&idpProfile; } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 bool게임 isNetworkConnected친구 = FKGTSystem::IsNetworkConnected(); |
연결된 네트워크 타입 가져오기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h"
FString networkType = FKGTSystem::GetNetworkType(); |
카카오 연동 기능
...
목록 조회 실패
}
})); |
카카오톡 게임 메시지 보내기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡friends 게임API를 메시지통해 수신가져온 여부카카오 설정친구 뷰프로필 띄우기 FKGTKakaoTalk::ShowSetting(FKGTResultWithIsAllowMeDelegate::CreateLambda([=](FKGTResult result, bool isAllowMe) { if (result.IsSuccess()) { // 카카오톡 게임 메시지 수신 여부 설정 성공 FKGTKakaoFriendProfile *kakaoFriendProfile; // [TODO] 템플릿 Id 설정 FString templateId = TEXT(""); // isAllowMe[TODO] -메시지 설정된템플릿에 메시지설정한 수신인자 허용설정 여부TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 카카오톡 게임 메시지 수신 여부 설정 실패 } })); |
카카오톡 프로필 조회하기
...
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 카카오톡 프로필 조회하기 FKGTKakaoTalk::TalkProfile(FKGTResultWithKakaoTalkProfileDelegate::CreateLambda([=](FKGTResult result, FKGTKakaoTalkProfile profile) { if (result.IsSuccess()) {kakaoFriendProfile->GetNickname()) argumentDic.Add(TEXT("rog_link"), TEXT("test=100&hello=20111")); // 카카오톡 게임 메시지 보내기 FKGTKakaoTalk::SendGameMessage((*kakaoFriendProfile), templateId, argumentDic, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 카카오톡 채팅 메시지 보내기 성공 } else { if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // 받은이가 메시지 수신 거부를 설정한 경우 } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 카카오톡특정 프로필앱에 조회대해 성공보낼 수 있는 하루 쿼터(받는 //사람 profile관계없이) -초과시 로그인한발생 유저의 카카오톡 프로필 정보 } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else {ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 } else { // 카카오톡 프로필채팅 메시지 조회보내기 실패 } } })); |
카카오톡
...
친구
...
초대 메시지 전송하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // 게임 친구 목록 조회하기 FKGTKakaoTalk::Friends(FKGTResultWithPlayerListDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTPlayer> playerList) { if (result.IsSuccess()) { // 카카오톡 게임 친구 목록 조회 성공. for (FKGTPlayer player : playerList) { FKGTIdpProfile idpProfile = player.GetIdpProfile(); FKGTKakaoFriendProfile *kakaoFriendProfile = (FKGTKakaoFriendProfile*)&idpProfile; } } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { "KakaoGameV4.h" // [TODO] 팝업창으로 띄울지 여부 설정 bool 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.IsSuccess()) { // 카카오톡 초대 메시지 보내기 성공 for (FKGTKakaoUser user : users) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우)유저가 초대 메시지를 전송한 유저 목록 확인 } } 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")); // 카카오톡 게임 메시지 보내기 FKGTKakaoTalk::SendGameMessage((*kakaoFriendProfile), templateId, argumentDic, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 카카오톡 채팅 메시지 보내기 성공 } else { if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // 받은이가 메시지 수신 거부를 설정한 경우 } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 } 경우(공통된 원인 리턴해주기 필요) if (result.GetCode() == FKGTResultCode::MessageSettingDisabled) { // 받은이가 메시지 수신 거부를 설정한 경우 } else if (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage) { // 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 } else { // 카카오톡 채팅 메시지 보내기 실패 } } })); |
카카오톡 채널 추가하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 채널 Id 설정 int32 channelId = 0; FKGTKakaoTalk::AddChannel(channelId, FKGTResultDelegate::CreateLambda([=](FKGTResult result) { if (result.IsSuccess()) { // 채널 추가 성공 } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsageNotKakaoTalkUser) { // 한명이로그인 특정한 앱에유저가 대해'카카오톡' 특정인에게유저가 보낼아닙니다. 수(카카오톡 있는유저가 한달 쿼터 초과시 발생아닌 경우) } else { // 카카오톡 채팅 메시지 보내기 실패 }채널 추가 실패 } })); |
...
내가 초대 메시지를 보낸 친구 목록 조회하기
발췌문 삽입 | ||||||
---|---|---|---|---|---|---|
|
...
language | cpp |
---|
...
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 템플릿이벤트 Id 설정 FStringint32 templateIdeventId = TEXT("")0; // [TODO] 메시지 템플릿에 설정한 인자 설정 TMap<FString, FString> argumentDic; argumentDic.Add(TEXT("${nickname}"), TEXT("nickname")); FKGTKakaoTalk::SendInviteMessage(isSingle, isPopup, templateId, argumentDic, FKGTResultWithKakaoUserListDelegate내가 초대한 플레이어 목록 조회하기 FKGTKakaoInvitation::Joiners(eventId, FKGTResultWithJoinersDelegate::CreateLambda([=](FKGTResult result, TArray<FKGTKakaoUser>TArray<FKGTPlayer> usersplayers) { if (result.IsSuccess()) { // 카카오톡내가 초대초대한 메시지플레이어 보내기목록 성공가져오기 for (FKGTKakaoUserFKGTPlayer userplayer : usersplayers) { // 유저가 초대 메시지를 전송한 유저 목록 확인 수신자의 플레이어 아이디 FString playerId = player.GetPlayerId(); } } FKGTIdpProfile idpProfile else = player.GetIdpProfile(); { //FKGTKakaoFriendProfile 전부*kakaoProfile 실패한= 경우(공통된 원인 리턴해주기 필요)(FKGTKakaoFriendProfile*)&idpProfile; // if (result.GetCode() == FKGTResultCode::MessageSettingDisabled)수신자의 닉네임 {FString nickname = kakaoProfile->GetNickname(); // 받은이가 메시지 수신 거부를// 설정한수신자의 경우프로필 썸네일 이미지 } FString elsethumbnailImageUrl if= (result.GetCode() == FKGTResultCode::ExceedDailyUsage) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생kakaoProfile->GetThumbnailImageUrl(); // 수신지의 탈퇴 이력 조회. UI상에서 탈퇴 여부 정보를 표시할 경우 해당 flag를 사용. bool isUnregistered = kakaoProfile->IsUnregistered(); } } else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsageNotKakaoTalkUser) { // 한명이로그인 특정한 앱에유저가 대해'카카오톡' 특정인에게유저가 보낼아닙니다. 수(카카오톡 있는유저가 한달 쿼터 초과시 발생 아닌 경우) } else { // 카카오톡 채팅 메시지 보내기 실패 호출 실패 } } })); |
...
내가 초대 메시지를 보낸 친구 숫자 조회하기
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
#include "KakaoGameV4.h" // [TODO] 채널이벤트 Id 설정 int32 channelIdeventId = 0; // 내가 초대한 플레이어 목록 조회하기 FKGTKakaoTalkFKGTKakaoInvitation::AddChannelReceiversCount(channelIdeventId, FKGTResultDelegateFKGTResultWithReceiversCountDelegate::CreateLambda([=](FKGTResult result, int32 totalReceiversCount, int32 joinersCount) { if (result.IsSuccess()) { // 호출 성공 // 채널 추가 성공 totalReceiversCount - 전체 친구 수 // joinersCount - 게임에 가입한 친구 수 } else if (result.GetCode() == FKGTResultCode::NotKakaoTalkUser) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. (카카오톡 유저가 아닌 경우) } else { // 채널 추가호출 실패 } })); |