app.hypergames.hypersdk 1.7.1 → 1.8.1

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.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.0...v1.8.1) (2026-04-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * runtime ignores developer's HyperSDKSettings ([26127c1](https://github.com/mvmhyper/hyper-sdk/commit/26127c10c47e64aaa47144c7158833140822cc50))
7
+
8
+ # [1.8.0](https://github.com/mvmhyper/hyper-sdk/compare/v1.7.1...v1.8.0) (2026-04-02)
9
+
10
+
11
+ ### Features
12
+
13
+ * expose safe-area-adjusted screen dimensions via IScreenAPI ([ba874e2](https://github.com/mvmhyper/hyper-sdk/commit/ba874e2dec213acf24e58caef5fca29d4975e1cb))
14
+
1
15
  ## [1.7.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.7.0...v1.7.1) (2026-04-02)
2
16
 
3
17
 
@@ -13,8 +13,6 @@ namespace Hyper.Editor
13
13
  {
14
14
  #region Private Fields
15
15
 
16
- private const string PrefKey = "Hyper/Mode";
17
-
18
16
  private static HyperSDKSettings _settings;
19
17
  private UnityEditor.Editor _settingsEditor;
20
18
  private Vector2 _scrollPosition;
@@ -228,6 +228,22 @@ namespace Hyper.Internal
228
228
  return matchingResources[0];
229
229
  }
230
230
 
231
+ // Prefer the project-configured copy over the package template.
232
+ // HyperSDKSettings: configured if the developer has enabled at least one platform/orientation flag.
233
+ if (typeof(T) == typeof(HyperSDKSettings))
234
+ {
235
+ for (int i = 0; i < matchingResources.Count; i++)
236
+ {
237
+ var settings = matchingResources[i] as HyperSDKSettings;
238
+ if (settings != null && settings.IsConfigured)
239
+ {
240
+ return matchingResources[i];
241
+ }
242
+ }
243
+ return matchingResources.Count > 1 ? matchingResources[1] : matchingResources[0];
244
+ }
245
+
246
+ // HyperGameContentConfig: configured if it has a valid game scene assigned.
231
247
  if (typeof(T) == typeof(HyperGameContentConfig))
232
248
  {
233
249
  for (int i = 0; i < matchingResources.Count; i++)
@@ -57,6 +57,17 @@ namespace Hyper.Internal
57
57
 
58
58
  #endregion
59
59
 
60
+ #region Validation
61
+
62
+ /// <summary>
63
+ /// Returns true if this settings asset has been configured by the developer.
64
+ /// A fresh package template has all platform/orientation flags set to false,
65
+ /// so any asset with at least one flag enabled is considered the project copy.
66
+ /// </summary>
67
+ public bool IsConfigured => portrait || landscape || pc || mobile;
68
+
69
+ #endregion
70
+
60
71
  #region Restart Flow Settings
61
72
 
62
73
  [Space(20)]
@@ -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>
@@ -12,12 +12,12 @@ MonoBehaviour:
12
12
  m_Script: {fileID: 11500000, guid: 56c34fa8aa6f98746a3664aa1d18f483, type: 3}
13
13
  m_Name: HyperSDKSettings
14
14
  m_EditorClassIdentifier:
15
- portrait: 1
15
+ portrait: 0
16
16
  landscape: 0
17
17
  pc: 0
18
- mobile: 1
18
+ mobile: 0
19
19
  startCTA: 0
20
- swipeDirection: 0
20
+ swipeDirection: 2
21
21
  controlBarLayout: 0
22
22
  controlBarTheme: 1
23
23
  useCustomRestartFlow: 0
@@ -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.1",
3
+ "version": "1.8.1",
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",