Fix hud issues and have rainbow play correctly

This commit is contained in:
Michal Pikulski
2025-11-09 22:40:58 +01:00
parent e9855faede
commit 6f515e954d
6 changed files with 938 additions and 123 deletions

View File

@@ -1183,8 +1183,8 @@ MonoBehaviour:
portraitObject: {fileID: 2258532551510216878} portraitObject: {fileID: 2258532551510216878}
cinematicsParentObject: {fileID: 5598823553633962789} cinematicsParentObject: {fileID: 5598823553633962789}
CinematicBackground: {fileID: 1256355336041814197} CinematicBackground: {fileID: 1256355336041814197}
appSwitcher: {fileID: 0}
eagleEye: {fileID: 8093509920149135307} eagleEye: {fileID: 8093509920149135307}
ramaSjangButton: {fileID: 4599222264323240281}
cinematicSprites: {fileID: 0} cinematicSprites: {fileID: 0}
cinematicBackgroundSprites: {fileID: 0} cinematicBackgroundSprites: {fileID: 0}
currentCinematicPlayer: {fileID: 0} currentCinematicPlayer: {fileID: 0}

View File

@@ -120,6 +120,44 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!1 &879012544333199198
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8293076336493130222}
m_Layer: 5
m_Name: Rainbows
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8293076336493130222
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 879012544333199198}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6108475066390421500}
- {fileID: 6717870941799174515}
- {fileID: 4136733570236406132}
m_Father: {fileID: 1315170081792486277}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &904161782565348054 --- !u!1 &904161782565348054
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -166,7 +204,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 200} m_AnchoredPosition: {x: 0, y: 200}
m_SizeDelta: {x: 1550, y: 700} m_SizeDelta: {x: 1550, y: 750}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &4291423916360628965 --- !u!223 &4291423916360628965
Canvas: Canvas:
@@ -252,7 +290,7 @@ MonoBehaviour:
m_StartCorner: 0 m_StartCorner: 0
m_StartAxis: 0 m_StartAxis: 0
m_CellSize: {x: 350, y: 350} m_CellSize: {x: 350, y: 350}
m_Spacing: {x: 50, y: 0} m_Spacing: {x: 50, y: 50}
m_Constraint: 2 m_Constraint: 2
m_ConstraintCount: 2 m_ConstraintCount: 2
--- !u!114 &7425566603516801919 --- !u!114 &7425566603516801919
@@ -300,7 +338,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 6108475066390421500} - {fileID: 8293076336493130222}
- {fileID: 808554455652734252} - {fileID: 808554455652734252}
- {fileID: 2831878373711017175} - {fileID: 2831878373711017175}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@@ -364,13 +402,12 @@ MonoBehaviour:
m_EditorClassIdentifier: '::' m_EditorClassIdentifier: '::'
PageName: PageName:
transitionDuration: 0.3 transitionDuration: 0.3
rainbowEstablish: {fileID: 4900000, guid: 622be2ef9d5e27d45a9deaf7ed805f5f, type: 3} rainbowIn: {fileID: 5382650426034128680}
rainbowRemove: {fileID: 4900000, guid: 589505308c5daf449800f30dd4b92ce7, type: 3} rainbowOut: {fileID: 3983328028282460839}
rainbow: {fileID: 5382650426034128680}
gameLayoutContainer: {fileID: 904161782565348054} gameLayoutContainer: {fileID: 904161782565348054}
exitButton: {fileID: 8427602740714176801} exitButton: {fileID: 8427602740714176801}
rectMask: {fileID: 7425566603516801919} rectMask: {fileID: 7425566603516801919}
slideDuration: 0.5 slideDuration: 0.6
--- !u!1 &2426870979657684456 --- !u!1 &2426870979657684456
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -491,6 +528,99 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!1 &3983328028282460839
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6717870941799174515}
- component: {fileID: 6334910097310371923}
- component: {fileID: 8821021733826365168}
- component: {fileID: 9163925342151684341}
m_Layer: 5
m_Name: RainbowOut
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6717870941799174515
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3983328028282460839}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8293076336493130222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6334910097310371923
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3983328028282460839}
m_CullTransparentMesh: 1
--- !u!114 &8821021733826365168
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3983328028282460839}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RawImage
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: -1
--- !u!114 &9163925342151684341
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3983328028282460839}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2fd09147b9e9d42a48d6ddc915ddc3d2, type: 3}
m_Name:
m_EditorClassIdentifier: SkiaSharp.Unity::SkiaSharp.Unity.SkottiePlayerV2
lottieFile: {fileID: 4900000, guid: 589505308c5daf449800f30dd4b92ce7, type: 3}
customResolution: 0
resWidth: 250
resHeight: 250
stateName:
resetAfterFinished: 0
autoPlay: 0
loop: 0
--- !u!1 &4270065472017787841 --- !u!1 &4270065472017787841
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -641,7 +771,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 6108475066390421500} m_Father: {fileID: 8293076336493130222}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@@ -819,7 +949,7 @@ GameObject:
- component: {fileID: 7920249735731934357} - component: {fileID: 7920249735731934357}
- component: {fileID: 3566391948883171773} - component: {fileID: 3566391948883171773}
m_Layer: 5 m_Layer: 5
m_Name: Rainbow m_Name: RainbowIn
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -832,13 +962,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5382650426034128680} m_GameObject: {fileID: 5382650426034128680}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children: []
- {fileID: 4136733570236406132} m_Father: {fileID: 8293076336493130222}
m_Father: {fileID: 1315170081792486277}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@@ -1392,6 +1521,7 @@ GameObject:
- component: {fileID: 5972191288640444065} - component: {fileID: 5972191288640444065}
- component: {fileID: 236099612463072939} - component: {fileID: 236099612463072939}
- component: {fileID: 447310668687539451} - component: {fileID: 447310668687539451}
- component: {fileID: 6704345904811573523}
m_Layer: 5 m_Layer: 5
m_Name: CloseUIButton m_Name: CloseUIButton
m_TagString: Untagged m_TagString: Untagged
@@ -1512,3 +1642,15 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 m_CallState: 2
--- !u!114 &6704345904811573523
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8427602740714176801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 494d0aedce9744308499355006071138, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::UI.DummyInput

