메타 데이터의 끝으로 건너뛰기
메타 데이터의 시작으로 이동

You are viewing an old version of this content. View the current version.

현재와 비교 View Version History

« 이전 버전 4 다음 »


Initialization and Status Change Event Processing


SDK Initialization

SDK에서 사용하는 앱 정보를 설정하고 초기화 하는 과정을 수행합니다.

게임 시작 시 다른 API보다 먼저 호출되어야 합니다.

#include "KakaoGameV4.h"

/**
 * Perform initialization using the information set in Unreal Editor
 */
FKGTApplication::InitSDK();

Start

매크로 처리 오류 'excerpt-include' : No link could be created for 'EN_Initialization and Status Change Event Processing SDK Example'.

#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)
    {
      // 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 - Initialization failed, so you should either 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

모바일 환경에서 게임이 백그라운드로 내려가는 시점이 오면, 게임은 Pause API를 호출하여 게임이 비 활성화되었다는 정보를 카카오게임 SDK로 전달해야 합니다.

카카오게임 SDK는 Pause API가 호출되면 배터리 소모를 막기 위해 연결된 세션을 끊고, 주기적으로 발송되던 Heartbeat을 중단합니다.

#include "KakaoGameV4.h"

// Called when the game enters a background state (e.g., switching to another app or exiting via the home button).
// Register with ApplicationWillEnterBackgroundDelegate so that SDK Pause can be called.
FCoreDelegates::ApplicationWillEnterBackgroundDelegate.AddUObject(this, &UApplicationWidget::Pause);

FKGTApplication::Pause(FKGTResultDelegate::CreateLambda([=](FKGTResult result) {
  // The result always returns a success (200) response.
}));

Resume

모바일 환경에서 게임이 백그라운드로 내려갔다가 다시 활성화되는 시점이 오면, 게임은 Resume API를 호출하여 게임이 활성화되었다는 정보를 카카오게임 SDK로 전달해야 합니다.

카카오게임 SDK는 Resume 메서드가 호출되면 인증의 만료 여부를 확인하고 그 여부에 따라 세션을 복구한 후 그 결과를 메서드 호출시 게임에서 입력한 콜백 함수를 통해 전달합니다.

게임은 그 결과를 활용하여 사용자의 인증을 다시 수행해야 할지, 혹은 이전에 하던 게임을 재개해야 할 지에 대한 결정을 할 수 있습니다.

#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, if it's an authentication failure, go to the login screen; otherwise, show an error popup and check whether to retry.
		if (result.Code == FKGTResultCode::AuthFailure || result.Code == FKGTResultCode::IdpAuthFailure)
        {
			// [TODO] In case of authentication failure, move to the start screen and perform the new login flow again.
		}
		else
		{
			// [TODO] If other errors occur, provide an error notification and retry the resume. If the issue persists, close the app.
		}
	}
});

Setting Up Auto Login in a Windows Environment

윈도우즈 환경에서 지원하는 기능입니다.

SDK에서 제공하는 기본 로그인 UI를 사용하지 않고, 로그인 UI를 직접 구현하는 경우 자동로그인 방식을 설정하는 기능을 제공합니다.

  • 자동로그인 유무를 설정하지 않으면 기본으로 자동로그인을 위한 파일을 생성하지 않습니다.

  • 자동로그인을 위한 파일이 생성되는 위치는 PC에서 여러 사용자가 있을 수 있어서 ".kakaogames" 폴더에 ".access"이름의 파일에 암호화되어 저장하고 있습니다.

  • 게임을 삭제하고 재 설치 시 자동로그인 파일이 남아 있는 경우 자동로그인이 진행되는 것을 막기 위해 윈도우SDK파일(KakaoGame.dll)위치에 암호화된 ".access"파일이 존재하는지 여부를 체크하고 정상적인 파일일 때 자동로그인 정보가 들어있는 파일을 불러와 자동로그인을 수행합니다.

  • 자동로그인을 위한 파일들이 손상되면 해당 파일들을 삭제합니다.

  • 자동로그인을 위한 파일이 존재한 상태에서 로그아웃이나 탈퇴를 진행하면 자동로그인을 위한 파일이 삭제됩니다.

