버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.
목차
stylenone

...

Initialization and Status Change Event Processing

...

SDK

...

Initialization

발췌문 삽입
KS4GFC:EN_초기화 및 상태변화 이벤트 처리 SDK 예제KS4GFC:EN_초기화 및 상태변화 이벤트 처리 SDK 예제Initialization and Status Change Event Processing SDK Example
Initialization and Status Change Event Processing SDK Example
nameapplication_init_sdk
nopaneltrue

코드 블럭
languagecpp
std::map<std::wstring, std::wstring> kakaoSetting, facebookSetting, googleSetting;
kakaoSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("jsKey"), TEXT("acd84e5c92067a159573483d8877de67")));
facebookSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientId"), TEXT("1421382574931990")));
googleSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientId"), TEXT("1002041625464-s2ruvcn1auv3rksr799gb4matvtvppb5.apps.googleusercontent.com")));
googleSetting.insert(std::pair<std::wstring, std::wstring>(TEXT("clientSecret"), TEXT("5MtQUUZ1sHl7RYgrhee-7-22")));

std::map<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>> idpSettings;
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Kakao, kakaoSetting));
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Facebook, facebookSetting));
idpSettings.insert(std::pair<KakaoGame::Data::KGTIdpCode, std::map<std::wstring, std::wstring>>(KakaoGame::Data::KGTIdpCode::Google, googleSetting));

/**
 * 단일For using 앱으로a 사용하는single 경우app
 */
KakaoGame::Data::KGTConfig config;
config.setAppInfo(
	TEXT("909428"), // appID
	TEXT("c3c38bbfa3828b342d946e9770c974d0"), // appSecret
	TEXT("1.0.0"), // appVersion
	TEXT("gameWeb"), // market
	TEXT("14"), // ageRating
	KakaoGame::Data::KGTServerType::QA, // server type
	KakaoGame::Data::KGTLogLevel::Error, // log level
	idpSettings // idpSettings
);

/**
 * For using 그룹을an 사용하는app 경우group
 */
std::map<std::wstring, std::wstring> apps;
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("909428"), TEXT("c3c38bbfa3828b342d946e9770c974d0")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("921478"), TEXT("5891c32124ca35821890a0bc1cec77a5")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("921482"), TEXT("43d0abf4ba4025994068607c545f04dc")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("947947"), TEXT("3c7fde7309a1fad65961110e8e290e28")));
apps.insert(std::pair<std::wstring, std::wstring>(TEXT("947950"), TEXT("7cc67cba7e3406585543d493f1548473")));

config.setAppGroupInfos(
	TEXT("tubeAppGroup"), // appGroupId
	apps, // app info map
	TEXT("1.0.0"), // appVersion
	TEXT("gameWeb"), // market
	TEXT("14"), // ageRating
	KakaoGame::Data::KGTServerType::QA, // server type
	KakaoGame::Data::KGTLogLevel::Error, // log level
	idpSettings // idpSettings
);

KakaoGame::API::KGTApplication applicationApi;
applicationApi.initSDK(config);

...

Start

...

발췌문 삽입
KS4GFC:EN_초기화 및 상태변화 이벤트 처리 SDK 예제KS4GFC:EN_초기화 및 상태변화 이벤트 처리 SDK 예제Initialization and Status Change Event Processing SDK Example
Initialization and Status Change Event Processing SDK Example
nameapplication_start
nopaneltrue
동기식 예제

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTApplication applicationApi;

applicationApi.start(GetSafeHwnd(), result);

