GameJolt SDK

API 整合流程

  1. Add Game
  2. Game API > API Settings > Game ID & Private Key
  3. User Name & Game Token
  4. Download and import Unity API v2
  5. Edit > Project Settings > Game Jolt API
  6. 填寫&勾選所有設定值
  7. 將 Plugins/GameJolt/Prefabs/GameJoltAPI 拖曳至場景
  8. 新增排行榜分數的範例語法片段
public void AddScore (int score) {
    bool isSignedIn = GameJolt.API.Manager.Instance.CurrentUser != null;

    int scoreValue = score;
    string scoreText = scoreValue.ToString ();
    int tableID = #####; // your score table id
    string extraData = "";

    if (isSignedIn) {
        GameJolt.API.Scores.Add (scoreValue, scoreText, tableID, extraData, (bool success) => {
            Debug.Log ("Player score added!");
        });
    } else {
        string guestName = "Guest";
        GameJolt.API.Scores.Add(scoreValue, scoreText, guestName, tableID, extraData, (bool success) => {
            Debug.Log ("Guest score added!");
        });
    }
}

Ref: GameJolt Unity API Tutorial

results matching ""

    No results matching ""