2025-11-06 14:27:44 +01:00
|
|
|
using UnityEngine;
|
2025-11-06 15:36:02 +01:00
|
|
|
using SkiaSharp.Unity;
|
2025-11-06 17:49:44 +01:00
|
|
|
using Input;
|
|
|
|
|
using AppleHills.Core;
|
|
|
|
|
using UnityEngine.Events;
|
2025-11-06 14:27:44 +01:00
|
|
|
|
|
|
|
|
public class AppSwitcher : MonoBehaviour
|
|
|
|
|
{
|
2025-11-06 15:36:02 +01:00
|
|
|
|
|
|
|
|
public TextAsset iconIdle;
|
|
|
|
|
public TextAsset iconEstablish;
|
|
|
|
|
public TextAsset rainbowEstablish;
|
|
|
|
|
public TextAsset rainbowRemove;
|
2025-11-06 17:49:44 +01:00
|
|
|
public GameObject rainbow;
|
|
|
|
|
public GameObject icon;
|
|
|
|
|
public GameObject gameLayoutContainer;
|
|
|
|
|
public GameObject exitButton;
|
|
|
|
|
|
|
|
|
|
private SkottiePlayerV2 iconPlayer;
|
|
|
|
|
private SkottiePlayerV2 rainbowPlayer;
|
|
|
|
|
private Animator animator;
|
2025-11-06 15:36:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
2025-11-06 17:49:44 +01:00
|
|
|
iconPlayer = icon.GetComponentInChildren<SkottiePlayerV2>();
|
|
|
|
|
rainbowPlayer = rainbow.GetComponentInChildren<SkottiePlayerV2>();
|
|
|
|
|
animator = GetComponent<Animator>();
|
2025-11-07 17:21:38 +01:00
|
|
|
rainbow.SetActive(false);
|
2025-11-06 15:36:02 +01:00
|
|
|
}
|
|
|
|
|
|
2025-11-06 14:27:44 +01:00
|
|
|
public void OpenAppSwitcher()
|
|
|
|
|
{
|
2025-11-07 17:21:38 +01:00
|
|
|
|
|
|
|
|
rainbow.SetActive(true);
|
2025-11-06 17:49:44 +01:00
|
|
|
//Activate players
|
|
|
|
|
rainbow.SetActive(true);
|
|
|
|
|
gameLayoutContainer.SetActive(true);
|
|
|
|
|
|
|
|
|
|
// Play establishing animations
|
|
|
|
|
rainbowPlayer.LoadAnimation(rainbowEstablish.text);
|
|
|
|
|
rainbowPlayer.PlayAnimation(false);
|
|
|
|
|
rainbowPlayer.loop = false;
|
|
|
|
|
gameLayoutContainer.SetActive(true);
|
|
|
|
|
animator.Play("GamesReveal");
|
|
|
|
|
|
|
|
|
|
// Show the exit button
|
|
|
|
|
exitButton.SetActive(true);
|
|
|
|
|
|
|
|
|
|
// Set input mode to UI
|
|
|
|
|
QuickAccess.Instance.PlayerController.InterruptMoveTo();
|
|
|
|
|
InputManager.Instance.SetInputMode(InputMode.UI);
|
|
|
|
|
|
|
|
|
|
rainbowPlayer.OnAnimationFinished += AnimFinished;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CloseAppSwitcher()
|
|
|
|
|
{
|
|
|
|
|
rainbowPlayer.resetAfterFinished = true;
|
|
|
|
|
rainbowPlayer.LoadAnimation(rainbowRemove.text);
|
|
|
|
|
rainbowPlayer.PlayAnimation(false);
|
|
|
|
|
rainbowPlayer.loop = false;
|
|
|
|
|
animator.Play("GamesHide");
|
|
|
|
|
|
|
|
|
|
// Set input mode to game and ui
|
|
|
|
|
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
|
|
|
|
|
|
|
|
|
|
// Hide the exit button
|
|
|
|
|
exitButton.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GamesHiddenAnimationEvent()
|
|
|
|
|
{
|
|
|
|
|
rainbow.SetActive(false);
|
|
|
|
|
gameLayoutContainer.SetActive(false);
|
|
|
|
|
|
2025-11-06 14:27:44 +01:00
|
|
|
}
|
|
|
|
|
|
2025-11-06 17:49:44 +01:00
|
|
|
private void AnimFinished(string str)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-11-06 14:27:44 +01:00
|
|
|
}
|