Good-enough-for-now appswitcher
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user