버전 비교

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

...

Initialization and Status Change Event Processing

...

SDK Initialization

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_init_sdk
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

KGTApplication.InitSDK();

Start

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_start
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

KGTApplication.Start((result) =>
{
    if (result.IsSuccess)
    {
        // Start successful
        if (KGTPlayer.IsLoggedIn) 
        {
            // Auto login successful
            // The current Player's ID issued by the platform
            string playerId = KGTPlayer.CurrentPlayer.PlayerId;
            // Platform access token
            string accessToken = KGTPlayer.AccessToken;
            // Retrieve the current IDP authentication information
            var idpProfile = KGTPlayer.CurrentPlayer.IdpProfile;
            // [TODO] Log in to the game server and proceed to the game screen
        } 
        else 
        {
            // No auto login information, call the login API
        }
    }
    else 
    {
        if (result.code == KGTResultCode.NetworkFailure ||
            result.code == KGTResultCode.ServerTimeout ||
            result.code == KGTResultCode.ServerConnectionFailed) 
        {
            // [TODO] In case of a network error, notify the user that the start failed due to network issues and retry
        } 
        else 
        {
            // [TODO] Notify the user that an error occurred. It would be helpful to include the error code in the message for tracking the cause.
        }
    }
});

Pause

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_pause
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

// Implement in the background transition function of appDelegate
// [Note] Implement in OnApplicationPause.
// [Note] Do not implement in OnApplicationFocus.
void OnApplicationPause(bool paused) {
    // Method to be executed when the game moves to the background
    // The Pause API always returns success.
    // Therefore, you do not need to check the result separately in the game.
    if (paused)
    {
        KGTApplication.Pause((result) => {});
    }
}

Resume

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_resume
nopaneltrue

...

Setting Up Auto Login in a Windows Environment

발췌문 삽입
EN_Initialization and Status Change Event Processing SDK ExampleEN_
Initialization and Status Change Event Processing SDK Example
nameapplication_set_use_auto_login
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

// 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, the next time KGTApplication starts, auto-login will proceed automatically. To remove the auto-login information, you must log out.
bool useAutoLogin = true;
KGTApplication.UseAutoLogin = useAutoLogin;

Login

...

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

Logging In Without Using the Default Login UI

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

...

Logging In Through the Launcher

발췌문 삽입
EN_Login SDK ExampleEN_
Login SDK Example
namelogin_with_bridge_token
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

// The bridgeToken received through the launcher
string bridgeToken = "";

