Estatísticas de jogador

Estatísticas de jogador

Registre contadores e recordes pessoais de cada jogador.

Começar grátis

Estatísticas de jogador

Registre contadores e recordes pessoais de cada jogador.

SDKs e REST

Integre Unity, Godot ou Unreal ou use a interface REST.

Painel do projeto

Configure cada função e gerencie seus dados atuais no projeto.

Integração rápida

Integração rápida

Estatísticas de jogador
Vídeo em breve

Regista rondas, eliminações e recordes num lote de sessão, com soma, máximo, mínimo ou último valor.

Integração rápida
Unity (C#)
using UnityEngine;
using PM.horizOn.Cloud.Manager;
using PM.horizOn.Cloud.Objects.Network.Requests;

var manager = StatisticsManager.Instance;
var snapshot = await manager.GetStatistics();
if (snapshot == null) { Debug.LogWarning(manager.LastErrorCode); return; }
string pendingKey = "horizOn_statistics_pending_" + snapshot.userId;
var pending = PlayerPrefs.HasKey(pendingKey)
    ? JsonUtility.FromJson<UpdateStatisticsRequest>(PlayerPrefs.GetString(pendingKey))
    : new UpdateStatisticsRequest {
        userId = snapshot.userId, operationId = manager.CreateOperationId(),
        updates = new[] { new StatisticUpdate("kills", 3), new StatisticUpdate("best_score", 250) }
    };
string originalJson = JsonUtility.ToJson(pending);
PlayerPrefs.SetString(pendingKey, originalJson);
PlayerPrefs.Save();
var result = await manager.UpdateStatistics(pending.updates, pending.operationId);
if (result == null) {
    // Keep the saved ID and batch. Reconcile OPERATION_EXPIRED before a new logical report.
    Debug.LogWarning(manager.LastErrorCode);
    return;
}
// A late success for O1 must never acknowledge a newer pending O2.
if (PlayerPrefs.GetString(pendingKey, null) == originalJson) {
    PlayerPrefs.DeleteKey(pendingKey);
    PlayerPrefs.Save();
}
foreach (var counter in result.values) Debug.Log(counter.key + "=" + counter.value);

Estes exemplos usam o SDK do Unity (C#) e a API REST. Godot e Unreal têm as mesmas chamadas nos seus próprios SDKs: veja o quickstart

Perguntas frequentes

Perguntas frequentes

Pronto para integrar?

Comece a construir com o horizOn hoje. Tier gratuito incluído.