File diff suppressed because one or more lines are too long

View File

@@ -11,9 +11,8 @@ using UI;
public class AppSwitcher : UIPage public class AppSwitcher : UIPage
{ {
public TextAsset rainbowEstablish; public GameObject rainbowIn;
public TextAsset rainbowRemove; public GameObject rainbowOut;
public GameObject rainbow;
public GameObject gameLayoutContainer; public GameObject gameLayoutContainer;
public GameObject exitButton; public GameObject exitButton;
public RectMask2D rectMask; public RectMask2D rectMask;
@@ -21,7 +20,8 @@ public class AppSwitcher : UIPage
[Header("Slide Animation Settings")] [Header("Slide Animation Settings")]
public float slideDuration = 0.5f; public float slideDuration = 0.5f;
private SkottiePlayerV2 rainbowPlayer; private SkottiePlayerV2 rainbowInPlayer;
private SkottiePlayerV2 rainbowOutPlayer;
private TweenBase slideInTween; private TweenBase slideInTween;
private TweenBase slideOutTween; private TweenBase slideOutTween;
@@ -30,51 +30,56 @@ public class AppSwitcher : UIPage
base.OnManagedAwake(); base.OnManagedAwake();
PageName = "AppSwitcher"; PageName = "AppSwitcher";
rainbowPlayer = rainbow.GetComponentInChildren<SkottiePlayerV2>(); rainbowInPlayer = rainbowIn.GetComponent<SkottiePlayerV2>();
rainbowOutPlayer = rainbowOut.GetComponent<SkottiePlayerV2>();
if (rectMask == null) if (rectMask == null)
{ {
rectMask = GetComponent<RectMask2D>(); rectMask = GetComponent<RectMask2D>();
} }
// Initially hide both
rainbowIn.SetActive(true);
exitButton.SetActive(false);
} }
protected override void DoTransitionIn(Action onComplete) protected override void DoTransitionIn(Action onComplete)
{ {
gameLayoutContainer.SetActive(true);
// Play establishing animations
rainbowPlayer.LoadAnimation(rainbowEstablish.text);
rainbowPlayer.PlayAnimation(false);
rainbowPlayer.loop = false;
// Show the exit button
exitButton.SetActive(true);
// Set input mode to UI
QuickAccess.Instance.PlayerController.InterruptMoveTo();
InputManager.Instance.SetInputMode(InputMode.UI); InputManager.Instance.SetInputMode(InputMode.UI);
gameLayoutContainer.SetActive(true);
// Hide rainbow out, show rainbow in
rainbowOut.SetActive(false);
// Play animation on rainbow in without resetting state
rainbowInPlayer.PlayAnimation(true);
// Slide in animation - tween padding.left from 1700 to 0 // Slide in animation - tween padding.left from 1700 to 0
slideInTween = TweenPaddingLeft(1700f, 0f, Tween.EaseOutBack, () => onComplete?.Invoke()); slideInTween = TweenPaddingLeft(1700f, 0f, Tween.EaseOut, () =>
{
onComplete?.Invoke();
rainbowOut.SetActive(true);
exitButton.SetActive(true);
});
} }
protected override void DoTransitionOut(Action onComplete) protected override void DoTransitionOut(Action onComplete)
{ {
rainbowPlayer.LoadAnimation(rainbowRemove.text); rainbowIn.SetActive(false);
rainbowPlayer.PlayAnimation(true);
rainbowPlayer.loop = false;
// Set input mode to game and ui // Play animation on rainbow out with resetting state
InputManager.Instance.SetInputMode(InputMode.GameAndUI); rainbowOutPlayer.PlayAnimation(true);
// Hide the exit button // Hide the exit button
exitButton.SetActive(false); exitButton.SetActive(false);
// Slide out animation - tween padding.left from 0 to 1700 // Slide out animation - tween padding.left from 0 to 1700
slideOutTween = TweenPaddingLeft(0f, 1700f, Tween.EaseInBack, () => { slideOutTween = TweenPaddingLeft(0f, 1700f, Tween.EaseIn, () => {
gameLayoutContainer.SetActive(false); gameLayoutContainer.SetActive(false);
PlayerHudManager.Instance.ShowAllHud(); rainbowIn.SetActive(true);
onComplete?.Invoke(); onComplete?.Invoke();
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
}); });
} }