if (result.isSuccess())
{
	// 스타트가If the 성공start is 경우successful
	
	// 자동로그인 여부Check if auto-login is enabled
	KakaoGame::API::KGTPlayer playerApi;
	boolean isLoggedIn = playerApi.isLoggedIn();
	
	if (isLoggedIn)
	{
		// 플랫폼에서 발급한 현재 Player의 IDThe current Player's ID issued by the platform
		KakaoGame::Data::KGTPlayer player;
		playerApi.getCurrentPlayer(player);
		
		std::wstring playerId = player.playerId; // 플랫폼에서 발급한 현재 Player의 IDThe current Player ID issued by the platform
		std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼Platform access 액세스token 토큰(AccessToken)
		
		// [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.
	if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
		|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	{
		// [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, provide an error notification and request a retry of the start process. - 문제가If 반복해서 발생하는 경우 에러코드 및 로그 확인 후 원인 파악이 필요합니다the issue persists, check the error code and logs to determine the cause.
	}
}

비동기식 예제Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTApplication applicationApi;

applicationApi.start(GetSafeHwnd(), [this](KakaoGame::Data::KGTResult result) {
	if (result.isSuccess())
	{
		// If 스타트가the 성공start is 경우successful
		
		// 자동로그인 여부 Check if auto-login is enabled
		KakaoGame::API::KGTPlayer playerApi;
		booleanbool isLoggedIn = playerApi.isLoggedIn();
		
		if (isLoggedIn)
		{
			// 플랫폼에서Get 발급한the 현재current Player의Player ID issued by the platform
			KakaoGame::Data::KGTPlayer player;
			playerApi.getCurrentPlayer(player);
			
			std::wstring playerId = player.playerId; // 플랫폼에서 발급한 현재 Player의 IDThe current Player ID issued by the platform
			std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼Platform access 액세스token 토큰(AccessToken)
			
			// [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.
		if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
			|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
			|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
		{
			// [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, 에러 안내 후 스타트 재시도 요청 하여야 합니다provide an error notification and request a retry of the start process. - 문제가 반복해서 발생하는 경우 에러코드 및 로그 확인 후 원인 파악이 필요합니다If the issue persists, check the error code and logs to determine the cause.
		}
	}
});

로그인

...

기본 로그인 UI를 사용하지 않는 로그인하기

...

동기식 예제

...

languagecpp

...

Setting Up Auto Login in a Windows Environment

This feature is supported in the Windows environment.

If you do not use the default login UI provided by the SDK and instead implement your own login UI, the SDK offers a feature to set up auto login.

  • If you do not configure auto login, the SDK will not create a file for automatic login by default.

  • The file for auto login is created and stored in an encrypted format in the folder ".kakaogames" under the name ".access". This is because multiple users can exist on a single PC."

  • When a game is uninstalled and then reinstalled, if the auto login file remains, the SDK checks whether an encrypted ".access" file exists in the location of the Windows SDK file (KakaoGame.dll). If the file is valid, the SDK loads the file containing the auto login information and performs the auto login.

  • If the auto login files are corrupted, the SDK will delete them.

  • If the auto login file exists and the user logs out or withdraws, the auto login file will be deleted.

코드 블럭
languagecpp
nclude "KakaoGameLib.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;
KakaoGame::API::KGTApplication applicationApi;

applicationApi.setUseAutoLogin(useAutoLogin);

Login

...

발췌문 삽입
Login SDK Example
Login SDK Example
namelogin
nopaneltrue

Logging In Without Using the Default Login UI

발췌문 삽입
Login SDK Example
Login SDK Example
namelogin_custom
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// Setting the idpCode for login
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTIdpCode::Kakao;

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.login(GetSafeHwnd(), idpCode, result);

if (result.isSuccess())
{
	// IDP login and platform login successful
	KakaoGame::Data::KGTPlayer player;
	KakaoGame::API::KGTPlayer playerApi;
	
	playerApi.getCurrentPlayer(player);
	
	std::wstring playerId = player.playerId; // Current Player ID issued by the platform
	std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
	
	// [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.
	if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
		|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	{
		// [TODO] If a network error occurs, notify the user that the start failed due to a network issue and retry.
	}
	else if (KakaoGame::Data::KGTResultCode::Forbidden == result.code)
	{
		// [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 (KakaoGame::Data::KGTResultCode::UserCanceled == result.code)
	{
		// [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 request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
	}
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// Set the idpCode you want to log in with
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTIdpCode::Kakao;

KakaoGame::API::KGTPlayer playerApi;

playerApi.login(GetSafeHwnd(), idpCode, [this](KakaoGame::Data::KGTResult result) {
	if (result.isSuccess())
	{
		// Successfully logged in with IDP and platform
		KakaoGame::Data::KGTPlayer player;
		KakaoGame::API::KGTPlayer playerApi;
		
		playerApi.getCurrentPlayer(player);
		
		std::wstring playerId = player.playerId; // The current Player ID issued by the platform
		std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
		
		// [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.
		if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
			|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
			|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
		{
			// [TODO] If a network error occurs, notify the user that the start failed due to a network issue and retry.
		}
		else if (KakaoGame::Data::KGTResultCode::Forbidden == result.code)
		{
			// [TODO] If the user is not allowed during the CBT period, authentication may not be possible. Provide a notification message to the user.
		}
		else if (KakaoGame::Data::KGTResultCode::UserCanceled == result.code)
		{
			// [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 request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
		}
	}
});

Logging in Using a Square Token

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// User ID requesting login
std::wstring playerId;

// Token received from Square
std::wstring squareToken;

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.loginIdpWithSquareToken(GetSafeHwnd(), playerId, squareToken, result);

if (result.isSuccess())
{
	// Successful IDP and platform login
	KakaoGame::Data::KGTPlayer player;
	KakaoGame::API::KGTPlayer playerApi;
	
	playerApi.getCurrentPlayer(player);
	
	std::wstring playerId = player.playerId; // Current Player ID issued by the platform
	std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
	
	// [TODO] Since login was successful, proceed to the game screen.
}
else
{
	// IDP or platform login failed
	// [TODO] If login fails, notify the user and request a retry.
	if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
		|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	{
		// [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, provide an error notification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
	}
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// User ID requesting login
std::wstring playerId;

// Token received from Square
std::wstring squareToken;

KakaoGame::API::KGTPlayer playerApi;

playerApi.login(GetSafeHwnd(), playerId, squareToken, [this](KakaoGame::Data::KGTResult result) {
	if (result.isSuccess())
	{
		// IDP login and platform login successful
		KakaoGame::Data::KGTPlayer player;
		KakaoGame::API::KGTPlayer playerApi;
		
		playerApi.getCurrentPlayer(player);
		
		std::wstring playerId = player.playerId; // The current Player's ID issued by the platform
		std::wstring accessToken = playerApi.getAccessToken(); // Platform access token (AccessToken)
		
		// [TODO] Since login was successful, proceed to the game screen.
	}
	else
	{
		// IDP login or platform login failed
		// [TODO] If login fails, notify the user and request a retry.
		if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
			|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
			|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
		{
			// [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, provide an error notification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause.
		}
	}
});

Logout

...

발췌문 삽입
Logout SDK Example
Logout SDK Example
namelogout
nopaneltrue

Logging Out Without Using the Default Logout UI

발췌문 삽입
Logout SDK Example
Logout SDK Example
namelogout_custom
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.loginlogout(GetSafeHwnd(), idpCodefalse, result);

if (result.isSuccess())
{
	// IDP 로그인과 플랫폼 로그인 성공
	KakaoGame::Data::KGTPlayer player;
	Logout successful
	
	// [TODO] Return to the start screen
}
else
{
	// Logout failed
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTPlayer playerApi;
	
	playerApi.getCurrentPlayerlogout(GetSafeHwnd(player);, 	
	stdfalse, [this](KakaoGame::Data::wstringKGTResult playerIdresult) = player.playerId; // 플랫폼에서 발급한 현재 Player의 ID
	std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼 액세스 토큰(AccessToken)
	
	// [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다.
}
else
{
	// IDP 로그인 혹은 플랫폼 로그인 실패
	// [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다.
	if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
		|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	{
		// [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도
	}
	else if (KakaoGame::Data::KGTResultCode::Forbidden== result.code)
	{
	{
	if (result.isSuccess())
	{
		// Logout successful
		
		// [TODO] Return to the start screen
	}
	else
	{
		// Logout failed
	}
});

Unregistration

...

발췌문 삽입
Unregistration SDK Example
Unregistration SDK Example
nameunregister
nopaneltrue

Unregistering Without Using the Default Unregistration UI

발췌문 삽입
Unregistration SDK Example
Unregistration SDK Example
nameunregister_custom
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.unregister(GetSafeHwnd(), false, result);

if (result.isSuccess())
{
	// Unregistration successful
	
	// [TODO] Return CBT기간동안to 허용된the 유저외에는start 인증이screen
불가능}
else
수 있습니다. 유저에게 안내메시지 처리가 필요합니다.
	}
	else if {
	// Unregistration failed
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTPlayer playerApi;

playerApi.unregister(GetSafeHwnd(), false, [this](KakaoGame::Data::KGTResultCode::UserCanceled== result.codeKGTResult result) {
	if (result.isSuccess())
	{
		// [TODO]Unregistration 사용자가successful
로그인 진행 중 취소한 상황이므로 로그인 화면을 유지 하여야 합니다.
		
		// [TODO] Return to the start screen
	}
	else
	{
		// [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 로그인 재시도 요청 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다.Unregistration failed
	}
}

...

);

Account Linking

...

발췌문 삽입
Account Linking SDK Example
Account Linking SDK Example
nameconnect
nopaneltrue

Linking Accounts Without Using the Default Account Linking UI

발췌문 삽입
Account Linking SDK Example
Account Linking SDK Example
nameconnect_custom
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// 로그인Set the 하고자idpCode 하는to idpCodeconnect 셋팅to
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTIdpCode::Kakao;

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.loginconnect(GetSafeHwnd(), idpCode, [this](KakaoGame::Data::KGTResult, idpCode, result);
{
	if (result.isSuccess())
	{
	// IDP connection successful
	// IDP 로그인과 플랫폼 로그인 성공
		 Player ID is not changed.
}
else
{
	// IDP connection failed
	if (KakaoGame::Data::KGTPlayer player;
		KakaoGameKGTResultCode::API::KGTPlayer playerApi;
		
		playerApi.getCurrentPlayer(player);
		
		std::wstring playerId = player.playerId; // 플랫폼에서 발급한 현재 Player의 ID
		std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼 액세스 토큰(AccessToken)
		InvalidParameter == result.code)
	{
		// An invalid parameter was passed
	}
	else if (KakaoGame::Data::KGTResultCode::NotAuthorized == result.code)
	{
		// The [TODO]user 로그인이is 성공하였으므로not 게임currently 화면으로logged 이동합니다.in
	}
	else if (KakaoGame::Data::KGTResultCode::InvalidState == result.code)
	{
		// IDPThe 로그인current 혹은authenticated 플랫폼IDP 로그인 실패
		// [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다.
		is not an IDP that can be linked to the account
	}
	else if (KakaoGame::Data::KGTResultCode::NetworkFailureAlreadyUsedIDPAccount == result.code)
	{
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
			|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	// The account is already linked to another IDP
	}
	else
	{
			// [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도
		}
		else if (Other errors occurred
	}
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// Set the idpCode to connect to
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTResultCodeKGTIdpCode::Forbidden== result.code)
		{
			// [TODO] CBT기간동안 허용된 유저외에는 인증이 불가능 할 수 있습니다. 유저에게 안내메시지 처리가 필요합니다.
		}
		else if Kakao;

KakaoGame::API::KGTPlayer playerApi;

playerApi.connect(GetSafeHwnd(), idpCode, [this](KakaoGame::Data::KGTResultCode::UserCanceled==KGTResult result.code) 		{
			// [TODO] 사용자가 로그인 진행 중 취소한 상황이므로 로그인 화면을 유지 하여야 합니다.
		}
		else
		if (result.isSuccess())
	{
			// [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 로그인 재시도 요청 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다.
		}
	}
});

스퀘어 토큰을 사용하여 로그인하기

동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// 로그인을 요청하는 사용자 아이디
std::wstring playerId;

// 스퀘어에서 전달받은 토큰
std::wstring squareToken;

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.loginIdpWithSquareToken(GetSafeHwnd(), playerId, squareToken, result);

if (result.isSuccess())
{
	// IDP 로그인과 플랫폼 로그인 성공
	KakaoGame::Data::KGTPlayer player;
	KakaoGame::API::KGTPlayer playerApi;
	
	playerApi.getCurrentPlayer(player);
	
	std::wstring playerId = player.playerId; // 플랫폼에서 발급한 현재 Player의 ID
	std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼 액세스 토큰(AccessToken)
	
	// [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다.
}
else
{
	// IDP 로그인 혹은 플랫폼 로그인 실패
	// [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다.
	if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
		|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
		|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
	{
		// [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도
	}
	else
	{
		// [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 로그인 재시도 요청 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다.
	}
}

...

IDP connection successful
		// Player ID is not changed.
	}
	else
	{
		// IDP connection failed
		if (KakaoGame::Data::KGTResultCode::InvalidParameter == result.code)
		{
			// An invalid parameter was passed
		}
		else if (KakaoGame::Data::KGTResultCode::NotAuthorized == result.code)
		{
			// The user is not currently logged in
		}
		else if (KakaoGame::Data::KGTResultCode::InvalidState == result.code)
		{
			// The current authenticated IDP is not an IDP that can be linked to the account
		}
		else if (KakaoGame::Data::KGTResultCode::AlreadyUsedIDPAccount == result.code)
		{
			// The account is already linked to another IDP
		}
		else
		{
			// Other errors occurred
		}
	}
});

Profile

...

Retrieve My Information

발췌문 삽입
Profile SDK Example
Profile SDK Example
nameplayer_currentPlayer
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;

playerApi.getCurrentPlayer(player);

Retrieve My IDP Information

발췌문 삽입
Profile SDK Example
Profile SDK Example
nameplayer_idpProfile
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;

playerApi.getCurrentPlayer(player);

player.kakaoProfile;

System Information

...

Retrieve Language Code

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_language_code
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// 로그인을 요청하는 사용자 아이디
KakaoGame::API::KGTSystem systemApi;

std::wstring playerId;languageCode 
// 스퀘어에서 전달받은 토큰
std::wstring squareToken;= systemApi.getLanguageCode();

Retrieve Language Tag

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_language_tag
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTPlayerKGTSystem playerApisystemApi;

playerApi.login(GetSafeHwnd(), playerId, squareToken, [this](KakaoGame::Data::KGTResult result) {
	if (result.isSuccess())
	{
		// IDP 로그인과 플랫폼 로그인 성공
		KakaoGame::Data::KGTPlayer player;
		KakaoGame::API::KGTPlayer playerApi;
		
		playerApi.getCurrentPlayer(player);
		
		std::wstring playerId = player.playerId; // 플랫폼에서 발급한 현재 Player의 ID
		std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼 액세스 토큰(AccessToken)
		
		// [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다.
	}
	else
	{
		// IDP 로그인 혹은 플랫폼 로그인 실패
		// [TODO] 로그인 실패 시 사용자 안내 후 재 시도 하도록 하여야 합니다.
		if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
			|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
			|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
		{
			// [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도
		}
		else
		{
			// [TODO] 나머지 에러가 발생한 경우에는 에러 안내 후 로그인 재시도 요청 하여야 합니다. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다.
		}
	}
});

로그아웃

...

기본 로그아웃 UI를 사용하지 않는 로그아웃하기

...

동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.logout(GetSafeHwnd(), false, result);

if (result.isSuccess())
{
	// 로그아웃 성공
	
	// [TODO] 시작 화면으로 돌아가기
}
else
{
	// 로그아웃 실패
}

...

std::wstring languageCode = systemApi.getLanguageTag();

Retrieve Country Code

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_country_code
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring countryCode = systemApi.getCountryCode();

Retrieve IP-based Country Code

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_geo_country_code
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring countryCode = systemApi.getGeoCountryCode();

Retrieve Device ID

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_device_id
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring deviceId = systemApi.getDeviceId();

Retrieve Device Model

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_device_model
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring deviceModel = systemApi.getDeviceModel();

Retrieve OS Name

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_os_name
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring osName = systemApi.getOSName();

Retrieve Network Connection Status

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_is_network_connected
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

boolean networkConnected = systemApi.isNetworkConnected();

Retrieve Connected Network Type

발췌문 삽입
System Information SDK Example
System Information SDK Example
namesystem_network_type
nopaneltrue

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring networkType = systemApi.getNetworkType();

Get the Set Game Language Code

Returns the set game language code.

If no language code is set, it retrieves the language setting information configured on the device, and the language code is returned according to the ISO 639-1 standard.

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring gameLanguageCode = systemApi.getGameLanguageCode();

Set the Game Language Code

Configures the game to use the language synchronized with the platform.

The following language codes are supported:

(Can be set before calling the Start API)

  • device: Device setting value. Can be used to revert to the device's setting value. (default)

  • en: English

  • ko: Korean

  • ja: Japanese

  • zh_hant: Chinese (Traditional)

  • zh_hans: Chinese (Simplified)

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::en; // English
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::ko; // Korean
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::ja; // Japanese
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::zh_hant; // Chinese(Traditional)
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::zh_hans; // Chinese (Simplified)
KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::device; // Device setting value

KakaoGame::API::KGTSystem systemApi;

systemApi.setGameLanguageCode(languageCode);

Kakao Integration Feature

...

Setting Up KakaoTalk Game Message Reception

발췌문 삽입
Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_show_setting
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
bool isAlloweMe;
KakaoGame::API::KGTPlayerKGTKakaoTalk playerApikakaotalkApi;

// 
playerApi.logoutDisplay the view to set KakaoTalk game message reception preferences
kakaotalkApi.showSetting(GetSafeHwnd(), falseresult, [this](KakaoGame::Data::KGTResult result) {
	isAlloweMe);

if (result.isSuccess())
	{
		// 로그아웃 성공
		
		// [TODO] 시작 화면으로
돌아가기
	}
	else
	{
		// 로그아웃 실패
	}
});

탈퇴

계정 연결

...

기본 계정 연결 UI를 사용하지 않는 계정 연결하기

...

동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// 연결하고자 하는 idpCode 셋팅
KakaoGame::Data::KGTIdpCode idpCode =  Successfully set the KakaoTalk game message reception settings
	isAlloweMe; // Whether message reception is allowed as per the settings
}
else if (KakaoGame::Data::KGTIdpCodeKGTResult::Kakao;NotKakaoTalkUser 
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;

playerApi.connect(GetSafeHwnd(), idpCode, result);

if (result.isSuccess())
{
	// IDP 연결 성공
	// Player ID 는 변경되지 않습니다== result.code)
{
	// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
}
else
{
	// IDP 연결 실패
	if (KakaoGame::Data::KGTResultCode::InvalidParameter== result.code)
	{
		// 잘못된 인자가 전달 된 경우
	}
	else if  Failed to set the KakaoTalk game message reception settings
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// Display the view to set KakaoTalk game message reception preferences
kakaotalkApi.showSetting(GetSafeHwnd(), [this](KakaoGame::Data::KGTResultCode::NotAuthorized== result.codeKGTResult result, bool isAlloweMe) {
	if (result.isSuccess())
	{
		// 현재Successfully 로그인이set 안되어the 있는KakaoTalk 경우game 	}message 	elsereception if (KakaoGame::Data::KGTResultCode::InvalidState== result.code)
	{
		settings
		isAlloweMe; // 현재Whether 인증message reception IDPis allowed 계정as 연결 가능한 idp가 아닌 경우per the settings
	}
	else if (KakaoGame::Data::KGTResultCodeKGTResult::AlreadyUsedIDPAccountNotKakaoTalkUser == result.code)
	{
		// 이미 연결되어 있는 계정이 있는 경우 The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
	}
	else
	{
		// 기타 에러 발생
	}
}

...

	// Failed to set the KakaoTalk game message reception settings
	}
});

Retrieve KakaoTalk Profile

발췌문 삽입
Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_talk_profile
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// 연결하고자 하는 idpCode 셋팅
KakaoGame::Data::KGTIdpCodeKGTResult idpCoderesult;
= KakaoGame::Data::KGTIdpCode::Kakao;
KGTKakaoTalkProfile profile;
KakaoGame::API::KGTPlayerKGTKakaoTalk playerApi;

playerApi.connect(GetSafeHwnd(), idpCode, [this](KakaoGame::Data::KGTResult result) {
	kakaotalkApi;

// Retrieve KakaoTalk profile
kakaotalkApi.talkProfile(result, profile);

if (result.isSuccess())
	{
		// IDPSuccessfully retrieved 연결KakaoTalk 성공profile
		profile; // KakaoTalk profile Playerinformation IDof the 변경되지 않습니다.
	logged-in user
}
	else 	{
		// IDP 연결 실패
		if (KakaoGame::Data::KGTResultCodeKGTResult::InvalidParameterNotKakaoTalkUser == result.code)
		{
			// 잘못된 인자가 전달 된 경우
		}
		else if (KakaoGame::Data::KGTResultCode::NotAuthorized== result.code)
		{
			// 현재 로그인이 안되어 있는 경우
		}
		else if (KakaoGame::Data::KGTResultCode::InvalidState== result.code)
		{
			// 현재 인증 된 IDP 가 계정 연결 가능한 idp가 아닌 경우
		}
		else if (KakaoGame::Data::KGTResultCode::AlreadyUsedIDPAccount== result.code)
		{
			// 이미 연결되어 있는 계정이 있는 경우
		}
		else
		{
			// 기타 에러 발생
		}
	}
});

프로필

내 정보 조회하기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;

playerApi.getCurrentPlayer(player);

내 IDP 정보 조회하기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;

playerApi.getCurrentPlayer(player);

player.kakaoProfile;

시스템 정보

언어 코드 가져오기

...

 The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
}
else
{
	// Failed to retrieve KakaoTalk profile
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// Retrieve KakaoTalk profile
kakaotalkApi.talkProfile([this](KakaoGame::Data::KGTResult result, KakaoGame::Data::KGTKakaoTalkProfile profile) {
	if (result.isSuccess())
	{
		// Successfully retrieved KakaoTalk profile
		profile; // KakaoTalk profile information of the logged-in user
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
	{
		// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
	}
	else
	{
		// Failed to retrieve KakaoTalk profile
	}
});

Retrieve KakaoTalk Game Friend List

발췌문 삽입
Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_friends
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::APIData::KGTSystemKGTResult systemApiresult;

std::wstring languageCode = systemApi.getLanguageCode();

언어 태그 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

vector<KakaoGame::Data::KGTPlayer> players;
KakaoGame::API::KGTSystemKGTKakaoTalk systemApikakaotalkApi;

std::wstring languageCode = systemApi.getLanguageTag();

국가 코드 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring countryCode = systemApi.getCountryCode();

IP 기반 국가 코드 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring countryCode = systemApi.getGeoCountryCode();

기기 아이디 가져오기

...

// Retrieve the list of game friends
kakaotalkApi.friends(result, players);

if (result.isSuccess())
{
	// Successfully retrieved KakaoTalk game friends list.
	// Game friends list
	for each (auto player in players)
	{
	}
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
	// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
}
else
{
	// Failed to retrieve KakaoTalk profile
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystemKGTKakaoTalk systemApikakaotalkApi;

std::wstring deviceId = systemApi.getDeviceId();

기기 모델 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring deviceModel = systemApi.getDeviceModel();

OS 이름 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring osName = systemApi.getOSName();

네트워크 연결 여부 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

boolean networkConnected = systemApi.isNetworkConnected();

연결된 네트워크 타입 가져오기

...

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring networkType = systemApi.getNetworkType();

설정된 게임 언어 코드 가져오기

설정된 게임 언어 코드를 반환한다.

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

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTSystem systemApi;

std::wstring gameLanguageCode = systemApi.getGameLanguageCode();

게임 언어 코드 설정하기

게임에서 사용하는 언어를 플랫폼에서 동기화 해서 사용하도록 설정한다.

아래와 같은 언어 코드를 지원한다.

(Start API 호출 이전에 설정 가능)

...

device: 디바이스 설정 값. 디바이스 설정 값으로 되돌릴 때 사용할 수 있음. (default)

...

en: 영어

...

ko: 한국어

...

ja: 일어

...

zh_hant: 중국어 (번체)

...

// Retrieve the list of game friends
kakaotalkApi.friends([this](KakaoGame::Data::KGTResult result, std::vector<KakaoGame::Data::KGTPlayer> players) {
	if (result.isSuccess())
	{
		// Successfully retrieved KakaoTalk game friends list.
		// Game friends list
		for each (auto player in players)
		{
		}
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
	{
		// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
	}
	else
	{
		// Failed to retrieve KakaoTalk game friends list
	}
});

Sending KakaoTalk Game Messages

발췌문 삽입
Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_send_game_message
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::en; // 영어
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::ko; // 한국어
// KakaoGame::Data::KGTLanguageCode languageCode =Friend object retrieved via the friends API
KakaoGame::Data::KGTLanguageCode::jaKGTKakaoProfile kakaoProfile;

// 일어
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::zh_hant; // 중국어 (번체)
// KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::zh_hans; // 중국어 (간체)
KakaoGame::Data::KGTLanguageCode languageCode = KakaoGame::Data::KGTLanguageCode::device; // 디바이스 설정 값

KakaoGame::API::KGTSystem systemApi;

systemApi.setGameLanguageCode(languageCode);

카카오 연동 기능

카카오톡 게임 메시지 수신 여부 설정하기

...

동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"[TODO] Set the template Id
std::wstring templateId = TEXT("");

// [TODO] Set the parameters for the message template
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${nickname}"), kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("rog_link"), TEXT("test=100&hello=20111")));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("bruce2"), kTEXT("test=100&hello=20111")));

KakaoGame::Data::KGTResult result;
bool isAlloweMe;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기Send a KakaoTalk game message
kakaotalkApi.showSetting(GetSafeHwnd()sendGameMessage(kakaoProfile, templateId, resultarguments, isAlloweMeresult);

if (result.isSuccess())
{
	// 카카오톡 게임 메시지 수신 여부 설정 성공
	isAlloweMe; // 설정된 메시지 수신 허용 여부Successfully sent KakaoTalk chat message
}
else if (KakaoGame::Data::KGTResult::MessageSettingDisabled == result.code)
{
	// The recipient has set message reception to be disabled.
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUserExceedDailyUsage == result.code)
{
	// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우.
}
else
{
	// 카카오톡 게임 메시지 수신 여부 설정 실패
}

비동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기
kakaotalkApi.showSetting(GetSafeHwnd(), [this](KakaoGame::Data::KGTResult result, bool isAlloweMe) {
	if (result.isSuccess())
	{
		// 카카오톡 게임 메시지 수신 여부 설정 성공
		isAlloweMe; // 설정된 메시지 수신 허용 여부
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
	{
		// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우.
	}
	else
	{
		// 카카오톡 게임 메시지 수신 여부 설정 실패
	}
});

카카오톡 프로필 조회하기

...

동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::Data::KGTResult result;
KakaoGame::Data::KGTKakaoTalkProfile profile;
Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded.
}
else if (KakaoGame::Data::KGTResult::ExceedMonthlyUsage == result.code)
{
	// 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
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// Friend object retrieved via the friends API
KakaoGame::Data::KGTKakaoProfile kakaoProfile;

// [TODO] Set the template Id
std::wstring templateId = TEXT("");

// [TODO] Set the parameters for the message template
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${nickname}"), kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("rog_link"), TEXT("test=100&hello=20111")));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("bruce2"), kTEXT("test=100&hello=20111")));

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// Send 카카오톡a KakaoTalk 프로필game 조회하기message
kakaotalkApi.talkProfile(result, profile);

sendGameMessage(kakaoProfile, templateId, arguments, [this](KakaoGame::Data::KGTResult result) {
	if (result.isSuccess())
{
	// 카카오톡 프로필 조회 성공
	profile;{
		// 로그인한Successfully 유저의sent 카카오톡KakaoTalk 프로필chat 정보message
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUserMessageSettingDisabled == result.code)
	{
	// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우.
}
else
{
	// 카카오톡The 프로필recipient 조회has 실패
}

비동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 카카오톡 프로필 조회하기
kakaotalkApi.talkProfile([this](set message reception to be disabled.
	}
	else if (KakaoGame::Data::KGTResult result, KakaoGame::Data::KGTKakaoTalkProfile profile) {
	if (result.isSuccess()ExceedDailyUsage == result.code)
	{
		// 카카오톡 프로필 조회 성공
		profile; // 로그인한 유저의 카카오톡 프로필 정보Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded.
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUserExceedMonthlyUsage == result.code)
	{
		// 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

발췌문 삽입
KS4GFC:EN_카카오 연동 기능 SDK 예제KS4GFC:EN_카카오 연동 기능 SDK 예제Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_add_friendsplus_friend
nopaneltrue

동기식 예제

...

languagecpp

...

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// [TODO] Set the channel Id
int channelId = 0;

KakaoGame::Data::KGTResult result;
std::vector<KakaoGame::Data::KGTPlayer> players;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 게임 친구
목록
조회하기
kakaotalkApi.friendsaddChannel(resultchannelId, playersresult);

if (result.isSuccess())
{
	// 카카오톡Successfully 게임added 친구 목록 조회 성공.
	// 게임 친구 목록
	for each (auto player in players)
	{
	}the channel
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
	// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
}
else
{
	// Failed 카카오톡to 프로필add 조회the 실패channel
}

비동기식 예제Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// [TODO] Set the channel Id
int channelId = 0;

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 게임
친구
목록 조회하기
kakaotalkApi.friendsaddChannel(channelId, [this](KakaoGame::Data::KGTResult result, std::vector<KakaoGame::Data::KGTPlayer> players) {
	if (result.isSuccess())
	{
		// 카카오톡Successfully 게임added 친구the 목록 조회 성공.
		// 게임 친구 목록
		for each (auto player in players)
		{
		channel
	}
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
	{
		// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우 The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
	}
	else
	{
		// 카카오톡Failed 게임to 친구add 목록 조회the 실패channel
	}
});

...

Retrieve the list of friends to whom I sent an invite message

발췌문 삽입
KS4GFC:EN_카카오 연동 기능 SDK 예제KS4GFC:EN_카카오 연동 기능 SDK 예제Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talk_send_game_message
nopaneltrue

동기식 예제

...

languagecpp

...

invitation_joiners
nopaneltrue

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"
// [TODO] 메시지 템플릿에 설정한 인자 설정
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${nickname}"), kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("rog_link"), TEXT("test=100&hello=20111")));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("bruce2"), kTEXT("test=100&hello=20111")));

KakaoGame Set the event ID
int32 eventId = 0;
KakaoGame::Data::KGTResult result;
std::vector<KakaoGame::Data::KGTResultKGTPlayer> resultplayers;
KakaoGame::API::KGTKakaoTalkKGTKakaoInvitation kakaotalkApikakaoInvitationApi;

// 카카오톡 게임 메시지 보내기
kakaotalkApi.sendGameMessage(kakaoProfile, templateId, arguments, result Retrieve the list of players I invited
kakaoInvitationApi.joiners(eventId, result, players);

if (result.isSuccess())
{
	// 카카오톡 채팅 메시지 보내기 성공
}
else ifSuccessfully retrieved the list of players I invited
    for (KakaoGame::Data::KGTResult::MessageSettingDisabled == result.code)
{
	// 받은이가 메시지 수신 거부를 설정한 경우
}
else if (KakaoGame::Data::KGTResult::ExceedDailyUsage == result.code)
{
	// 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생
}
else if (KakaoGame::Data::KGTResult::ExceedMonthlyUsage == result.code)
{
	// 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생
}
else
{
	// 카카오톡 채팅 메시지 보내기 실패
}

비동기식 예제

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// friends API를 통해 가져온 친구 객체
KakaoGame::Data::KGTKakaoProfile kakaoProfile;

// [TODO] 템플릿 Id 설정
std::wstring templateId = TEXT("");

// [TODO] 메시지 템플릿에 설정한 인자 설정
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${nickname}"), kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("rog_link"), TEXT("test=100&hello=20111")));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("bruce2"), kTEXT("test=100&hello=20111")));

KakaoGame::API::KGTKakaoTalk kakaotalkApi;

// 카카오톡 게임 메시지 보내기
kakaotalkApi.sendGameMessage(kakaoProfile, templateId, argumentsKGTPlayer player : players)
    {
      // Recipient's player ID
      player.playerId;
      // Recipient's nickname
      player.kakaoProfile.nickname;
      // Recipient's profile thumbnail image
      player.kakaoProfile.thumbnailImageUrl;
      // Check if the recipient has a withdrawal history. Use this flag to display withdrawal information in the UI.
      player.kakaoProfile.isUnregistered;
    }
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
	// 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
}

Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"
// [TODO] Set the event ID
int32 eventId = 0;
KakaoGame::API::KGTKakaoInvitation kakaoInvitationApi;

// Retrieve the list of players I invited
kakaoInvitationApi.joiners(eventId, [this](KakaoGame::Data::KGTResult result, int32_t totalReceiversCount, int32_t joinersCount) {
	if (result.isSuccess())
	{
		// 카카오톡 채팅 메시지 보내기 성공
	}
	else if Successfully retrieved the list of players I invited
		for (KakaoGame::Data::KGTResult::MessageSettingDisabled == result.code)
	{
KGTPlayer player : players)
		{
			// Recipient's player ID
			player.playerId;
			// Recipient's nickname
			player.kakaoProfile.nickname;
			// 받은이가Recipient's 메시지profile 수신thumbnail 거부를 설정한 경우
	}
	else if (KakaoGame::Data::KGTResult::ExceedDailyUsage == result.code)
	{
		// 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생image
			player.kakaoProfile.thumbnailImageUrl;
			// Check if the recipient has a withdrawal history. Use this flag to display withdrawal information in the UI.
			player.kakaoProfile.isUnregistered;
		}
	}
	else if (KakaoGame::Data::KGTResult::ExceedMonthlyUsageNotKakaoTalkUser == result.code)
	{
		// 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 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

발췌문 삽입
KS4GFC:EN_카카오 연동 기능 SDK 예제KS4GFC:EN_카카오 연동 기능 SDK 예제Kakao Integration Feature SDK Example
Kakao Integration Feature SDK Example
namekakao_talkinvitation_addreceivers_plus_friendcount
nopaneltrue
동기식 예제

Synchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// [TODO] Set 채널the Idevent 설정ID
intint32 channelIdeventId = 0;

KakaoGame::Data::KGTResult result;
int32 totalReceiversCount;
int32 joinersCount;
KakaoGame::API::KGTKakaoTalkKGTKakaoInvitation kakaotalkApikakaoInvitationApi;

kakaotalkApi.addChannel(channelId// Retrieve the count of players I invited
kakaoInvitationApi.receiversCount(eventId, result, totalReceiversCount, joinersCount);

if (result.isSuccess())
{
	// 채널 추가 성공
{
	// Successfully retrieved the counts
    // totalReceiversCount - Total number of friends
    // joinersCount - Number of friends who joined the game
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
	// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우.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
}

비동기식 예제Asynchronous Example

코드 블럭
languagecpp
#include "KakaoGameLib.h"

// [TODO] 채널Set the Idevent 설정ID
intint32 channelIdeventId = 0;

KakaoGame::API::KGTKakaoTalkKGTKakaoInvitation kakaotalkApi;

kakaotalkApi.addChannel(channelIdkakaoInvitationApi;

// Retrieve the count of players I invited
kakaoInvitationApi.receiversCount(eventId, [this](KakaoGame::Data::KGTResult result, int32_t totalReceiversCount, int32_t joinersCount) {
	if (result.isSuccess())
	{
		// 채널 추가 성공 Successfully retrieved the counts
		// totalReceiversCount - Total number of friends
		// joinersCount - Number of friends who joined the game
	}
	else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
	{
		// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우.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
	}
});