app.hypergames.hypersdk 1.5.10 → 1.7.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 +21 -0
- package/Editor/Scripts/Tools/HyperBuildAssistant.cs +4 -3
- package/Editor/Scripts/Windows/HyperGameContentWindow.cs +10 -0
- package/Editor/Scripts/Windows/HyperSettingsWindow.cs +10 -0
- package/HyperLoader.unity +3 -3
- package/Runtime/Internal/Bootstrap/HyperLoader.cs +57 -10
- package/Runtime/Internal/Bootstrap/HyperProductionLoggingBootstrap.cs +19 -0
- package/Runtime/Internal/Bootstrap/HyperProductionLoggingBootstrap.cs.meta +11 -0
- package/Runtime/Internal/Core/HyperRuntime.cs +16 -0
- package/Runtime/Internal/Managers/BackendManager.cs +110 -82
- package/Runtime/Internal/Managers/DataManager.cs +0 -11
- package/Runtime/Internal/Managers/EventManager.cs +1 -1
- package/Runtime/Internal/Managers/GameManager.cs +29 -23
- package/Runtime/Internal/Managers/TimeManager.cs +5 -0
- package/Runtime/Internal/ScriptableObjects/HyperGameContentConfig.cs +8 -0
- package/Runtime/Internal/UI/Modals/GamePausedModal.cs +1 -8
- package/Runtime/Plugins/WebGL/HyperCorePlugin.jslib +26 -0
- package/Runtime/Public/Core/HyperSDK.cs +191 -0
- package/Runtime/Public/PlayerDeviceClassification.cs +41 -0
- package/Runtime/Public/PlayerDeviceClassification.cs.meta +2 -0
- package/Runtime/Resources/HyperGameContentConfig.asset +1 -0
- package/Runtime/Resources/UIPrefabs/GamePausedModal_Battle.prefab +1 -1
- package/Runtime/Resources/UIPrefabs/ScoreSubmissionFailedModal_Landscape.prefab +16 -16
- package/Runtime/Resources/UIPrefabs/TimeUpModal.prefab +59 -14
- package/Runtime/Shared/DTOs/Enums.cs +1 -1
- package/Runtime/Shared/Utils/HyperDebug.cs +1 -1
- package/package.json +4 -4
|
@@ -59,32 +59,14 @@ namespace Hyper.Internal.Managers
|
|
|
59
59
|
{
|
|
60
60
|
if (!IsInGameScene || _hasGameEnded || !_hasGameStarted) return;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
// Use appropriate method based on game mode
|
|
64
|
-
if (IsBattleMode)
|
|
65
|
-
{
|
|
66
|
-
EndBattleGame();
|
|
67
|
-
}
|
|
68
|
-
else
|
|
69
|
-
{
|
|
70
|
-
EndPracticeGame();
|
|
71
|
-
}
|
|
62
|
+
EndGame();
|
|
72
63
|
}
|
|
73
64
|
|
|
74
65
|
private void HandleHealthExhausted()
|
|
75
66
|
{
|
|
76
67
|
if (!IsInGameScene || _hasGameEnded || !_hasGameStarted) return;
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
// Use appropriate method based on game mode
|
|
80
|
-
if (IsBattleMode)
|
|
81
|
-
{
|
|
82
|
-
EndBattleGame();
|
|
83
|
-
}
|
|
84
|
-
else
|
|
85
|
-
{
|
|
86
|
-
EndPracticeGame();
|
|
87
|
-
}
|
|
69
|
+
EndGame();
|
|
88
70
|
}
|
|
89
71
|
|
|
90
72
|
internal void Cleanup()
|
|
@@ -107,6 +89,22 @@ namespace Hyper.Internal.Managers
|
|
|
107
89
|
public bool HasGameStarted => _hasGameStarted;
|
|
108
90
|
public bool HasGameEnded => _hasGameEnded;
|
|
109
91
|
|
|
92
|
+
internal int BattleTimeRemaining =>
|
|
93
|
+
IsBattleMode && HyperRuntime.Timer != null
|
|
94
|
+
? HyperRuntime.Timer.BattleTimeRemaining
|
|
95
|
+
: 0;
|
|
96
|
+
|
|
97
|
+
/// <summary>
|
|
98
|
+
/// Ends the current session for whichever mode is active (practice or battle).
|
|
99
|
+
/// </summary>
|
|
100
|
+
public void EndGame()
|
|
101
|
+
{
|
|
102
|
+
if (IsBattleMode)
|
|
103
|
+
EndBattleGame();
|
|
104
|
+
else
|
|
105
|
+
EndPracticeGame();
|
|
106
|
+
}
|
|
107
|
+
|
|
110
108
|
public void EndBattleGame()
|
|
111
109
|
{
|
|
112
110
|
if (!IsBattleMode) return;
|
|
@@ -187,7 +185,9 @@ namespace Hyper.Internal.Managers
|
|
|
187
185
|
|
|
188
186
|
void OnApplicationFocus(bool hasFocus)
|
|
189
187
|
{
|
|
188
|
+
#if !UNITY_EDITOR
|
|
190
189
|
HandlePauseState(!hasFocus);
|
|
190
|
+
#endif
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
void HandlePauseState(bool shouldPause)
|
|
@@ -220,6 +220,14 @@ namespace Hyper.Internal.Managers
|
|
|
220
220
|
_eventManager.InvokeTimeScaleResumedEvent();
|
|
221
221
|
HyperDebug.Log("Time scale resumed event invoked");
|
|
222
222
|
|
|
223
|
+
// Always restart capturing when game resumes, even if offline,
|
|
224
|
+
// so scores accumulate for the offline batch and are flushed on reconnect.
|
|
225
|
+
if (!_hasGameEnded && _hasGameStarted)
|
|
226
|
+
{
|
|
227
|
+
_dataManager.StartCapturingScores();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Only resume server session if connected
|
|
223
231
|
if (_backendManager.isSocketConnected && !_hasGameEnded && _hasGameStarted)
|
|
224
232
|
{
|
|
225
233
|
_backendManager.SendGameResumed();
|
|
@@ -711,8 +719,6 @@ namespace Hyper.Internal.Managers
|
|
|
711
719
|
|
|
712
720
|
private void OptimizeForWebGL()
|
|
713
721
|
{
|
|
714
|
-
QualitySettings.streamingMipmapsActive = false;
|
|
715
|
-
QualitySettings.billboardsFaceCameraPosition = false;
|
|
716
722
|
Resources.UnloadUnusedAssets();
|
|
717
723
|
}
|
|
718
724
|
|
|
@@ -993,7 +999,7 @@ namespace Hyper.Internal.Managers
|
|
|
993
999
|
_canvasScaler = _canvas.GetComponent<CanvasScaler>();
|
|
994
1000
|
_canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
|
995
1001
|
_canvasScaler.referenceResolution = new Vector2(1080, 1920);
|
|
996
|
-
_canvasScaler.matchWidthOrHeight = 0.
|
|
1002
|
+
_canvasScaler.matchWidthOrHeight = IsPortrait() ? 0.43f : 0.73f;
|
|
997
1003
|
|
|
998
1004
|
CreateSafeArea();
|
|
999
1005
|
CreateBlockerUI();
|
|
@@ -68,6 +68,11 @@ namespace Hyper.Internal.Managers
|
|
|
68
68
|
? (int)_battleTimer
|
|
69
69
|
: (int)_practiceTimer;
|
|
70
70
|
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// Match countdown seconds (floored, clamped at zero). Same source as battle branch of <see cref="CurrentTime"/>.
|
|
73
|
+
/// </summary>
|
|
74
|
+
internal int BattleTimeRemaining => Mathf.Max(0, (int)_battleTimer);
|
|
75
|
+
|
|
71
76
|
public int SessionTimeRemaining => (int)_sessionTimer;
|
|
72
77
|
|
|
73
78
|
private GameManager _gameManager;
|
|
@@ -49,6 +49,14 @@ namespace Hyper.Internal
|
|
|
49
49
|
|
|
50
50
|
#endregion
|
|
51
51
|
|
|
52
|
+
#region Custom Pre-Loading
|
|
53
|
+
|
|
54
|
+
[Header("Custom Pre-Loading")]
|
|
55
|
+
[Tooltip("Enable if your game needs to perform custom work (e.g. downloading assets, fetching remote config) after SDK initialization but before the game scene loads. When enabled, the bootstrap will pause and wait for HyperSDK.Loader.CompleteCustomLoading() to be called.")]
|
|
56
|
+
public bool EnableCustomLoading = false;
|
|
57
|
+
|
|
58
|
+
#endregion
|
|
59
|
+
|
|
52
60
|
#region Game Posters & Hints
|
|
53
61
|
|
|
54
62
|
[Space]
|
|
@@ -96,16 +96,9 @@ namespace Hyper.Internal
|
|
|
96
96
|
|
|
97
97
|
public void ForfeitGame()
|
|
98
98
|
{
|
|
99
|
+
HyperRuntime.GameManager.EndGame();
|
|
99
100
|
if (!IsPVPMode)
|
|
100
|
-
{
|
|
101
|
-
HyperRuntime.GameManager.EndPracticeGame();
|
|
102
101
|
_gameManager.LoadPracticeMenuScene();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
else
|
|
106
|
-
{
|
|
107
|
-
HyperRuntime.GameManager.EndBattleGame();
|
|
108
|
-
}
|
|
109
102
|
}
|
|
110
103
|
|
|
111
104
|
public void ToggleSound()
|
|
@@ -56,6 +56,32 @@ mergeInto(LibraryManager.library, {
|
|
|
56
56
|
window.location.reload();
|
|
57
57
|
},
|
|
58
58
|
|
|
59
|
+
HyperIsMobileUserAgent: function () {
|
|
60
|
+
var ua = navigator.userAgent || '';
|
|
61
|
+
if (/Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop|Mobile/i.test(ua)) {
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
// Large screen.* vs small inner viewport: typical of desktop Chrome DevTools device toolbar (not a guarantee).
|
|
68
|
+
HyperIsLikelyDesktopDevtoolsMobileViewport: function () {
|
|
69
|
+
try {
|
|
70
|
+
var sw = window.screen.width;
|
|
71
|
+
var sh = window.screen.height;
|
|
72
|
+
var screenLong = Math.max(sw, sh);
|
|
73
|
+
var iw = window.innerWidth;
|
|
74
|
+
var ih = window.innerHeight;
|
|
75
|
+
var innerLong = Math.max(iw, ih);
|
|
76
|
+
if (screenLong >= 1280 && innerLong <= 900 && screenLong > innerLong * 1.35) {
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
return 0;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
59
85
|
getDeviceScreenResolution: function () {
|
|
60
86
|
// Get the device screen width and height
|
|
61
87
|
const width = window.screen.width;
|
|
@@ -15,6 +15,7 @@ namespace Hyper
|
|
|
15
15
|
private static GameAPIAdapter _gameAdapter;
|
|
16
16
|
private static DataAPIAdapter _dataAdapter;
|
|
17
17
|
private static EventAPIAdapter _eventAdapter;
|
|
18
|
+
private static LoaderAPIAdapter _loaderAdapter;
|
|
18
19
|
|
|
19
20
|
/// <summary>
|
|
20
21
|
/// Returns true if the SDK runtime has been initialized.
|
|
@@ -89,11 +90,33 @@ namespace Hyper
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
/// <summary>
|
|
94
|
+
/// Access loader control for custom pre-loading workflows.
|
|
95
|
+
/// Use when EnableCustomLoading is enabled in HyperGameContentConfig.
|
|
96
|
+
/// </summary>
|
|
97
|
+
public static ILoaderAPI Loader
|
|
98
|
+
{
|
|
99
|
+
get
|
|
100
|
+
{
|
|
101
|
+
if (_loaderAdapter == null)
|
|
102
|
+
{
|
|
103
|
+
_loaderAdapter = new LoaderAPIAdapter();
|
|
104
|
+
}
|
|
105
|
+
return _loaderAdapter;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
/// <summary>
|
|
93
110
|
/// Current Hyper SDK version string.
|
|
94
111
|
/// </summary>
|
|
95
112
|
public static string Version => HyperSDKVersion.Version;
|
|
96
113
|
|
|
114
|
+
/// <summary>True if the player is treated as mobile (heuristic). In the Unity Editor, follows the Device Simulator when active.</summary>
|
|
115
|
+
public static bool PlayerDeviceIsMobile => PlayerDeviceClassification.PlayerDeviceIsMobile;
|
|
116
|
+
|
|
117
|
+
/// <summary>True if the player is treated as PC/desktop (opposite of <see cref="PlayerDeviceIsMobile"/>).</summary>
|
|
118
|
+
public static bool PlayerDeviceIsPC => PlayerDeviceClassification.PlayerDeviceIsPC;
|
|
119
|
+
|
|
97
120
|
private static void EnsureAdaptersReady()
|
|
98
121
|
{
|
|
99
122
|
if (_gameAdapter == null)
|
|
@@ -121,32 +144,106 @@ namespace Hyper
|
|
|
121
144
|
/// </summary>
|
|
122
145
|
public interface IGameAPI
|
|
123
146
|
{
|
|
147
|
+
/// <summary>
|
|
148
|
+
/// True when the current mode is Battle (PvP or timed battle).
|
|
149
|
+
/// </summary>
|
|
124
150
|
bool IsBattleMode { get; }
|
|
151
|
+
/// <summary>
|
|
152
|
+
/// True when the current mode is Practice.
|
|
153
|
+
/// </summary>
|
|
125
154
|
bool IsPracticeMode { get; }
|
|
155
|
+
/// <summary>
|
|
156
|
+
/// True if the game is currently paused by the SDK.
|
|
157
|
+
/// </summary>
|
|
126
158
|
bool IsPaused { get; }
|
|
159
|
+
/// <summary>
|
|
160
|
+
/// True once gameplay has begun (post countdown/start).
|
|
161
|
+
/// </summary>
|
|
127
162
|
bool HasGameStarted { get; }
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// True after the current game session has ended.
|
|
165
|
+
/// </summary>
|
|
128
166
|
bool HasGameEnded { get; }
|
|
129
167
|
|
|
168
|
+
/// <summary>
|
|
169
|
+
/// Seconds remaining on the PvP match clock. Zero in practice mode or when not in a timed battle.
|
|
170
|
+
/// </summary>
|
|
171
|
+
int BattleTimeRemaining { get; }
|
|
172
|
+
|
|
173
|
+
/// <summary>
|
|
174
|
+
/// Ends the current session for whichever mode is active (practice or battle).
|
|
175
|
+
/// </summary>
|
|
176
|
+
void EndGame();
|
|
177
|
+
|
|
178
|
+
[Obsolete("Use EndGame() instead; it ends practice or battle based on the current mode.")]
|
|
130
179
|
void EndBattleGame();
|
|
180
|
+
|
|
181
|
+
[Obsolete("Use EndGame() instead; it ends practice or battle based on the current mode.")]
|
|
131
182
|
void EndPracticeGame();
|
|
183
|
+
|
|
184
|
+
/// <summary>
|
|
185
|
+
/// Closes the practice menu and enters gameplay (only relevant when practice scene is a menu).
|
|
186
|
+
/// </summary>
|
|
132
187
|
void ExitPracticeMenu();
|
|
133
188
|
|
|
134
189
|
// Lives Management (only available when ControlBarLayout is HeartsLeft)
|
|
190
|
+
/// <summary>
|
|
191
|
+
/// Initialize the lives system with a maximum and optional initial value.
|
|
192
|
+
/// </summary>
|
|
135
193
|
void InitializeLives(int maxLives, int initialLives = -1);
|
|
194
|
+
/// <summary>
|
|
195
|
+
/// Set the current number of lives.
|
|
196
|
+
/// </summary>
|
|
136
197
|
void SetLives(int lives);
|
|
198
|
+
/// <summary>
|
|
199
|
+
/// Increment lives by one.
|
|
200
|
+
/// </summary>
|
|
137
201
|
void AddLife();
|
|
202
|
+
/// <summary>
|
|
203
|
+
/// Decrement lives by one.
|
|
204
|
+
/// </summary>
|
|
138
205
|
void RemoveLife();
|
|
206
|
+
/// <summary>
|
|
207
|
+
/// Get the current number of lives.
|
|
208
|
+
/// </summary>
|
|
139
209
|
int GetCurrentLives();
|
|
210
|
+
/// <summary>
|
|
211
|
+
/// Get the configured maximum number of lives.
|
|
212
|
+
/// </summary>
|
|
140
213
|
int GetMaxLives();
|
|
141
214
|
|
|
142
215
|
// Health Management (only available when ControlBarLayout is HealthBarGreenLeft)
|
|
216
|
+
/// <summary>
|
|
217
|
+
/// Initialize the health system with a maximum and optional initial value.
|
|
218
|
+
/// </summary>
|
|
143
219
|
void InitializeHealth(float maxHealth, float initialHealth = -1f, bool isNormalized = false);
|
|
220
|
+
/// <summary>
|
|
221
|
+
/// Set the current health (absolute units).
|
|
222
|
+
/// </summary>
|
|
144
223
|
void SetHealth(float health);
|
|
224
|
+
/// <summary>
|
|
225
|
+
/// Set the current health as a normalized value in [0,1].
|
|
226
|
+
/// </summary>
|
|
145
227
|
void SetHealthNormalized(float normalizedHealth);
|
|
228
|
+
/// <summary>
|
|
229
|
+
/// Add to the current health by an absolute amount.
|
|
230
|
+
/// </summary>
|
|
146
231
|
void AddHealth(float amount);
|
|
232
|
+
/// <summary>
|
|
233
|
+
/// Remove from the current health by an absolute amount.
|
|
234
|
+
/// </summary>
|
|
147
235
|
void RemoveHealth(float amount);
|
|
236
|
+
/// <summary>
|
|
237
|
+
/// Get the current health (absolute units).
|
|
238
|
+
/// </summary>
|
|
148
239
|
float GetCurrentHealth();
|
|
240
|
+
/// <summary>
|
|
241
|
+
/// Get the maximum health (absolute units).
|
|
242
|
+
/// </summary>
|
|
149
243
|
float GetMaxHealth();
|
|
244
|
+
/// <summary>
|
|
245
|
+
/// Get the current health normalized to [0,1].
|
|
246
|
+
/// </summary>
|
|
150
247
|
float GetHealthNormalized();
|
|
151
248
|
}
|
|
152
249
|
|
|
@@ -155,34 +252,119 @@ namespace Hyper
|
|
|
155
252
|
/// </summary>
|
|
156
253
|
public interface IDataAPI
|
|
157
254
|
{
|
|
255
|
+
/// <summary>
|
|
256
|
+
/// Current in-session score value.
|
|
257
|
+
/// </summary>
|
|
158
258
|
int CurrentScore { get; }
|
|
159
259
|
|
|
260
|
+
/// <summary>
|
|
261
|
+
/// Overwrite the current score with a new value.
|
|
262
|
+
/// </summary>
|
|
160
263
|
void UpdateScore(int score);
|
|
264
|
+
/// <summary>
|
|
265
|
+
/// Set the combo multiplier applied to scoring.
|
|
266
|
+
/// </summary>
|
|
161
267
|
void SetComboMultiplier(float value);
|
|
268
|
+
/// <summary>
|
|
269
|
+
/// Set a global multiplier applied to scoring.
|
|
270
|
+
/// </summary>
|
|
162
271
|
void SetGlobalMultiplier(float value);
|
|
272
|
+
/// <summary>
|
|
273
|
+
/// Register that a powerup is active by type identifier.
|
|
274
|
+
/// </summary>
|
|
163
275
|
void AddPowerup(string powerupType);
|
|
276
|
+
/// <summary>
|
|
277
|
+
/// Remove an active powerup by type identifier.
|
|
278
|
+
/// </summary>
|
|
164
279
|
void RemovePowerup(string powerupType);
|
|
280
|
+
/// <summary>
|
|
281
|
+
/// Retrieve the best/high score recorded for the player.
|
|
282
|
+
/// </summary>
|
|
165
283
|
int GetBestScore();
|
|
166
284
|
}
|
|
167
285
|
|
|
286
|
+
/// <summary>
|
|
287
|
+
/// Public API for custom pre-loading control during the HyperLoader bootstrap.
|
|
288
|
+
/// </summary>
|
|
289
|
+
public interface ILoaderAPI
|
|
290
|
+
{
|
|
291
|
+
/// <summary>
|
|
292
|
+
/// Report progress of your custom loading (0.0 to 1.0).
|
|
293
|
+
/// This feeds into the loading bar so players see smooth progress during your custom work.
|
|
294
|
+
/// Optional — if not called, the loader will simulate progress automatically.
|
|
295
|
+
/// </summary>
|
|
296
|
+
void ReportCustomLoadingProgress(float progress);
|
|
297
|
+
|
|
298
|
+
/// <summary>
|
|
299
|
+
/// Signal that your custom pre-loading is complete.
|
|
300
|
+
/// The HyperLoader bootstrap will resume and load the game scene.
|
|
301
|
+
/// Must be called when EnableCustomLoading is true in HyperGameContentConfig.
|
|
302
|
+
/// </summary>
|
|
303
|
+
void CompleteCustomLoading();
|
|
304
|
+
}
|
|
305
|
+
|
|
168
306
|
/// <summary>
|
|
169
307
|
/// Public API for SDK events.
|
|
170
308
|
/// </summary>
|
|
171
309
|
public interface IEventAPI
|
|
172
310
|
{
|
|
311
|
+
/// <summary>
|
|
312
|
+
/// Fired when gameplay begins.
|
|
313
|
+
/// </summary>
|
|
173
314
|
event Action OnGameStart;
|
|
315
|
+
/// <summary>
|
|
316
|
+
/// Fired when the match timer reaches zero (battle mode).
|
|
317
|
+
/// </summary>
|
|
174
318
|
event Action OnTimeUp;
|
|
319
|
+
/// <summary>
|
|
320
|
+
/// Fired when the game is paused by the SDK.
|
|
321
|
+
/// </summary>
|
|
175
322
|
event Action OnGamePaused;
|
|
323
|
+
/// <summary>
|
|
324
|
+
/// Fired when the game resumes from a paused state.
|
|
325
|
+
/// </summary>
|
|
176
326
|
event Action OnGameResumed;
|
|
327
|
+
/// <summary>
|
|
328
|
+
/// Fired when the current game session ends.
|
|
329
|
+
/// </summary>
|
|
177
330
|
event Action OnGameEnded;
|
|
331
|
+
/// <summary>
|
|
332
|
+
/// Fired when the SDK sound setting changes (true = enabled).
|
|
333
|
+
/// </summary>
|
|
178
334
|
event Action<bool> OnSoundChanged;
|
|
335
|
+
/// <summary>
|
|
336
|
+
/// Fired when lives reach zero (when lives UI is in use).
|
|
337
|
+
/// </summary>
|
|
179
338
|
event Action OnLivesExhausted;
|
|
339
|
+
/// <summary>
|
|
340
|
+
/// Fired when health reaches zero (when health UI is in use).
|
|
341
|
+
/// </summary>
|
|
180
342
|
event Action OnHealthExhausted;
|
|
343
|
+
/// <summary>
|
|
344
|
+
/// Fired when a custom restart flow is requested by the SDK.
|
|
345
|
+
/// </summary>
|
|
181
346
|
event Action OnCustomRestart;
|
|
182
347
|
}
|
|
183
348
|
|
|
184
349
|
#region Adapter Implementations
|
|
185
350
|
|
|
351
|
+
/// <summary>
|
|
352
|
+
/// Bridges the public loader API to the internal HyperRuntime custom loading state.
|
|
353
|
+
/// </summary>
|
|
354
|
+
internal sealed class LoaderAPIAdapter : ILoaderAPI
|
|
355
|
+
{
|
|
356
|
+
public void ReportCustomLoadingProgress(float progress)
|
|
357
|
+
{
|
|
358
|
+
HyperRuntime.CustomLoadingProgress = Mathf.Clamp01(progress);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
public void CompleteCustomLoading()
|
|
362
|
+
{
|
|
363
|
+
HyperRuntime.CustomLoadingComplete = true;
|
|
364
|
+
HyperDebug.Log("Custom pre-loading complete. Bootstrap resuming");
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
186
368
|
/// <summary>
|
|
187
369
|
/// Bridges the public game API to the internal GameManager without exposing it to consumers.
|
|
188
370
|
/// </summary>
|
|
@@ -196,8 +378,17 @@ namespace Hyper
|
|
|
196
378
|
public bool HasGameStarted => Manager != null && Manager.HasGameStarted;
|
|
197
379
|
public bool HasGameEnded => Manager != null && Manager.HasGameEnded;
|
|
198
380
|
|
|
381
|
+
public int BattleTimeRemaining => Manager?.BattleTimeRemaining ?? 0;
|
|
382
|
+
|
|
383
|
+
/// <inheritdoc/>
|
|
384
|
+
public void EndGame() => Manager?.EndGame();
|
|
385
|
+
|
|
386
|
+
[Obsolete("Use EndGame() instead; it ends practice or battle based on the current mode.")]
|
|
199
387
|
public void EndBattleGame() => Manager?.EndBattleGame();
|
|
388
|
+
|
|
389
|
+
[Obsolete("Use EndGame() instead; it ends practice or battle based on the current mode.")]
|
|
200
390
|
public void EndPracticeGame() => Manager?.EndPracticeGame();
|
|
391
|
+
|
|
201
392
|
public void ExitPracticeMenu() => Manager?.ExitPracticeMenu();
|
|
202
393
|
|
|
203
394
|
public void InitializeLives(int maxLives, int initialLives = -1) => Manager?.InitializeLives(maxLives, initialLives);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
using System.Runtime.InteropServices;
|
|
2
|
+
using Hyper.Shared;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace Hyper
|
|
6
|
+
{
|
|
7
|
+
internal static class PlayerDeviceClassification
|
|
8
|
+
{
|
|
9
|
+
internal static bool PlayerDeviceIsMobile => Resolve() == DevicePlatform.Mobile;
|
|
10
|
+
|
|
11
|
+
internal static bool PlayerDeviceIsPC => !PlayerDeviceIsMobile;
|
|
12
|
+
|
|
13
|
+
private static DevicePlatform Resolve()
|
|
14
|
+
{
|
|
15
|
+
#if UNITY_EDITOR
|
|
16
|
+
// Unity Device Simulator: Device.Application matches the simulated device; Application does not.
|
|
17
|
+
return UnityEngine.Device.Application.isMobilePlatform ? DevicePlatform.Mobile : DevicePlatform.PC;
|
|
18
|
+
#elif UNITY_WEBGL && !UNITY_EDITOR
|
|
19
|
+
if (HyperIsLikelyDesktopDevtoolsMobileViewport() != 0)
|
|
20
|
+
return DevicePlatform.PC;
|
|
21
|
+
if (Application.isMobilePlatform || HyperIsMobileUserAgent() != 0)
|
|
22
|
+
return DevicePlatform.Mobile;
|
|
23
|
+
return DevicePlatform.PC;
|
|
24
|
+
#else
|
|
25
|
+
return Application.isMobilePlatform ? DevicePlatform.Mobile : DevicePlatform.PC;
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#if UNITY_WEBGL && !UNITY_EDITOR
|
|
30
|
+
[DllImport("__Internal")]
|
|
31
|
+
private static extern int HyperIsMobileUserAgent();
|
|
32
|
+
|
|
33
|
+
[DllImport("__Internal")]
|
|
34
|
+
private static extern int HyperIsLikelyDesktopDevtoolsMobileViewport();
|
|
35
|
+
#else
|
|
36
|
+
private static int HyperIsMobileUserAgent() => 0;
|
|
37
|
+
|
|
38
|
+
private static int HyperIsLikelyDesktopDevtoolsMobileViewport() => 0;
|
|
39
|
+
#endif
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1526,7 +1526,7 @@ RectTransform:
|
|
|
1526
1526
|
m_AnchorMin: {x: 0, y: 1}
|
|
1527
1527
|
m_AnchorMax: {x: 0, y: 1}
|
|
1528
1528
|
m_AnchoredPosition: {x: 242.0348, y: -33.43245}
|
|
1529
|
-
m_SizeDelta: {x:
|
|
1529
|
+
m_SizeDelta: {x: 0, y: 46.0515}
|
|
1530
1530
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
1531
1531
|
--- !u!222 &8480469813127575513
|
|
1532
1532
|
CanvasRenderer:
|
|
@@ -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:
|
|
31
|
+
m_LocalScale: {x: 0.82, y: 0.82, z: 0.82}
|
|
32
32
|
m_ConstrainProportionsScale: 1
|
|
33
33
|
m_Children:
|
|
34
34
|
- {fileID: 3260987079844009583}
|
|
@@ -40,7 +40,7 @@ RectTransform:
|
|
|
40
40
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
|
41
41
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
|
42
42
|
m_AnchoredPosition: {x: 0, y: 0}
|
|
43
|
-
m_SizeDelta: {x: 890.68, y:
|
|
43
|
+
m_SizeDelta: {x: 890.68, y: 854.7493}
|
|
44
44
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
45
45
|
--- !u!222 &5855589522202011792
|
|
46
46
|
CanvasRenderer:
|
|
@@ -130,9 +130,9 @@ RectTransform:
|
|
|
130
130
|
m_Children: []
|
|
131
131
|
m_Father: {fileID: 1314863699767144124}
|
|
132
132
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
133
|
-
m_AnchorMin: {x: 0.5, y:
|
|
134
|
-
m_AnchorMax: {x: 0.5, y:
|
|
135
|
-
m_AnchoredPosition: {x: 0.0000076293945, y: -
|
|
133
|
+
m_AnchorMin: {x: 0.5, y: 0.6192544}
|
|
134
|
+
m_AnchorMax: {x: 0.5, y: 0.6192544}
|
|
135
|
+
m_AnchoredPosition: {x: 0.0000076293945, y: -3}
|
|
136
136
|
m_SizeDelta: {x: 766, y: 150.8242}
|
|
137
137
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
138
138
|
--- !u!222 &4673185574738174376
|
|
@@ -267,10 +267,10 @@ RectTransform:
|
|
|
267
267
|
- {fileID: 8757155083608065361}
|
|
268
268
|
m_Father: {fileID: 1314863699767144124}
|
|
269
269
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
270
|
-
m_AnchorMin: {x: 0.5, y:
|
|
271
|
-
m_AnchorMax: {x: 0.5, y:
|
|
272
|
-
m_AnchoredPosition: {x: 0, y:
|
|
273
|
-
m_SizeDelta: {x: 766, y: 138.
|
|
270
|
+
m_AnchorMin: {x: 0.5, y: 0}
|
|
271
|
+
m_AnchorMax: {x: 0.5, y: 0}
|
|
272
|
+
m_AnchoredPosition: {x: 0, y: 104}
|
|
273
|
+
m_SizeDelta: {x: 766, y: 138.00012}
|
|
274
274
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
275
275
|
--- !u!225 &60913365496353251
|
|
276
276
|
CanvasGroup:
|
|
@@ -316,9 +316,9 @@ RectTransform:
|
|
|
316
316
|
m_Children: []
|
|
317
317
|
m_Father: {fileID: 1314863699767144124}
|
|
318
318
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
319
|
-
m_AnchorMin: {x: 0, y: 1}
|
|
320
|
-
m_AnchorMax: {x: 0, y: 1}
|
|
321
|
-
m_AnchoredPosition: {x:
|
|
319
|
+
m_AnchorMin: {x: 0.5, y: 1}
|
|
320
|
+
m_AnchorMax: {x: 0.5, y: 1}
|
|
321
|
+
m_AnchoredPosition: {x: 0.33999634, y: -144.2}
|
|
322
322
|
m_SizeDelta: {x: 180, y: 180}
|
|
323
323
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
324
324
|
--- !u!222 &1807166882388356321
|
|
@@ -871,7 +871,7 @@ PrefabInstance:
|
|
|
871
871
|
objectReference: {fileID: 0}
|
|
872
872
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
873
873
|
propertyPath: m_AnchorMax.y
|
|
874
|
-
value: 0.
|
|
874
|
+
value: 0.3654065
|
|
875
875
|
objectReference: {fileID: 0}
|
|
876
876
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
877
877
|
propertyPath: m_AnchorMin.x
|
|
@@ -879,7 +879,7 @@ PrefabInstance:
|
|
|
879
879
|
objectReference: {fileID: 0}
|
|
880
880
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
881
881
|
propertyPath: m_AnchorMin.y
|
|
882
|
-
value: 0.
|
|
882
|
+
value: 0.3654065
|
|
883
883
|
objectReference: {fileID: 0}
|
|
884
884
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
885
885
|
propertyPath: m_SizeDelta.x
|
|
@@ -919,11 +919,11 @@ PrefabInstance:
|
|
|
919
919
|
objectReference: {fileID: 0}
|
|
920
920
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
921
921
|
propertyPath: m_AnchoredPosition.x
|
|
922
|
-
value: 0
|
|
922
|
+
value: 0
|
|
923
923
|
objectReference: {fileID: 0}
|
|
924
924
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
925
925
|
propertyPath: m_AnchoredPosition.y
|
|
926
|
-
value:
|
|
926
|
+
value: 2
|
|
927
927
|
objectReference: {fileID: 0}
|
|
928
928
|
- target: {fileID: 6466996468591858475, guid: 6a53542e1517b294097a062f761d422c, type: 3}
|
|
929
929
|
propertyPath: m_LocalEulerAnglesHint.x
|