...
코드 블럭 | ||
---|---|---|
| ||
#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, 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. } } }); |
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.
코드 블럭 | ||
---|---|---|
| ||
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
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
코드 블럭 | ||
---|---|---|
| ||
#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
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
Unregistering Without Using the Default Unregistration UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...