app.hypergames.hypersdk 1.8.14 → 1.8.16
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 +16 -0
- package/Editor/Scripts/Build/HyperBuildPipeline.cs +1 -1
- package/HyperLoader.unity +2 -2
- package/Runtime/Internal/Bootstrap/HyperLoader.cs +2 -3
- package/Runtime/Internal/Core/HyperRuntime.cs +30 -0
- package/Runtime/Internal/Managers/BackendManager.cs +52 -2
- package/Runtime/Internal/Managers/GameManager.cs +12 -7
- package/Runtime/Internal/Managers/TimeManager.cs +35 -2
- package/Runtime/Internal/UI/Modals/GameOverModal.cs +10 -4
- package/Runtime/Public/Core/HyperSDK.cs +40 -1
- package/Runtime/Public/IgnoreSafeArea.cs +56 -0
- package/Runtime/Public/IgnoreSafeArea.cs.meta +11 -0
- package/Runtime/Resources/HyperGameContentConfig.asset.meta +1 -1
- package/Runtime/Resources/UIPrefabs/GamePausedModal_Battle_Landscape.prefab +1 -1
- package/Runtime/Resources/UIPrefabs/GamePausedModal_Practice_Landscape.prefab +1 -1
- package/Runtime/Resources/UIPrefabs/RetryTimeExpiredModal_Landscape.prefab +13 -1
- package/Runtime/Resources/UIPrefabs/ScoreSubmissionFailedModal_Landscape.prefab +2 -2
- package/Runtime/Resources/UIPrefabs/SessionTimedOutModal.prefab +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.8.16](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.15...v1.8.16) (2026-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **loader:** expose custom loading start hook ([acdec3a](https://github.com/mvmhyper/hyper-sdk/commit/acdec3a1c484a1b476690f3ac5ca8e38877915a6))
|
|
7
|
+
* **safe-area:** add ignore safe area component + upm sync ([9c1ea51](https://github.com/mvmhyper/hyper-sdk/commit/9c1ea5165c7b5bb4e97396ff0e7d375db52a1041))
|
|
8
|
+
* **ui:** improve HyperCanvas landscape layout ([2a3ba8c](https://github.com/mvmhyper/hyper-sdk/commit/2a3ba8c2fa753bc5ab13934c49ba0dee0571814d))
|
|
9
|
+
|
|
10
|
+
## [1.8.15](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.14...v1.8.15) (2026-06-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* derive SDK session timer from backend remaining time ([d1f79a8](https://github.com/mvmhyper/hyper-sdk/commit/d1f79a814c17828faf6590baf46c925dd7d47b80))
|
|
16
|
+
|
|
1
17
|
## [1.8.14](https://github.com/mvmhyper/hyper-sdk/compare/v1.8.13...v1.8.14) (2026-05-14)
|
|
2
18
|
|
|
3
19
|
|
|
@@ -727,7 +727,7 @@ namespace Hyper.Editor
|
|
|
727
727
|
return true;
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
-
|
|
730
|
+
internal static bool ValidateConfigurationAssets(HyperBuildProfile profile)
|
|
731
731
|
{
|
|
732
732
|
if (!LoadConfigurationAssets())
|
|
733
733
|
{
|
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:
|
|
307
|
+
m_AnchoredPosition: {x: 1059.0492, 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:
|
|
1095
|
+
m_AnchoredPosition: {x: 1059.0492, 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
|
|
@@ -343,14 +343,12 @@ namespace Hyper.Internal
|
|
|
343
343
|
|
|
344
344
|
private IEnumerator WaitForCustomPreLoading()
|
|
345
345
|
{
|
|
346
|
-
HyperRuntime.CustomLoadingComplete = false;
|
|
347
|
-
HyperRuntime.CustomLoadingProgress = 0f;
|
|
348
|
-
|
|
349
346
|
float simulatedProgress = 0f;
|
|
350
347
|
const float simulatedSpeed = 0.15f;
|
|
351
348
|
const float simulatedCap = 0.70f;
|
|
352
349
|
|
|
353
350
|
HyperDebug.Log("Custom pre-loading enabled. Waiting for HyperSDK.Loader.CompleteCustomLoading()");
|
|
351
|
+
HyperRuntime.BeginCustomLoading();
|
|
354
352
|
|
|
355
353
|
while (!HyperRuntime.CustomLoadingComplete)
|
|
356
354
|
{
|
|
@@ -371,6 +369,7 @@ namespace Hyper.Internal
|
|
|
371
369
|
// Snap to end of custom loading range
|
|
372
370
|
_bootstrapProgress = _progressAfterCustomLoad;
|
|
373
371
|
_loadingBarSlider.value = _bootstrapProgress;
|
|
372
|
+
HyperRuntime.EndCustomLoading();
|
|
374
373
|
}
|
|
375
374
|
|
|
376
375
|
private long GetRandomSeed()
|
|
@@ -20,7 +20,9 @@ namespace Hyper.Internal
|
|
|
20
20
|
private static bool _isInitialized;
|
|
21
21
|
private static bool _isSoftRestarting;
|
|
22
22
|
private static bool _customLoadingComplete;
|
|
23
|
+
private static bool _customLoadingActive;
|
|
23
24
|
private static float _customLoadingProgress;
|
|
25
|
+
private static Action _customLoadingStarted;
|
|
24
26
|
private static HyperSDKSettings _settings;
|
|
25
27
|
private static HyperGameContentConfig _gameContent;
|
|
26
28
|
private static GameManager _gameManager;
|
|
@@ -40,6 +42,7 @@ namespace Hyper.Internal
|
|
|
40
42
|
get => _customLoadingComplete;
|
|
41
43
|
set => _customLoadingComplete = value;
|
|
42
44
|
}
|
|
45
|
+
internal static bool CustomLoadingActive => _customLoadingActive;
|
|
43
46
|
internal static float CustomLoadingProgress
|
|
44
47
|
{
|
|
45
48
|
get => _customLoadingProgress;
|
|
@@ -53,6 +56,31 @@ namespace Hyper.Internal
|
|
|
53
56
|
internal static EventManager EventManager => _eventManager;
|
|
54
57
|
internal static TimerManager Timer => _timerManager;
|
|
55
58
|
|
|
59
|
+
internal static event Action CustomLoadingStarted
|
|
60
|
+
{
|
|
61
|
+
add => _customLoadingStarted += value;
|
|
62
|
+
remove => _customLoadingStarted -= value;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
internal static void BeginCustomLoading()
|
|
66
|
+
{
|
|
67
|
+
_customLoadingComplete = false;
|
|
68
|
+
_customLoadingProgress = 0f;
|
|
69
|
+
_customLoadingActive = true;
|
|
70
|
+
_customLoadingStarted?.Invoke();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
internal static void CompleteCustomLoading()
|
|
74
|
+
{
|
|
75
|
+
_customLoadingComplete = true;
|
|
76
|
+
_customLoadingActive = false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
internal static void EndCustomLoading()
|
|
80
|
+
{
|
|
81
|
+
_customLoadingActive = false;
|
|
82
|
+
}
|
|
83
|
+
|
|
56
84
|
/// <summary>
|
|
57
85
|
/// Perform a full soft restart of the Hyper session.
|
|
58
86
|
///
|
|
@@ -309,6 +337,7 @@ namespace Hyper.Internal
|
|
|
309
337
|
HyperRandom.Clear();
|
|
310
338
|
_gameContent = null;
|
|
311
339
|
_customLoadingComplete = false;
|
|
340
|
+
_customLoadingActive = false;
|
|
312
341
|
_customLoadingProgress = 0f;
|
|
313
342
|
|
|
314
343
|
if (_singletonObject != null)
|
|
@@ -359,6 +388,7 @@ namespace Hyper.Internal
|
|
|
359
388
|
_gameContent = null;
|
|
360
389
|
_isInitialized = false;
|
|
361
390
|
_customLoadingComplete = false;
|
|
391
|
+
_customLoadingActive = false;
|
|
362
392
|
_customLoadingProgress = 0f;
|
|
363
393
|
}
|
|
364
394
|
}
|
|
@@ -4,6 +4,7 @@ using System;
|
|
|
4
4
|
using System.Collections;
|
|
5
5
|
using System.Collections.Generic;
|
|
6
6
|
using System.Linq;
|
|
7
|
+
using System.Globalization;
|
|
7
8
|
using System.Runtime.InteropServices;
|
|
8
9
|
using System.Text;
|
|
9
10
|
using UnityEngine;
|
|
@@ -96,6 +97,7 @@ namespace Hyper.Internal.Managers
|
|
|
96
97
|
private string _csrfToken;
|
|
97
98
|
private string _cachedSessionId;
|
|
98
99
|
private bool _hasSessionEnded;
|
|
100
|
+
private bool _hasAppliedBackendSessionRemainingTime;
|
|
99
101
|
|
|
100
102
|
#endregion
|
|
101
103
|
|
|
@@ -163,6 +165,7 @@ namespace Hyper.Internal.Managers
|
|
|
163
165
|
private IEnumerator CreateSessionCoroutine(Action onSuccess)
|
|
164
166
|
{
|
|
165
167
|
_currentRetryCount = 0;
|
|
168
|
+
_hasAppliedBackendSessionRemainingTime = false;
|
|
166
169
|
const int maxRetries = 1;
|
|
167
170
|
|
|
168
171
|
while (_currentRetryCount < maxRetries)
|
|
@@ -222,6 +225,9 @@ namespace Hyper.Internal.Managers
|
|
|
222
225
|
|
|
223
226
|
private bool ProcessSessionResponse(string responseText)
|
|
224
227
|
{
|
|
228
|
+
Debug.Log($"Session creation response: {responseText}");
|
|
229
|
+
TryApplyBackendSessionRemainingTime(responseText, "session creation");
|
|
230
|
+
|
|
225
231
|
try
|
|
226
232
|
{
|
|
227
233
|
var response = JsonConvert.DeserializeObject<Dictionary<string, object>>(responseText);
|
|
@@ -646,6 +652,9 @@ namespace Hyper.Internal.Managers
|
|
|
646
652
|
|
|
647
653
|
public void OnSocketGameStarted(string message)
|
|
648
654
|
{
|
|
655
|
+
HyperDebug.Log($"[WebSocket] gameStarted response: {message}");
|
|
656
|
+
TryApplyBackendSessionRemainingTime(message, "gameStarted");
|
|
657
|
+
|
|
649
658
|
_gameStarted = true;
|
|
650
659
|
_canFlushScoresAfterGameStartAck = true;
|
|
651
660
|
_hasLoggedWaitingForGameStartAck = false;
|
|
@@ -664,6 +673,9 @@ namespace Hyper.Internal.Managers
|
|
|
664
673
|
|
|
665
674
|
public void OnSocketGameResumed(string message)
|
|
666
675
|
{
|
|
676
|
+
HyperDebug.Log($"[WebSocket] gameResumed response: {message}");
|
|
677
|
+
TryApplyBackendSessionRemainingTime(message, "gameResumed");
|
|
678
|
+
|
|
667
679
|
_gameResumed = true;
|
|
668
680
|
HyperDebug.Log("[WebSocket] Received gameResumed event from server.");
|
|
669
681
|
|
|
@@ -681,11 +693,15 @@ namespace Hyper.Internal.Managers
|
|
|
681
693
|
|
|
682
694
|
public void OnSocketMessage(string message)
|
|
683
695
|
{
|
|
684
|
-
|
|
696
|
+
HyperDebug.Log($"[WebSocket] ack response: {message}");
|
|
697
|
+
TryApplyBackendSessionRemainingTime(message, "socket ack");
|
|
685
698
|
}
|
|
686
699
|
|
|
687
700
|
public void OnSocketSdkPong(string message)
|
|
688
701
|
{
|
|
702
|
+
HyperDebug.Log($"[WebSocket] sdkPong response: {message}");
|
|
703
|
+
TryApplyBackendSessionRemainingTime(message, "sdkPong");
|
|
704
|
+
|
|
689
705
|
if (string.IsNullOrEmpty(message) || !_pendingSdkPingId.HasValue)
|
|
690
706
|
return;
|
|
691
707
|
|
|
@@ -718,6 +734,9 @@ namespace Hyper.Internal.Managers
|
|
|
718
734
|
|
|
719
735
|
public void OnSocketScoreUpdated(string message)
|
|
720
736
|
{
|
|
737
|
+
HyperDebug.Log($"[WebSocket] scoreUpdated response: {message}");
|
|
738
|
+
TryApplyBackendSessionRemainingTime(message, "scoreUpdated");
|
|
739
|
+
|
|
721
740
|
if (_lastSentBatch != null && _lastSentBatch.Count > 0)
|
|
722
741
|
{
|
|
723
742
|
_lastScoreData = _lastSentBatch[_lastSentBatch.Count - 1];
|
|
@@ -764,6 +783,37 @@ namespace Hyper.Internal.Managers
|
|
|
764
783
|
}
|
|
765
784
|
}
|
|
766
785
|
|
|
786
|
+
private void TryApplyBackendSessionRemainingTime(string json, string context)
|
|
787
|
+
{
|
|
788
|
+
if (_hasAppliedBackendSessionRemainingTime || string.IsNullOrEmpty(json))
|
|
789
|
+
return;
|
|
790
|
+
|
|
791
|
+
try
|
|
792
|
+
{
|
|
793
|
+
var parsed = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
|
|
794
|
+
if (!parsed.TryGetValue("remainingTime", out object remainingTimeObj))
|
|
795
|
+
{
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
if (!float.TryParse(remainingTimeObj.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture, out float remainingTime))
|
|
800
|
+
{
|
|
801
|
+
HyperDebug.LogWarning($"[SessionTimer] Could not parse remainingTime from '{context}': {remainingTimeObj}");
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
if (HyperRuntime.Timer.TrySetSessionDurationFromBackendRemainingTime(remainingTime))
|
|
806
|
+
{
|
|
807
|
+
_hasAppliedBackendSessionRemainingTime = true;
|
|
808
|
+
HyperDebug.Log($"[SessionTimer] Applied remainingTime from '{context}'.");
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
catch (Exception ex)
|
|
812
|
+
{
|
|
813
|
+
HyperDebug.LogWarning($"[SessionTimer] Failed to inspect remainingTime from '{context}': {ex.Message}");
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
767
817
|
private void ResumeScoreSending()
|
|
768
818
|
{
|
|
769
819
|
if (isSocketConnected && !_gameManager.HasGameEnded)
|
|
@@ -1683,4 +1733,4 @@ namespace Hyper.Internal.Managers
|
|
|
1683
1733
|
|
|
1684
1734
|
#endregion
|
|
1685
1735
|
}
|
|
1686
|
-
}
|
|
1736
|
+
}
|
|
@@ -1002,16 +1002,18 @@ namespace Hyper.Internal.Managers
|
|
|
1002
1002
|
_canvasScaler = _canvas.GetComponent<CanvasScaler>();
|
|
1003
1003
|
_canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
|
1004
1004
|
_canvasScaler.referenceResolution = new Vector2(1080, 1920);
|
|
1005
|
-
_canvasScaler.matchWidthOrHeight = IsPortrait() ? 0.43f : 0.
|
|
1005
|
+
_canvasScaler.matchWidthOrHeight = IsPortrait() ? 0.43f : 0.593f;
|
|
1006
1006
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1007
|
+
CreateHyperCanvasSafeArea();
|
|
1008
|
+
CreateHyperCanvasBlockerUI();
|
|
1009
1009
|
}
|
|
1010
1010
|
|
|
1011
|
-
private void
|
|
1011
|
+
private void CreateHyperCanvasSafeArea()
|
|
1012
1012
|
{
|
|
1013
1013
|
_safeArea = new GameObject("SafeArea", typeof(RectTransform));
|
|
1014
1014
|
RectTransform safeAreaRect = _safeArea.GetComponent<RectTransform>();
|
|
1015
|
+
|
|
1016
|
+
//? Attaching safe area to HyperCanvas
|
|
1015
1017
|
safeAreaRect.SetParent(_canvas.transform, false);
|
|
1016
1018
|
|
|
1017
1019
|
safeAreaRect.anchorMin = Vector2.zero;
|
|
@@ -1019,10 +1021,13 @@ namespace Hyper.Internal.Managers
|
|
|
1019
1021
|
safeAreaRect.offsetMin = Vector2.zero;
|
|
1020
1022
|
safeAreaRect.offsetMax = Vector2.zero;
|
|
1021
1023
|
|
|
1022
|
-
|
|
1024
|
+
if (IsPortrait())
|
|
1025
|
+
{
|
|
1026
|
+
_safeArea.AddComponent<SafeArea>();
|
|
1027
|
+
}
|
|
1023
1028
|
}
|
|
1024
1029
|
|
|
1025
|
-
private void
|
|
1030
|
+
private void CreateHyperCanvasBlockerUI()
|
|
1026
1031
|
{
|
|
1027
1032
|
_blockerUI = new GameObject("BlockerUI",
|
|
1028
1033
|
typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
|
@@ -1396,7 +1401,7 @@ namespace Hyper.Internal.Managers
|
|
|
1396
1401
|
private void ShowTimeUpModalInternal()
|
|
1397
1402
|
{
|
|
1398
1403
|
_hasGameEnded = true;
|
|
1399
|
-
|
|
1404
|
+
|
|
1400
1405
|
if (_timeUpModal == null)
|
|
1401
1406
|
{
|
|
1402
1407
|
EnsureTimeUpModal();
|
|
@@ -22,6 +22,7 @@ namespace Hyper.Internal.Managers
|
|
|
22
22
|
|
|
23
23
|
#region Configuration
|
|
24
24
|
private const float SESSION_DURATION = HyperConstants.SESSION_DURATION;
|
|
25
|
+
private const float SESSION_DURATION_BUFFER_SECONDS = 60f;
|
|
25
26
|
|
|
26
27
|
#endregion
|
|
27
28
|
|
|
@@ -35,7 +36,9 @@ namespace Hyper.Internal.Managers
|
|
|
35
36
|
private float _fiveSecondTimer = 5f;
|
|
36
37
|
private bool _isFiveSecondTimerRunning;
|
|
37
38
|
private bool _startDeadlineTriggered;
|
|
39
|
+
private float _sessionDuration = SESSION_DURATION;
|
|
38
40
|
private float _sessionTimer = SESSION_DURATION;
|
|
41
|
+
private bool _hasBackendSessionDuration;
|
|
39
42
|
private bool _isPreSessionRunning;
|
|
40
43
|
private bool _isSessionRunning;
|
|
41
44
|
private bool _sessionWarningTriggered;
|
|
@@ -56,6 +59,9 @@ namespace Hyper.Internal.Managers
|
|
|
56
59
|
|
|
57
60
|
_practiceTimer = 0;
|
|
58
61
|
_battleTimer = _gameManager.Config.TimeLimit;
|
|
62
|
+
_sessionDuration = SESSION_DURATION;
|
|
63
|
+
_sessionTimer = SESSION_DURATION;
|
|
64
|
+
_hasBackendSessionDuration = false;
|
|
59
65
|
_lastUnscaledTime = Time.unscaledTime;
|
|
60
66
|
_timeUpTriggered = false;
|
|
61
67
|
}
|
|
@@ -176,6 +182,33 @@ namespace Hyper.Internal.Managers
|
|
|
176
182
|
internal void StartBattle() => _isBattleRunning = true;
|
|
177
183
|
internal void StopBattle() => _isBattleRunning = false;
|
|
178
184
|
|
|
185
|
+
internal bool TrySetSessionDurationFromBackendRemainingTime(float remainingTimeSeconds)
|
|
186
|
+
{
|
|
187
|
+
if (_hasBackendSessionDuration)
|
|
188
|
+
return true;
|
|
189
|
+
|
|
190
|
+
if (remainingTimeSeconds <= SESSION_DURATION_BUFFER_SECONDS)
|
|
191
|
+
{
|
|
192
|
+
HyperDebug.LogWarning($"[SessionTimer] Ignoring backend remainingTime={remainingTimeSeconds}. It must be greater than the {SESSION_DURATION_BUFFER_SECONDS}s buffer.");
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
_sessionDuration = remainingTimeSeconds - SESSION_DURATION_BUFFER_SECONDS;
|
|
197
|
+
_hasBackendSessionDuration = true;
|
|
198
|
+
|
|
199
|
+
if (_isPreSessionRunning || _isSessionRunning)
|
|
200
|
+
{
|
|
201
|
+
_sessionTimer = Mathf.Min(_sessionTimer, _sessionDuration);
|
|
202
|
+
}
|
|
203
|
+
else
|
|
204
|
+
{
|
|
205
|
+
_sessionTimer = _sessionDuration;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
HyperDebug.Log($"[SessionTimer] Using backend remainingTime={remainingTimeSeconds}. Buffered SDK session duration={_sessionDuration}s.");
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
|
|
179
212
|
internal void StartSessionTimer(bool isPreSessionTimer = false)
|
|
180
213
|
{
|
|
181
214
|
if(_isPreSessionRunning && _isSessionRunning) return; // Already running both timers
|
|
@@ -183,7 +216,7 @@ namespace Hyper.Internal.Managers
|
|
|
183
216
|
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
184
217
|
StartHTMLSessionTimer();
|
|
185
218
|
#endif
|
|
186
|
-
_sessionTimer =
|
|
219
|
+
_sessionTimer = _sessionDuration;
|
|
187
220
|
_sessionWarningTriggered = false;
|
|
188
221
|
_startDeadlineTriggered = false;
|
|
189
222
|
_lastUnscaledTime = Time.unscaledTime;
|
|
@@ -324,4 +357,4 @@ namespace Hyper.Internal.Managers
|
|
|
324
357
|
|
|
325
358
|
#endregion
|
|
326
359
|
}
|
|
327
|
-
}
|
|
360
|
+
}
|
|
@@ -41,13 +41,19 @@ namespace Hyper.Internal
|
|
|
41
41
|
loadingCircle.SetActive(false);
|
|
42
42
|
|
|
43
43
|
_gameManager = HyperRuntime.GameManager;
|
|
44
|
+
|
|
45
|
+
if (!_gameManager.IsPortrait()) // If landscape, position Y-50 + scale 1.2f
|
|
46
|
+
{
|
|
47
|
+
GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -50);
|
|
48
|
+
GetComponent<RectTransform>().localScale = new Vector3(1.2f, 1.2f, 1.2f);
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
public void Init()
|
|
47
53
|
{
|
|
48
54
|
if (scoreSubmissionText != null)
|
|
49
55
|
scoreSubmissionText.text = "Submitting score";
|
|
50
|
-
|
|
56
|
+
|
|
51
57
|
if (loadingBarSlider != null)
|
|
52
58
|
loadingBarSlider.value = 0.075f;
|
|
53
59
|
|
|
@@ -56,7 +62,7 @@ namespace Hyper.Internal
|
|
|
56
62
|
|
|
57
63
|
public void StartLerpingSlider(float targetValue, float duration)
|
|
58
64
|
{
|
|
59
|
-
if(loadingBarSlider == null)
|
|
65
|
+
if (loadingBarSlider == null)
|
|
60
66
|
{
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
@@ -65,7 +71,7 @@ namespace Hyper.Internal
|
|
|
65
71
|
{
|
|
66
72
|
StopCoroutine(sliderCoroutine);
|
|
67
73
|
}
|
|
68
|
-
|
|
74
|
+
|
|
69
75
|
sliderCoroutine = StartCoroutine(LerpSlider(targetValue, duration));
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -113,7 +119,7 @@ namespace Hyper.Internal
|
|
|
113
119
|
// and we're just loading to completion
|
|
114
120
|
if (scoreSubmissionText != null)
|
|
115
121
|
scoreSubmissionText.text = "Submitting score";
|
|
116
|
-
|
|
122
|
+
|
|
117
123
|
StopLerpingSlider();
|
|
118
124
|
StartCoroutine(SetLoadingBarComplete());
|
|
119
125
|
}
|
|
@@ -303,6 +303,17 @@ namespace Hyper
|
|
|
303
303
|
/// </summary>
|
|
304
304
|
public interface ILoaderAPI
|
|
305
305
|
{
|
|
306
|
+
/// <summary>
|
|
307
|
+
/// True while the HyperLoader is waiting for custom pre-loading to finish.
|
|
308
|
+
/// </summary>
|
|
309
|
+
bool IsCustomLoadingActive { get; }
|
|
310
|
+
|
|
311
|
+
/// <summary>
|
|
312
|
+
/// Fired after SDK/bootstrap setup is ready and custom pre-loading may begin.
|
|
313
|
+
/// If subscribed while custom loading is already active, the handler is invoked immediately.
|
|
314
|
+
/// </summary>
|
|
315
|
+
event Action OnCustomLoadingStarted;
|
|
316
|
+
|
|
306
317
|
/// <summary>
|
|
307
318
|
/// Report progress of your custom loading (0.0 to 1.0).
|
|
308
319
|
/// This feeds into the loading bar so players see smooth progress during your custom work.
|
|
@@ -385,6 +396,29 @@ namespace Hyper
|
|
|
385
396
|
/// </summary>
|
|
386
397
|
internal sealed class LoaderAPIAdapter : ILoaderAPI
|
|
387
398
|
{
|
|
399
|
+
private Action _onCustomLoadingStarted;
|
|
400
|
+
|
|
401
|
+
public LoaderAPIAdapter()
|
|
402
|
+
{
|
|
403
|
+
HyperRuntime.CustomLoadingStarted += HandleCustomLoadingStarted;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
public bool IsCustomLoadingActive => HyperRuntime.CustomLoadingActive;
|
|
407
|
+
|
|
408
|
+
public event Action OnCustomLoadingStarted
|
|
409
|
+
{
|
|
410
|
+
add
|
|
411
|
+
{
|
|
412
|
+
_onCustomLoadingStarted += value;
|
|
413
|
+
|
|
414
|
+
if (HyperRuntime.CustomLoadingActive)
|
|
415
|
+
{
|
|
416
|
+
value?.Invoke();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
remove => _onCustomLoadingStarted -= value;
|
|
420
|
+
}
|
|
421
|
+
|
|
388
422
|
public void ReportCustomLoadingProgress(float progress)
|
|
389
423
|
{
|
|
390
424
|
HyperRuntime.CustomLoadingProgress = Mathf.Clamp01(progress);
|
|
@@ -392,9 +426,14 @@ namespace Hyper
|
|
|
392
426
|
|
|
393
427
|
public void CompleteCustomLoading()
|
|
394
428
|
{
|
|
395
|
-
HyperRuntime.
|
|
429
|
+
HyperRuntime.CompleteCustomLoading();
|
|
396
430
|
HyperDebug.Log("Custom pre-loading complete. Bootstrap resuming");
|
|
397
431
|
}
|
|
432
|
+
|
|
433
|
+
private void HandleCustomLoadingStarted()
|
|
434
|
+
{
|
|
435
|
+
_onCustomLoadingStarted?.Invoke();
|
|
436
|
+
}
|
|
398
437
|
}
|
|
399
438
|
|
|
400
439
|
/// <summary>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace Hyper
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Allows a UI element to render outside the SDK safe area.
|
|
7
|
+
/// Useful for full-screen canvas backgrounds that should extend behind notches or insets.
|
|
8
|
+
/// </summary>
|
|
9
|
+
[AddComponentMenu("Hyper/Ignore Safe Area")]
|
|
10
|
+
[DisallowMultipleComponent]
|
|
11
|
+
[RequireComponent(typeof(RectTransform))]
|
|
12
|
+
public sealed class IgnoreSafeArea : MonoBehaviour
|
|
13
|
+
{
|
|
14
|
+
private const string SafeAreaObjectName = "SafeArea";
|
|
15
|
+
|
|
16
|
+
private void Awake()
|
|
17
|
+
{
|
|
18
|
+
MoveOutsideSafeArea();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private void Start()
|
|
22
|
+
{
|
|
23
|
+
MoveOutsideSafeArea();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private void MoveOutsideSafeArea()
|
|
27
|
+
{
|
|
28
|
+
Transform safeArea = transform.parent;
|
|
29
|
+
if (safeArea == null || safeArea.name != SafeAreaObjectName)
|
|
30
|
+
{
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Transform canvasTransform = safeArea.parent;
|
|
35
|
+
if (canvasTransform == null)
|
|
36
|
+
{
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
int siblingIndex = safeArea.GetSiblingIndex();
|
|
41
|
+
transform.SetParent(canvasTransform, false);
|
|
42
|
+
transform.SetSiblingIndex(siblingIndex);
|
|
43
|
+
|
|
44
|
+
StretchToParent(GetComponent<RectTransform>());
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private static void StretchToParent(RectTransform rectTransform)
|
|
48
|
+
{
|
|
49
|
+
rectTransform.anchorMin = Vector2.zero;
|
|
50
|
+
rectTransform.anchorMax = Vector2.one;
|
|
51
|
+
rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
|
52
|
+
rectTransform.anchoredPosition = Vector2.zero;
|
|
53
|
+
rectTransform.sizeDelta = Vector2.zero;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -556,7 +556,7 @@ PrefabInstance:
|
|
|
556
556
|
objectReference: {fileID: 0}
|
|
557
557
|
- target: {fileID: 7363684731116559227, guid: a339c1d0d1ed34649bc790f13508f5c1, type: 3}
|
|
558
558
|
propertyPath: m_AnchoredPosition.y
|
|
559
|
-
value:
|
|
559
|
+
value: -50
|
|
560
560
|
objectReference: {fileID: 0}
|
|
561
561
|
- target: {fileID: 7363684731116559227, guid: a339c1d0d1ed34649bc790f13508f5c1, type: 3}
|
|
562
562
|
propertyPath: m_LocalEulerAnglesHint.x
|
|
@@ -438,7 +438,7 @@ PrefabInstance:
|
|
|
438
438
|
objectReference: {fileID: 0}
|
|
439
439
|
- target: {fileID: 1058585634037846549, guid: d9d0c284a651b3a488ec179c56fe7d7f, type: 3}
|
|
440
440
|
propertyPath: m_AnchoredPosition.y
|
|
441
|
-
value:
|
|
441
|
+
value: -50
|
|
442
442
|
objectReference: {fileID: 0}
|
|
443
443
|
- target: {fileID: 1058585634037846549, guid: d9d0c284a651b3a488ec179c56fe7d7f, type: 3}
|
|
444
444
|
propertyPath: m_LocalEulerAnglesHint.x
|
|
@@ -160,6 +160,18 @@ PrefabInstance:
|
|
|
160
160
|
propertyPath: m_SizeDelta.y
|
|
161
161
|
value: 870.2895
|
|
162
162
|
objectReference: {fileID: 0}
|
|
163
|
+
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
164
|
+
propertyPath: m_LocalScale.x
|
|
165
|
+
value: 0.96
|
|
166
|
+
objectReference: {fileID: 0}
|
|
167
|
+
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
168
|
+
propertyPath: m_LocalScale.y
|
|
169
|
+
value: 0.96
|
|
170
|
+
objectReference: {fileID: 0}
|
|
171
|
+
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
172
|
+
propertyPath: m_LocalScale.z
|
|
173
|
+
value: 0.96
|
|
174
|
+
objectReference: {fileID: 0}
|
|
163
175
|
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
164
176
|
propertyPath: m_LocalPosition.x
|
|
165
177
|
value: 0
|
|
@@ -194,7 +206,7 @@ PrefabInstance:
|
|
|
194
206
|
objectReference: {fileID: 0}
|
|
195
207
|
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
196
208
|
propertyPath: m_AnchoredPosition.y
|
|
197
|
-
value:
|
|
209
|
+
value: -50
|
|
198
210
|
objectReference: {fileID: 0}
|
|
199
211
|
- target: {fileID: 9176982616275533154, guid: 856acbd60978d3740849e762e87c5e7c, type: 3}
|
|
200
212
|
propertyPath: m_LocalEulerAnglesHint.x
|
|
@@ -28,7 +28,7 @@ RectTransform:
|
|
|
28
28
|
m_GameObject: {fileID: 858581963775131442}
|
|
29
29
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
30
30
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
31
|
-
m_LocalScale: {x: 0.
|
|
31
|
+
m_LocalScale: {x: 0.96, y: 0.96, z: 0.96}
|
|
32
32
|
m_ConstrainProportionsScale: 1
|
|
33
33
|
m_Children:
|
|
34
34
|
- {fileID: 3260987079844009583}
|
|
@@ -39,7 +39,7 @@ RectTransform:
|
|
|
39
39
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
40
40
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
|
41
41
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
|
42
|
-
m_AnchoredPosition: {x: 0, y:
|
|
42
|
+
m_AnchoredPosition: {x: 0, y: -50}
|
|
43
43
|
m_SizeDelta: {x: 890.68, y: 854.7493}
|
|
44
44
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
45
45
|
--- !u!222 &5855589522202011792
|
|
@@ -40,7 +40,7 @@ RectTransform:
|
|
|
40
40
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
41
41
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
|
42
42
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
|
43
|
-
m_AnchoredPosition: {x: 0, y:
|
|
43
|
+
m_AnchoredPosition: {x: 0, y: -15}
|
|
44
44
|
m_SizeDelta: {x: 890.6797, y: 784.1287}
|
|
45
45
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
46
46
|
--- !u!222 &7474295978719854104
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app.hypergames.hypersdk",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.16",
|
|
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",
|