View File

@@ -190,23 +190,35 @@ namespace UI.Core
{ {
if (_pageStack.Count <= 0) return; if (_pageStack.Count <= 0) return;
// Hide and pop current page // Pop current page from stack
UIPage currentPage = _pageStack.Pop(); UIPage currentPage = _pageStack.Pop();
currentPage.TransitionOut();
// Show previous page if there is one // Subscribe to transition out completion event
if (_pageStack.Count > 0) Action onTransitionComplete = null;
onTransitionComplete = () =>
{ {
UIPage previousPage = _pageStack.Peek(); // Unsubscribe to prevent memory leaks
previousPage.TransitionIn(); currentPage.OnTransitionOutCompleted -= onTransitionComplete;
OnPageChanged?.Invoke(previousPage);
Logging.Debug($"[UIPageController] Popped to previous page: {previousPage.PageName}"); // Fire OnPageChanged AFTER transition completes
} if (_pageStack.Count > 0)
else {
{ UIPage previousPage = _pageStack.Peek();
OnPageChanged?.Invoke(null); previousPage.TransitionIn();
Logging.Debug("[UIPageController] Popped last page, no pages left in stack"); OnPageChanged?.Invoke(previousPage);
} Logging.Debug($"[UIPageController] Popped to previous page: {previousPage.PageName}");
}
else
{
OnPageChanged?.Invoke(null);
Logging.Debug("[UIPageController] Popped last page, no pages left in stack");
}
};
currentPage.OnTransitionOutCompleted += onTransitionComplete;
// Start the transition out animation
currentPage.TransitionOut();
} }
/// <summary> /// <summary>

View File

@@ -32,7 +32,7 @@ namespace UI
[Header("HUD Elements")] [Header("HUD Elements")]
public GameObject eagleEye; public GameObject eagleEye;
public GameObject ramaSjangButton;
[HideInInspector] public Image cinematicSprites; [HideInInspector] public Image cinematicSprites;
[HideInInspector] public Image cinematicBackgroundSprites; [HideInInspector] public Image cinematicBackgroundSprites;
@@ -157,42 +157,17 @@ namespace UI
switch (sceneName) switch (sceneName)
{ {
case "AppleHillsOverworld": case "AppleHillsOverworld":
UpdateUIMode(UIMode.Overworld); currentUIMode = UIMode.Overworld;
break; break;
case "Quarry": case "Quarry":
UpdateUIMode(UIMode.Puzzle); currentUIMode = UIMode.Puzzle;
break; break;
case "DivingForPictures": case "DivingForPictures":
UpdateUIMode(UIMode.Minigame);
break;
}
}
public void UpdateUIMode(UIMode mode)
{
switch (mode)
{
case UIMode.Overworld:
// Update currentUIMode var
currentUIMode = UIMode.Overworld;
// Hide eagle eye
eagleEye.SetActive(false);
break;
case UIMode.Puzzle:
// Update currentUIMode var
currentUIMode = UIMode.Puzzle;
// show eagle eye
eagleEye.SetActive(true);
break;
case UIMode.Minigame:
// Update currentUIMode var
currentUIMode = UIMode.Minigame; currentUIMode = UIMode.Minigame;
// Hide birds eye
eagleEye.SetActive(false);
break; break;
} }
ShowAllHud();
} }
/// <summary> /// <summary>
@@ -245,14 +220,47 @@ namespace UI
return; return;
} }
// Set visibility for all HUD children
foreach (Transform child in hudButtonsContainer) foreach (Transform child in hudButtonsContainer)
{ {
child.gameObject.SetActive(visible); child.gameObject.SetActive(visible);
} }
ApplyUIModeOverrides(visible);
Logging.Debug($"[PlayerHudManager] {(visible ? "Shown" : "Hidden")} all HUD elements"); Logging.Debug($"[PlayerHudManager] {(visible ? "Shown" : "Hidden")} all HUD elements");
} }
/// <summary>
/// Applies UI mode-specific visibility rules (e.g., hiding eagleEye in certain modes)
/// </summary>
private void ApplyUIModeOverrides(bool visible)
{
switch (currentUIMode)
{
case UIMode.Overworld:
if (visible)
{
eagleEye.SetActive(false);
}
break;
case UIMode.Puzzle:
if (visible)
{
ramaSjangButton.SetActive(false);
}
break;
case UIMode.Minigame:
if (visible)
{
eagleEye.SetActive(false);
}
break;
case UIMode.HideAll:
break;
}
}
/// <summary> /// <summary>
/// Automatically manages HUD visibility based on page stack state /// Automatically manages HUD visibility based on page stack state
/// </summary> /// </summary>