Fix hud issues and have rainbow play correctly
This commit is contained in:
@@ -11,9 +11,8 @@ using UI;
|
||||
|
||||
public class AppSwitcher : UIPage
|
||||
{
|
||||
public TextAsset rainbowEstablish;
|
||||
public TextAsset rainbowRemove;
|
||||
public GameObject rainbow;
|
||||
public GameObject rainbowIn;
|
||||
public GameObject rainbowOut;
|
||||
public GameObject gameLayoutContainer;
|
||||
public GameObject exitButton;
|
||||
public RectMask2D rectMask;
|
||||
@@ -21,7 +20,8 @@ public class AppSwitcher : UIPage
|
||||
[Header("Slide Animation Settings")]
|
||||
public float slideDuration = 0.5f;
|
||||
|
||||
private SkottiePlayerV2 rainbowPlayer;
|
||||
private SkottiePlayerV2 rainbowInPlayer;
|
||||
private SkottiePlayerV2 rainbowOutPlayer;
|
||||
private TweenBase slideInTween;
|
||||
private TweenBase slideOutTween;
|
||||
|
||||
@@ -30,51 +30,56 @@ public class AppSwitcher : UIPage
|
||||
base.OnManagedAwake();
|
||||
|
||||
PageName = "AppSwitcher";
|
||||
rainbowPlayer = rainbow.GetComponentInChildren<SkottiePlayerV2>();
|
||||
rainbowInPlayer = rainbowIn.GetComponent<SkottiePlayerV2>();
|
||||
rainbowOutPlayer = rainbowOut.GetComponent<SkottiePlayerV2>();
|
||||
|
||||
if (rectMask == null)
|
||||
{
|
||||
rectMask = GetComponent<RectMask2D>();
|
||||
}
|
||||
|
||||
// Initially hide both
|
||||
rainbowIn.SetActive(true);
|
||||
exitButton.SetActive(false);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
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)
|
||||
{
|
||||
rainbowPlayer.LoadAnimation(rainbowRemove.text);
|
||||
rainbowPlayer.PlayAnimation(true);
|
||||
rainbowPlayer.loop = false;
|
||||
rainbowIn.SetActive(false);
|
||||
|
||||
// Set input mode to game and ui
|
||||
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
|
||||
// Play animation on rainbow out with resetting state
|
||||
rainbowOutPlayer.PlayAnimation(true);
|
||||
|
||||
// Hide the exit button
|
||||
exitButton.SetActive(false);
|
||||
|
||||
// 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);
|
||||
PlayerHudManager.Instance.ShowAllHud();
|
||||
rainbowIn.SetActive(true);
|
||||
onComplete?.Invoke();
|
||||
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user