Good-enough-for-now appswitcher

This commit is contained in:
2025-11-06 17:49:44 +01:00
parent 78d0bf6441
commit eba2befc5f
11 changed files with 1221 additions and 114 deletions

View File

@@ -12,7 +12,9 @@
"Unity.Cinemachine",
"AudioSourceEvents",
"NewAssembly",
"SkiaSharp.Unity"
"SkiaSharp.Unity",
"SkiaSharp.Editor",
"SkiaSharp"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -1,5 +1,8 @@
using UnityEngine;
using SkiaSharp.Unity;
using Input;
using AppleHills.Core;
using UnityEngine.Events;
public class AppSwitcher : MonoBehaviour
{
@@ -8,17 +11,72 @@ public class AppSwitcher : MonoBehaviour
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 SkottiePlayerV2 skottiePlayer;
private void OnEnable()
{
skottiePlayer = GetComponent<SkottiePlayerV2>();
iconPlayer = icon.GetComponentInChildren<SkottiePlayerV2>();
rainbowPlayer = rainbow.GetComponentInChildren<SkottiePlayerV2>();
animator = GetComponent<Animator>();
}
public void OpenAppSwitcher()
{
Debug.Log("I'm mr. frog, hello!");
//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)
{
}
}