app.hypergames.hypersdk 1.4.9 → 1.4.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,17 @@
1
+ ## [1.4.11](https://github.com/mvmhyper/hyper-sdk/compare/v1.4.10...v1.4.11) (2025-12-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bug fixes and reliability improvements ([4bc454b](https://github.com/mvmhyper/hyper-sdk/commit/4bc454b08dd61ae3300ab2272eac31789e81d3d0))
7
+
8
+ ## [1.4.10](https://github.com/mvmhyper/hyper-sdk/compare/v1.4.9...v1.4.10) (2025-12-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * follow up modal management changes ([a39dbaf](https://github.com/mvmhyper/hyper-sdk/commit/a39dbafa18e4c10dcaf20c22200ff2c2a3dca390))
14
+
1
15
  ## [1.4.9](https://github.com/mvmhyper/hyper-sdk/compare/v1.4.8...v1.4.9) (2025-12-16)
2
16
 
3
17
 
package/HyperLoader.unity CHANGED
@@ -304,7 +304,7 @@ RectTransform:
304
304
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
305
305
  m_AnchorMin: {x: 0, y: 1}
306
306
  m_AnchorMax: {x: 0, y: 1}
307
- m_AnchoredPosition: {x: 489.20746, y: -280.1698}
307
+ m_AnchoredPosition: {x: 489.112, y: -280.1698}
308
308
  m_SizeDelta: {x: 1044.9, y: 239.347}
309
309
  m_Pivot: {x: 0.5, y: 0.5}
310
310
  --- !u!114 &751153944
@@ -1092,7 +1092,7 @@ RectTransform:
1092
1092
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1093
1093
  m_AnchorMin: {x: 0, y: 1}
1094
1094
  m_AnchorMax: {x: 0, y: 1}
1095
- m_AnchoredPosition: {x: 489.20746, y: -133.2274}
1095
+ m_AnchoredPosition: {x: 489.112, y: -133.2274}
1096
1096
  m_SizeDelta: {x: 875, y: 54.5378}
1097
1097
  m_Pivot: {x: 0.5, y: 0.5}
1098
1098
  --- !u!1 &2874543288936963705
@@ -269,7 +269,9 @@ namespace Hyper.Internal.Managers
269
269
 
270
270
  private Coroutine _initWebSocketCoroutine;
271
271
  private Coroutine _sendGameStartedCoroutine;
272
+ private Coroutine _sendGameResumedCoroutine;
272
273
  private bool _gameStarted;
274
+ private bool _gameResumed;
273
275
  private bool _isManuallyClosed;
274
276
  private bool _isSocketErrorCalled;
275
277
 
@@ -334,18 +336,63 @@ namespace Hyper.Internal.Managers
334
336
 
335
337
  public void SendGameResumed()
336
338
  {
337
- var message = new
339
+ if (_sendGameResumedCoroutine == null)
338
340
  {
339
- @event = "resumeGame",
340
- data = new
341
+ _sendGameResumedCoroutine = StartCoroutine(SendGameResumedCoroutine());
342
+ }
343
+ }
344
+
345
+ private IEnumerator SendGameResumedCoroutine()
346
+ {
347
+ int attempts = 0;
348
+ const int maxAttempts = 3;
349
+
350
+ if (string.IsNullOrEmpty(_cachedSessionId))
351
+ {
352
+ HyperDebug.LogError("No valid session ID – cannot send resumeGame");
353
+ _sendGameResumedCoroutine = null;
354
+ yield break;
355
+ }
356
+
357
+ _gameResumed = false;
358
+
359
+ while (!_gameResumed && attempts < maxAttempts)
360
+ {
361
+ attempts++;
362
+
363
+ try
364
+ {
365
+ var message = new
366
+ {
367
+ @event = "resumeGame",
368
+ data = new
369
+ {
370
+ sessionId = _cachedSessionId,
371
+ userId = _gameManager?.Config.UserId
372
+ }
373
+ };
374
+
375
+ string json = JsonConvert.SerializeObject(message);
376
+ SendWebSocketMessage(json);
377
+ }
378
+ catch (Exception ex)
341
379
  {
342
- sessionId = _cachedSessionId,
343
- userId = _gameManager?.Config.UserId
380
+ HyperDebug.LogError($"SendGameResumed attempt {attempts} failed: {ex.Message}");
344
381
  }
345
- };
346
382
 
347
- string json = JsonConvert.SerializeObject(message);
348
- SendWebSocketMessage(json);
383
+ float elapsed = 0f;
384
+ const float timeout = 2f;
385
+
386
+ while (!_gameResumed && elapsed < timeout)
387
+ {
388
+ yield return null;
389
+ elapsed += Time.unscaledDeltaTime;
390
+ }
391
+ }
392
+
393
+ yield return new WaitForSecondsRealtime(2f);
394
+
395
+ _sendGameResumedCoroutine = null;
349
396
  }
