mirror of
https://github.com/ppy/osu
synced 2024-12-14 02:46:27 +00:00
Improve participants list transforms
This commit is contained in:
parent
97c07281d8
commit
fe10a64137
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -25,7 +24,9 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.RelativeSizeAxes = value;
|
base.RelativeSizeAxes = value;
|
||||||
fill.RelativeSizeAxes = value;
|
|
||||||
|
if (tiles != null)
|
||||||
|
tiles.RelativeSizeAxes = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,21 +36,24 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.AutoSizeAxes = value;
|
base.AutoSizeAxes = value;
|
||||||
fill.AutoSizeAxes = value;
|
|
||||||
|
if (tiles != null)
|
||||||
|
tiles.AutoSizeAxes = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FillDirection direction = FillDirection.Full;
|
||||||
|
|
||||||
public FillDirection Direction
|
public FillDirection Direction
|
||||||
{
|
{
|
||||||
get => fill.Direction;
|
get => direction;
|
||||||
set => fill.Direction = value;
|
set
|
||||||
}
|
{
|
||||||
|
direction = value;
|
||||||
|
|
||||||
private readonly FillFlowContainer<UserTile> fill;
|
if (tiles != null)
|
||||||
|
tiles.Direction = value;
|
||||||
public ParticipantsList()
|
}
|
||||||
{
|
|
||||||
InternalChild = fill = new FillFlowContainer<UserTile> { Spacing = new Vector2(10) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -60,37 +64,30 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate scheduledUpdate;
|
private ScheduledDelegate scheduledUpdate;
|
||||||
|
private FillFlowContainer<UserTile> tiles;
|
||||||
|
|
||||||
private void updateParticipants()
|
private void updateParticipants()
|
||||||
{
|
{
|
||||||
scheduledUpdate?.Cancel();
|
scheduledUpdate?.Cancel();
|
||||||
scheduledUpdate = Schedule(() =>
|
scheduledUpdate = Schedule(() =>
|
||||||
{
|
{
|
||||||
// Remove all extra tiles with a nice, progressive fade
|
tiles?.FadeOut(250, Easing.Out).Expire();
|
||||||
int time = 500;
|
|
||||||
|
|
||||||
for (int i = Participants.Count; i < fill.Count; i++)
|
tiles = new FillFlowContainer<UserTile>
|
||||||
{
|
{
|
||||||
var tile = fill[i];
|
Alpha = 0,
|
||||||
|
Direction = Direction,
|
||||||
tile.Delay(500 - time).FadeOut(time, Easing.Out);
|
AutoSizeAxes = AutoSizeAxes,
|
||||||
time = Math.Max(20, time - 20);
|
RelativeSizeAxes = RelativeSizeAxes,
|
||||||
tile.Expire();
|
Spacing = new Vector2(10)
|
||||||
}
|
};
|
||||||
|
|
||||||
// Add new tiles for all new players
|
|
||||||
for (int i = fill.Count; i < Participants.Count; i++)
|
|
||||||
{
|
|
||||||
var tile = new UserTile();
|
|
||||||
fill.Add(tile);
|
|
||||||
|
|
||||||
tile.ClearTransforms();
|
|
||||||
tile.LifetimeEnd = double.MaxValue;
|
|
||||||
tile.FadeInFromZero(250, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < Participants.Count; i++)
|
for (int i = 0; i < Participants.Count; i++)
|
||||||
fill[i].User = Participants[i];
|
tiles.Add(new UserTile { User = Participants[i] });
|
||||||
|
|
||||||
|
AddInternal(tiles);
|
||||||
|
|
||||||
|
tiles.Delay(250).FadeIn(250, Easing.OutQuint);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user