app.hypergames.hypersdk 1.7.0 → 1.8.0

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.8.0](https://github.com/mvmhyper/hyper-sdk/compare/v1.7.1...v1.8.0) (2026-04-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * expose safe-area-adjusted screen dimensions via IScreenAPI ([ba874e2](https://github.com/mvmhyper/hyper-sdk/commit/ba874e2dec213acf24e58caef5fca29d4975e1cb))
7
+
8
+ ## [1.7.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.7.0...v1.7.1) (2026-04-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * reset Time.timeScale to 1 on RestartSession ([9dfb2bf](https://github.com/mvmhyper/hyper-sdk/commit/9dfb2bfce336c6a569889d2482b9f8aaa4f6e4fa))
14
+
1
15
  # [1.7.0](https://github.com/mvmhyper/hyper-sdk/compare/v1.6.0...v1.7.0) (2026-04-02)
2
16
 
3
17
 
@@ -66,28 +66,21 @@ namespace Hyper.Internal
66
66
  internal static void RestartSession()
67
67
  {
68
68
  _isSoftRestarting = true;
69
+ Time.timeScale = 1f; // Always reset time scale before restart — PauseGame() sets it to 0 and it persists across scene loads
69
70
 
70
71
  if (_settings != null && _settings.useCustomRestartFlow)
71
72
  {
72
- // Fire custom restart event - developers handle restart themselves
73
73
  _eventManager?.InvokeCustomRestartEvent();
74
-
75
- // Reset SDK UI state for custom restart
76
- // This prepares the SDK UI (hides game over, shows start modal, resets timer, etc.)
77
- // so the game appears fresh when the developer's restart logic runs
78
74
  _gameManager?.ResetUIStateForCustomRestart();
79
-
80
75
  return;
81
76
  }
82
77
 
83
- // Use improved default restart flow
84
78
  if (_host != null)
85
79
  {
86
80
  _host.StartCoroutine(RestartSessionCoroutine());
87
81
  }
88
82
  else
89
83
  {
90
- // Fallback to immediate restart if host doesn't exist
91
84
  ClearAllDontDestroyOnLoadObjects();
92
85
  SceneManager.LoadScene("HyperLoader");
93
86
  }
@@ -1,9 +1,10 @@
1
1
  using Hyper.Internal.Managers;
2
2
  using UnityEngine;
3
+ using UnityEngine.EventSystems;
3
4
 
4
5
  namespace Hyper.Internal
5
6
  {
6
- internal class PauseButton : MonoBehaviour
7
+ internal class PauseButton : MonoBehaviour, IPointerDownHandler
7
8
  {
8
9
  [SerializeField] GameObject notifyDot;
9
10
  private GameManager _gameManager;
@@ -16,17 +17,15 @@ namespace Hyper.Internal
16
17
  private void Start()
17
18
  {
18
19
  if (notifyDot != null)
19
- {
20
20
  notifyDot.SetActive(false);
21
- }
22
21
  }
23
22
 
24
23
  private void Notify()
25
24
  {
26
- if(_gameManager.HasGameStarted) notifyDot.SetActive(true);
25
+ if (_gameManager.HasGameStarted) notifyDot.SetActive(true);
27
26
  }
28
27
 
29
- public void PauseGame()
28
+ public void OnPointerDown(PointerEventData eventData)
30
29
  {
31
30
  _gameManager.PauseGame();
32
31
  }
@@ -16,6 +16,7 @@ namespace Hyper
16
16
  private static DataAPIAdapter _dataAdapter;
17
17
  private static EventAPIAdapter _eventAdapter;
18
18
  private static LoaderAPIAdapter _loaderAdapter;
19
+ private static ScreenAPIAdapter _screenAdapter;
19
20
 
20
21
  /// <summary>
21
22
  /// Returns true if the SDK runtime has been initialized.
@@ -106,6 +107,20 @@ namespace Hyper
106
107
  }
107
108
  }
108
109
 
110
+ /// <summary>
111
+ /// Access safe-area-adjusted screen dimensions.
112
+ /// Use instead of Screen.width / Screen.height to account for notches and system insets.
113
+ /// </summary>
114
+ public static IScreenAPI Screen
115
+ {
116
+ get
117
+ {
118
+ if (_screenAdapter == null)
119
+ _screenAdapter = new ScreenAPIAdapter();
120
+ return _screenAdapter;
121
+ }
122
+ }
123
+
109
124
  /// <summary>
110
125
  /// Current Hyper SDK version string.
111
126
  /// </summary>
@@ -346,6 +361,23 @@ namespace Hyper
346
361
  event Action OnCustomRestart;
347
362
  }
348
363
 
364
+ /// <summary>
365
+ /// Safe-area-adjusted screen dimensions.
366
+ /// Use these instead of Screen.width / Screen.height to match the playable area after notch and system inset adjustments.
367
+ /// </summary>
368
+ public interface IScreenAPI
369
+ {
370
+ /// <summary>
371
+ /// Usable screen width in pixels after safe area insets are applied.
372
+ /// </summary>
373
+ float Width { get; }
374
+
375
+ /// <summary>
376
+ /// Usable screen height in pixels after safe area insets are applied.
377
+ /// </summary>
378
+ float Height { get; }
379
+ }
380
+
349
381
  #region Adapter Implementations
350
382
 
351
383
  /// <summary>
@@ -365,6 +397,40 @@ namespace Hyper
365
397
  }
366
398
  }
367
399
 
400
+ /// <summary>
401
+ /// Bridges the public screen API to the platform safe area.
402
+ /// </summary>
403
+ internal sealed class ScreenAPIAdapter : IScreenAPI
404
+ {
405
+ public float Width => GetSafeArea().width;
406
+
407
+ public float Height
408
+ {
409
+ get
410
+ {
411
+ var sa = GetSafeArea();
412
+ return sa.y + sa.height;
413
+ }
414
+ }
415
+
416
+ private Rect GetSafeArea()
417
+ {
418
+ #if UNITY_WEBGL && !UNITY_EDITOR
419
+ var config = HyperRuntime.GameManager?.Config;
420
+ if (config != null)
421
+ {
422
+ var insets = config.SafeArea;
423
+ float x = insets.left;
424
+ float y = 0f;
425
+ float width = UnityEngine.Screen.width - insets.left - insets.right;
426
+ float height = UnityEngine.Screen.height - insets.top;
427
+ return new Rect(x, y, width, height);
428
+ }
429
+ #endif
430
+ return UnityEngine.Screen.safeArea;
431
+ }
432
+ }
433
+
368
434
  /// <summary>
369
435
  /// Bridges the public game API to the internal GameManager without exposing it to consumers.
370
436
  /// </summary>
@@ -718,19 +718,7 @@ MonoBehaviour:
718
718
  m_TargetGraphic: {fileID: 6337179202905528179}
719
719
  m_OnClick:
720
720
  m_PersistentCalls:
721
- m_Calls:
722
- - m_Target: {fileID: 4052121302679636064}
723
- m_TargetAssemblyTypeName: Hyper.PauseButton, Assembly-CSharp
724
- m_MethodName: PauseGame
725
- m_Mode: 1
726
- m_Arguments:
727
- m_ObjectArgument: {fileID: 0}
728
- m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
729
- m_IntArgument: 0
730
- m_FloatArgument: 0
731
- m_StringArgument:
732
- m_BoolArgument: 0
733
- m_CallState: 2
721
+ m_Calls: []
734
722
  --- !u!114 &4052121302679636064
735
723
  MonoBehaviour:
736
724
  m_ObjectHideFlags: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
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",