Animate the Challenge after a live Match ends (#89)
This commit is contained in:
1 parent
aac2f4212c
commit
126912fd09
13 files changed
+677
-76
No files matched your search
@@ -19,8 +19,14 @@ use crate::worker::BelowNormal;
|
|||||||
|
|
||||||
const FADE: Duration = Duration::from_millis(500);
|
const FADE: Duration = Duration::from_millis(500);
|
||||||
|
|
||||||
|
enum Reveal {
|
||||||
|
AwaitingImage,
|
||||||
|
Settling(Instant),
|
||||||
|
}
|
||||||
|
|
||||||
pub struct BannerArt {
|
pub struct BannerArt {
|
||||||
pub(crate) target: Option<Rc<Splash>>,
|
pub(crate) target: Option<Rc<Splash>>,
|
||||||
|
reveal: Option<Reveal>,
|
||||||
previous: Option<(Rc<Splash>, Arc<RenderImage>, Instant)>,
|
previous: Option<(Rc<Splash>, Arc<RenderImage>, Instant)>,
|
||||||
/// The splash shown, and its image; none when it could not be read.
|
/// The splash shown, and its image; none when it could not be read.
|
||||||
shown: Option<(Rc<Splash>, Option<Arc<RenderImage>>)>,
|
shown: Option<(Rc<Splash>, Option<Arc<RenderImage>>)>,
|
||||||
@@ -38,6 +44,7 @@ impl BannerArt {
|
|||||||
pub fn new(cx: &mut App) -> Entity<BannerArt> {
|
pub fn new(cx: &mut App) -> Entity<BannerArt> {
|
||||||
let art = cx.new(|_| BannerArt {
|
let art = cx.new(|_| BannerArt {
|
||||||
target: None,
|
target: None,
|
||||||
|
reveal: None,
|
||||||
previous: None,
|
previous: None,
|
||||||
shown: None,
|
shown: None,
|
||||||
decoding: None,
|
decoding: None,
|
||||||
@@ -54,8 +61,57 @@ impl BannerArt {
|
|||||||
art
|
art
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn reveal(&mut self, target: Option<Rc<Splash>>, cx: &mut Context<Self>) {
|
||||||
|
self.set_target(target, cx);
|
||||||
|
self.reveal = self.target.as_ref().map(|_| Reveal::AwaitingImage);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The incoming splash starts at its first decoded frame, even on a slow disk.
|
||||||
|
pub(crate) fn reveal_frame(
|
||||||
|
&mut self,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) -> (f32, f32) {
|
||||||
|
if cx.reduce_motion() {
|
||||||
|
self.reveal = None;
|
||||||
|
}
|
||||||
|
let Some(reveal) = &mut self.reveal else {
|
||||||
|
return (1., 1.);
|
||||||
|
};
|
||||||
|
let now = cx.background_executor().now();
|
||||||
|
let start = match *reveal {
|
||||||
|
Reveal::Settling(start) => start,
|
||||||
|
Reveal::AwaitingImage => {
|
||||||
|
if !self.shown.as_ref().is_some_and(|(shown, image)| {
|
||||||
|
Some(shown) == self.target.as_ref() && image.is_some()
|
||||||
|
}) {
|
||||||
|
return (1., 1.);
|
||||||
|
}
|
||||||
|
*reveal = Reveal::Settling(now);
|
||||||
|
now
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let elapsed = now.duration_since(start).as_secs_f32();
|
||||||
|
let t = elapsed / 1.2;
|
||||||
|
if t >= 1. {
|
||||||
|
self.reveal = None;
|
||||||
|
return (1., 1.);
|
||||||
|
}
|
||||||
|
window.request_animation_frame();
|
||||||
|
(
|
||||||
|
1. + 0.1 * (1. - t).powi(2),
|
||||||
|
if self.previous.is_some() {
|
||||||
|
1.
|
||||||
|
} else {
|
||||||
|
(elapsed / FADE.as_secs_f32()).min(1.)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_target(&mut self, target: Option<Rc<Splash>>, cx: &mut Context<Self>) {
|
pub fn set_target(&mut self, target: Option<Rc<Splash>>, cx: &mut Context<Self>) {
|
||||||
if self.target != target {
|
if self.target != target {
|
||||||
|
self.reveal = None;
|
||||||
self.target = target;
|
self.target = target;
|
||||||
self.wanted = None;
|
self.wanted = None;
|
||||||
cx.notify();
|
cx.notify();
|
||||||
@@ -167,6 +223,7 @@ impl BannerArt {
|
|||||||
/// Drops the splash, in memory and in the window's atlas, for a banner that is not shown or
|
/// Drops the splash, in memory and in the window's atlas, for a banner that is not shown or
|
||||||
/// has no illustration. A decode running ends unused.
|
/// has no illustration. A decode running ends unused.
|
||||||
pub fn release(&mut self, window: &mut Window, cx: &mut App) {
|
pub fn release(&mut self, window: &mut Window, cx: &mut App) {
|
||||||
|
self.reveal = None;
|
||||||
self.wanted = None;
|
self.wanted = None;
|
||||||
self.drop_previous(Some(window), cx);
|
self.drop_previous(Some(window), cx);
|
||||||
self.drop_shown(Some(window), cx);
|
self.drop_shown(Some(window), cx);
|
||||||
|
|||||||
+15
-6
@@ -119,6 +119,7 @@ pub struct Card {
|
|||||||
/// the bottom.
|
/// the bottom.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct Pose {
|
pub struct Pose {
|
||||||
|
pub mark_fill: Option<(Marks, f32)>,
|
||||||
/// 0 at rest, 1 lifted all the way.
|
/// 0 at rest, 1 lifted all the way.
|
||||||
pub progress: f32,
|
pub progress: f32,
|
||||||
/// The hand's veil on this card: 0 to 1.
|
/// The hand's veil on this card: 0 to 1.
|
||||||
@@ -342,7 +343,7 @@ fn face(root: Div, card: &Card, pose: Option<Pose>, cx: &App) -> Div {
|
|||||||
0.
|
0.
|
||||||
};
|
};
|
||||||
el.child(
|
el.child(
|
||||||
caption(card)
|
caption(card, pose.and_then(|p| p.mark_fill))
|
||||||
.bottom(px(CAPTION_BOTTOM - slide))
|
.bottom(px(CAPTION_BOTTOM - slide))
|
||||||
.opacity(1. - progress),
|
.opacity(1. - progress),
|
||||||
)
|
)
|
||||||
@@ -456,7 +457,7 @@ fn reasons(id: u32, reasons: &[Reason]) -> Div {
|
|||||||
.children(reasons.iter().map(|reason| reason.badge(id)))
|
.children(reasons.iter().map(|reason| reason.badge(id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn caption(card: &Card) -> Div {
|
fn caption(card: &Card, fill: Option<(Marks, f32)>) -> Div {
|
||||||
div()
|
div()
|
||||||
.absolute()
|
.absolute()
|
||||||
.left(px(12.))
|
.left(px(12.))
|
||||||
@@ -479,13 +480,21 @@ fn caption(card: &Card) -> Div {
|
|||||||
.mt(px(7.))
|
.mt(px(7.))
|
||||||
.gap_x(px(10.))
|
.gap_x(px(10.))
|
||||||
.gap_y(px(4.))
|
.gap_y(px(4.))
|
||||||
.child(mark("Joué", card.marks.played))
|
.child(mark(
|
||||||
.child(mark("Victoire", card.marks.won)),
|
"Joué",
|
||||||
|
card.marks.played,
|
||||||
|
fill.filter(|(old, _)| !old.played).map_or(1., |(_, t)| t),
|
||||||
|
))
|
||||||
|
.child(mark(
|
||||||
|
"Victoire",
|
||||||
|
card.marks.won,
|
||||||
|
fill.filter(|(old, _)| !old.won).map_or(1., |(_, t)| t),
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A dot, filled with a check when on, and its label.
|
/// A dot, filled with a check when on, and its label.
|
||||||
fn mark(label: &'static str, on: bool) -> Div {
|
fn mark(label: &'static str, on: bool, fill: f32) -> Div {
|
||||||
div()
|
div()
|
||||||
.h_flex()
|
.h_flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
@@ -503,7 +512,7 @@ fn mark(label: &'static str, on: bool) -> Div {
|
|||||||
.border_1()
|
.border_1()
|
||||||
.border_color(rgb(if on { LOGO_GOLD } else { MARK_OFF_RING }))
|
.border_color(rgb(if on { LOGO_GOLD } else { MARK_OFF_RING }))
|
||||||
.when(on, |dot| {
|
.when(on, |dot| {
|
||||||
dot.bg(rgb(LOGO_GOLD))
|
dot.bg(Hsla::from(rgb(LOGO_GOLD)).opacity(fill))
|
||||||
.text_color(rgb(ON_GOLD))
|
.text_color(rgb(ON_GOLD))
|
||||||
.child(Icon::new(IconName::Check).size(px(8.)))
|
.child(Icon::new(IconName::Check).size(px(8.)))
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ pub(crate) fn layer(
|
|||||||
placed: Placements,
|
placed: Placements,
|
||||||
images: Option<Entity<CardImages>>,
|
images: Option<Entity<CardImages>>,
|
||||||
lifted_cards: Vec<Lifted>,
|
lifted_cards: Vec<Lifted>,
|
||||||
|
changing: Option<(Rc<Card>, f32)>,
|
||||||
veil: f32,
|
veil: f32,
|
||||||
moves: bool,
|
moves: bool,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
@@ -215,7 +216,13 @@ pub(crate) fn layer(
|
|||||||
let (Some(place), Some(card)) = (place, card) else {
|
let (Some(place), Some(card)) = (place, card) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
let change = changing.as_ref().filter(|(before, _)| before.id == id);
|
||||||
|
let card = change
|
||||||
|
.filter(|(_, t)| *t < 0.)
|
||||||
|
.map_or(card, |(before, _)| before.as_ref());
|
||||||
let pose = Pose {
|
let pose = Pose {
|
||||||
|
mark_fill: change
|
||||||
|
.map(|(before, t)| (before.marks, (t / 1.2).clamp(0., 1.))),
|
||||||
progress,
|
progress,
|
||||||
// Settling back, it goes under the veil of the cards at rest.
|
// Settling back, it goes under the veil of the cards at rest.
|
||||||
veil: veil * (1. - progress),
|
veil: veil * (1. - progress),
|
||||||
|
|||||||
+28
-14
@@ -20,20 +20,34 @@ const FADE_OUT: Duration = Duration::from_millis(130);
|
|||||||
/// How long the screen arriving takes to come out of it.
|
/// How long the screen arriving takes to come out of it.
|
||||||
const FADE_IN: Duration = Duration::from_millis(280);
|
const FADE_IN: Duration = Duration::from_millis(280);
|
||||||
|
|
||||||
/// What the end of a followed Match brought its champion, from the weakest to the strongest:
|
pub(crate) use arena_tracker_core::MatchEnd;
|
||||||
/// the animation it plays on « Défi » is in proportion (#89).
|
|
||||||
#[cfg_attr(
|
/// Geometry fixed at the statistics update, shared by the ring and banner.
|
||||||
not(test),
|
#[derive(Clone, Copy)]
|
||||||
expect(dead_code, reason = "the end of a followed Match asks for it (#89)")
|
pub(crate) struct MatchAnimation {
|
||||||
)]
|
pub start: Instant,
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
|
pub end: MatchEnd,
|
||||||
pub(crate) enum MatchEnd {
|
pub index: usize,
|
||||||
/// Nothing new: the tick blinks.
|
pub count: usize,
|
||||||
Nothing,
|
pub state: arena_tracker_core::ChampionState,
|
||||||
/// A new Mark: the tick steps up.
|
}
|
||||||
Mark,
|
|
||||||
/// The champion's first top 1: the comet.
|
impl MatchAnimation {
|
||||||
Completion,
|
pub fn flight(self) -> f32 {
|
||||||
|
if self.end == MatchEnd::Completion {
|
||||||
|
0.65 + 0.55 * self.index as f32 / self.count as f32
|
||||||
|
} else {
|
||||||
|
0.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn elapsed(self, now: Instant) -> f32 {
|
||||||
|
now.saturating_duration_since(self.start).as_secs_f32()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn finished(self, now: Instant) -> bool {
|
||||||
|
self.elapsed(now) >= self.flight() + 1.2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Animations asked for while « Défi » is not in front of the player: only the strongest is
|
/// Animations asked for while « Défi » is not in front of the player: only the strongest is
|
||||||
|
|||||||
+292
-35
@@ -8,9 +8,9 @@ use std::sync::Arc;
|
|||||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use arena_tracker_core::{
|
use arena_tracker_core::{
|
||||||
Account, ChampSelect, ChampionRow, ChampionSearch, ChampionSort, Format, ProgressCheck, Scope,
|
Account, ChampSelect, ChampionRow, ChampionSearch, ChampionSort, FollowedMatch, Format,
|
||||||
SeasonScope, StateFilter, Statistics, Status, SyncProgress, Tracker, UpdateProblem,
|
ProgressCheck, Scope, SeasonScope, StateFilter, Statistics, Status, SyncProgress, Tracker,
|
||||||
account_riot_id, same_riot_id,
|
UpdateProblem, account_riot_id, same_riot_id,
|
||||||
};
|
};
|
||||||
use gpui_kit::base::Button as BaseButton;
|
use gpui_kit::base::Button as BaseButton;
|
||||||
use gpui_kit::base::async_util::{Receiver, Sender};
|
use gpui_kit::base::async_util::{Receiver, Sender};
|
||||||
@@ -31,7 +31,7 @@ use crate::card_grid::{CardGrid, CardHovered, PutDown};
|
|||||||
use crate::card_lift::Lifts;
|
use crate::card_lift::Lifts;
|
||||||
use crate::card_order::card_order;
|
use crate::card_order::card_order;
|
||||||
use crate::champion_table::ChampionTable;
|
use crate::champion_table::ChampionTable;
|
||||||
use crate::motion::{AnimationSetting, Deferred, Fade, FadePhase, MatchEnd};
|
use crate::motion::{AnimationSetting, Deferred, Fade, FadePhase, MatchAnimation, MatchEnd};
|
||||||
use crate::ring::{self, Ring, Tick};
|
use crate::ring::{self, Ring, Tick};
|
||||||
use crate::text::{CLIENT_ABSENT, official_differs, sync_line};
|
use crate::text::{CLIENT_ABSENT, official_differs, sync_line};
|
||||||
use crate::worker::{
|
use crate::worker::{
|
||||||
@@ -174,6 +174,12 @@ pub struct Page {
|
|||||||
covered: bool,
|
covered: bool,
|
||||||
/// The animation asked for while « Défi » was not visible.
|
/// The animation asked for while « Défi » was not visible.
|
||||||
deferred: Deferred<MatchEnd>,
|
deferred: Deferred<MatchEnd>,
|
||||||
|
latest_match: Option<FollowedMatch>,
|
||||||
|
match_stats_pending: bool,
|
||||||
|
match_animation: Option<MatchAnimation>,
|
||||||
|
previous_banner: Option<home::BannerContent>,
|
||||||
|
previous_card: Option<Rc<Card>>,
|
||||||
|
hold_grid: bool,
|
||||||
/// The animations played, in order.
|
/// The animations played, in order.
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
played: Vec<MatchEnd>,
|
played: Vec<MatchEnd>,
|
||||||
@@ -321,7 +327,7 @@ impl Page {
|
|||||||
// lifted, and nothing waits.
|
// lifted, and nothing waits.
|
||||||
cx.observe_global_in::<AnimationSetting>(window, |this, window, cx| {
|
cx.observe_global_in::<AnimationSetting>(window, |this, window, cx| {
|
||||||
if cx.reduce_motion() {
|
if cx.reduce_motion() {
|
||||||
this.deferred.abandon();
|
this.abandon_match(cx);
|
||||||
this.lifts.finish(cx.background_executor().now());
|
this.lifts.finish(cx.background_executor().now());
|
||||||
this.end_fade(window, cx);
|
this.end_fade(window, cx);
|
||||||
}
|
}
|
||||||
@@ -455,6 +461,12 @@ impl Page {
|
|||||||
lifted_by_keyboard: None,
|
lifted_by_keyboard: None,
|
||||||
covered: false,
|
covered: false,
|
||||||
deferred: Deferred::new(),
|
deferred: Deferred::new(),
|
||||||
|
latest_match: None,
|
||||||
|
match_stats_pending: false,
|
||||||
|
match_animation: None,
|
||||||
|
previous_banner: None,
|
||||||
|
previous_card: None,
|
||||||
|
hold_grid: false,
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
played: Vec::new(),
|
played: Vec::new(),
|
||||||
season,
|
season,
|
||||||
@@ -534,21 +546,48 @@ impl Page {
|
|||||||
self.play_waiting(window, cx);
|
self.play_waiting(window, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Plays an animation of « Défi » now if it is visible, else keeps the strongest until it
|
fn abandon_match(&mut self, cx: &mut Context<Self>) {
|
||||||
/// is. With the Windows « Show animations » setting off, the end state is all there is.
|
if self.match_animation.is_some() || self.latest_match.is_some() {
|
||||||
#[cfg_attr(
|
self.banner_art.update(cx, |art, cx| {
|
||||||
not(test),
|
art.set_target(self.banner.splash.clone(), cx);
|
||||||
expect(dead_code, reason = "the end of a followed Match asks for it (#89)")
|
});
|
||||||
)]
|
}
|
||||||
pub(crate) fn animate(&mut self, end: MatchEnd, window: &mut Window, cx: &mut Context<Self>) {
|
|
||||||
if cx.reduce_motion() {
|
|
||||||
// Nor does an older one wait for the setting to come back.
|
|
||||||
self.deferred.abandon();
|
self.deferred.abandon();
|
||||||
return;
|
self.latest_match = None;
|
||||||
|
self.match_stats_pending = false;
|
||||||
|
self.match_animation = None;
|
||||||
|
self.previous_banner = None;
|
||||||
|
self.previous_card = None;
|
||||||
}
|
}
|
||||||
if let Some(end) = self.deferred.request(end, self.challenge_visible(window)) {
|
|
||||||
self.play(end);
|
fn queue_match(&mut self, event: FollowedMatch, cx: &mut Context<Self>) {
|
||||||
|
if self.match_animation.is_some() {
|
||||||
|
self.abandon_match(cx);
|
||||||
}
|
}
|
||||||
|
if self.latest_match.is_none() {
|
||||||
|
self.previous_banner = Some(if self.in_champ_select() {
|
||||||
|
home::BannerContent::new(self.home_season.as_ref(), self.home_statistics())
|
||||||
|
} else {
|
||||||
|
self.banner.clone()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
self.deferred.request(event.end, false);
|
||||||
|
if self
|
||||||
|
.latest_match
|
||||||
|
.as_ref()
|
||||||
|
.is_none_or(|old| event.started_at_ms >= old.started_at_ms)
|
||||||
|
{
|
||||||
|
self.previous_card = self
|
||||||
|
.home_grid
|
||||||
|
.read(cx)
|
||||||
|
.cards()
|
||||||
|
.iter()
|
||||||
|
.find(|c| c.id == event.champion_id)
|
||||||
|
.cloned()
|
||||||
|
.map(Rc::new);
|
||||||
|
self.latest_match = Some(event);
|
||||||
|
}
|
||||||
|
self.match_stats_pending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether « Défi » is in front of the player. A window merely covered by another cannot
|
/// Whether « Défi » is in front of the player. A window merely covered by another cannot
|
||||||
@@ -567,17 +606,29 @@ impl Page {
|
|||||||
fn play_waiting(&mut self, window: &Window, cx: &mut Context<Self>) {
|
fn play_waiting(&mut self, window: &Window, cx: &mut Context<Self>) {
|
||||||
if self.challenge_visible(window)
|
if self.challenge_visible(window)
|
||||||
&& !cx.reduce_motion()
|
&& !cx.reduce_motion()
|
||||||
|
&& !self.match_stats_pending
|
||||||
&& let Some(end) = self.deferred.shown()
|
&& let Some(end) = self.deferred.shown()
|
||||||
{
|
{
|
||||||
self.play(end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Draws the end of a followed Match: #89.
|
|
||||||
fn play(&mut self, end: MatchEnd) {
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
self.played.push(end);
|
self.played.push(end);
|
||||||
let _ = end;
|
if let Some(event) = self.latest_match.take() {
|
||||||
|
self.match_animation = self.ring.read(cx).animation(
|
||||||
|
event.champion_id,
|
||||||
|
end,
|
||||||
|
cx.background_executor().now(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let target = self
|
||||||
|
.previous_banner
|
||||||
|
.as_ref()
|
||||||
|
.filter(|_| end == MatchEnd::Completion && self.match_animation.is_some())
|
||||||
|
.unwrap_or(&self.banner)
|
||||||
|
.splash
|
||||||
|
.clone();
|
||||||
|
self.banner_art
|
||||||
|
.update(cx, |art, cx| art.set_target(target, cx));
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts a refresh, or queues one behind the refresh already running.
|
/// Starts a refresh, or queues one behind the refresh already running.
|
||||||
@@ -797,8 +848,9 @@ impl Page {
|
|||||||
// The champ select is about the Challenge, whatever tab was open.
|
// The champ select is about the Challenge, whatever tab was open.
|
||||||
self.tab = Tab::Challenge;
|
self.tab = Tab::Challenge;
|
||||||
// Nothing plays during a champ select: what waited is no longer news.
|
// Nothing plays during a champ select: what waited is no longer news.
|
||||||
|
self.hold_grid = false;
|
||||||
|
self.abandon_match(cx);
|
||||||
self.end_fade(window, cx);
|
self.end_fade(window, cx);
|
||||||
self.deferred.abandon();
|
|
||||||
// The home grid gives way to the champ select's sections.
|
// The home grid gives way to the champ select's sections.
|
||||||
self.home_grid
|
self.home_grid
|
||||||
.update(cx, |grid, cx| grid.release_images(window, cx));
|
.update(cx, |grid, cx| grid.release_images(window, cx));
|
||||||
@@ -807,7 +859,7 @@ impl Page {
|
|||||||
self.anvil_grid
|
self.anvil_grid
|
||||||
.update(cx, |grid, cx| grid.release_images(window, cx));
|
.update(cx, |grid, cx| grid.release_images(window, cx));
|
||||||
// An animation asked for during the champ select plays on the home.
|
// An animation asked for during the champ select plays on the home.
|
||||||
self.play_waiting(window, cx);
|
self.match_stats_pending = self.latest_match.is_some();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if switch {
|
if switch {
|
||||||
@@ -836,7 +888,11 @@ impl Page {
|
|||||||
// the client's events get here: no polling.
|
// the client's events get here: no polling.
|
||||||
self.prepare_champ_select(cx);
|
self.prepare_champ_select(cx);
|
||||||
}
|
}
|
||||||
Msg::Round { status, reload } => {
|
Msg::Round {
|
||||||
|
status,
|
||||||
|
reload,
|
||||||
|
matches,
|
||||||
|
} => {
|
||||||
// A follower round that changes nothing shown must not rebuild the page (they keep coming).
|
// A follower round that changes nothing shown must not rebuild the page (they keep coming).
|
||||||
if status == self.status
|
if status == self.status
|
||||||
&& !reload
|
&& !reload
|
||||||
@@ -850,6 +906,19 @@ impl Page {
|
|||||||
self.pending_round = false;
|
self.pending_round = false;
|
||||||
self.progress = None;
|
self.progress = None;
|
||||||
self.crashed = false;
|
self.crashed = false;
|
||||||
|
for event in matches {
|
||||||
|
if self.viewed().is_some_and(|a| a.puuid == event.puuid)
|
||||||
|
&& self.home_season.as_deref() == Some(event.season.as_str())
|
||||||
|
{
|
||||||
|
self.hold_grid |= self.lit_by == Some(self.home_grid.entity_id());
|
||||||
|
if cx.reduce_motion() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
self.queue_match(event, cx);
|
||||||
|
// A statistics job already running may predate the insertion.
|
||||||
|
self.stats_generation += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if reload {
|
if reload {
|
||||||
self.reload_in_background(window, cx);
|
self.reload_in_background(window, cx);
|
||||||
}
|
}
|
||||||
@@ -979,8 +1048,13 @@ impl Page {
|
|||||||
{
|
{
|
||||||
self.filter = StateFilter::All;
|
self.filter = StateFilter::All;
|
||||||
}
|
}
|
||||||
|
let previous_season = self.home_season.clone();
|
||||||
self.settle_home_scope();
|
self.settle_home_scope();
|
||||||
let viewed = self.viewed().map(|a| a.puuid.clone());
|
let viewed = self.viewed().map(|a| a.puuid.clone());
|
||||||
|
if previous_season != self.home_season || viewed != self.shown {
|
||||||
|
self.abandon_match(cx);
|
||||||
|
self.hold_grid = false;
|
||||||
|
}
|
||||||
if computing || viewed != self.shown {
|
if computing || viewed != self.shown {
|
||||||
self.stats_generation += 1;
|
self.stats_generation += 1;
|
||||||
}
|
}
|
||||||
@@ -1112,7 +1186,7 @@ impl Page {
|
|||||||
self.stats = None;
|
self.stats = None;
|
||||||
self.stats_error = None;
|
self.stats_error = None;
|
||||||
self.stored = None;
|
self.stored = None;
|
||||||
let keep_home = viewed.is_some() && self.home_is_current();
|
let keep_home = !self.match_stats_pending && viewed.is_some() && self.home_is_current();
|
||||||
if !keep_home {
|
if !keep_home {
|
||||||
self.forget_home();
|
self.forget_home();
|
||||||
}
|
}
|
||||||
@@ -1134,7 +1208,23 @@ impl Page {
|
|||||||
|
|
||||||
/// Shows `stats`: the Format choices, the charts and the table.
|
/// Shows `stats`: the Format choices, the charts and the table.
|
||||||
fn show_statistics(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn show_statistics(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
if self.hold_grid {
|
||||||
|
// Row indices are reusable only while the catalog has the same champions.
|
||||||
|
let rows = self
|
||||||
|
.home_statistics()
|
||||||
|
.map_or(&[][..], |s| s.rows.as_slice());
|
||||||
|
let cards = self.home_grid.read(cx).cards();
|
||||||
|
self.hold_grid = rows.len() == cards.len()
|
||||||
|
&& self.order.len() == rows.len()
|
||||||
|
&& self
|
||||||
|
.order
|
||||||
|
.iter()
|
||||||
|
.zip(cards.iter())
|
||||||
|
.all(|(&ix, c)| rows.get(ix).is_some_and(|r| r.champion.id == c.id));
|
||||||
|
}
|
||||||
|
if !self.hold_grid {
|
||||||
self.reorder();
|
self.reorder();
|
||||||
|
}
|
||||||
if self.in_champ_select() {
|
if self.in_champ_select() {
|
||||||
// Neither the charts, the table nor the home grid are shown during a champ select.
|
// Neither the charts, the table nor the home grid are shown during a champ select.
|
||||||
self.prepare_banner(cx);
|
self.prepare_banner(cx);
|
||||||
@@ -1160,7 +1250,11 @@ impl Page {
|
|||||||
.update(cx, |select, cx| select.set_items(names, window, cx));
|
.update(cx, |select, cx| select.set_items(names, window, cx));
|
||||||
}
|
}
|
||||||
self.refresh_table(cx);
|
self.refresh_table(cx);
|
||||||
|
if !self.hold_grid {
|
||||||
self.refresh_home(cx);
|
self.refresh_home(cx);
|
||||||
|
}
|
||||||
|
self.match_stats_pending = false;
|
||||||
|
self.play_waiting(window, cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1186,9 +1280,11 @@ impl Page {
|
|||||||
.into();
|
.into();
|
||||||
if !champ_select {
|
if !champ_select {
|
||||||
self.banner = home::BannerContent::new(self.home_season.as_ref(), stats);
|
self.banner = home::BannerContent::new(self.home_season.as_ref(), stats);
|
||||||
|
if self.latest_match.is_none() && self.match_animation.is_none() {
|
||||||
self.banner_art
|
self.banner_art
|
||||||
.update(cx, |art, cx| art.set_target(self.banner.splash.clone(), cx));
|
.update(cx, |art, cx| art.set_target(self.banner.splash.clone(), cx));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self.champ_select_splashes = splashes;
|
self.champ_select_splashes = splashes;
|
||||||
self.ring.update(cx, |ring, cx| ring.set_ticks(ticks, cx));
|
self.ring.update(cx, |ring, cx| ring.set_ticks(ticks, cx));
|
||||||
}
|
}
|
||||||
@@ -1233,7 +1329,27 @@ impl Page {
|
|||||||
pub(super) fn lift_layer(&self, grid: &Entity<CardGrid>, cx: &App) -> Option<AnyElement> {
|
pub(super) fn lift_layer(&self, grid: &Entity<CardGrid>, cx: &App) -> Option<AnyElement> {
|
||||||
let now = cx.background_executor().now();
|
let now = cx.background_executor().now();
|
||||||
let id = grid.entity_id();
|
let id = grid.entity_id();
|
||||||
let lifted: Vec<_> = self.lifts.lifted(id, now).collect();
|
let mut lifted: Vec<_> = self.lifts.lifted(id, now).collect();
|
||||||
|
let changing = self
|
||||||
|
.match_animation
|
||||||
|
.filter(|a| id == self.home_grid.entity_id() && a.end != MatchEnd::Nothing)
|
||||||
|
.and_then(|a| {
|
||||||
|
let t = a.elapsed(now) - a.flight();
|
||||||
|
let before = self.previous_card.clone()?;
|
||||||
|
if t >= 0. && a.end == MatchEnd::Completion {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
if !lifted.iter().any(|card| card.id == before.id) {
|
||||||
|
lifted.insert(
|
||||||
|
0,
|
||||||
|
crate::card_lift::Lifted {
|
||||||
|
id: before.id,
|
||||||
|
progress: 0.,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Some((before, t))
|
||||||
|
});
|
||||||
let veil = self.lifts.veil(id, now);
|
let veil = self.lifts.veil(id, now);
|
||||||
if lifted.is_empty() && veil == 0. {
|
if lifted.is_empty() && veil == 0. {
|
||||||
return None;
|
return None;
|
||||||
@@ -1244,6 +1360,7 @@ impl Page {
|
|||||||
grid.placed().clone(),
|
grid.placed().clone(),
|
||||||
grid.images().cloned(),
|
grid.images().cloned(),
|
||||||
lifted,
|
lifted,
|
||||||
|
changing,
|
||||||
veil,
|
veil,
|
||||||
!cx.reduce_motion(),
|
!cx.reduce_motion(),
|
||||||
))
|
))
|
||||||
@@ -1258,6 +1375,12 @@ impl Page {
|
|||||||
None if self.lit_by == Some(grid) => self.lit_by = None,
|
None if self.lit_by == Some(grid) => self.lit_by = None,
|
||||||
None => return,
|
None => return,
|
||||||
}
|
}
|
||||||
|
if self.hold_grid && id.is_none() && grid == self.home_grid.entity_id() {
|
||||||
|
self.hold_grid = false;
|
||||||
|
self.reorder();
|
||||||
|
self.prepare_home_cards(cx);
|
||||||
|
self.refresh_home(cx);
|
||||||
|
}
|
||||||
self.ring.update(cx, |ring, cx| ring.set_lit(id, cx));
|
self.ring.update(cx, |ring, cx| ring.set_lit(id, cx));
|
||||||
if self.in_champ_select() {
|
if self.in_champ_select() {
|
||||||
self.select_art(id, cx);
|
self.select_art(id, cx);
|
||||||
@@ -1311,6 +1434,7 @@ impl Page {
|
|||||||
if self.champion_sort == Some(sort) {
|
if self.champion_sort == Some(sort) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
self.hold_grid = false;
|
||||||
self.champion_sort = Some(sort);
|
self.champion_sort = Some(sort);
|
||||||
self.reorder();
|
self.reorder();
|
||||||
if self.in_champ_select() {
|
if self.in_champ_select() {
|
||||||
@@ -1604,6 +1728,25 @@ impl Render for Page {
|
|||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
// A card lifting or settling asks for the next frame, and none once they are still.
|
// A card lifting or settling asks for the next frame, and none once they are still.
|
||||||
let now = cx.background_executor().now();
|
let now = cx.background_executor().now();
|
||||||
|
if let Some(animation) = self.match_animation {
|
||||||
|
if animation.finished(now) || cx.reduce_motion() || !self.challenge_visible(window) {
|
||||||
|
self.match_animation = None;
|
||||||
|
self.previous_banner = None;
|
||||||
|
self.previous_card = None;
|
||||||
|
self.banner_art.update(cx, |art, cx| {
|
||||||
|
art.set_target(self.banner.splash.clone(), cx);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if animation.end == MatchEnd::Completion
|
||||||
|
&& animation.elapsed(now) >= animation.flight()
|
||||||
|
&& self.previous_banner.take().is_some()
|
||||||
|
{
|
||||||
|
self.banner_art
|
||||||
|
.update(cx, |art, cx| art.reveal(self.banner.splash.clone(), cx));
|
||||||
|
}
|
||||||
|
window.request_animation_frame();
|
||||||
|
}
|
||||||
|
}
|
||||||
self.lifts.tidy(now);
|
self.lifts.tidy(now);
|
||||||
if self.lifts.animating(now) {
|
if self.lifts.animating(now) {
|
||||||
window.request_animation_frame();
|
window.request_animation_frame();
|
||||||
@@ -3359,7 +3502,24 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn animate(page: &Entity<Page>, cx: &mut VisualTestContext, end: MatchEnd) {
|
fn animate(page: &Entity<Page>, cx: &mut VisualTestContext, end: MatchEnd) {
|
||||||
cx.update(|window, cx| page.update(cx, |page, cx| page.animate(end, window, cx)));
|
cx.update(|window, cx| {
|
||||||
|
page.update(cx, |page, cx| {
|
||||||
|
if !cx.reduce_motion() {
|
||||||
|
page.queue_match(
|
||||||
|
arena_tracker_core::FollowedMatch {
|
||||||
|
puuid: String::new(),
|
||||||
|
season: "Saison".into(),
|
||||||
|
champion_id: 1,
|
||||||
|
started_at_ms: 0,
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
page.match_stats_pending = false;
|
||||||
|
page.play_waiting(window, cx);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn played(page: &Entity<Page>, cx: &mut VisualTestContext) -> Vec<MatchEnd> {
|
fn played(page: &Entity<Page>, cx: &mut VisualTestContext) -> Vec<MatchEnd> {
|
||||||
@@ -3404,6 +3564,102 @@ mod tests {
|
|||||||
assert_eq!(played(&page, cx), [Mark, Completion, Nothing, Mark]);
|
assert_eq!(played(&page, cx), [Mark, Completion, Nothing, Mark]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
fn a_hidden_completion_plays_on_the_latest_tick_without_rebuilding_the_grid_or_statistics(
|
||||||
|
cx: &mut TestAppContext,
|
||||||
|
) {
|
||||||
|
let (page, cx) = open_page_in_season(cx);
|
||||||
|
let cx = &mut { cx };
|
||||||
|
show(&page, cx, statistics(0, 5, champions(5)));
|
||||||
|
draw(cx);
|
||||||
|
cx.simulate_visibility_change(WindowVisibility::Hidden);
|
||||||
|
cx.update(|_, cx| {
|
||||||
|
page.update(cx, |p, cx| {
|
||||||
|
for (id, end) in [(1, MatchEnd::Completion), (4, MatchEnd::Mark)] {
|
||||||
|
p.queue_match(
|
||||||
|
arena_tracker_core::FollowedMatch {
|
||||||
|
puuid: "p".into(),
|
||||||
|
season: "Saison".into(),
|
||||||
|
champion_id: id,
|
||||||
|
started_at_ms: i64::from(id),
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
cx.simulate_visibility_change(WindowVisibility::Visible);
|
||||||
|
assert!(
|
||||||
|
played(&page, cx).is_empty(),
|
||||||
|
"the new statistics are still loading"
|
||||||
|
);
|
||||||
|
cx.update(|window, cx| {
|
||||||
|
page.update(cx, |p, cx| {
|
||||||
|
let mut rows = champions(5);
|
||||||
|
rows[0] = banner_champion(1, "A", 1, Some(on(11, 20)), 0);
|
||||||
|
rows[3] = banner_champion(4, "D", 1, None, 0);
|
||||||
|
p.apply(
|
||||||
|
crate::worker::Msg::Statistics {
|
||||||
|
generation: p.stats_generation,
|
||||||
|
stats: Ok(banner_statistics(
|
||||||
|
rows,
|
||||||
|
vec![1],
|
||||||
|
Some(LastMatch {
|
||||||
|
champion_id: 4,
|
||||||
|
placement: 5,
|
||||||
|
outcome: MatchOutcome::Attempt(1),
|
||||||
|
}),
|
||||||
|
)),
|
||||||
|
home: None,
|
||||||
|
stored: Some(2),
|
||||||
|
},
|
||||||
|
window,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
draw(cx);
|
||||||
|
let baseline = |cx: &mut VisualTestContext| {
|
||||||
|
page.read_with(cx, |p, cx| {
|
||||||
|
(
|
||||||
|
p.stats_generation,
|
||||||
|
p.reorders,
|
||||||
|
p.home_grid.read(cx).set_cards_calls,
|
||||||
|
p.ring.read(cx).renders,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
// Deliver the statistics update's queued grid invalidation before measuring playback.
|
||||||
|
frame_after(cx, 16);
|
||||||
|
let first = baseline(cx);
|
||||||
|
page.read_with(cx, |p, _| {
|
||||||
|
let animation = p.match_animation.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
(animation.index, animation.count, animation.end),
|
||||||
|
(1, 5, MatchEnd::Completion)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
let grid_renders =
|
||||||
|
|cx: &mut VisualTestContext| page.read_with(cx, |p, cx| p.home_grid.read(cx).renders);
|
||||||
|
let in_flight = grid_renders(cx);
|
||||||
|
for _ in 0..3 {
|
||||||
|
frame_after(cx, 200);
|
||||||
|
}
|
||||||
|
assert_eq!(grid_renders(cx), in_flight);
|
||||||
|
// The first last-Match line can change the banner's height once, at arrival.
|
||||||
|
frame_after(cx, 200);
|
||||||
|
let arrived = grid_renders(cx);
|
||||||
|
for _ in 0..10 {
|
||||||
|
frame_after(cx, 200);
|
||||||
|
}
|
||||||
|
assert_eq!(grid_renders(cx), arrived);
|
||||||
|
assert_eq!(baseline(cx), first);
|
||||||
|
assert!(page.read_with(cx, |p, _| p.match_animation.is_none()));
|
||||||
|
assert_eq!(played(&page, cx), [MatchEnd::Completion]);
|
||||||
|
assert_at_rest(cx);
|
||||||
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
fn a_champ_select_that_starts_abandons_the_animation_waiting(cx: &mut TestAppContext) {
|
fn a_champ_select_that_starts_abandons_the_animation_waiting(cx: &mut TestAppContext) {
|
||||||
use crate::worker::Msg;
|
use crate::worker::Msg;
|
||||||
@@ -4329,8 +4585,8 @@ mod tests {
|
|||||||
// The hand gives way when the champ select ends: its lifted card goes at once, and no frame
|
// The hand gives way when the champ select ends: its lifted card goes at once, and no frame
|
||||||
// is asked for a card no longer shown.
|
// is asked for a card no longer shown.
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn a_grid_no_longer_shown_asks_for_no_frame(cx: &mut TestAppContext) {
|
async fn a_grid_no_longer_shown_asks_for_no_frame(app: &mut TestAppContext) {
|
||||||
let (page, mut window) = page_in_champ_select(cx, &frames()[0]).await;
|
let (page, mut window) = page_in_champ_select(app, &frames()[0]).await;
|
||||||
let cx = &mut window;
|
let cx = &mut window;
|
||||||
settle(cx);
|
settle(cx);
|
||||||
let id = ids(&anvil_cards(&page, cx))[0];
|
let id = ids(&anvil_cards(&page, cx))[0];
|
||||||
@@ -4346,9 +4602,10 @@ mod tests {
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
assert_eq!(lifting, (false, 0.));
|
assert_eq!(lifting, (false, 0.));
|
||||||
frame_after(cx, 16);
|
// The returning home's filter pill has its own entry animation.
|
||||||
let asked = cx.update(|window, cx| window.simulate_next_frame(cx));
|
app.condition(&page, |p, _| !p.stats_job.running()).await;
|
||||||
assert_eq!(asked, 0, "a frame is asked for");
|
draw(cx);
|
||||||
|
assert_at_rest(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// As the home grid's test: hovering the cards of « Autres champions » does not draw its grid
|
// As the home grid's test: hovering the cards of « Autres champions » does not draw its grid
|
||||||
|
|||||||
+44
-11
@@ -383,6 +383,16 @@ impl Page {
|
|||||||
/// stronger fade.
|
/// stronger fade.
|
||||||
fn banner(&self, window: &mut Window, cx: &mut Context<Page>) -> impl IntoElement {
|
fn banner(&self, window: &mut Window, cx: &mut Context<Page>) -> impl IntoElement {
|
||||||
let layout = BannerLayout::of(window.viewport_size().width);
|
let layout = BannerLayout::of(window.viewport_size().width);
|
||||||
|
let animation = self
|
||||||
|
.match_animation
|
||||||
|
.map(|a| (a, a.elapsed(cx.background_executor().now())));
|
||||||
|
let arriving = animation.map(|(a, elapsed)| elapsed - a.flight());
|
||||||
|
let flying = arriving.is_some_and(|t| t < 0.);
|
||||||
|
let text = self
|
||||||
|
.previous_banner
|
||||||
|
.as_ref()
|
||||||
|
.filter(|_| flying)
|
||||||
|
.unwrap_or(&self.banner);
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
let (band, muted, foreground, ink) = (
|
let (band, muted, foreground, ink) = (
|
||||||
banner_band(theme),
|
banner_band(theme),
|
||||||
@@ -390,7 +400,6 @@ impl Page {
|
|||||||
theme.foreground,
|
theme.foreground,
|
||||||
gold_ink(theme),
|
gold_ink(theme),
|
||||||
);
|
);
|
||||||
let text = &self.banner;
|
|
||||||
let name = |line: &Line| {
|
let name = |line: &Line| {
|
||||||
StyledText::new(line.text.clone()).with_highlights([(
|
StyledText::new(line.text.clone()).with_highlights([(
|
||||||
line.bold.clone(),
|
line.bold.clone(),
|
||||||
@@ -401,6 +410,12 @@ impl Page {
|
|||||||
},
|
},
|
||||||
)])
|
)])
|
||||||
};
|
};
|
||||||
|
let rise = animation
|
||||||
|
.filter(|(a, _)| a.end == crate::motion::MatchEnd::Completion)
|
||||||
|
.map_or(0., |(a, elapsed)| {
|
||||||
|
let t = ((elapsed - a.flight()) / 0.7).clamp(0., 1.);
|
||||||
|
6. * (1. - t) * (std::f32::consts::PI * t).sin()
|
||||||
|
});
|
||||||
let copy = div()
|
let copy = div()
|
||||||
.v_flex()
|
.v_flex()
|
||||||
.min_w_0()
|
.min_w_0()
|
||||||
@@ -426,8 +441,8 @@ impl Page {
|
|||||||
.gap(px(3.))
|
.gap(px(3.))
|
||||||
.child(
|
.child(
|
||||||
heading(cx)
|
heading(cx)
|
||||||
.mt(px(8.))
|
.mt(px(8. + rise))
|
||||||
.mb(px(7.))
|
.mb(px(7. - rise))
|
||||||
.text_size(px(layout.title))
|
.text_size(px(layout.title))
|
||||||
.line_height(relative(1.12))
|
.line_height(relative(1.12))
|
||||||
.debug_selector(|| "banner-title".into())
|
.debug_selector(|| "banner-title".into())
|
||||||
@@ -440,11 +455,17 @@ impl Page {
|
|||||||
)])),
|
)])),
|
||||||
)
|
)
|
||||||
.child(div().text_sm().text_color(muted).child(name(&text.detail)))
|
.child(div().text_sm().text_color(muted).child(name(&text.detail)))
|
||||||
.children(
|
.children(text.last_match.as_ref().map(|line| {
|
||||||
text.last_match
|
div()
|
||||||
.as_ref()
|
.opacity(
|
||||||
.map(|line| div().text_sm().text_color(muted).child(name(line))),
|
arriving
|
||||||
|
.filter(|t| *t >= 0.)
|
||||||
|
.map_or(1., |t| (t / 0.7).min(1.)),
|
||||||
)
|
)
|
||||||
|
.text_sm()
|
||||||
|
.text_color(muted)
|
||||||
|
.child(name(line))
|
||||||
|
}))
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}));
|
}));
|
||||||
div()
|
div()
|
||||||
@@ -470,9 +491,18 @@ impl Page {
|
|||||||
.child(self.banner_art.clone())
|
.child(self.banner_art.clone())
|
||||||
.child(
|
.child(
|
||||||
// Cached: only a change of its ticks or of the lit one draws it again.
|
// Cached: only a change of its ticks or of the lit one draws it again.
|
||||||
|
div()
|
||||||
|
.relative()
|
||||||
|
.size(px(layout.ring))
|
||||||
|
.flex_none()
|
||||||
|
.child(
|
||||||
self.ring
|
self.ring
|
||||||
.clone()
|
.clone()
|
||||||
.cached(StyleRefinement::default().size(px(layout.ring)).flex_none()),
|
.cached(StyleRefinement::default().size_full()),
|
||||||
|
)
|
||||||
|
.children(
|
||||||
|
animation.map(|(a, elapsed)| crate::ring::match_layer(a, elapsed, cx)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.child(copy)
|
.child(copy)
|
||||||
}
|
}
|
||||||
@@ -528,6 +558,7 @@ impl Render for BannerArt {
|
|||||||
..Corners::default()
|
..Corners::default()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let (zoom, opacity) = self.reveal_frame(window, cx);
|
||||||
let layer = |previous: bool| {
|
let layer = |previous: bool| {
|
||||||
let art = art.clone();
|
let art = art.clone();
|
||||||
let splash = splash.clone();
|
let splash = splash.clone();
|
||||||
@@ -551,9 +582,11 @@ impl Render for BannerArt {
|
|||||||
};
|
};
|
||||||
let frame =
|
let frame =
|
||||||
focus.banner_frame(bounds.size.width.as_f32(), bounds.size.height.as_f32());
|
focus.banner_frame(bounds.size.width.as_f32(), bounds.size.height.as_f32());
|
||||||
|
let zoom = if previous { 1. } else { zoom };
|
||||||
let frame = Bounds {
|
let frame = Bounds {
|
||||||
origin: bounds.origin + point(px(frame.left), px(frame.top)),
|
origin: bounds.origin + point(px(frame.left * zoom), px(frame.top * zoom))
|
||||||
size: size(px(frame.width), px(frame.height)),
|
- point(bounds.size.width, bounds.size.height) * ((zoom - 1.) / 2.),
|
||||||
|
size: size(px(frame.width * zoom), px(frame.height * zoom)),
|
||||||
};
|
};
|
||||||
let _ = window.paint_image(bounds, frame, corners, image, 0, false);
|
let _ = window.paint_image(bounds, frame, corners, image, 0, false);
|
||||||
},
|
},
|
||||||
@@ -566,7 +599,7 @@ impl Render for BannerArt {
|
|||||||
.right_0()
|
.right_0()
|
||||||
.bottom_0()
|
.bottom_0()
|
||||||
.debug_selector(|| "banner-art".into())
|
.debug_selector(|| "banner-art".into())
|
||||||
.child(layer(false))
|
.child(layer(false).opacity(opacity))
|
||||||
.children(self.previous_opacity(window, cx).map(|opacity| {
|
.children(self.previous_opacity(window, cx).map(|opacity| {
|
||||||
div()
|
div()
|
||||||
.absolute()
|
.absolute()
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use gpui_kit::component::ActiveTheme as _;
|
|||||||
use gpui_kit::*;
|
use gpui_kit::*;
|
||||||
|
|
||||||
use crate::card_order::card_order;
|
use crate::card_order::card_order;
|
||||||
|
use crate::motion::{MatchAnimation, MatchEnd, ease_out};
|
||||||
use crate::theme::{ring_never, ring_played};
|
use crate::theme::{ring_never, ring_played};
|
||||||
|
|
||||||
/// A champion's tick: long and gold when Completed, pale gold when played, short and faint when
|
/// A champion's tick: long and gold when Completed, pale gold when played, short and faint when
|
||||||
@@ -235,6 +236,22 @@ impl Ring {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn animation(
|
||||||
|
&self,
|
||||||
|
id: u32,
|
||||||
|
end: MatchEnd,
|
||||||
|
start: std::time::Instant,
|
||||||
|
) -> Option<MatchAnimation> {
|
||||||
|
let index = self.ticks.iter().position(|tick| tick.id == id)?;
|
||||||
|
Some(MatchAnimation {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
index,
|
||||||
|
count: self.ticks.len(),
|
||||||
|
state: self.ticks[index].state,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Replaces the ticks; the ring is drawn again only when they differ.
|
/// Replaces the ticks; the ring is drawn again only when they differ.
|
||||||
pub fn set_ticks(&mut self, ticks: Rc<[Tick]>, cx: &mut Context<Self>) {
|
pub fn set_ticks(&mut self, ticks: Rc<[Tick]>, cx: &mut Context<Self>) {
|
||||||
if *self.ticks != *ticks {
|
if *self.ticks != *ticks {
|
||||||
@@ -277,6 +294,87 @@ impl Ring {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Paints only the moving shapes over the cached ring.
|
||||||
|
pub fn match_layer(animation: MatchAnimation, elapsed: f32, cx: &App) -> impl IntoElement {
|
||||||
|
let theme = cx.theme();
|
||||||
|
let (gold, bright, disc) = (theme.primary, theme.foreground, theme.background);
|
||||||
|
canvas(
|
||||||
|
|_, _, _| {},
|
||||||
|
move |bounds, _, window, _| {
|
||||||
|
let frame = Frame::of(bounds);
|
||||||
|
let flight = animation.flight();
|
||||||
|
if elapsed < flight {
|
||||||
|
let arc = TAU * (animation.index as f32 + 0.5) / animation.count as f32
|
||||||
|
* ease_out(elapsed / flight);
|
||||||
|
let radius = (R1 + R2) * 0.5;
|
||||||
|
let at =
|
||||||
|
|angle: f32| frame.point(C + radius * angle.sin(), C - radius * angle.cos());
|
||||||
|
let mut trail = PathBuilder::stroke(px(4. * frame.scale));
|
||||||
|
let tail = (arc - 0.8).max(0.);
|
||||||
|
trail.move_to(at(tail));
|
||||||
|
for i in 1..=12 {
|
||||||
|
trail.line_to(at(tail + (arc - tail) * i as f32 / 12.));
|
||||||
|
}
|
||||||
|
if let Ok(path) = trail.build() {
|
||||||
|
window.paint_path(path, gold);
|
||||||
|
}
|
||||||
|
let dot = px(8. * frame.scale);
|
||||||
|
window.paint_quad(
|
||||||
|
fill(
|
||||||
|
Bounds::centered_at(at(arc), size(dot * 2., dot * 2.)),
|
||||||
|
bright,
|
||||||
|
)
|
||||||
|
.corner_radii(dot),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let t = ((elapsed - flight) / 1.2).clamp(0., 1.);
|
||||||
|
let pulse = (std::f32::consts::PI * t).sin();
|
||||||
|
let mut tick = PathBuilder::fill();
|
||||||
|
frame.add_tick(
|
||||||
|
&mut tick,
|
||||||
|
animation.index,
|
||||||
|
animation.count,
|
||||||
|
animation.state,
|
||||||
|
shape(animation.state).2 + 6. * pulse,
|
||||||
|
);
|
||||||
|
if let Ok(path) = tick.build() {
|
||||||
|
let ink = if animation.end == MatchEnd::Mark {
|
||||||
|
gold
|
||||||
|
} else {
|
||||||
|
bright
|
||||||
|
};
|
||||||
|
window.paint_path(path, ink.opacity(pulse));
|
||||||
|
}
|
||||||
|
if animation.end == MatchEnd::Completion {
|
||||||
|
// Cover the resting crown inside the disc, then draw it at its bouncing height.
|
||||||
|
let radius = px(DISC * frame.scale);
|
||||||
|
window.paint_quad(
|
||||||
|
fill(
|
||||||
|
Bounds::centered_at(frame.point(C, C), size(radius * 2., radius * 2.)),
|
||||||
|
disc,
|
||||||
|
)
|
||||||
|
.corner_radii(radius),
|
||||||
|
);
|
||||||
|
let rise = 25. * (1. - t).powi(2) * (std::f32::consts::TAU * t).sin();
|
||||||
|
let points = CROWN.map(|(x, y)| {
|
||||||
|
frame.point(
|
||||||
|
CROWN_AT.0 + x * CROWN_SCALE,
|
||||||
|
CROWN_AT.1 + y * CROWN_SCALE - rise,
|
||||||
|
)
|
||||||
|
});
|
||||||
|
let mut crown = PathBuilder::fill();
|
||||||
|
crown.add_polygon(&points, true);
|
||||||
|
if let Ok(path) = crown.build() {
|
||||||
|
window.paint_path(path, gold);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.absolute()
|
||||||
|
.inset_0()
|
||||||
|
}
|
||||||
|
|
||||||
impl Render for Ring {
|
impl Render for Ring {
|
||||||
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ pub enum Msg {
|
|||||||
Round {
|
Round {
|
||||||
status: Status,
|
status: Status,
|
||||||
reload: bool,
|
reload: bool,
|
||||||
|
matches: Vec<arena_tracker_core::FollowedMatch>,
|
||||||
},
|
},
|
||||||
/// A refresh ended.
|
/// A refresh ended.
|
||||||
Refreshed(Status),
|
Refreshed(Status),
|
||||||
@@ -229,11 +230,19 @@ pub fn spawn_follower(tracker: Arc<Tracker>, fallback_riot_id: String, tx: Sende
|
|||||||
let mut progress = |progress| {
|
let mut progress = |progress| {
|
||||||
let _ = tx.try_send(Msg::Progress(progress));
|
let _ = tx.try_send(Msg::Progress(progress));
|
||||||
};
|
};
|
||||||
let changed = history.follow_client_with(now_ms(), fallback, &snapshot, &mut progress);
|
let mut matches = Vec::new();
|
||||||
|
let changed = history.follow_client_reporting(
|
||||||
|
now_ms(),
|
||||||
|
fallback,
|
||||||
|
&snapshot,
|
||||||
|
&mut progress,
|
||||||
|
&mut |event| matches.push(event),
|
||||||
|
);
|
||||||
if tx
|
if tx
|
||||||
.try_send(Msg::Round {
|
.try_send(Msg::Round {
|
||||||
status: history.status(),
|
status: history.status(),
|
||||||
reload: changed || first,
|
reload: changed || first,
|
||||||
|
matches,
|
||||||
})
|
})
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -223,6 +223,18 @@ impl Tracker {
|
|||||||
fallback_riot_id: Option<&str>,
|
fallback_riot_id: Option<&str>,
|
||||||
snapshot: &ClientSnapshot,
|
snapshot: &ClientSnapshot,
|
||||||
on_progress: &mut dyn FnMut(SyncProgress),
|
on_progress: &mut dyn FnMut(SyncProgress),
|
||||||
|
) -> bool {
|
||||||
|
self.follow_client_reporting(now_ms, fallback_riot_id, snapshot, on_progress, &mut |_| {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Reports only newly inserted Matches identified by the live gameflow.
|
||||||
|
pub fn follow_client_reporting(
|
||||||
|
&self,
|
||||||
|
now_ms: i64,
|
||||||
|
fallback_riot_id: Option<&str>,
|
||||||
|
snapshot: &ClientSnapshot,
|
||||||
|
on_progress: &mut dyn FnMut(SyncProgress),
|
||||||
|
on_match: &mut dyn FnMut(crate::FollowedMatch),
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let before = self.status();
|
let before = self.status();
|
||||||
let mut added = 0;
|
let mut added = 0;
|
||||||
@@ -285,7 +297,7 @@ impl Tracker {
|
|||||||
due.dedup();
|
due.dedup();
|
||||||
for game_id in due {
|
for game_id in due {
|
||||||
let (found, over) = match &account {
|
let (found, over) = match &account {
|
||||||
Some(account) => self.look_for_match(account, game_id, on_progress),
|
Some(account) => self.look_for_match(account, game_id, on_progress, on_match),
|
||||||
None => (0, false),
|
None => (0, false),
|
||||||
};
|
};
|
||||||
added += found;
|
added += found;
|
||||||
@@ -467,6 +479,7 @@ impl Tracker {
|
|||||||
account: &Account,
|
account: &Account,
|
||||||
game_id: Option<u64>,
|
game_id: Option<u64>,
|
||||||
on_progress: &mut dyn FnMut(SyncProgress),
|
on_progress: &mut dyn FnMut(SyncProgress),
|
||||||
|
on_match: &mut dyn FnMut(crate::FollowedMatch),
|
||||||
) -> (usize, bool) {
|
) -> (usize, bool) {
|
||||||
let platform = self.platform_of(&account.puuid).ok().flatten();
|
let platform = self.platform_of(&account.puuid).ok().flatten();
|
||||||
let Some(match_id) = game_id.zip(platform).map(|(id, p)| format!("{p}_{id}")) else {
|
let Some(match_id) = game_id.zip(platform).map(|(id, p)| format!("{p}_{id}")) else {
|
||||||
@@ -474,7 +487,7 @@ impl Tracker {
|
|||||||
let added = self.update(&account_riot_id(account), on_progress);
|
let added = self.update(&account_riot_id(account), on_progress);
|
||||||
return (added.map_or(0, |report| report.added), false);
|
return (added.map_or(0, |report| report.added), false);
|
||||||
};
|
};
|
||||||
match self.fetch_and_store(&account.puuid, &match_id) {
|
match self.fetch_and_store(&account.puuid, &match_id, Some(on_match)) {
|
||||||
Ok(fetched) => {
|
Ok(fetched) => {
|
||||||
let added = usize::from(fetched == Fetched::Added);
|
let added = usize::from(fetched == Fetched::Added);
|
||||||
self.clear_problem(added);
|
self.clear_problem(added);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub use follow::{
|
|||||||
same_riot_id,
|
same_riot_id,
|
||||||
};
|
};
|
||||||
pub use league_client::{LeagueClient, decode_gameflow};
|
pub use league_client::{LeagueClient, decode_gameflow};
|
||||||
pub use model::{Account, Format, Match, SyncProgress, SyncReport};
|
pub use model::{Account, FollowedMatch, Format, Match, MatchEnd, SyncProgress, SyncReport};
|
||||||
pub use riot::RiotApi;
|
pub use riot::RiotApi;
|
||||||
pub use seasons::{Season, default_seasons, load_seasons};
|
pub use seasons::{Season, default_seasons, load_seasons};
|
||||||
pub use splash::{BannerFrame, Splash, SplashFocus};
|
pub use splash::{BannerFrame, Splash, SplashFocus};
|
||||||
|
|||||||
@@ -51,6 +51,23 @@ pub struct Match {
|
|||||||
pub started_at_ms: i64,
|
pub started_at_ms: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The strongest milestone gained when a followed Match is first stored.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
pub enum MatchEnd {
|
||||||
|
Nothing,
|
||||||
|
Mark,
|
||||||
|
Completion,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
|
pub struct FollowedMatch {
|
||||||
|
pub puuid: String,
|
||||||
|
pub season: String,
|
||||||
|
pub champion_id: u32,
|
||||||
|
pub started_at_ms: i64,
|
||||||
|
pub end: MatchEnd,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub struct SyncProgress {
|
pub struct SyncProgress {
|
||||||
pub fetched: usize,
|
pub fetched: usize,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
|
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
|
use crate::{FollowedMatch, MatchEnd};
|
||||||
use rusqlite::{Connection, OptionalExtension, Row, params};
|
use rusqlite::{Connection, OptionalExtension, Row, params};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ impl Tracker {
|
|||||||
let mut added = 0;
|
let mut added = 0;
|
||||||
for (i, match_id) in to_fetch.iter().enumerate() {
|
for (i, match_id) in to_fetch.iter().enumerate() {
|
||||||
// Stored at once, so an interrupted import loses nothing.
|
// Stored at once, so an interrupted import loses nothing.
|
||||||
if self.fetch_and_store(&account.puuid, match_id)? == Fetched::Added {
|
if self.fetch_and_store(&account.puuid, match_id, None)? == Fetched::Added {
|
||||||
added += 1;
|
added += 1;
|
||||||
}
|
}
|
||||||
on_progress(SyncProgress {
|
on_progress(SyncProgress {
|
||||||
@@ -205,7 +206,12 @@ impl Tracker {
|
|||||||
|
|
||||||
/// Fetches one Match by id and stores it. A Match Riot does not have or that cannot be
|
/// Fetches one Match by id and stores it. A Match Riot does not have or that cannot be
|
||||||
/// read is skipped rather than failing the caller: one bad id must not block the rest.
|
/// read is skipped rather than failing the caller: one bad id must not block the rest.
|
||||||
pub(crate) fn fetch_and_store(&self, puuid: &str, match_id: &str) -> Result<Fetched, Error> {
|
pub(crate) fn fetch_and_store(
|
||||||
|
&self,
|
||||||
|
puuid: &str,
|
||||||
|
match_id: &str,
|
||||||
|
report: Option<&mut dyn FnMut(FollowedMatch)>,
|
||||||
|
) -> Result<Fetched, Error> {
|
||||||
let raw = match with_retry(|| self.history.fetch_match(match_id)) {
|
let raw = match with_retry(|| self.history.fetch_match(match_id)) {
|
||||||
Ok(raw) => raw,
|
Ok(raw) => raw,
|
||||||
Err(SourceError::NotFound) => return Ok(Fetched::NotFound),
|
Err(SourceError::NotFound) => return Ok(Fetched::NotFound),
|
||||||
@@ -214,12 +220,43 @@ impl Tracker {
|
|||||||
let Ok(Some((m, queue_id))) = decode_match(&raw, puuid) else {
|
let Ok(Some((m, queue_id))) = decode_match(&raw, puuid) else {
|
||||||
return Ok(Fetched::Ignored);
|
return Ok(Fetched::Ignored);
|
||||||
};
|
};
|
||||||
let inserted = insert_match(&self.db(), puuid, &m, queue_id, &raw)?;
|
let db = self.db();
|
||||||
Ok(if inserted {
|
let event = if report.is_some()
|
||||||
Fetched::Added
|
&& let Some(season) = self.current_season(m.started_at_ms)
|
||||||
|
{
|
||||||
|
let range = crate::seasons::period(&self.seasons, &season.name).expect("known Season");
|
||||||
|
let (played, won, completed): (bool, bool, bool) = db.query_row(
|
||||||
|
"SELECT count(*) > 0, coalesce(max(win), 0), coalesce(min(placement) = 1, 0)
|
||||||
|
FROM matches WHERE puuid = ?1 AND champion_id = ?2
|
||||||
|
AND started_at_ms >= ?3 AND started_at_ms < ?4",
|
||||||
|
params![puuid, m.champion_id, range.start, range.end],
|
||||||
|
|row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)),
|
||||||
|
)?;
|
||||||
|
let end = if !completed && m.placement == 1 {
|
||||||
|
MatchEnd::Completion
|
||||||
|
} else if !played || (!completed && !won && m.win) {
|
||||||
|
MatchEnd::Mark
|
||||||
} else {
|
} else {
|
||||||
Fetched::Known
|
MatchEnd::Nothing
|
||||||
|
};
|
||||||
|
Some(FollowedMatch {
|
||||||
|
puuid: puuid.into(),
|
||||||
|
season: season.name,
|
||||||
|
champion_id: m.champion_id,
|
||||||
|
started_at_ms: m.started_at_ms,
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
if !insert_match(&db, puuid, &m, queue_id, &raw)? {
|
||||||
|
return Ok(Fetched::Known);
|
||||||
|
}
|
||||||
|
drop(db);
|
||||||
|
if let (Some(report), Some(event)) = (report, event) {
|
||||||
|
report(event);
|
||||||
|
}
|
||||||
|
Ok(Fetched::Added)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn accounts(&self) -> Result<Vec<Account>, Error> {
|
pub fn accounts(&self) -> Result<Vec<Account>, Error> {
|
||||||
|
|||||||
@@ -669,6 +669,56 @@ fn play_arena_game(world: &World, tracker: &Tracker) {
|
|||||||
world.client.set_phase("EndOfGame", true);
|
world.client.set_phase("EndOfGame", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn only_a_live_insert_reports_what_the_match_brought_to_the_challenge() {
|
||||||
|
use arena_tracker_core::MatchEnd::*;
|
||||||
|
let world = World::new(&s2_matches());
|
||||||
|
let tracker = world.tracker();
|
||||||
|
let follow = || {
|
||||||
|
let mut events = Vec::new();
|
||||||
|
tracker.follow_client_reporting(
|
||||||
|
now(),
|
||||||
|
None,
|
||||||
|
&tracker.client_snapshot(),
|
||||||
|
&mut |_| {},
|
||||||
|
&mut |e| events.push(e),
|
||||||
|
);
|
||||||
|
events
|
||||||
|
};
|
||||||
|
assert!(follow().is_empty(), "history import");
|
||||||
|
for (i, (placement, expected)) in [
|
||||||
|
(6, Mark),
|
||||||
|
(2, Mark),
|
||||||
|
(3, Nothing),
|
||||||
|
(1, Completion),
|
||||||
|
(1, Nothing),
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.enumerate()
|
||||||
|
{
|
||||||
|
let id = common::recorded_game_id() + i as u64;
|
||||||
|
world.client.set_game_id(Some(id));
|
||||||
|
world.client.set_phase("InProgress", true);
|
||||||
|
assert!(follow().is_empty());
|
||||||
|
world.history.add_unlisted(payload(
|
||||||
|
&format!("EUW1_{id}"),
|
||||||
|
1750,
|
||||||
|
222,
|
||||||
|
"Jinx",
|
||||||
|
placement,
|
||||||
|
placement <= 3,
|
||||||
|
at(date(2026, 4, 5), i as i64),
|
||||||
|
));
|
||||||
|
world.client.set_phase("EndOfGame", true);
|
||||||
|
let events = follow();
|
||||||
|
assert_eq!(events.len(), 1);
|
||||||
|
assert_eq!((events[0].champion_id, events[0].end), (222, expected));
|
||||||
|
assert_eq!(events[0].puuid, SELF_PUUID);
|
||||||
|
assert_eq!(events[0].season, S2);
|
||||||
|
assert!(follow().is_empty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_finished_game_is_fetched_by_its_id_even_in_a_queue_nobody_lists() {
|
fn a_finished_game_is_fetched_by_its_id_even_in_a_queue_nobody_lists() {
|
||||||
let world = World::new(&s2_matches());
|
let world = World::new(&s2_matches());
|
||||||
|
|||||||
Reference in new issue
Block a user