...
코드 블럭 |
---|
|
#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;
bool isLoggedIn = playerApi.isLoggedIn();
if (isLoggedIn)
{
// Get the current Player ID issued by the platform
KakaoGame::Data::KGTPlayer player;
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] 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, informnotify the user thatof the start failed duenetwork issue and the failure to networkstart, issuesthen and retry
}
else
{
// [TODO] ForIf other errors occur, notify the user of the error and request a retry of the start. - If the issue persists, check the error code and logs to identifydetermine the cause.
}
}
}); |
Login
...
발췌문 삽입 |
---|
| EN_Login SDK Example |
---|
| EN_Login SDK Example |
---|
name | login |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#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 login is successful, proceed to the game screen.
}
else
{
// IDP login or platform login failed
// [TODO] In case of login failure, notify the user and 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 of the network issue and the retry.failure to start, then retry
}
else if (KakaoGame::Data::KGTResultCode::Forbidden == result.code)
{
// [TODO] During the CBT period, authentication may not be possible for users who are not permitted. Notify the user accordingly.
}
else if (KakaoGame::Data::KGTResultCode::UserCanceled == result.code)
{
// [TODO] If the user cancels during the login process, maintain the login screen.
}
else
{
// [TODO] In case ofIf other errors occur, notify the user of the error and request a retry of the login processstart. - Check If the issue persists, check the error codescode and logs to identifydetermine the cause.
}
} |
Asynchronous Example
코드 블럭 |
---|
|
#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] MoveSince login is successful, proceed to the game screen after successful login.
}
else
{
// IDP login or platform login failed
// [TODO] After notifying the user of the login failure, retry the login.
if (KakaoGame::Data::KGTResultCode::NetworkFailure == result.code
|| KakaoGame::Data::KGTResultCode::ServerTimeout == result.code
|| KakaoGame::Data::KGTResultCode::ConnectionFailed == result.code)
{
// [TODO] InIf casea ofnetwork aerror network erroroccurs, notify the user of the network issue that causedand the startfailure to failstart, andthen 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] If the user cancels during the login process, keepmaintain the login screen.
}
else
{
// [TODO] ForIf other errors occur, provide annotify the user of the error notification and promptrequest thea userretry toof retrythe loginstart. - After checking If the issue persists, check the error code and logs, to identifydetermine the cause.
}
}
}); |
Logging in Using a Square Token
...
코드 블럭 |
---|
|
#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] MoveSince tologin theis gamesuccessful, screenproceed asto the logingame is successfulscreen.
}
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, informnotify the user of the network issue and request a the failure to start, then retry.
}
else
{
// [TODO] If other errors occur, informnotify the user and of the error and request a retry of the start. - Check If the issue persists, check the error code and logs to identifydetermine the cause if the problem persists.
}
} |
Asynchronous Example
코드 블럭 |
---|
|
#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; // 플랫폼에서 발급한 현재 Player의 ID The current Player's ID issued by the platform
std::wstring accessToken = playerApi.getAccessToken(); // 플랫폼Platform access 액세스token 토큰(AccessToken)
// [TODO] 로그인이 성공하였으므로 게임 화면으로 이동합니다Since login is 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 of the network issue and the failure to start, then retry.
}
else
{
// [TODO] 나머지If 에러가other 발생한errors 경우에는occur, 에러notify 안내the 후user 로그인of 재시도the 요청error 하여야and 합니다.request - 에러코드 및 로그 확인 후 원인 파악이 필요합니다a retry of the start. - If the issue persists, check the error code and logs to determine the cause.
}
}
}); |
...
Logout
...
발췌문 삽입 |
---|
| EN_Logout SDK Example |
---|
| EN_Logout SDK Example |
---|
name | logout |
---|
nopanel | true |
---|
|
...
Logging Out Without Using the Default Logout UI
발췌문 삽입 |
---|
| EN_Logout SDK Example |
---|
| EN_Logout SDK Example |
---|
name | logout_custom |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;
playerApi.logout(GetSafeHwnd(), false, result);
if (result.isSuccess())
{
// 로그아웃Logout 성공successful
// [TODO] Return to 시작the 화면으로start 돌아가기screen
}
else
{
// 로그아웃Logout 실패failed
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTPlayer playerApi;
playerApi.logout(GetSafeHwnd(), false, [this](KakaoGame::Data::KGTResult result) {
if (result.isSuccess())
{
// 로그아웃Logout 성공successful
// [TODO] Return 시작to the 화면으로start 돌아가기screen
}
else
{
// 로그아웃Logout 실패failed
}
}); |
...
Unregistration
...
발췌문 삽입 |
---|
| 탈퇴 SDK 예제 |
---|
| 탈퇴 SDK 예제 |
---|
name | unregister |
---|
nopanel | true |
---|
|
...
Unregistering Without Using the Default Unregistration UI
발췌문 삽입 |
---|
| 탈퇴 SDK 예제 |
---|
| 탈퇴 SDK 예제 |
---|
name | unregister_custom |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;
playerApi.unregister(GetSafeHwnd(), false, result);
if (result.isSuccess())
{
// 탈퇴Unregistration 성공successful
// [TODO] Return to 시작the 화면으로start 돌아가기screen
}
else
{
// 탈퇴Unregistration 실패failed
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTPlayer playerApi;
playerApi.unregister(GetSafeHwnd(), false, [this](KakaoGame::Data::KGTResult result) {
if (result.isSuccess())
{
// 탈퇴Unregistration 성공successful
// [TODO] Return 시작to the 화면으로start 돌아가기screen
}
else
{
// 탈퇴Unregistration 실패failed
}
}); |
...
Account Linking
...
발췌문 삽입 |
---|
| EN_Account Linking SDK Example |
---|
| EN_Account Linking SDK Example |
---|
name | connect |
---|
nopanel | true |
---|
|
...
Linking Accounts Without Using the Default Account Linking UI
발췌문 삽입 |
---|
| EN_Account Linking SDK Example |
---|
| EN_Account Linking SDK Example |
---|
name | connect_custom |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// 연결하고자Set 하는the idpCode to 셋팅connect to
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTIdpCode::Kakao;
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTPlayer playerApi;
playerApi.connect(GetSafeHwnd(), idpCode, result);
if (result.isSuccess())
{
// 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 idp가to 아닌the 경우account
}
else if (KakaoGame::Data::KGTResultCode::AlreadyUsedIDPAccount == result.code)
{
// The account 이미is 연결되어already 있는linked 계정이to 있는another 경우IDP
}
else
{
// 기타Other 에러errors 발생occurred
}
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// 연결하고자Set 하는the idpCode to 셋팅connect to
KakaoGame::Data::KGTIdpCode idpCode = KakaoGame::Data::KGTIdpCode::Kakao;
KakaoGame::API::KGTPlayer playerApi;
playerApi.connect(GetSafeHwnd(), idpCode, [this](KakaoGame::Data::KGTResult result) {
if (result.isSuccess())
{
// 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 idp가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
발췌문 삽입 |
---|
| EN_Profile SDK Example |
---|
| EN_Profile SDK Example |
---|
name | player_currentPlayer |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;
playerApi.getCurrentPlayer(player); |
...
Retrieve My IDP
...
Information
발췌문 삽입 |
---|
| EN_Profile SDK Example |
---|
| EN_Profile SDK Example |
---|
name | player_idpProfile |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTPlayer player;
KakaoGame::API::KGTPlayer playerApi;
playerApi.getCurrentPlayer(player);
player.kakaoProfile; |
시스템 정보
...
System Information
...
Retrieve Language Code
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_language_code |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring languageCode = systemApi.getLanguageCode(); |
...
Retrieve Language Tag
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_language_tag |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring languageCode = systemApi.getLanguageTag(); |
...
Retrieve Country Code
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_country_code |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring countryCode = systemApi.getCountryCode(); |
...
Retrieve IP-based Country Code
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_geo_country_code |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring countryCode = systemApi.getGeoCountryCode(); |
...
Retrieve Device ID
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_device_id |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring deviceId = systemApi.getDeviceId(); |
...
Retrieve Device Model
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_device_model |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring deviceModel = systemApi.getDeviceModel(); |
Retrieve OS
...
Name
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_os_name |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring osName = systemApi.getOSName(); |
...
Retrieve Network Connection Status
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_is_network_connected |
---|
nopanel | true |
---|
|
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
boolean networkConnected = systemApi.isNetworkConnected(); |
...
Retrieve Connected Network Type
발췌문 삽입 |
---|
| EN_System Information SDK Example |
---|
| EN_System Information SDK Example |
---|
name | system_network_type |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTSystem systemApi;
std::wstring gameLanguageCode = systemApi.getGameLanguageCode(); |
게임 언어 코드 설정하기
게임에서 사용하는 언어를 플랫폼에서 동기화 해서 사용하도록 설정한다.
아래와 같은 언어 코드를 지원한다.
(Start API 호출 이전에 설정 가능)
...
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)
코드 블럭 |
---|
|
#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
발췌문 삽입 |
---|
| EN_Kakao Integration Feature SDK Example |
---|
| EN_Kakao Integration Feature SDK Example |
---|
name | kakao_talk_show_setting |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
bool isAlloweMe;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기 Show the view to set whether to receive KakaoTalk game messages
kakaotalkApi.showSetting(GetSafeHwnd(), result, isAlloweMe);
if (result.isSuccess())
{
// 카카오톡Successfully 게임set 메시지whether 수신to 여부receive 설정KakaoTalk 성공game messages
isAlloweMe; // Indicates 설정된whether 메시지receiving 수신messages 허용is 여부allowed
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우 The logged-in user is not a 'KakaoTalk' user. This occurs when the user is not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// Failed to 카카오톡set 게임whether 메시지to 수신receive 여부KakaoTalk 설정game 실패messages
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 카카오톡 게임 메시지 수신 여부 설정 뷰 띄우기 Show the view to set whether to receive KakaoTalk game messages
kakaotalkApi.showSetting(GetSafeHwnd(), [this](KakaoGame::Data::KGTResult result, bool isAlloweMe) {
if (result.isSuccess())
{
// Successfully 카카오톡set 게임whether 메시지to 수신receive 여부KakaoTalk 설정game 성공messages
isAlloweMe; // 설정된Indicates whether 메시지receiving 수신messages 허용is 여부allowed
}
else if (KakaoGame::Data::KGTResult::NotKakaoTalkUser == result.code)
{
// 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우NotKakaoTalkUser == result.code)
{
// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 카카오톡 게임 메시지 수신 여부 설정 실패Failed to set whether to receive KakaoTalk game messages
}
}); |
...
Retrieving KakaoTalk Profile
발췌문 삽입 |
---|
| EN_Kakao Integration Feature SDK Example |
---|
| EN_Kakao Integration Feature SDK Example |
---|
name | kakao_talk_talk_profile |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
KakaoGame::Data::KGTKakaoTalkProfile profile;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 카카오톡Retrieve 프로필KakaoTalk 조회하기profile
kakaotalkApi.talkProfile(result, 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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 카카오톡Failed to 프로필retrieve 조회KakaoTalk 실패profile
} |
Asynchronous Example
코드 블럭 |
---|
|
#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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 카카오톡Failed to 프로필retrieve 조회KakaoTalk 실패profile
}
}); |
...
Retrieving KakaoTalk Game Friend List
발췌문 삽입 |
---|
| EN_Kakao Integration Feature SDK Example |
---|
| EN_Kakao Integration Feature SDK Example |
---|
name | kakao_talk_friends |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::Data::KGTResult result;
std::vector<KakaoGame::Data::KGTPlayer> players;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 카카오톡Failed to 프로필retrieve 조회KakaoTalk 실패profile
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 카카오톡Failed to 게임retrieve 친구KakaoTalk 목록game 조회friends 실패list
}
}); |
...
Sending KakaoTalk Game Messages
발췌문 삽입 |
---|
| EN_Kakao Integration Feature SDK Example |
---|
| EN_Kakao Integration Feature SDK Example |
---|
name | kakao_talk_send_game_message |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// friendsFriend object API를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::Data::KGTResult result;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
// 카카오톡Send a 게임KakaoTalk 메시지game 보내기message
kakaotalkApi.sendGameMessage(kakaoProfile, templateId, arguments, result);
if (result.isSuccess())
{
// 카카오톡Successfully 채팅sent 메시지KakaoTalk 보내기chat 성공message
}
else if (KakaoGame::Data::KGTResult::MessageSettingDisabled == result.code)
{
// 받은이가 메시지 수신 거부를 설정한 경우 The recipient has set message reception to "Do Not Disturb"
}
else if (KakaoGame::Data::KGTResult::ExceedDailyUsage == result.code)
{
// 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생Occurs when the daily quota for sending messages from a specific app (regardless of recipient) is exceeded
}
else if (KakaoGame::Data::KGTResult::ExceedMonthlyUsage == result.code)
{
// 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 Occurs when the monthly quota for sending messages to a specific person from a specific app is exceeded
}
else
{
// Failed 카카오톡to 채팅send 메시지KakaoTalk 보내기chat 실패message
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// Friend friendsobject API를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.sendGameMessage(kakaoProfile, templateId, arguments, [this](KakaoGame::Data::KGTResult result) {
if (result.isSuccess())
{
// 카카오톡Successfully 채팅sent 메시지KakaoTalk 보내기chat 성공message
}
else if (KakaoGame::Data::KGTResult::MessageSettingDisabled == result.code)
{
// 받은이가 메시지 수신 거부를 설정한 경우The recipient has set message reception to "Do Not Disturb"
}
else if (KakaoGame::Data::KGTResult::ExceedDailyUsage == result.code)
{
// 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생Occurs when the daily quota for sending messages from a specific app (regardless of recipient) is exceeded
}
else if (KakaoGame::Data::KGTResult::ExceedMonthlyUsage == result.code)
{
// 한명이 특정 앱에 대해 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생 Occurs when the monthly quota for sending messages to a specific person from a specific app is exceeded
}
else
{
// 카카오톡Failed to 채팅send 메시지KakaoTalk 보내기chat 실패message
}
}); |
...
Adding a KakaoTalk Channel
발췌문 삽입 |
---|
| EN_Kakao Integration Feature SDK Example |
---|
| EN_Kakao Integration Feature SDK Example |
---|
name | kakao_talk_add_plus_friend |
---|
nopanel | true |
---|
|
...
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// [TODO] 채널Set the channel Id
설정
int channelId = 0;
KakaoGame::Data::KGTResult result;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
kakaotalkApi.addChannel(channelId, result);
if (result.isSuccess())
{
// Successfully 채널added 추가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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// 채널 추가 실패Failed to add the channel
} |
Asynchronous Example
코드 블럭 |
---|
|
#include "KakaoGameLib.h"
// [TODO] Set the 채널channel Id
설정
int channelId = 0;
KakaoGame::API::KGTKakaoTalk kakaotalkApi;
kakaotalkApi.addChannel(channelId, [this](KakaoGame::Data::KGTResult result, int32_t totalReceiversCount, int32_t joinersCount) {
if (result.isSuccess())
{
// Successfully 채널added 추가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 not a KakaoTalk user, such as an account that is only registered with Kakao Story.
}
else
{
// Failed to 채널add 추가the 실패channel
}
}); |