app.hypergames.hypersdk 1.9.1 → 1.11.0-beta.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 +37 -0
- package/Editor/Scripts/Setup/HyperSDKInstaller.cs +42 -0
- package/Editor/Scripts/Tools/HyperGameModeMenu.cs +27 -7
- package/Runtime/Internal/AssemblyInfo.cs +1 -0
- package/Runtime/Internal/Bootstrap/HyperLoader.cs +186 -8
- package/Runtime/Internal/Core/HyperRuntime.cs +58 -0
- package/Runtime/Internal/Core/HyperRuntimeHost.cs +6 -0
- package/Runtime/Internal/Data/URLData.cs +18 -1
- package/Runtime/Internal/Managers/BackendManager.cs +281 -24
- package/Runtime/Internal/Managers/DataManager.cs +207 -21
- package/Runtime/Internal/Managers/GameManager.cs +350 -15
- package/Runtime/Internal/Managers/ReplayManager.cs +111 -0
- package/Runtime/Internal/Managers/ReplayManager.cs.meta +11 -0
- package/Runtime/Internal/Managers/TimeManager.cs +56 -14
- package/Runtime/Internal/Replay/ReplayActivityRecorder.cs +182 -0
- package/Runtime/Internal/Replay/ReplayActivityRecorder.cs.meta +2 -0
- package/Runtime/Internal/Replay/ReplaySessionState.cs +181 -0
- package/Runtime/Internal/Replay/ReplaySessionState.cs.meta +2 -0
- package/Runtime/Internal/Replay.meta +8 -0
- package/Runtime/Internal/ScriptableObjects/HyperSDKSettings.cs +5 -0
- package/Runtime/Internal/UI/Animation/LoadingTextAnimation.cs +15 -1
- package/Runtime/Internal/UI/Components/ConcaveImage.cs +147 -0
- package/Runtime/Internal/UI/Components/ConcaveImage.cs.meta +11 -0
- package/Runtime/Internal/UI/Components/ControlBar.cs +86 -6
- package/Runtime/Internal/UI/Components/PauseButton.cs +4 -1
- package/Runtime/Internal/UI/Components/ReplayController.cs +501 -0
- package/Runtime/Internal/UI/Components/ReplayController.cs.meta +2 -0
- package/Runtime/Internal/UI/Components/ReplayMarkerPulse.cs +89 -0
- package/Runtime/Internal/UI/Components/ReplayMarkerPulse.cs.meta +2 -0
- package/Runtime/Internal/UI/Components/ReplayPresentationCanvas.cs +183 -0
- package/Runtime/Internal/UI/Components/ReplayPresentationCanvas.cs.meta +2 -0
- package/Runtime/Internal/UI/Components/SnackBar.cs +2 -9
- package/Runtime/Internal/UI/Modals/LoadingFailedModal.cs +12 -0
- package/Runtime/Internal/UI/Modals/ReplayOverModal.cs +54 -0
- package/Runtime/Internal/UI/Modals/ReplayOverModal.cs.meta +2 -0
- package/Runtime/Internal/UI/Modals/StartingInstructionModal.cs +38 -29
- package/Runtime/Public/AssemblyInfo.cs +3 -0
- package/Runtime/Public/AssemblyInfo.cs.meta +2 -0
- package/Runtime/Public/Core/HyperSDK.cs +305 -109
- package/Runtime/Public/Hyper.asmdef +2 -1
- package/Runtime/Public/Replay/ReplayPlaybackEngine.cs +555 -0
- package/Runtime/Public/Replay/ReplayPlaybackEngine.cs.meta +2 -0
- package/Runtime/Public/Replay.meta +8 -0
- package/Runtime/Resources/Fonts/Nunito/Nunito-Light SDF.asset +528 -521
- package/Runtime/Resources/Materials/HyperReplayScanlines.preset +340 -0
- package/Runtime/Resources/Materials/HyperReplayScanlines.preset.meta +8 -0
- package/Runtime/Resources/Materials/ReplayScanlineOverlay.mat +55 -0
- package/Runtime/Resources/Materials/ReplayScanlineOverlay.mat.meta +8 -0
- package/Runtime/Resources/Shaders/ConcaveImage.shader +155 -0
- package/Runtime/Resources/Shaders/ConcaveImage.shader.meta +10 -0
- package/Runtime/Resources/Shaders/ReplayScanlineOverlay.shader +150 -0
- package/Runtime/Resources/Shaders/ReplayScanlineOverlay.shader.meta +10 -0
- package/Runtime/Resources/Sprites/Replays/Fallback avatar.png +0 -0
- package/Runtime/Resources/Sprites/Replays/Fallback avatar.png.meta +156 -0
- package/Runtime/Resources/Sprites/Replays/Recording.png +0 -0
- package/Runtime/Resources/Sprites/{Control Bar/Top_Black_Rounded_Bar_Portrait_IV.png.meta → Replays/Recording.png.meta} +16 -29
- package/Runtime/Resources/Sprites/Replays/Replay frame.png +0 -0
- package/Runtime/Resources/Sprites/Replays/Replay frame.png.meta +156 -0
- package/Runtime/Resources/Sprites/Replays/Replay modal icon.png +0 -0
- package/Runtime/Resources/Sprites/Replays/Replay modal icon.png.meta +156 -0
- package/Runtime/Resources/Sprites/Replays.meta +8 -0
- package/Runtime/Resources/UIPrefabs/ControlBar.prefab +389 -42
- package/Runtime/Resources/UIPrefabs/GamePausedModal_Battle.prefab +1 -1
- package/Runtime/Resources/UIPrefabs/ReplayController.prefab +1269 -0
- package/Runtime/Resources/UIPrefabs/ReplayController.prefab.meta +7 -0
- package/Runtime/Resources/UIPrefabs/ReplayInputBlocker.prefab +90 -0
- package/Runtime/Resources/UIPrefabs/ReplayInputBlocker.prefab.meta +7 -0
- package/Runtime/Resources/UIPrefabs/ReplayOverModal.prefab +958 -0
- package/Runtime/Resources/UIPrefabs/ReplayOverModal.prefab.meta +7 -0
- package/Runtime/Resources/UIPrefabs/ReplaySeekOverlay.prefab +189 -0
- package/Runtime/Resources/UIPrefabs/ReplaySeekOverlay.prefab.meta +7 -0
- package/Runtime/Resources/UIPrefabs/Rounded Cutout.prefab +96 -0
- package/Runtime/Resources/UIPrefabs/Rounded Cutout.prefab.meta +7 -0
- package/Runtime/Resources/UIPrefabs/SnackBar.prefab +23 -6
- package/Runtime/Shared/AssemblyInfo.cs +5 -0
- package/Runtime/Shared/AssemblyInfo.cs.meta +11 -0
- package/Runtime/Shared/DTOs/Enums.cs +8 -3
- package/Runtime/Shared/DTOs/Score/ScoreSnapshot.cs +13 -1
- package/Runtime/Shared/Replay/IReplayPlaybackEngine.cs +37 -0
- package/Runtime/Shared/Replay/IReplayPlaybackEngine.cs.meta +11 -0
- package/Runtime/Shared/Replay.meta +8 -0
- package/Runtime/Shared/Utils/HyperRandom.cs +25 -5
- package/Samples~/LaneRunner/LaneRunnerSample.unity +1603 -0
- package/Samples~/LaneRunner/LaneRunnerSample.unity.meta +7 -0
- package/Samples~/LaneRunner/Materials/DoubleScore.mat +86 -0
- package/Samples~/LaneRunner/Materials/DoubleScore.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials/Ground.mat +84 -0
- package/Samples~/LaneRunner/Materials/Ground.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials/Lane.mat +84 -0
- package/Samples~/LaneRunner/Materials/Lane.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials/LaneMarker.mat +84 -0
- package/Samples~/LaneRunner/Materials/LaneMarker.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials/Obstacle.mat +84 -0
- package/Samples~/LaneRunner/Materials/Obstacle.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials/Player.mat +84 -0
- package/Samples~/LaneRunner/Materials/Player.mat.meta +8 -0
- package/Samples~/LaneRunner/Materials.meta +8 -0
- package/Samples~/LaneRunner/Prefabs/DoubleScorePickup.prefab +152 -0
- package/Samples~/LaneRunner/Prefabs/DoubleScorePickup.prefab.meta +7 -0
- package/Samples~/LaneRunner/Prefabs/Obstacle.prefab +152 -0
- package/Samples~/LaneRunner/Prefabs/Obstacle.prefab.meta +7 -0
- package/Samples~/LaneRunner/Prefabs.meta +8 -0
- package/Samples~/LaneRunner/README.md +35 -0
- package/Samples~/LaneRunner/README.md.meta +7 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerCommand.cs +9 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerCommand.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerGame.cs +93 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerGame.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerPlayer.cs +155 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerPlayer.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerSpawner.cs +110 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerSpawner.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerTrackItem.cs +41 -0
- package/Samples~/LaneRunner/Scripts/Gameplay/LaneRunnerTrackItem.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Gameplay.meta +8 -0
- package/Samples~/LaneRunner/Scripts/Hyper/LaneRunnerReplayAdapter.cs +62 -0
- package/Samples~/LaneRunner/Scripts/Hyper/LaneRunnerReplayAdapter.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Hyper/LaneRunnerTournamentAdapter.cs +64 -0
- package/Samples~/LaneRunner/Scripts/Hyper/LaneRunnerTournamentAdapter.cs.meta +2 -0
- package/Samples~/LaneRunner/Scripts/Hyper.meta +8 -0
- package/Samples~/LaneRunner/Scripts.meta +8 -0
- package/Tests.meta +8 -0
- package/package.json +9 -3
- package/Runtime/Resources/Sprites/Control Bar/Top_Black_Rounded_Bar_Portrait_IV.png +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Sprites;
|
|
3
|
+
using UnityEngine.UI;
|
|
4
|
+
|
|
5
|
+
namespace Hyper.Internal
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Applies a pixel-configurable, rounded bottom cutout to a standard uGUI Image.
|
|
9
|
+
/// The assigned sprite, Image color, UI masks, and raycast target remain supported.
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ExecuteAlways]
|
|
12
|
+
[DisallowMultipleComponent]
|
|
13
|
+
[RequireComponent(typeof(Image))]
|
|
14
|
+
public sealed class ConcaveImage : MonoBehaviour
|
|
15
|
+
{
|
|
16
|
+
private const string ShaderResourcePath = "Shaders/ConcaveImage";
|
|
17
|
+
private const string ShaderName = "Hyper/UI/Concave Image";
|
|
18
|
+
private const float PortraitCutoutHeight = 55f;
|
|
19
|
+
private const float LandscapeCutoutHeight = 35f;
|
|
20
|
+
|
|
21
|
+
private static readonly int RectSizeId = Shader.PropertyToID("_RectSize");
|
|
22
|
+
private static readonly int PivotId = Shader.PropertyToID("_Pivot");
|
|
23
|
+
private static readonly int SpriteUVRectId = Shader.PropertyToID("_SpriteUVRect");
|
|
24
|
+
private static readonly int SideInsetId = Shader.PropertyToID("_SideInset");
|
|
25
|
+
private static readonly int CutoutHeightId = Shader.PropertyToID("_CutoutHeight");
|
|
26
|
+
private static readonly int CornerRadiusId = Shader.PropertyToID("_CornerRadius");
|
|
27
|
+
private static readonly int AASoftnessId = Shader.PropertyToID("_AASoftness");
|
|
28
|
+
|
|
29
|
+
[Header("Cutout (UI pixels)")]
|
|
30
|
+
[SerializeField, Min(0f)] private float sideInset = 32f;
|
|
31
|
+
[SerializeField, Min(0f)] private float cutoutHeight = 30f;
|
|
32
|
+
[SerializeField, Min(0f)] private float cornerRadius = 30f;
|
|
33
|
+
[SerializeField, Min(0.25f)] private float aaSoftness = 1f;
|
|
34
|
+
|
|
35
|
+
private Image image;
|
|
36
|
+
private RectTransform rectTransform;
|
|
37
|
+
private Material materialInstance;
|
|
38
|
+
private bool? lastPortraitState;
|
|
39
|
+
|
|
40
|
+
public float SideInset { get => sideInset; set { sideInset = Mathf.Max(0f, value); ApplyProperties(); } }
|
|
41
|
+
public float CutoutHeight { get => cutoutHeight; set { cutoutHeight = Mathf.Max(0f, value); ApplyProperties(); } }
|
|
42
|
+
public float CornerRadius { get => cornerRadius; set { cornerRadius = Mathf.Max(0f, value); ApplyProperties(); } }
|
|
43
|
+
|
|
44
|
+
private void OnEnable()
|
|
45
|
+
{
|
|
46
|
+
EnsureMaterial();
|
|
47
|
+
SyncCutoutHeightWithOrientation();
|
|
48
|
+
ApplyProperties();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private void Update()
|
|
52
|
+
{
|
|
53
|
+
SyncCutoutHeightWithOrientation();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private void OnValidate()
|
|
57
|
+
{
|
|
58
|
+
sideInset = Mathf.Max(0f, sideInset);
|
|
59
|
+
cutoutHeight = Mathf.Max(0f, cutoutHeight);
|
|
60
|
+
cornerRadius = Mathf.Max(0f, cornerRadius);
|
|
61
|
+
aaSoftness = Mathf.Max(0.25f, aaSoftness);
|
|
62
|
+
|
|
63
|
+
if (!isActiveAndEnabled) return;
|
|
64
|
+
EnsureMaterial();
|
|
65
|
+
ApplyProperties();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private void OnRectTransformDimensionsChange()
|
|
69
|
+
{
|
|
70
|
+
ApplyProperties();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private void OnDidApplyAnimation()
|
|
74
|
+
{
|
|
75
|
+
ApplyProperties();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private void SyncCutoutHeightWithOrientation()
|
|
79
|
+
{
|
|
80
|
+
if (!Application.isPlaying) return;
|
|
81
|
+
|
|
82
|
+
var gameManager = HyperRuntime.GameManager;
|
|
83
|
+
if (gameManager == null) return;
|
|
84
|
+
|
|
85
|
+
bool isPortrait = gameManager.IsPortrait();
|
|
86
|
+
if (lastPortraitState == isPortrait) return;
|
|
87
|
+
|
|
88
|
+
lastPortraitState = isPortrait;
|
|
89
|
+
cutoutHeight = isPortrait ? PortraitCutoutHeight : LandscapeCutoutHeight;
|
|
90
|
+
ApplyProperties();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private void OnDestroy()
|
|
94
|
+
{
|
|
95
|
+
if (materialInstance == null) return;
|
|
96
|
+
|
|
97
|
+
if (Application.isPlaying) Destroy(materialInstance);
|
|
98
|
+
else DestroyImmediate(materialInstance);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private void EnsureMaterial()
|
|
102
|
+
{
|
|
103
|
+
if (image == null) image = GetComponent<Image>();
|
|
104
|
+
if (rectTransform == null) rectTransform = transform as RectTransform;
|
|
105
|
+
|
|
106
|
+
if (materialInstance != null)
|
|
107
|
+
{
|
|
108
|
+
if (image.material != materialInstance) image.material = materialInstance;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Shader shader = Resources.Load<Shader>(ShaderResourcePath);
|
|
113
|
+
if (shader == null) shader = Shader.Find(ShaderName);
|
|
114
|
+
if (shader == null)
|
|
115
|
+
{
|
|
116
|
+
Debug.LogWarning($"{nameof(ConcaveImage)} could not find shader '{ShaderName}'.", this);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
materialInstance = new Material(shader)
|
|
121
|
+
{
|
|
122
|
+
name = $"{name} Concave Image (Instance)",
|
|
123
|
+
hideFlags = HideFlags.HideAndDontSave
|
|
124
|
+
};
|
|
125
|
+
image.material = materialInstance;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private void ApplyProperties()
|
|
129
|
+
{
|
|
130
|
+
if (materialInstance == null || rectTransform == null) return;
|
|
131
|
+
|
|
132
|
+
Vector2 size = rectTransform.rect.size;
|
|
133
|
+
Vector2 pivot = rectTransform.pivot;
|
|
134
|
+
Vector4 spriteUV = image.sprite != null
|
|
135
|
+
? DataUtility.GetOuterUV(image.sprite)
|
|
136
|
+
: new Vector4(0f, 0f, 1f, 1f);
|
|
137
|
+
materialInstance.SetVector(RectSizeId, new Vector4(size.x, size.y, 0f, 0f));
|
|
138
|
+
materialInstance.SetVector(PivotId, new Vector4(pivot.x, pivot.y, 0f, 0f));
|
|
139
|
+
materialInstance.SetVector(SpriteUVRectId, spriteUV);
|
|
140
|
+
materialInstance.SetFloat(SideInsetId, sideInset);
|
|
141
|
+
materialInstance.SetFloat(CutoutHeightId, cutoutHeight);
|
|
142
|
+
materialInstance.SetFloat(CornerRadiusId, cornerRadius);
|
|
143
|
+
materialInstance.SetFloat(AASoftnessId, aaSoftness);
|
|
144
|
+
image.SetMaterialDirty();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -2,6 +2,7 @@ using Hyper.Internal.Managers;
|
|
|
2
2
|
using Hyper.Shared;
|
|
3
3
|
using TMPro;
|
|
4
4
|
using UnityEngine;
|
|
5
|
+
using UnityEngine.Serialization;
|
|
5
6
|
using UnityEngine.UI;
|
|
6
7
|
|
|
7
8
|
namespace Hyper.Internal
|
|
@@ -9,7 +10,10 @@ namespace Hyper.Internal
|
|
|
9
10
|
internal class ControlBar : MonoBehaviour
|
|
10
11
|
{
|
|
11
12
|
[Header("UI Components")]
|
|
12
|
-
|
|
13
|
+
[Tooltip("Legacy content container. Its Image is disabled; it is no longer used as the visual control-bar background.")]
|
|
14
|
+
public GameObject roundedBG;
|
|
15
|
+
[Tooltip("Procedural control-bar background containing the ConcaveImage component.")]
|
|
16
|
+
[SerializeField] private Image controlBarBackground;
|
|
13
17
|
[SerializeField] TextMeshProUGUI scoreText;
|
|
14
18
|
[SerializeField] private RectTransform scoreTextRect;
|
|
15
19
|
[SerializeField] private RectTransform timerText;
|
|
@@ -17,6 +21,9 @@ namespace Hyper.Internal
|
|
|
17
21
|
[SerializeField] private Image pauseButtonImage;
|
|
18
22
|
[SerializeField] private Image pauseBarsImage;
|
|
19
23
|
[SerializeField] private Button connectionStatusIcon;
|
|
24
|
+
[Tooltip("Shown only for the Hearts Left layout in landscape orientation.")]
|
|
25
|
+
[FormerlySerializedAs("pcLandscapeHeartsDivider")]
|
|
26
|
+
[SerializeField] private GameObject landscapeHeartsDivider;
|
|
20
27
|
|
|
21
28
|
[Header("Sprites")]
|
|
22
29
|
[SerializeField] Sprite pauseBarsLight;
|
|
@@ -33,6 +40,8 @@ namespace Hyper.Internal
|
|
|
33
40
|
private TextMeshProUGUI _timerTextComponent;
|
|
34
41
|
private LivesDisplay _livesDisplay;
|
|
35
42
|
private HealthBarDisplay _healthBarDisplay;
|
|
43
|
+
private GameObject _pauseButtonRoot;
|
|
44
|
+
private GameObject _replayMarker;
|
|
36
45
|
|
|
37
46
|
// Layout constants
|
|
38
47
|
private const float CENTERED_LAYOUT_SCORE_Y = 31f;
|
|
@@ -46,6 +55,9 @@ namespace Hyper.Internal
|
|
|
46
55
|
private const float DEFAULT_LAYOUT_SCORE_FONT_SIZE = 100f;
|
|
47
56
|
private const float DEFAULT_LAYOUT_TIMER_FONT_SIZE = 60f;
|
|
48
57
|
|
|
58
|
+
private const float LANDSCAPE_HEARTS_TIMER_X = -80f;
|
|
59
|
+
private const float LANDSCAPE_HEARTS_SCORE_X = 285.2284f;
|
|
60
|
+
|
|
49
61
|
// Theme constants
|
|
50
62
|
private const string LIGHT_THEME_BG_COLOR = "#F5F5F5";
|
|
51
63
|
private const string LIGHT_THEME_TEXT_COLOR = "#434343";
|
|
@@ -58,6 +70,7 @@ namespace Hyper.Internal
|
|
|
58
70
|
void Awake()
|
|
59
71
|
{
|
|
60
72
|
_gameManager = HyperRuntime.GameManager;
|
|
73
|
+
ConfigureControlBarBackground();
|
|
61
74
|
CacheTextComponents();
|
|
62
75
|
|
|
63
76
|
RectTransform rect = transform.GetComponent<RectTransform>();
|
|
@@ -65,12 +78,26 @@ namespace Hyper.Internal
|
|
|
65
78
|
ConfigureLayout();
|
|
66
79
|
ConfigureTheme();
|
|
67
80
|
|
|
68
|
-
|
|
81
|
+
ConfigureReplayState();
|
|
82
|
+
|
|
83
|
+
connectionStatusIcon?.onClick.AddListener(ShowConnectionLostStatus);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private void ConfigureControlBarBackground()
|
|
87
|
+
{
|
|
88
|
+
if (controlBarBackground == null)
|
|
89
|
+
{
|
|
90
|
+
ConcaveImage concaveImage = GetComponentInChildren<ConcaveImage>(true);
|
|
91
|
+
if (concaveImage != null)
|
|
92
|
+
{
|
|
93
|
+
controlBarBackground = concaveImage.GetComponent<Image>();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
69
96
|
}
|
|
70
97
|
|
|
71
98
|
private void OnDestroy()
|
|
72
99
|
{
|
|
73
|
-
connectionStatusIcon
|
|
100
|
+
connectionStatusIcon?.onClick.RemoveListener(ShowConnectionLostStatus);
|
|
74
101
|
}
|
|
75
102
|
|
|
76
103
|
private void CacheTextComponents()
|
|
@@ -93,10 +120,26 @@ namespace Hyper.Internal
|
|
|
93
120
|
|
|
94
121
|
private void ConfigureLayout()
|
|
95
122
|
{
|
|
123
|
+
bool useLandscapeHeartsLayout =
|
|
124
|
+
_gameManager.ControlBarLayout == ControlBarLayout.HeartsLeft &&
|
|
125
|
+
!_gameManager.IsPortrait();
|
|
126
|
+
|
|
127
|
+
if (landscapeHeartsDivider != null)
|
|
128
|
+
{
|
|
129
|
+
landscapeHeartsDivider.SetActive(useLandscapeHeartsLayout);
|
|
130
|
+
}
|
|
131
|
+
|
|
96
132
|
switch (_gameManager.ControlBarLayout)
|
|
97
133
|
{
|
|
98
134
|
case ControlBarLayout.HeartsLeft:
|
|
99
|
-
|
|
135
|
+
if (useLandscapeHeartsLayout)
|
|
136
|
+
{
|
|
137
|
+
ApplyLandscapeHeartsLayout();
|
|
138
|
+
}
|
|
139
|
+
else
|
|
140
|
+
{
|
|
141
|
+
ApplyCenteredLayout();
|
|
142
|
+
}
|
|
100
143
|
SetupLivesDisplay();
|
|
101
144
|
break;
|
|
102
145
|
case ControlBarLayout.HealthBarLeft:
|
|
@@ -215,6 +258,24 @@ namespace Hyper.Internal
|
|
|
215
258
|
_timerTextComponent.alignment = TextAlignmentOptions.MidlineLeft;
|
|
216
259
|
}
|
|
217
260
|
|
|
261
|
+
private void ApplyLandscapeHeartsLayout()
|
|
262
|
+
{
|
|
263
|
+
// Begin with the standard score/timer sizing and vertical positions.
|
|
264
|
+
ApplyDefaultLayout();
|
|
265
|
+
|
|
266
|
+
timerText.anchorMin = new Vector2(0.5f, 0.5f);
|
|
267
|
+
timerText.anchorMax = new Vector2(0.5f, 0.5f);
|
|
268
|
+
timerText.pivot = new Vector2(0.5f, 0.5f);
|
|
269
|
+
timerText.anchoredPosition = new Vector2(LANDSCAPE_HEARTS_TIMER_X, DEFAULT_LAYOUT_TIMER_Y);
|
|
270
|
+
_timerTextComponent.alignment = TextAlignmentOptions.MidlineRight;
|
|
271
|
+
|
|
272
|
+
scoreTextRect.anchorMin = new Vector2(0.5f, 0.5f);
|
|
273
|
+
scoreTextRect.anchorMax = new Vector2(0.5f, 0.5f);
|
|
274
|
+
scoreTextRect.pivot = new Vector2(0.5f, 0.5f);
|
|
275
|
+
scoreTextRect.anchoredPosition = new Vector2(LANDSCAPE_HEARTS_SCORE_X, DEFAULT_LAYOUT_SCORE_Y);
|
|
276
|
+
_scoreTextComponent.alignment = TextAlignmentOptions.MidlineLeft;
|
|
277
|
+
}
|
|
278
|
+
|
|
218
279
|
private void ConfigureTheme()
|
|
219
280
|
{
|
|
220
281
|
switch (_gameManager.ControlBarTheme)
|
|
@@ -230,7 +291,7 @@ namespace Hyper.Internal
|
|
|
230
291
|
|
|
231
292
|
private void ApplyDarkTheme()
|
|
232
293
|
{
|
|
233
|
-
|
|
294
|
+
if (controlBarBackground != null) controlBarBackground.color = Color.black;
|
|
234
295
|
safeAreaFillerBG.color = Color.black;
|
|
235
296
|
|
|
236
297
|
_scoreTextComponent.color = Color.white;
|
|
@@ -245,7 +306,7 @@ namespace Hyper.Internal
|
|
|
245
306
|
Color bgColor = HexToColor(LIGHT_THEME_BG_COLOR);
|
|
246
307
|
Color textColor = HexToColor(LIGHT_THEME_TEXT_COLOR);
|
|
247
308
|
|
|
248
|
-
|
|
309
|
+
if (controlBarBackground != null) controlBarBackground.color = bgColor;
|
|
249
310
|
safeAreaFillerBG.color = bgColor;
|
|
250
311
|
|
|
251
312
|
_scoreTextComponent.color = textColor;
|
|
@@ -257,10 +318,29 @@ namespace Hyper.Internal
|
|
|
257
318
|
|
|
258
319
|
private void ShowConnectionLostStatus()
|
|
259
320
|
{
|
|
321
|
+
if (HyperRuntime.GameManager != null && HyperRuntime.GameManager.IsReplayMode) return;
|
|
260
322
|
// Show the connection lost status
|
|
261
323
|
_gameManager.ShowConnectionLost();
|
|
262
324
|
}
|
|
263
325
|
|
|
326
|
+
private void ConfigureReplayState()
|
|
327
|
+
{
|
|
328
|
+
Transform[] children = GetComponentsInChildren<Transform>(true);
|
|
329
|
+
for (int i = 0; i < children.Length; i++)
|
|
330
|
+
{
|
|
331
|
+
if (children[i].name == "PauseButton") _pauseButtonRoot = children[i].gameObject;
|
|
332
|
+
else if (children[i].name == "Replay Marker") _replayMarker = children[i].gameObject;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
bool replay = HyperRuntime.GameManager != null && HyperRuntime.GameManager.IsReplayMode;
|
|
336
|
+
if (_pauseButtonRoot != null) _pauseButtonRoot.SetActive(!replay);
|
|
337
|
+
if (_replayMarker != null)
|
|
338
|
+
{
|
|
339
|
+
_replayMarker.SetActive(replay);
|
|
340
|
+
}
|
|
341
|
+
if (connectionStatusIcon != null) connectionStatusIcon.gameObject.SetActive(!replay);
|
|
342
|
+
}
|
|
343
|
+
|
|
264
344
|
public void UpdateScoreLabel()
|
|
265
345
|
{
|
|
266
346
|
int currentScore = HyperRuntime.DataManager.CurrentScore;
|
|
@@ -2,6 +2,7 @@ using Hyper.Internal.Managers;
|
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
using UnityEngine.EventSystems;
|
|
4
4
|
using UnityEngine.UI;
|
|
5
|
+
using Hyper.Shared;
|
|
5
6
|
|
|
6
7
|
namespace Hyper.Internal
|
|
7
8
|
{
|
|
@@ -31,6 +32,7 @@ namespace Hyper.Internal
|
|
|
31
32
|
|
|
32
33
|
public void OnPointerDown(PointerEventData eventData)
|
|
33
34
|
{
|
|
35
|
+
if (HyperRuntime.GameManager != null && HyperRuntime.GameManager.IsReplayMode) return;
|
|
34
36
|
if (!_isTypeRush)
|
|
35
37
|
{
|
|
36
38
|
_gameManager.PauseGame();
|
|
@@ -39,10 +41,11 @@ namespace Hyper.Internal
|
|
|
39
41
|
|
|
40
42
|
public void OnPointerUp(PointerEventData eventData)
|
|
41
43
|
{
|
|
44
|
+
if (HyperRuntime.GameManager != null && HyperRuntime.GameManager.IsReplayMode) return;
|
|
42
45
|
if (_isTypeRush)
|
|
43
46
|
{
|
|
44
47
|
_gameManager.PauseGame();
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
}
|
|
51
|
+
}
|