
Statistiques joueur
Enregistrez les compteurs et records personnels de chaque joueur.
Statistiques joueur
Enregistrez les compteurs et records personnels de chaque joueur.
SDK et REST
Intégrez Unity, Godot ou Unreal, ou utilisez l’interface REST.
Tableau de bord du projet
Configurez chaque fonction et gérez ses données actuelles dans votre projet.
Intégration rapide
Statistiques joueur
Vidéo bientôt disponible
Suivez manches, éliminations et records par lot de session, avec somme, maximum, minimum ou dernière valeur.
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);Ces exemples utilisent le SDK Unity (C#) et l'API REST. Godot et Unreal ont les mêmes appels dans leurs propres SDK : voir le démarrage rapide
Questions fréquentes
Prêt à intégrer ?
Commencez à construire avec horizOn dès aujourd'hui. Tier gratuit inclus.
