app.hypergames.hypersdk 1.8.10 → 1.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.8.11](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.10...v1.8.11) (2026-04-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * normalize score ordering and prevent duplicate final score delta ([ad47380](https://github.com/mvmhyper/hyper-sdk/commit/ad47380e7af6d3c6323a53732bc56d2c0fd545fa))
7
+
1
8
  ## [1.8.10](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.9...v1.8.10) (2026-04-22)
2
9
 
3
10
 
@@ -928,24 +928,6 @@ namespace Hyper.Internal.Managers
928
928
  yield break;
929
929
  }
930
930
 
931
- var finalScoreData = _dataManager?.CurrentScoreData;
932
- finalScoreData.isFinal = true;
933
-
934
- // For consistency with per-second and backlog submissions, always send
935
- // the final score as an array of ScoreData.
936
- var finalScoreList = new List<ScoreData>(1) { finalScoreData };
937
- string rawScoreJson = JsonConvert.SerializeObject(finalScoreList);
938
- var compressedScoreData = JsonCompressor.CompressJson(rawScoreJson);
939
- string scoreJson = compressedScoreData.MinifiedJson;
940
- string encryptedScoreData = EncryptScore(scoreJson);
941
-
942
- if (string.IsNullOrEmpty(encryptedScoreData))
943
- {
944
- LastSubmissionError = SubmissionErrorType.EncryptionError;
945
- HyperDebug.LogError("Encryption failed [ENCRYPTION_ERROR]");
946
- yield break;
947
- }
948
-
949
931
  // Reset gameResumed flag for this attempt
950
932
  _gameResumed = false;
951
933
 
@@ -1042,6 +1024,39 @@ namespace Hyper.Internal.Managers
1042
1024
  _finalScoreSubmitted = false;
1043
1025
  _isWaitingForFinalScoreResponse = true;
1044
1026
 
1027
+ float currentScoreDataScoreTime = _dataManager.CurrentScoreData.cumulativeScore + _dataManager.CurrentScoreData.scoreSnapshot.scoreTime;
1028
+ float lastCapturedScoreDataScoreTime = _lastSentBatch.Last().cumulativeScore + _lastSentBatch.Last().scoreSnapshot.scoreTime;
1029
+ ScoreData finalScoreData;
1030
+
1031
+ if (currentScoreDataScoreTime > lastCapturedScoreDataScoreTime)
1032
+ {
1033
+ finalScoreData = _dataManager.CurrentScoreData;
1034
+ finalScoreData.isFinal = true;
1035
+ }
1036
+ else
1037
+ {
1038
+ finalScoreData = _lastSentBatch.Last();
1039
+ finalScoreData.isFinal = true;
1040
+ finalScoreData.timestampUtc = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
1041
+ finalScoreData.scoreSnapshot.scoreDelta = 0;
1042
+ finalScoreData.scoreSnapshot.gameplayModifiers = new GameplayModifiers();
1043
+ }
1044
+
1045
+ // For consistency with per-second and backlog submissions, always send
1046
+ // the final score as an array of ScoreData.
1047
+ var finalScoreList = new List<ScoreData>(1) { finalScoreData };
1048
+ string rawScoreJson = JsonConvert.SerializeObject(finalScoreList);
1049
+ var compressedScoreData = JsonCompressor.CompressJson(rawScoreJson);
1050
+ string scoreJson = compressedScoreData.MinifiedJson;
1051
+ string encryptedScoreData = EncryptScore(scoreJson);
1052
+
1053
+ if (string.IsNullOrEmpty(encryptedScoreData))
1054
+ {
1055
+ LastSubmissionError = SubmissionErrorType.EncryptionError;
1056
+ HyperDebug.LogError("Encryption failed [ENCRYPTION_ERROR]");
1057
+ yield break;
1058
+ }
1059
+
1045
1060
  _lastSentBatch.Clear();
1046
1061
  if (finalScoreData != null)
1047
1062
  {
@@ -1199,8 +1214,10 @@ namespace Hyper.Internal.Managers
1199
1214
  // Scores will be flushed when the connection is restored.
1200
1215
  if (!isSocketConnected)
1201
1216
  {
1217
+ #if UNITY_WEBGL && !UNITY_EDITOR
1202
1218
  int pendingCount = _dataManager?.PendingScores?.Count ?? 0;
1203
1219
  HyperDebug.Log($"[Score] Socket disconnected - accumulating scores for offline batch. PendingCount={pendingCount}");
1220
+ #endif
1204
1221
  _isWaitingForTokenLogEmitted = false;
1205
1222
  _hasLoggedWaitingForGameStartAck = false;
1206
1223
  yield return _scoreSendInterval;
@@ -66,7 +66,7 @@ namespace Hyper.Internal.Managers
66
66
 
67
67
  CurrentScoreData.cumulativeScore = CurrentScore;
68
68
  CurrentScoreData.timestampUtc = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
69
- CurrentScoreData.isFinal = true;
69
+ CurrentScoreData.isFinal = false;
70
70
 
71
71
  var snapshot = CurrentScoreData.scoreSnapshot;
72
72
  snapshot.scoreTime = currentGameSecond;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.8.10",
3
+ "version": "1.8.11",
4
4
  "displayName": "HyperSDK",
5
5
  "description": "Official Unity SDK for Hyper: multiplayer battles, leaderboards, deterministic RNG, session management, tutorials, and WebGL optimizations for production-ready games.",
6
6
  "unity": "6000.0",