#include "KakaoGameV4.h"

// Set whether to use auto-login; if not set, it defaults to not using auto-login
// When auto-login is enabled and login is 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


  • 로그인 UI는 개발사에서 로그인 UI를 커스터마이징하여 적용 가능합니다.

  • 개발사에서 로그인 UI를 직접 구현하는 경우 참고사항

    • IDP별 로그인 API가 제공됩니다.

    • 개발사에서 로그인 화면에, 각 IDP별 로그인 버튼을 배치하고, 각 버튼을 클릭했을 경우, 각각의 IDP별 로그인 API를 호출하도록 구현해야 합니다.

    • 글로벌 원빌드를 제공할 경우, 국가에 따라서 IDP버튼의 노출을 처리해야 합니다. 예를 들어서, 한국의 경우에는 카카오 로그인을 제공하고, 그 외 국가에서는 페이스북 로그인을 제공하도록 구현해야 합니다.

    • 국가를 구분하기 위해서 KGTSystem클래스에 countryCode를 가져올 수 있는 API를 제공합니다.

  •  로그인이 성공한 이후에 설정창을 띄우면 회원번호에 PlayerID가 노출되도록 구현해야 합니다.

Logging In Without Using the Default Login UI

기본 로그인 UI를 사용하지 않는 로그인하는 예제입니다.

국가별로 로그인 IDP가 다를 경우에는 국가를 얻어오는 API를 통해서, 분기 처리 하도록 합니다. 

  • 게스트 인증

게스트 로그인의 경우 알람 팝업을 직접 구현해야 합니다. 카카오 게임 검수 진행시, 필수 체크 항목입니다.

게스트 인증을 진행하기 전에, "게스트 로그인 시 게임 삭제 및 디바이스 변경을 하면 게임 데이터가 삭제될 수 있습니다."

알림 팝업을 노출하여, 사용자가 계속 게스트 인증을 진행할지, 취소를 할지를 선택할지를 선택할 수 있게 구현해야 합니다.

예)

게스트 로그인시에 앱 삭제나 기기 정보가 변경될 시에 기존 playerId로 이어서 게임 진행 할 수 없습니다.

기본 로그인을 사용하는 경우 SDK에서 띄워줍니다.

#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, notify the user and prompt them to retry the login. It is necessary to check the error code and logs to determine the cause.
    }
  }
}));

Logging In Through the Launcher

매크로 처리 오류 'excerpt-include' : No link could be created for 'EN_Login SDK Example'.

#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] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다.
    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.
    }
  }
}));

Logout


  • 로그아웃 UI를 개발사에서 직접 구현해야 합니다.

    • 각 로그아웃UI에 대해서 로그아웃 API를 제공합니다.

Logging Out Without Using the Default Logout UI

기본 로그아웃 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


  • 탈퇴 UI를 개발사에서 직접 구현하고 싶을 경우(탈퇴 UI를 사용하고 싶지 않은 경우)를 위해서, 탈퇴 API가 제공됩니다.

Unregistering Without Using the Default Unregistration UI

기본 탈퇴 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


  • 만약 계정 연결 UI를 개발사에서 직접 구현하고 싶을 경우(기본 계정 연결 UI를 사용하고 싶지 않은 경우)를 위해서, IDP별 계정 연결 API가 제공된다.

    • 개발사에서 계정 연결 화면에, 각 IDP별 계정 연결 버튼을 배치하고, 각 버튼을 클릭했을 경우, 각각의 IDP별 계정 연결 API를 호출하도록 구현해야 한다.

Linking Accounts Without Using the Default Account Linking UI

기본 계정 연결 UI를 사용하지 않는 계정 연결 예제입니다.
계정 연결에 성공하면, 플레이어 아이디는 계속 동일하게 유지됩니다.

#include "KakaoGameV4.h"

// Set the IdpCode for the login
EKGTIdpCode idpCode = EKGTIdpCode::Kakao;

// 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 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

내 IDP 프로필 정보를 조회하는 예제입니다.
카카오 IDP의 GroupUserToken 정보를 사용하기 위해서는 앱 그룹 설정을 위한 별도 문의가 필요합니다.

#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 the 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

