[PR #454] [MERGED] World backup toast slides in and out with its sounds (#384) #2577

Closed
opened 2026-11-02 15:57:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/454
Author: @ludovic111
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: fix/title-toast-slide


📝 Commits (1)

  • c163fbf The world backup toast slides in and out with its sounds

📊 Changes

6 files changed (+123 additions, -60 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/advancements.rs (+1 -45)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/title.rs (+28 -15)
📝 crates/horizon-client/src/title/tests.rs (+32 -0)
➕ crates/horizon-client/src/toasts.rs (+58 -0)

📄 Description

Fixes #384

What vanilla does

  • EditWorldScreen.makeBackupAndShowToast adds a SystemToast (WORLD_BACKUP) to the ToastManager.
  • ToastManager.ToastInstance slides it in from the right over 600 ms, eased by the square (calculateVisiblePortion). It is drawn at Toast.xPos = screen width − width × visible portion.
  • It stays while SystemToast.update wants it: 5000 ms × the notification display time, counted from when it was fully in. Then it slides out the same way.
  • Each change of visibility plays ui.toast.in / ui.toast.out (Toast.Visibility.playSound).

Horizon's title screens drew the backup toast fully in at once and dropped it after 5 s, with no slide and no sound. That is what the issue's video shows.

Changes

  • New toasts.rs in the lib: the in-game toasts' Slide (ToastInstance) moves there unchanged, plus update_now. game/advancements.rs imports it.
  • title.rs: the backup toast carries a Slide. update_toast updates it every frame, honours the notification display time, drops it once it has slid out, and returns the sound to play. The draw uses xPos.
  • game.rs: plays that sound each frame after poll_backup.

How it was verified

  • Unit test backup_toast_slides_in_and_out_with_its_sounds: ui.toast.in on the first frame and nothing after it. A quarter of the width is in at 300 ms, ui.toast.out comes after 5 s fully shown, and the toast is gone after it has slid out. The existing advancement and recipe toast slide tests still pass on the moved Slide.
  • In game on the Mac mini (classic menus, offscreen): Edit World → Make Backup on a world, then screenshots every ~120 ms. The "Backed up: … / Size: 4 MB" toast came in partly, then about half way, then fully. It was gone about 5.7 s later. Sounds were not heard (the check ran with HORIZON_NO_AUDIO), so they are covered by the test only.

Self-check (fmt, clippy, client tests, parity) for the whole batch: see the last comment.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/454 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/title-toast-slide` --- ### 📝 Commits (1) - [`c163fbf`](https://github.com/horizon-rust/horizon/commit/c163fbff832080396d18c91ded72873fff499832) The world backup toast slides in and out with its sounds ### 📊 Changes **6 files changed** (+123 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/advancements.rs` (+1 -45) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/title.rs` (+28 -15) 📝 `crates/horizon-client/src/title/tests.rs` (+32 -0) ➕ `crates/horizon-client/src/toasts.rs` (+58 -0) </details> ### 📄 Description Fixes #384 **What vanilla does** - `EditWorldScreen.makeBackupAndShowToast` adds a `SystemToast` (`WORLD_BACKUP`) to the `ToastManager`. - `ToastManager.ToastInstance` slides it in from the right over 600 ms, eased by the square (`calculateVisiblePortion`). It is drawn at `Toast.xPos` = screen width − width × visible portion. - It stays while `SystemToast.update` wants it: 5000 ms × the notification display time, counted from when it was fully in. Then it slides out the same way. - Each change of visibility plays `ui.toast.in` / `ui.toast.out` (`Toast.Visibility.playSound`). Horizon's title screens drew the backup toast fully in at once and dropped it after 5 s, with no slide and no sound. That is what the issue's video shows. **Changes** - New `toasts.rs` in the lib: the in-game toasts' `Slide` (`ToastInstance`) moves there unchanged, plus `update_now`. `game/advancements.rs` imports it. - `title.rs`: the backup toast carries a `Slide`. `update_toast` updates it every frame, honours the notification display time, drops it once it has slid out, and returns the sound to play. The draw uses `xPos`. - `game.rs`: plays that sound each frame after `poll_backup`. **How it was verified** - Unit test `backup_toast_slides_in_and_out_with_its_sounds`: `ui.toast.in` on the first frame and nothing after it. A quarter of the width is in at 300 ms, `ui.toast.out` comes after 5 s fully shown, and the toast is gone after it has slid out. The existing advancement and recipe toast slide tests still pass on the moved `Slide`. - In game on the Mac mini (classic menus, offscreen): Edit World → Make Backup on a world, then screenshots every ~120 ms. The "Backed up: … / Size: 4 MB" toast came in partly, then about half way, then fully. It was gone about 5.7 s later. Sounds were not heard (the check ran with `HORIZON_NO_AUDIO`), so they are covered by the test only. Self-check (fmt, clippy, client tests, parity) for the whole batch: see the last comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2577
No description provided.