Add scene fade transitions, gacha pull reveal, and modal/hover animations
Menu <-> combat scene loads now fade through black instead of hard-cutting, gacha pulls reveal reward cards with a staggered stagger-in and a rarity flash instead of a static text block, starter selection and root-credit exchange modals fade+scale in/out instead of popping via display:none, and menu/collection/gacha rows now transition on hover/select instead of snapping. All new motion respects the existing reduced-motion setting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015hiJi3irEg1RegCXRaQDcu
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using KernelPanic.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace KernelPanic.Core
|
||||
{
|
||||
@@ -10,14 +12,38 @@ namespace KernelPanic.Core
|
||||
public const string MainMenuSceneName = "MainMenuScene";
|
||||
public const string GameSceneName = "GameScene";
|
||||
|
||||
public static void LoadMainMenu()
|
||||
private const string CurtainClassName = "scene-fade-curtain";
|
||||
private const string CurtainVisibleClassName = "scene-fade-visible";
|
||||
private const int FadeOutMs = 200;
|
||||
|
||||
public static void LoadMainMenu(VisualElement fadeRoot)
|
||||
{
|
||||
LoadScene(MainMenuSceneName);
|
||||
FadeThenLoad(fadeRoot, MainMenuSceneName);
|
||||
}
|
||||
|
||||
public static void LoadGame()
|
||||
public static void LoadGame(VisualElement fadeRoot)
|
||||
{
|
||||
LoadScene(GameSceneName);
|
||||
FadeThenLoad(fadeRoot, GameSceneName);
|
||||
}
|
||||
|
||||
private static void FadeThenLoad(VisualElement fadeRoot, string sceneName)
|
||||
{
|
||||
if (fadeRoot == null)
|
||||
{
|
||||
LoadScene(sceneName);
|
||||
return;
|
||||
}
|
||||
|
||||
VisualElement curtain = new() { pickingMode = PickingMode.Ignore };
|
||||
curtain.AddToClassList(CurtainClassName);
|
||||
fadeRoot.Add(curtain);
|
||||
|
||||
// Two scheduled steps: add the class one tick late so the initial opacity:0 is
|
||||
// actually rendered first and the transition has something to animate from.
|
||||
curtain.schedule.Execute(() => curtain.AddToClassList(CurtainVisibleClassName)).StartingIn(0);
|
||||
|
||||
int delay = UIPreferences.ReducedMotion ? 0 : FadeOutMs;
|
||||
curtain.schedule.Execute(() => LoadScene(sceneName)).StartingIn(delay);
|
||||
}
|
||||
|
||||
// Static for now because menu navigation has no instance state; a loading-screen service can replace this hook later.
|
||||
|
||||
Reference in New Issue
Block a user