버전 비교

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

...

코드 블럭
// Whether or not the user is logged into Google Game
boolean isLoggedIn = KGGoogleGames.isLoggedIn();

Unreal

코드 블럭
#include "KakaoGame.h"
  
// Whether or not the user is logged into Google Game
bool isLoggedIn = FKGGoogleGames::IsLoggedIn();

31.1.2. Google game login

...

코드 블럭
KGGoogleGames.login(activity, new KGResultCallback<Void>() {
    @Override
    public void onResult(KGResult<Void> result) {
        if (result.isSuccess()) {
            // Login successful
        } else {
            // Login failed
        }
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
FKGGoogleGames::Login(FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // Login successful
  }
  else
  {
    // Login failed
  }
}));

31.1.3. Google game logout

...

코드 블럭
KGGoogleGames.logout(new KGResultCallback<Void>() {
    @Override
    public void onResult(KGResult<Void> result) {
        if (result.isSuccess()) {
            // Logout successful
        } else {
            // Logout failed
        }
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
 
FKGGoogleGames::Logout(FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // Logout successful
  }
  else
  {
    // Logout failed
  }
}));

31.1.4. Complete achievements

...

코드 블럭
String id; // Achievement ID
KGGoogleGamesAchievements.unlock(id);

Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT(""); // Achievement ID
FKGGoogleGamesAchievements::Unlock(id);

31.1.5. Display achievements

...

코드 블럭
String id; // Achievement ID
KGGoogleGamesAchievements.reveal(id);

Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT(""); // Achievement ID
FKGGoogleGamesAchievements::Reveal(id);

31.1.6. Incremental achievements

...

코드 블럭
String id; // Achievement ID
int numSteps; // The value of the level to be increased
 
// Achievements increased
KGGoogleGamesAchievements.increment(id, numSteps);

Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT(""); // Achievement ID
int32 numSteps = 20; // The value of the level to be increased
 
// Achievements increased
FKGGoogleGamesAchievements::Increment(id, numSteps);

31.1.7. Set achievement completion level

...

코드 블럭
String id; // Achievement ID
int numSteps; // The value of the level to be increased
 
// Set steps completed.
KGGoogleGamesAchievements.setSteps(id, numSteps);

Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT(""); // Achievement ID
int32 numSteps = 20; // The value of the level to be increased
 
// Set steps completed.
FKGGoogleGamesAchievements::SetSteps(id, numSteps);

31.1.8. Show the Achievements screen

...

코드 블럭
// Show the Google Game Achievements screen
KGGoogleGamesAchievements.showAchievementView(activity);

Unreal

코드 블럭
#include "KakaoGame.h"
  
// Show the Google Game Achievements screen
FKGGoogleGamesAchievements::ShowAchievementView();

31.1.9. Set a score in the Leaderboard

...

코드 블럭
String id; // Leaderboard Id
int score; // score
  
// Set a score in Google Game Leaderboard
KGGoogleGamesLeaderboards.submitScore(id, 100, "Stage1");

 Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT("CgkI8vSF8d4YEAIQBg"); // Leaderboard Id
int64 score = 100;                       // score
FString tag = TEXT("");                  // tag
 
FKGGoogleGamesLeaderboards::SubmitScore(id, score, tag);

31.1.10. Show the Leaderboard screen

...

코드 블럭
String id; // Leaderboard Id
// Ranking period
// NONE(Not setting), DAILY (daily), WEEKELY (weekly), ALL_TIME (all) 
KGTimeSpan span = KGGoogleGamesLeaderboards.KGTimeSpan.WEEKLY;
  
// Show the Google Game Leaderboard screen
KGGoogleGamesLeaderboards.showLeaderboardView(activity, id, span);

Unreal

코드 블럭
#include "KakaoGame.h"
  
FString id = TEXT("CgkI8vSF8d4YEAIQBg"); // Leaderboard Id
// Ranking period
// NONE(Not setting), 0 (Daily), 1 (Weekly), 2 (All)
int32 timeSpan = -1;
 
// Show the Google Game Leaderboard screen
FKGGoogleGamesLeaderboards::ShowLeaderboardView(id, timeSpan);