350
397
 
351
398
  private IEnumerator SendGameStartedCoroutine()
@@ -356,6 +403,7 @@ namespace Hyper.Internal.Managers
356
403
  if (string.IsNullOrEmpty(_cachedSessionId))
357
404
  {
358
405
  HyperDebug.LogError("No valid session ID – cannot send startGame");
406
+ _sendGameStartedCoroutine = null;
359
407
  yield break;
360
408
  }
361
409
 
@@ -394,8 +442,11 @@ namespace Hyper.Internal.Managers
394
442
  }
395
443
 
396
444
  yield return new WaitForSecondsRealtime(2f);
445
+
446
+ _sendGameStartedCoroutine = null;
397
447
  }
398
448
 
449
+
399
450
  #endregion
400
451
 
401
452
  #region WebSocket Event Handlers
@@ -458,6 +509,14 @@ namespace Hyper.Internal.Managers
458
509
 
459
510
  public void OnSocketGameResumed(string message)
460
511
  {
512
+ _gameResumed = true;
513
+
514
+ if (_sendGameResumedCoroutine != null)
515
+ {
516
+ StopCoroutine(_sendGameResumedCoroutine);
517
+ _sendGameResumedCoroutine = null;
518
+ }
519
+
461
520
  TryUpdateCSRFToken(message);
462
521
  }
463
522
 
@@ -913,7 +972,7 @@ namespace Hyper.Internal.Managers
913
972
  if (_dataManager == null) _dataManager = HyperRuntime.DataManager;
914
973
  if (_eventManager == null) _eventManager = HyperRuntime.EventManager;
915
974
  if (_gameManager == null) _gameManager = HyperRuntime.GameManager;
916
-
975
+
917
976
  string eventName = eventType switch
