using UnityEngine; using SkiaSharp.Unity; using Input; using AppleHills.Core; using UnityEngine.Events; public class AppSwitcher : MonoBehaviour { public TextAsset iconIdle; public TextAsset iconEstablish; public TextAsset rainbowEstablish; public TextAsset rainbowRemove; public GameObject rainbow; public GameObject icon; public GameObject gameLayoutContainer; public GameObject exitButton; private SkottiePlayerV2 iconPlayer; private SkottiePlayerV2 rainbowPlayer; private Animator animator; private void OnEnable() { iconPlayer = icon.GetComponentInChildren(); rainbowPlayer = rainbow.GetComponentInChildren(); animator = GetComponent(); } public void OpenAppSwitcher() { //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); } private void AnimFinished(string str) { } }