기기에 설정되어 있는 언어 설정 정보를 가져오며, 언어 코드는 ISO 639-1 표준에 따른 값을 반환한다.

#include "KakaoGameV4.h"

FString languageCode = FKGTSystem::GetLanguageCode();

Retrieve Country Code

SDK에서는 최초 GeoIP 기준으로 국가코드 수집한다. 국가 코드는 ISO 3166-1 alpha-2 표준을 따르며 국가 정보가 없을 경우에는 "zz" 를 반환한다.
국가 코드는 최초 앱 실행 시의 판단한 국가 코드를 유지하지만, 로그인한 유저의 국가 코드 정보가 다른 경우 유저의 국가 코드 정보를 따른다.

#include "KakaoGameV4.h"

FString countryCode = FKGTSystem::GetCountryCode();

Retrieve IP-based Country Code

기기가 현재 접속한 네트워크의 IP기반으로 한 countryCode 값을 리턴한다.

#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

현재 기기의 OS 이름(android/ios)을 반환 한다.

#include "KakaoGameV4.h"

FString osName = FKGTSystem::GetOSName();

Retrieve Network Connection Status

현재 기기가 외부 네트워크에 연결 되어 있는지 여부를 반환한다.

#include "KakaoGameV4.h"

bool isNetworkConnected = FKGTSystem::IsNetworkConnected();

Retrieve Connected Network Type

현재 기기가 외부 네트워크에 연결 되어 있는 방식(wifi/cellular/unknown)을 가져온다.

#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 preferences
    // 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 preferences
  }
}));

KakaoTalk Profile Retrieval

자신의 카카오톡 프로필을 조회하는 예제입니다.

#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
  }
}));

Retrieving 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 friend 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 friend list
  }
}));

Sending KakaoTalk Game Messages

메시지템플릿을 사용한 카카오톡 게임 메시지를 보내는 예제입니다.
수신된 메시지를 터치하여 게임에 진입할 때 특정 파라미터를 받고 싶으면 메시지 템플릿에 exec parm을 설정하여 사용할 수 있습니다.
카카오톡으로 해당 메시지를 수신해서 앱으로 연결 링크를 터치하면, 앱이 실행되면서 exec param을 넘겨줍니다.
이 값을 이용해서 특정 스테이지를 시작하거나 미리 정의해둔 아이템을 지급해줄 수 있습니다. exec parm은 게임 메시지만 사용할 수 있습니다.

#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)
    {
      // Exceeded the daily quota of messages that can be sent by one person for a specific app (regardless of the recipient)
    }
    else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage)
    {
      // Exceeded the monthly quota of messages that can be sent by one person to a specific recipient for a specific app
    }
    else
    {
      // Failed to send the KakaoTalk chat message
    }
  }
}));

Sending KakaoTalk Friend Invitation Messages

카카오톡 친구피커를 이용하여 초대 메시지를 전송합니다.
isSingle 옵션에 따라서 여러 명의 친구에게 초대 메시지를 전송할 수 있습니다.
여러 명의 친구에게 초대 메시지를 전송한 경우, 한 명이라도 성공한 경우 성공 응답을 반환합니다.
isPopup 옵션에 따라서 친구피커를 팝업 형태로 노출 할 수 있습니다. 해당 기능은 KakaoSDK를 통해 지원이 가능한 feature로 Windows SDK에서는 미지원 스펙입니다.

#include "KakaoGameV4.h"

// [TODO] Set whether to display in a popup window
bool isSingle = true;

// [TODO] Set whether to display in 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)
    {
      // Exceeded the daily quota of messages that can be sent by one person for a specific app (regardless of the recipient)
    }
    else if (result.GetCode() == FKGTResultCode::ExceedMonthlyUsage)
    {
      // Exceeded the monthly quota of messages that can be sent by one person to a specific recipient for a specific app
    }
    else
    {
      // Failed to send KakaoTalk chat message
    }
  }
}));

Adding a KakaoTalk Channel

카카오톡 채널을 추가하는 예제입니다.

#include "KakaoGameV4.h"

// [TODO] Set the channel 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 event 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();
      // 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 event 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
  }
}));
  • 레이블 없음