KGTPlayer.LoginWithBridgeToken(bridgeToken, (result) =>
{
    if (result.IsSuccess) 
    {
        // Handle successful login.
        // The current Player's ID issued by the platform
        string playerId = KGTPlayer.CurrentPlayer.PlayerId;
        // Platform access token
        string accessToken = KGTPlayer.AccessToken;
        // Retrieve the current IDP authentication information
        var idpProfile = KGTPlayer.CurrentPlayer.IdpProfile;
        // [TODO] Log in to the game server and proceed to the game screen
    } 
    else 
    {
        // Handle login failure.
        if (result.code == KGTResultCode.NetworkFailure ||
            result.code == KGTResultCode.ServerTimeout ||
            result.code == KGTResultCode.ServerConnectionFailed) 
        {
            // [TODO] If a network error occurs, prompt the user to retry logging in.
        } 
        else if (result.code == KGTResultCode.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 (result.code == KGTResultCode.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

...

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

Logging Out Without Using the Default Logout UI

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

코드 블럭
languagec#
using KakaoGame.API;

KGTPlayer.Logout(false, (result) =>
{
    if (result.IsSuccess) 
    {
        // Logout successful
        // [TODO] Return to the start screen
    } 
    else 
    {
        // Logout failed
    }
});

Unregistration

...

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

Unregistering Without Using the Default Unregistration UI

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

코드 블럭
languagec#
using KakaoGame.API;

KGTPlayer.Unregister(false, (result) =>
{
    if (result.IsSuccess) 
    {
        // Unregistration successful
        // [TODO] Return to the start screen
    } 
    else 
    {
        // Unregistration failed
    }
});

Account Linking

...

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

Linking Accounts Without Using the Default Account Linking UI

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

...

Retrieve My Information

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

...

Retrieve My IDP Information

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

...

Retrieve Language Code

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

...

Retrieve Country Code

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

...

Retrieve IP-based Country Code

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

코드 블럭
languagec#
using KakaoGame.API;

string geoCountryCode = KGTSystem.GeoCountryCode;

Retrieve Device ID

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

...

Retrieve Device Model

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

코드 블럭
languagec#
using KakaoGame.API;

string deviceModel = KGTSystem.DeviceModel;

Retrieve OS Name

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

...

Retrieve Network Connection Status

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

...

Retrieve Connected Network Type

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

코드 블럭
languagec#
using KakaoGame.API;

string networkType = KGTSystem.NetworkType;

...

Kakao Integration Feature

...

Setting Up KakaoTalk Game Message Reception

발췌문 삽입
EN_System Information Kakao Integration Feature SDK ExampleEN_System Information
Kakao Integration Feature SDK Example
namesystemkakao_gametalk_languageshow_codesetting
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

KGTKakaoTalk.ShowSetting((result) => 
{
string   gameLanguageCode =if KGTSystem.GameLanguageCode;

Set Game Language Code

...

코드 블럭
languagec#
using KakaoGame.API;

var languageCode = KGTLanguageCode.Device;
KGTSystem.SetGameLanguageCode(languageCode);

Kakao Integration Feature

Setting Up KakaoTalk Game Message Reception

...

코드 블럭
languagec#
using KakaoGame.API;

KGTKakaoTalk.ShowSetting((result) =>(result.IsSuccess) 
    {
        // Successfully set the KakaoTalk game message reception settings
    }
    else if (result.code == KGTResultCode.NotKakaoTalkUser)
    {
    if (result.IsSuccess)   // The  {
        // Successfully set the KakaoTalk game message reception settings
    }
    else if (result.code == KGTResultCode.NotKakaoTalkUser)
    {
        // The logged-in 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

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

...

Retrieve KakaoTalk Game Friend List

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

...

Sending KakaoTalk Game Messages

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

...

Sending KakaoTalk Friend Invitation Messages

발췌문 삽입
EN_Kakao Integration Feature SDK ExampleEN_
Kakao Integration Feature SDK Example
namekakao_talk_send_invite_message
nopaneltrue

코드 블럭
languagec#
using KakaoGame.API;

// [TODO] Set whether to display as a popup window
bool isSingle;

// [TODO] Set whether to display as a popup window
bool isPopup;
  
// [TODO] Set the template Id
string templateId;
  
// [TODO] Set the arguments for the message template
Dictionary<string, object> argumentDic = new Dictionary<string, object>();

KGTKakaoTalk.SendInviteMessage(isSingle, isPopup, templateId, argumentDic, (result) =>
{
    if (result.IsSuccess) 
    {
        // Request successful
    }
    else
    {
        // Request failed
        if (result.code == KGTResultCode.MessageSettingDisabled)
        {
            // The recipient has set message reception to be disabled.
        }
        else if (result.code == KGTResultCode.ExceedDailyUsage)
        {
            // Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded.
        }
        else if (result.code == KGTResultCode.ExceedMonthlyUsage)
        {
            // Occurs when the monthly quota for sending messages to a specific person for a specific app is exceeded.
        }
        else if (result.code == KGTResultCode.NotKakaoTalkUser)
        {
            // The logged-in user is not a 'KakaoTalk' user.
        }
        else
        {
            // Other errors
        }
    }
});

Adding a KakaoTalk Channel

...

코드 블럭
languagec#
using KakaoGame.API;

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

KGTKakaoTalk.AddChannel(channelId, (result) => 
{
    if (result.IsSuccess) 
    {
        // Successfully added friend
    }
    else if (result.code == KGTResultCode.NotKakaoTalkUser)
    {
        // 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 friend
    }
});

Google Games

Show Achievement Screen

...

코드 블럭
languagec#
using KakaoGame.API;

KGTGoogleGamesAchievements.ShowAchievementView();

Achievement Unlocked

...

코드 블럭
languagec#
using KakaoGame.API;

// [TODO] Set the achievement ID
var id = "";

KGTGoogleGamesAchievements.Unlock(id);

Display Achievement

...


        {
            // Other errors
        }
    }
});

Adding a KakaoTalk Channel

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

코드 블럭
languagec#
using KakaoGame.API;

// [TODO] Set the achievement ID
var id = "";

KGTGoogleGamesAchievements.Reveal(id);

Increase Achievement Level

...

코드 블럭
languagec#
using KakaoGame.API;

// [TODO] Set the achievement ID
var id = "";
var numSteps = 0;

KGTGoogleGamesAchievements.SetSteps(id, numSteps);

Set Achievement Level

...

코드 블럭
languagec#
using KakaoGame.API;

// [TODO] Set the achievement ID
var id = "";
var numSteps = 0;

KGTGoogleGamesAchievements.Increment(id, numStepsusing KakaoGame.API;

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

KGTKakaoTalk.AddChannel(channelId, (result) => 
{
    if (result.IsSuccess) 
    {
        // Successfully added friend
    }
    else if (result.code == KGTResultCode.NotKakaoTalkUser)
    {
        // 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 friend
    }
});