mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Merge branch 'master' into import-stable-scores
This commit is contained in:
@ -20,7 +20,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
{
|
||||
public class DownloadButton : BeatmapDownloadTrackingComposite, IHasTooltip
|
||||
public class HeaderDownloadButton : BeatmapDownloadTrackingComposite, IHasTooltip
|
||||
{
|
||||
private readonly bool noVideo;
|
||||
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
private ShakeContainer shakeContainer;
|
||||
private HeaderButton button;
|
||||
|
||||
public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
||||
public HeaderDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
||||
: base(beatmapSet)
|
||||
{
|
||||
this.noVideo = noVideo;
|
@ -18,7 +18,6 @@ using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||
using osu.Game.Overlays.Direct;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using DownloadButton = osu.Game.Overlays.BeatmapSet.Buttons.DownloadButton;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -268,7 +267,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
case DownloadState.LocallyAvailable:
|
||||
// temporary for UX until new design is implemented.
|
||||
downloadButtonsContainer.Child = new Direct.DownloadButton(BeatmapSet.Value)
|
||||
downloadButtonsContainer.Child = new PanelDownloadButton(BeatmapSet.Value)
|
||||
{
|
||||
Width = 50,
|
||||
RelativeSizeAxes = Axes.Y
|
||||
@ -278,13 +277,13 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
case DownloadState.Downloading:
|
||||
case DownloadState.Downloaded:
|
||||
// temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design.
|
||||
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
|
||||
downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value);
|
||||
break;
|
||||
|
||||
default:
|
||||
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
|
||||
downloadButtonsContainer.Child = new HeaderDownloadButton(BeatmapSet.Value);
|
||||
if (BeatmapSet.Value.OnlineInfo.HasVideo)
|
||||
downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true));
|
||||
downloadButtonsContainer.Add(new HeaderDownloadButton(BeatmapSet.Value, true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ namespace osu.Game.Overlays.Chat.Selection
|
||||
private readonly SearchTextBox search;
|
||||
private readonly SearchContainer<ChannelSection> sectionsFlow;
|
||||
|
||||
protected override bool DimMainContent => false;
|
||||
|
||||
public Action<Channel> OnRequestJoin;
|
||||
public Action<Channel> OnRequestLeave;
|
||||
|
||||
|
@ -49,6 +49,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
// performTabSort might've made selectorTab's position wonky, fix it
|
||||
TabContainer.SetLayoutPosition(selectorTab, float.MaxValue);
|
||||
|
||||
((ChannelTabItem)item).OnRequestClose += tabCloseRequested;
|
||||
|
||||
base.AddTabItem(item, addToDropdown);
|
||||
}
|
||||
|
||||
@ -57,10 +59,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
switch (value.Type)
|
||||
{
|
||||
default:
|
||||
return new ChannelTabItem(value) { OnRequestClose = tabCloseRequested };
|
||||
return new ChannelTabItem(value);
|
||||
|
||||
case ChannelType.PM:
|
||||
return new PrivateChannelTabItem(value) { OnRequestClose = tabCloseRequested };
|
||||
return new PrivateChannelTabItem(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float TAB_AREA_HEIGHT = 50;
|
||||
|
||||
private ChannelTabControl channelTabControl;
|
||||
protected ChannelTabControl ChannelTabControl;
|
||||
|
||||
protected virtual ChannelTabControl CreateChannelTabControl() => new ChannelTabControl();
|
||||
|
||||
private Container chatContainer;
|
||||
private TabsArea tabsArea;
|
||||
@ -55,9 +57,10 @@ namespace osu.Game.Overlays
|
||||
public Bindable<double> ChatHeight { get; set; }
|
||||
|
||||
private Container channelSelectionContainer;
|
||||
private ChannelSelectionOverlay channelSelectionOverlay;
|
||||
protected ChannelSelectionOverlay ChannelSelectionOverlay;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || (channelSelectionOverlay.State.Value == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos));
|
||||
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos)
|
||||
|| (ChannelSelectionOverlay.State.Value == Visibility.Visible && ChannelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos));
|
||||
|
||||
public ChatOverlay()
|
||||
{
|
||||
@ -81,7 +84,7 @@ namespace osu.Game.Overlays
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
channelSelectionOverlay = new ChannelSelectionOverlay
|
||||
ChannelSelectionOverlay = new ChannelSelectionOverlay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@ -154,31 +157,25 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
channelTabControl = new ChannelTabControl
|
||||
ChannelTabControl = CreateChannelTabControl().With(d =>
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
OnRequestLeave = channelManager.LeaveChannel
|
||||
},
|
||||
d.Anchor = Anchor.BottomLeft;
|
||||
d.Origin = Anchor.BottomLeft;
|
||||
d.RelativeSizeAxes = Axes.Both;
|
||||
d.OnRequestLeave = channelManager.LeaveChannel;
|
||||
}),
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
|
||||
channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||
channelSelectionOverlay.State.ValueChanged += state =>
|
||||
ChannelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
|
||||
ChannelTabControl.ChannelSelectorActive.ValueChanged += active => ChannelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||
ChannelSelectionOverlay.State.ValueChanged += state =>
|
||||
{
|
||||
if (state.NewValue == Visibility.Hidden && channelManager.JoinedChannels.Count == 0)
|
||||
{
|
||||
channelSelectionOverlay.Show();
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
channelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible;
|
||||
// Propagate the visibility state to ChannelSelectorActive
|
||||
ChannelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible;
|
||||
|
||||
if (state.NewValue == Visibility.Visible)
|
||||
{
|
||||
@ -190,8 +187,8 @@ namespace osu.Game.Overlays
|
||||
textbox.HoldFocus = true;
|
||||
};
|
||||
|
||||
channelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
||||
channelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
||||
ChannelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
||||
ChannelSelectionOverlay.OnRequestLeave = channelManager.LeaveChannel;
|
||||
|
||||
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
|
||||
ChatHeight.ValueChanged += height =>
|
||||
@ -217,11 +214,11 @@ namespace osu.Game.Overlays
|
||||
channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels;
|
||||
channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
|
||||
foreach (Channel channel in channelManager.JoinedChannels)
|
||||
channelTabControl.AddChannel(channel);
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
|
||||
channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged;
|
||||
channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged;
|
||||
channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
|
||||
currentChannel = channelManager.CurrentChannel.GetBoundCopy();
|
||||
currentChannel.BindValueChanged(currentChannelChanged, true);
|
||||
@ -236,7 +233,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
textbox.Current.Disabled = true;
|
||||
currentChannelContainer.Clear(false);
|
||||
channelSelectionOverlay.Show();
|
||||
ChannelSelectionOverlay.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -245,8 +242,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
textbox.Current.Disabled = e.NewValue.ReadOnly;
|
||||
|
||||
if (channelTabControl.Current.Value != e.NewValue)
|
||||
Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue);
|
||||
if (ChannelTabControl.Current.Value != e.NewValue)
|
||||
Scheduler.Add(() => ChannelTabControl.Current.Value = e.NewValue);
|
||||
|
||||
var loaded = loadedChannels.Find(d => d.Channel == e.NewValue);
|
||||
|
||||
@ -294,7 +291,7 @@ namespace osu.Game.Overlays
|
||||
double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
|
||||
|
||||
// If the channel selection screen is shown, mind its minimum height
|
||||
if (channelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
|
||||
if (ChannelSelectionOverlay.State.Value == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
|
||||
targetChatHeight = 1f - channel_selection_min_height;
|
||||
|
||||
ChatHeight.Value = targetChatHeight;
|
||||
@ -311,9 +308,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
private void selectTab(int index)
|
||||
{
|
||||
var channel = channelTabControl.Items.Skip(index).FirstOrDefault();
|
||||
var channel = ChannelTabControl.Items.Skip(index).FirstOrDefault();
|
||||
if (channel != null && !(channel is ChannelSelectorTabItem.ChannelSelectorTabChannel))
|
||||
channelTabControl.Current.Value = channel;
|
||||
ChannelTabControl.Current.Value = channel;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
@ -358,6 +355,7 @@ namespace osu.Game.Overlays
|
||||
this.FadeIn(transition_length, Easing.OutQuint);
|
||||
|
||||
textbox.HoldFocus = true;
|
||||
|
||||
base.PopIn();
|
||||
}
|
||||
|
||||
@ -366,7 +364,7 @@ namespace osu.Game.Overlays
|
||||
this.MoveToY(Height, transition_length, Easing.InSine);
|
||||
this.FadeOut(transition_length, Easing.InSine);
|
||||
|
||||
channelSelectionOverlay.Hide();
|
||||
ChannelSelectionOverlay.Hide();
|
||||
|
||||
textbox.HoldFocus = false;
|
||||
base.PopOut();
|
||||
@ -375,20 +373,20 @@ namespace osu.Game.Overlays
|
||||
private void onChannelAddedToJoinedChannels(IEnumerable<Channel> channels)
|
||||
{
|
||||
foreach (Channel channel in channels)
|
||||
channelTabControl.AddChannel(channel);
|
||||
ChannelTabControl.AddChannel(channel);
|
||||
}
|
||||
|
||||
private void onChannelRemovedFromJoinedChannels(IEnumerable<Channel> channels)
|
||||
{
|
||||
foreach (Channel channel in channels)
|
||||
{
|
||||
channelTabControl.RemoveChannel(channel);
|
||||
ChannelTabControl.RemoveChannel(channel);
|
||||
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
|
||||
}
|
||||
}
|
||||
|
||||
private void availableChannelsChanged(IEnumerable<Channel> channels)
|
||||
=> channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
=> ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Direct
|
||||
},
|
||||
},
|
||||
},
|
||||
new DownloadButton(SetInfo)
|
||||
new PanelDownloadButton(SetInfo)
|
||||
{
|
||||
Size = new Vector2(50, 30),
|
||||
Margin = new MarginPadding(horizontal_padding),
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Direct
|
||||
private const float height = 70;
|
||||
|
||||
private FillFlowContainer statusContainer;
|
||||
protected DownloadButton DownloadButton;
|
||||
protected PanelDownloadButton DownloadButton;
|
||||
private PlayButton playButton;
|
||||
private Box progressBar;
|
||||
|
||||
@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Direct
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Child = DownloadButton = new DownloadButton(SetInfo)
|
||||
Child = DownloadButton = new PanelDownloadButton(SetInfo)
|
||||
{
|
||||
Size = new Vector2(height - vertical_padding * 3),
|
||||
Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding },
|
||||
|
@ -1,136 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class DownloadButton : BeatmapDownloadTrackingComposite
|
||||
{
|
||||
protected bool DownloadEnabled => button.Enabled.Value;
|
||||
|
||||
private readonly bool noVideo;
|
||||
private readonly SpriteIcon icon;
|
||||
private readonly SpriteIcon checkmark;
|
||||
private readonly Box background;
|
||||
|
||||
private OsuColour colours;
|
||||
private readonly ShakeContainer shakeContainer;
|
||||
private readonly OsuAnimatedButton button;
|
||||
|
||||
public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
||||
: base(beatmapSet)
|
||||
{
|
||||
this.noVideo = noVideo;
|
||||
|
||||
InternalChild = shakeContainer = new ShakeContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = button = new OsuAnimatedButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(13),
|
||||
Icon = FontAwesome.Solid.Download,
|
||||
},
|
||||
checkmark = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
X = 8,
|
||||
Size = Vector2.Zero,
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
State.BindValueChanged(state => updateState(state.NewValue), true);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours, OsuGame game, BeatmapManager beatmaps)
|
||||
{
|
||||
this.colours = colours;
|
||||
|
||||
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
||||
{
|
||||
button.Enabled.Value = false;
|
||||
button.TooltipText = "This beatmap is currently not available for download.";
|
||||
return;
|
||||
}
|
||||
|
||||
button.Action = () =>
|
||||
{
|
||||
switch (State.Value)
|
||||
{
|
||||
case DownloadState.Downloading:
|
||||
case DownloadState.Downloaded:
|
||||
shakeContainer.Shake();
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
game.PresentBeatmap(BeatmapSet.Value);
|
||||
break;
|
||||
|
||||
default:
|
||||
beatmaps.Download(BeatmapSet.Value, noVideo);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void updateState(DownloadState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case DownloadState.NotDownloaded:
|
||||
background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
break;
|
||||
|
||||
case DownloadState.Downloading:
|
||||
background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
break;
|
||||
|
||||
case DownloadState.Downloaded:
|
||||
background.FadeColour(colours.Yellow, 500, Easing.InOutExpo);
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
background.FadeColour(colours.Green, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(-8, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
75
osu.Game/Overlays/Direct/PanelDownloadButton.cs
Normal file
75
osu.Game/Overlays/Direct/PanelDownloadButton.cs
Normal file
@ -0,0 +1,75 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class PanelDownloadButton : BeatmapDownloadTrackingComposite
|
||||
{
|
||||
protected bool DownloadEnabled => button.Enabled.Value;
|
||||
|
||||
private readonly bool noVideo;
|
||||
|
||||
private readonly ShakeContainer shakeContainer;
|
||||
private readonly DownloadButton button;
|
||||
|
||||
public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
||||
: base(beatmapSet)
|
||||
{
|
||||
this.noVideo = noVideo;
|
||||
|
||||
InternalChild = shakeContainer = new ShakeContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = button = new DownloadButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
button.State.BindTo(State);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game, BeatmapManager beatmaps)
|
||||
{
|
||||
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
||||
{
|
||||
button.Enabled.Value = false;
|
||||
button.TooltipText = "This beatmap is currently not available for download.";
|
||||
return;
|
||||
}
|
||||
|
||||
button.Action = () =>
|
||||
{
|
||||
switch (State.Value)
|
||||
{
|
||||
case DownloadState.Downloading:
|
||||
case DownloadState.Downloaded:
|
||||
shakeContainer.Shake();
|
||||
break;
|
||||
|
||||
case DownloadState.LocallyAvailable:
|
||||
game.PresentBeatmap(BeatmapSet.Value);
|
||||
break;
|
||||
|
||||
default:
|
||||
beatmaps.Download(BeatmapSet.Value, noVideo);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -72,18 +72,30 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
usernameText = new OsuSpriteText
|
||||
new FillFlowContainer
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
usernameText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
|
||||
},
|
||||
openUserExternally = new ExternalLinkButton
|
||||
{
|
||||
Margin = new MarginPadding { Left = 5 },
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
}
|
||||
},
|
||||
openUserExternally = new ExternalLinkButton
|
||||
titleText = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Left = 5 },
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular)
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -95,10 +107,6 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
titleText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular)
|
||||
},
|
||||
supporterTag = new SupporterIcon
|
||||
{
|
||||
Height = 20,
|
||||
@ -111,10 +119,11 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Colour = colours.GreySeafoamLighter,
|
||||
},
|
||||
new Container
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
userFlag = new UpdateableFlag
|
||||
@ -125,7 +134,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
userCountryText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular),
|
||||
Margin = new MarginPadding { Left = 40 },
|
||||
Margin = new MarginPadding { Left = 10 },
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Colour = colours.GreySeafoamLighter,
|
||||
|
@ -2,9 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
@ -14,37 +12,17 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
|
||||
{
|
||||
protected override string Header => "Garbage Collector";
|
||||
|
||||
private readonly Bindable<LatencyMode> latencyMode = new Bindable<LatencyMode>();
|
||||
private Bindable<GCLatencyMode> configLatencyMode;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkDebugConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsEnumDropdown<LatencyMode>
|
||||
{
|
||||
LabelText = "Active mode",
|
||||
Bindable = latencyMode
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
Text = "Force garbage collection",
|
||||
Action = GC.Collect
|
||||
},
|
||||
};
|
||||
|
||||
configLatencyMode = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode);
|
||||
configLatencyMode.BindValueChanged(mode => latencyMode.Value = (LatencyMode)mode.NewValue, true);
|
||||
latencyMode.BindValueChanged(mode => configLatencyMode.Value = (GCLatencyMode)mode.NewValue);
|
||||
}
|
||||
|
||||
private enum LatencyMode
|
||||
{
|
||||
Batch = GCLatencyMode.Batch,
|
||||
Interactive = GCLatencyMode.Interactive,
|
||||
LowLatency = GCLatencyMode.LowLatency,
|
||||
SustainedLowLatency = GCLatencyMode.SustainedLowLatency
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
BackgroundColour = colours.Gray3;
|
||||
}
|
||||
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
|
||||
protected override DrawableDropdownMenuItem CreateDrawableDropdownMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
|
||||
|
||||
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||
{
|
||||
|
@ -66,24 +66,64 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
};
|
||||
|
||||
Header.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
Header.Tabs.Current.ValueChanged += _ => queueUpdate();
|
||||
|
||||
Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
Filter.Tabs.Current.ValueChanged += _ => queueUpdate();
|
||||
|
||||
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => queueUpdate();
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
currentQuery.ValueChanged += query =>
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (string.IsNullOrEmpty(query.NewValue))
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdate();
|
||||
else
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);
|
||||
};
|
||||
}
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
private APIRequest getUsersRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
|
||||
private void queueUpdate() => Scheduler.AddOnce(updateSearch);
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
Users = null;
|
||||
clearPanels();
|
||||
loading.Hide();
|
||||
getUsersRequest?.Cancel();
|
||||
|
||||
if (API?.IsLoggedIn != true)
|
||||
return;
|
||||
|
||||
switch (Header.Tabs.Current.Value)
|
||||
{
|
||||
case SocialTab.Friends:
|
||||
var friendRequest = new GetFriendsRequest(); // TODO filter arguments?
|
||||
friendRequest.Success += updateUsers;
|
||||
API.Queue(getUsersRequest = friendRequest);
|
||||
break;
|
||||
|
||||
default:
|
||||
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
||||
userRequest.Success += response => updateUsers(response.Select(r => r.User));
|
||||
API.Queue(getUsersRequest = userRequest);
|
||||
break;
|
||||
}
|
||||
|
||||
loading.Show();
|
||||
}
|
||||
|
||||
private void recreatePanels(PanelDisplayStyle displayStyle)
|
||||
@ -133,45 +173,6 @@ namespace osu.Game.Overlays
|
||||
});
|
||||
}
|
||||
|
||||
private APIRequest getUsersRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
Users = null;
|
||||
clearPanels();
|
||||
loading.Hide();
|
||||
getUsersRequest?.Cancel();
|
||||
|
||||
if (API?.IsLoggedIn != true)
|
||||
return;
|
||||
|
||||
switch (Header.Tabs.Current.Value)
|
||||
{
|
||||
case SocialTab.Friends:
|
||||
var friendRequest = new GetFriendsRequest(); // TODO filter arguments?
|
||||
friendRequest.Success += updateUsers;
|
||||
API.Queue(getUsersRequest = friendRequest);
|
||||
break;
|
||||
|
||||
default:
|
||||
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
||||
userRequest.Success += response => updateUsers(response.Select(r => r.User));
|
||||
API.Queue(getUsersRequest = userRequest);
|
||||
break;
|
||||
}
|
||||
|
||||
loading.Show();
|
||||
}
|
||||
|
||||
private void updateUsers(IEnumerable<User> newUsers)
|
||||
{
|
||||
Users = newUsers;
|
||||
@ -193,7 +194,7 @@ namespace osu.Game.Overlays
|
||||
switch (state)
|
||||
{
|
||||
case APIState.Online:
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
queueUpdate();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
private const float padding = 10;
|
||||
|
||||
private Drawable modeButtonLine;
|
||||
protected Drawable ModeButtonLine { get; private set; }
|
||||
|
||||
public ToolbarRulesetSelector()
|
||||
{
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Depth = 1,
|
||||
},
|
||||
modeButtonLine = new Container
|
||||
ModeButtonLine = new Container
|
||||
{
|
||||
Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
@ -66,17 +66,22 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Current.BindValueChanged(_ => moveLineToCurrent(), true);
|
||||
}
|
||||
|
||||
private void moveLineToCurrent()
|
||||
private bool hasInitialPosition;
|
||||
|
||||
// Scheduled to allow the flow layout to be computed before the line position is updated
|
||||
private void moveLineToCurrent() => ScheduleAfterChildren(() =>
|
||||
{
|
||||
foreach (TabItem<RulesetInfo> tabItem in TabContainer)
|
||||
foreach (var tabItem in TabContainer)
|
||||
{
|
||||
if (tabItem.Value == Current.Value)
|
||||
{
|
||||
modeButtonLine.MoveToX(tabItem.DrawPosition.X, 200, Easing.OutQuint);
|
||||
ModeButtonLine.MoveToX(tabItem.DrawPosition.X, !hasInitialPosition ? 0 : 200, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasInitialPosition = true;
|
||||
});
|
||||
|
||||
public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput;
|
||||
|
||||
|
@ -14,6 +14,8 @@ namespace osu.Game.Overlays
|
||||
protected override bool BlockNonPositionalInput => true;
|
||||
protected override Container<Drawable> Content => Waves;
|
||||
|
||||
protected override bool StartHidden => true;
|
||||
|
||||
protected WaveOverlayContainer()
|
||||
{
|
||||
AddInternal(Waves = new WaveContainer
|
||||
@ -25,13 +27,17 @@ namespace osu.Game.Overlays
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
Waves.Show();
|
||||
this.FadeIn(100, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
Waves.Hide();
|
||||
this.FadeOut(WaveContainer.DISAPPEAR_DURATION, Easing.InQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user