918
977
  {
919
978
  ConsoleEventType.GameEnd => "GameEnd",
@@ -23,11 +23,13 @@ namespace Hyper.Internal.Managers
23
23
 
24
24
  private DataManager _dataManager;
25
25
  private EventManager _eventManager;
26
+ private BackendManager _backendManager;
26
27
 
27
28
  private void Awake()
28
29
  {
29
30
  _dataManager = HyperRuntime.DataManager;
30
31
  _eventManager = HyperRuntime.EventManager;
32
+ _backendManager = HyperRuntime.BackendManager;
31
33
  }
32
34
 
33
35
  internal void Initialize()
@@ -167,6 +169,11 @@ namespace Hyper.Internal.Managers
167
169
 
168
170
  internal void ResumeGame()
169
171
  {
172
+ if (_backendManager.isSocketConnected)
173
+ {
174
+ _backendManager.SendGameResumed();
175
+ }
176
+
170
177
  _isPaused = false;
171
178
 
172
179
  if (!_isFrozenBeforePause)
@@ -458,6 +465,7 @@ namespace Hyper.Internal.Managers
458
465
 
459
466
  if (HyperRuntime.GameContent.HasTransitionScene)
460
467
  {
468
+ HyperRuntime.GameManager.HidePauseModals();
461
469
  StartCoroutine(PracticeMenuLoadingCoroutine());
462
470
  }
463
471
  else
@@ -733,6 +741,7 @@ namespace Hyper.Internal.Managers
733
741
 
734
742
  string menuSceneName = HyperRuntime.GameContent.IsPracticeMenu ?
735
743
  HyperRuntime.GameContent.PracticeScene?.SceneName : null;
744
+
736
745
  string transitionSceneName = HyperRuntime.GameContent.TransitionScene?.SceneName;
737
746
 
738
747
  if ((!string.IsNullOrEmpty(menuSceneName) && scene.name.Equals(menuSceneName, StringComparison.OrdinalIgnoreCase)) ||
@@ -1326,6 +1335,8 @@ namespace Hyper.Internal.Managers
1326
1335
 
1327
1336
  private void ShowTimeUpModalInternal()
1328
1337
  {
1338
+ _hasGameEnded = true;
1339
+
1329
1340
  if (_timeUpModal == null)
1330
1341
  {
1331
1342
  EnsureTimeUpModal();
@@ -75,7 +75,7 @@ namespace Hyper.Internal
75
75
  }
76
76
  else
77
77
  {
78
- footerHLG.spacing = HyperRuntime.GameContent.IsPracticeMenu ? 375 : 158;
78
+ footerHLG.spacing = HyperRuntime.GameContent.IsPracticeMenu ? 375 : 338;
79
79
  }
80
80
  }
81
81
  }
@@ -38,7 +38,6 @@ mergeInto(LibraryManager.library, {
38
38
 
39
39
  MarkGameStartedOnHTML: function () {
40
40
  if (window.markGameStarted) {
41
- console.log("Called MarkGameStarted successfully");
42
41
  window.markGameStarted();
43
42
  } else {
44
43
  console.error("markGameStarted() not found!");
@@ -47,7 +46,6 @@ mergeInto(LibraryManager.library, {
47
46
 
48
47
  MarkGameLoadedOnHTML: function () {
49
48
  if (window.markGameLoaded) {
50
- console.log("Called MarkGameLoaded successfully");
51
49
  window.markGameLoaded();
52
50
  } else {
53
51
  console.error("markGameLoaded() not found!");
@@ -112,9 +110,9 @@ mergeInto(LibraryManager.library, {
112
110
  try {
113
111
  if (window.parent && window.parent !== window) {
114
112
  window.parent.postMessage(eventDataStr, "*");
115
- console.log("Stringified message sent to parent");
113
+ // console.log("Stringified message sent to parent");
116
114
  } else {
117
- console.log("No parent window found or same window");
115
+ // console.log("No parent window found or same window");
118
116
  }
119
117
  } catch (error) {
120
118
  console.error("Failed to send message to parent:", error);
@@ -126,7 +124,10 @@ mergeInto(LibraryManager.library, {
126
124
  // Run only on iOS-like browsers (Safari/Chrome on iOS share WebKit)
127
125
  var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) ||
128
126
  (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
129
- if (!iOS) { console.log('Unity: iOS inline video fix skipped (not iOS)'); return; }
127
+ if (!iOS) {
128
+ // console.log('Unity: iOS inline video fix skipped (not iOS)');
129
+ return;
130
+ }
130
131
 
131
132
  function fixVideo(v) {
132
133
  v.setAttribute('playsinline', '');
@@ -137,9 +138,9 @@ mergeInto(LibraryManager.library, {
137
138
  v.addEventListener('webkitbeginfullscreen', function (e) {
138
139
  e.preventDefault();
139
140
  try { e.stopImmediatePropagation(); } catch (_) { }
140
- console.log('Unity: Prevented iOS fullscreen');
141
+ // console.log('Unity: Prevented iOS fullscreen');
141
142
  }, true);
142
- console.log('Unity: configured video for iOS inline playback');
143
+ // console.log('Unity: configured video for iOS inline playback');
143
144
  }
144
145
 
145
146
  // Fix any existing videos
@@ -157,7 +158,7 @@ mergeInto(LibraryManager.library, {
157
158
  });
158
159
  });
159
160
  mo.observe(document.documentElement, { childList: true, subtree: true });
160
- console.log('Unity: iOS inline video fix registered');
161
+ // console.log('Unity: iOS inline video fix registered');
161
162
  } catch (err) {
162
163
  console.error('Unity: iOS inline video fix error', err);
163
164
  }
@@ -75,7 +75,7 @@ mergeInto(LibraryManager.library, {
75
75
  }
76
76
 
77
77
  window.socketInstance.emit(payload.event, payload.data, (ackResponse) => {
78
- console.log("[WebSocket] ACK received:", ackResponse);
78
+ // console.log("[WebSocket] ACK received:", ackResponse);
79
79
  try {
80
80
  const ackJson = JSON.stringify(ackResponse);
81
81
  SendMessage('HyperSDKSingleton', 'OnSocketMessage', ackJson);
@@ -1124,7 +1124,7 @@ MonoBehaviour:
1124
1124
  m_Name:
1125
1125
  m_EditorClassIdentifier:
1126
1126
  m_Material: {fileID: 0}
1127
- m_Color: {r: 0.30980393, g: 0.23921569, b: 0.7647059, a: 1}
1127
+ m_Color: {r: 0.30588236, g: 0.23529413, b: 0.7607844, a: 1}
1128
1128
  m_RaycastTarget: 1
1129
1129
  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
1130
1130
  m_Maskable: 1
@@ -688,7 +688,7 @@ MonoBehaviour:
688
688
  m_Name:
689
689
  m_EditorClassIdentifier:
690
690
  m_Material: {fileID: 0}
691
- m_Color: {r: 0.30980393, g: 0.2392157, b: 0.76470596, a: 1}
691
+ m_Color: {r: 0.30588236, g: 0.23529413, b: 0.7607844, a: 1}
692
692
  m_RaycastTarget: 1
693
693
  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
694
694
  m_Maskable: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.4.9",
3
+ "version": "1.4.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",