mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into backgrounded-beatmap-status-lookups
This commit is contained in:
@ -109,7 +109,7 @@ namespace osu.Game.Overlays
|
||||
break;
|
||||
|
||||
case APIState.Online:
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Overlays
|
||||
public void ShowListing()
|
||||
{
|
||||
Current.Value = null;
|
||||
State = Visibility.Visible;
|
||||
Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -106,7 +106,7 @@ namespace osu.Game.Overlays
|
||||
if (build == null) throw new ArgumentNullException(nameof(build));
|
||||
|
||||
Current.Value = build;
|
||||
State = Visibility.Visible;
|
||||
Show();
|
||||
}
|
||||
|
||||
public void ShowBuild([NotNull] string updateStream, [NotNull] string version)
|
||||
@ -123,7 +123,7 @@ namespace osu.Game.Overlays
|
||||
ShowBuild(build);
|
||||
});
|
||||
|
||||
State = Visibility.Visible;
|
||||
Show();
|
||||
}
|
||||
|
||||
public override bool OnPressed(GlobalAction action)
|
||||
@ -133,7 +133,7 @@ namespace osu.Game.Overlays
|
||||
case GlobalAction.Back:
|
||||
if (Current.Value == null)
|
||||
{
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Overlays
|
||||
private readonly Container channelSelectionContainer;
|
||||
private readonly ChannelSelectionOverlay channelSelectionOverlay;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelectionOverlay.State == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos);
|
||||
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || (channelSelectionOverlay.State.Value == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos));
|
||||
|
||||
public ChatOverlay()
|
||||
{
|
||||
@ -130,7 +130,7 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 1,
|
||||
PlaceholderText = "type your message",
|
||||
Exit = () => State = Visibility.Hidden,
|
||||
Exit = Hide,
|
||||
OnCommit = postMessage,
|
||||
ReleaseFocusOnCommit = false,
|
||||
HoldFocus = true,
|
||||
@ -163,19 +163,19 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
|
||||
channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
|
||||
channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||
channelSelectionOverlay.StateChanged += state =>
|
||||
channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||
channelSelectionOverlay.State.ValueChanged += state =>
|
||||
{
|
||||
if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null)
|
||||
if (state.NewValue == Visibility.Hidden && channelManager.CurrentChannel.Value == null)
|
||||
{
|
||||
channelSelectionOverlay.State = Visibility.Visible;
|
||||
State = Visibility.Hidden;
|
||||
channelSelectionOverlay.Show();
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
channelTabControl.ChannelSelectorActive.Value = state == Visibility.Visible;
|
||||
channelTabControl.ChannelSelectorActive.Value = state.NewValue == Visibility.Visible;
|
||||
|
||||
if (state == Visibility.Visible)
|
||||
if (state.NewValue == Visibility.Visible)
|
||||
{
|
||||
textbox.HoldFocus = false;
|
||||
if (1f - ChatHeight.Value < channel_selection_min_height)
|
||||
@ -195,7 +195,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
textbox.Current.Disabled = true;
|
||||
currentChannelContainer.Clear(false);
|
||||
channelSelectionOverlay.State = Visibility.Visible;
|
||||
channelSelectionOverlay.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -253,7 +253,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 == 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;
|
||||
@ -325,7 +325,7 @@ namespace osu.Game.Overlays
|
||||
this.MoveToY(Height, transition_length, Easing.InSine);
|
||||
this.FadeOut(transition_length, Easing.InSine);
|
||||
|
||||
channelSelectionOverlay.State = Visibility.Hidden;
|
||||
channelSelectionOverlay.Hide();
|
||||
|
||||
textbox.HoldFocus = false;
|
||||
base.PopOut();
|
||||
|
@ -37,8 +37,8 @@ namespace osu.Game.Overlays
|
||||
dialogContainer.Add(currentDialog);
|
||||
|
||||
currentDialog.Show();
|
||||
currentDialog.StateChanged += state => onDialogOnStateChanged(dialog, state);
|
||||
State = Visibility.Visible;
|
||||
currentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
|
||||
Show();
|
||||
}
|
||||
|
||||
protected override bool PlaySamplesOnStateChange => false;
|
||||
@ -53,7 +53,7 @@ namespace osu.Game.Overlays
|
||||
dialog.Delay(PopupDialog.EXIT_DURATION).Expire();
|
||||
|
||||
if (dialog == currentDialog)
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
if (currentDialog?.State == Visibility.Visible)
|
||||
if (currentDialog?.State.Value == Visibility.Visible)
|
||||
{
|
||||
currentDialog.Hide();
|
||||
return;
|
||||
|
@ -252,7 +252,7 @@ namespace osu.Game.Overlays
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (State == Visibility.Hidden)
|
||||
if (State.Value == Visibility.Hidden)
|
||||
return;
|
||||
|
||||
if (API == null)
|
||||
|
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -40,6 +41,19 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
if (State.Value == Visibility.Visible)
|
||||
{
|
||||
// re-trigger the state changed so we can potentially surface to front
|
||||
State.TriggerChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Show();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
@ -413,12 +413,12 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (selectedMod != null)
|
||||
{
|
||||
if (State == Visibility.Visible) sampleOn?.Play();
|
||||
if (State.Value == Visibility.Visible) sampleOn?.Play();
|
||||
DeselectTypes(selectedMod.IncompatibleMods, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (State == Visibility.Visible) sampleOff?.Play();
|
||||
if (State.Value == Visibility.Visible) sampleOff?.Play();
|
||||
}
|
||||
|
||||
refreshSelectedMods();
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
ExitRequested = () => State = Visibility.Hidden,
|
||||
ExitRequested = Hide,
|
||||
FilterChanged = search => list.Filter(search),
|
||||
Padding = new MarginPadding(10),
|
||||
},
|
||||
|
@ -200,7 +200,7 @@ namespace osu.Game.Overlays
|
||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||
|
||||
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||
playlist.State.ValueChanged += s => playlistButton.FadeColour(s.NewValue == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private ScheduledDelegate seekDelegate;
|
||||
@ -449,7 +449,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
// This is here mostly as a performance fix.
|
||||
// If the playlist is not hidden it will update children even when the music controller is hidden (due to AlwaysPresent).
|
||||
playlist.State = Visibility.Hidden;
|
||||
playlist.Hide();
|
||||
|
||||
this.FadeOut(transition_length, Easing.OutQuint);
|
||||
dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint);
|
||||
|
@ -81,13 +81,13 @@ namespace osu.Game.Overlays
|
||||
|
||||
private void updateProcessingMode()
|
||||
{
|
||||
bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State == Visibility.Visible;
|
||||
bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State.Value == Visibility.Visible;
|
||||
|
||||
notificationsEnabler?.Cancel();
|
||||
|
||||
if (enabled)
|
||||
// we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed.
|
||||
notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State == Visibility.Visible ? 0 : 1000);
|
||||
notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, State.Value == Visibility.Visible ? 0 : 1000);
|
||||
else
|
||||
processingPosts = false;
|
||||
}
|
||||
@ -96,7 +96,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
StateChanged += _ => updateProcessingMode();
|
||||
State.ValueChanged += _ => updateProcessingMode();
|
||||
OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true);
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ namespace osu.Game.Overlays
|
||||
section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth);
|
||||
|
||||
if (notification.IsImportant)
|
||||
State = Visibility.Visible;
|
||||
Show();
|
||||
|
||||
updateCounts();
|
||||
});
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
{
|
||||
new LoadingAnimation
|
||||
{
|
||||
State = Visibility.Visible,
|
||||
State = { Value = Visibility.Visible },
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
|
@ -14,7 +14,6 @@ namespace osu.Game.Overlays.Settings
|
||||
|
||||
public override string LabelText
|
||||
{
|
||||
get => checkbox.LabelText;
|
||||
set => checkbox.LabelText = value;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using osu.Game.Overlays.Settings.Sections;
|
||||
using osuTK.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -37,23 +38,23 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
}
|
||||
|
||||
public override bool AcceptsFocus => subPanels.All(s => s.State != Visibility.Visible);
|
||||
public override bool AcceptsFocus => subPanels.All(s => s.State.Value != Visibility.Visible);
|
||||
|
||||
private T createSubPanel<T>(T subPanel)
|
||||
where T : SettingsSubPanel
|
||||
{
|
||||
subPanel.Depth = 1;
|
||||
subPanel.Anchor = Anchor.TopRight;
|
||||
subPanel.StateChanged += subPanelStateChanged;
|
||||
subPanel.State.ValueChanged += subPanelStateChanged;
|
||||
|
||||
subPanels.Add(subPanel);
|
||||
|
||||
return subPanel;
|
||||
}
|
||||
|
||||
private void subPanelStateChanged(Visibility visibility)
|
||||
private void subPanelStateChanged(ValueChangedEvent<Visibility> state)
|
||||
{
|
||||
switch (visibility)
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case Visibility.Visible:
|
||||
Background.FadeTo(0.9f, 300, Easing.OutQuint);
|
||||
@ -73,7 +74,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
protected override float ExpandedPosition => subPanels.Any(s => s.State == Visibility.Visible) ? -WIDTH : base.ExpandedPosition;
|
||||
protected override float ExpandedPosition => subPanels.Any(s => s.State.Value == Visibility.Visible) ? -WIDTH : base.ExpandedPosition;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
|
@ -84,10 +84,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
};
|
||||
|
||||
StateChanged += visibility =>
|
||||
State.ValueChanged += visibility =>
|
||||
{
|
||||
if (overlayActivationMode.Value == OverlayActivation.Disabled)
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
};
|
||||
|
||||
if (osuGame != null)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private OverlayContainer stateContainer;
|
||||
|
||||
private readonly Bindable<Visibility> overlayState = new Bindable<Visibility>();
|
||||
|
||||
public OverlayContainer StateContainer
|
||||
{
|
||||
get => stateContainer;
|
||||
@ -22,10 +25,12 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
stateContainer = value;
|
||||
|
||||
overlayState.UnbindBindings();
|
||||
|
||||
if (stateContainer != null)
|
||||
{
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
stateContainer.StateChanged += stateChanged;
|
||||
overlayState.BindTo(stateContainer.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,18 +45,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Depth = 2,
|
||||
Alpha = 0,
|
||||
});
|
||||
|
||||
overlayState.ValueChanged += stateChanged;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
private void stateChanged(ValueChangedEvent<Visibility> state)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
if (stateContainer != null)
|
||||
stateContainer.StateChanged -= stateChanged;
|
||||
}
|
||||
|
||||
private void stateChanged(Visibility state)
|
||||
{
|
||||
switch (state)
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case Visibility.Hidden:
|
||||
stateBackground.FadeOut(200);
|
||||
|
@ -100,14 +100,14 @@ namespace osu.Game.Overlays
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.DecreaseVolume:
|
||||
if (State == Visibility.Hidden)
|
||||
if (State.Value == Visibility.Hidden)
|
||||
Show();
|
||||
else
|
||||
volumeMeterMaster.Decrease(amount, isPrecise);
|
||||
return true;
|
||||
|
||||
case GlobalAction.IncreaseVolume:
|
||||
if (State == Visibility.Hidden)
|
||||
if (State.Value == Visibility.Hidden)
|
||||
Show();
|
||||
else
|
||||
volumeMeterMaster.Increase(amount, isPrecise);
|
||||
@ -126,7 +126,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
if (State == Visibility.Visible)
|
||||
if (State.Value == Visibility.Visible)
|
||||
schedulePopOut();
|
||||
|
||||
base.Show();
|
||||
|
Reference in New Issue
Block a user