Update with framework bindable changes

This commit is contained in:
smoogipoo
2019-02-21 18:56:34 +09:00
parent d637b184e4
commit bca347427f
195 changed files with 567 additions and 555 deletions

View File

@ -239,6 +239,6 @@ namespace osu.Game.Overlays.Direct
updateStatusContainer();
}
private void updateStatusContainer() => statusContainer.FadeTo(IsHovered || PreviewPlaying ? 0 : 1, 120, Easing.InOutQuint);
private void updateStatusContainer() => statusContainer.FadeTo(IsHovered || PreviewPlaying.Value ? 0 : 1, 120, Easing.InOutQuint);
}
}

View File

@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Direct
{
base.Update();
if (PreviewPlaying && Preview != null && Preview.TrackLoaded)
if (PreviewPlaying.Value && Preview != null && Preview.TrackLoaded)
{
PreviewBar.Width = (float)(Preview.CurrentTime / Preview.Length);
}
@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Direct
{
content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
content.MoveToY(0, hover_transition_time, Easing.OutQuint);
if (FadePlayButton && !PreviewPlaying)
if (FadePlayButton && !PreviewPlaying.Value)
PlayButton.FadeOut(120, Easing.InOutQuint);
base.OnHoverLost(e);
@ -127,8 +127,8 @@ namespace osu.Game.Overlays.Direct
base.LoadComplete();
this.FadeInFromZero(200, Easing.Out);
PreviewPlaying.ValueChanged += newValue => PlayButton.FadeTo(newValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint);
PreviewPlaying.ValueChanged += newValue => PreviewBar.FadeTo(newValue ? 1 : 0, 120, Easing.InOutQuint);
PreviewPlaying.ValueChanged += e => PlayButton.FadeTo(e.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint);
PreviewPlaying.ValueChanged += e => PreviewBar.FadeTo(e.NewValue ? 1 : 0, 120, Easing.InOutQuint);
}
protected List<DifficultyIcon> GetDifficultyIcons()

View File

@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Direct
{
base.LoadComplete();
State.BindValueChanged(updateState, true);
State.BindValueChanged(e => updateState(e.NewValue), true);
FinishTransforms(true);
}
@ -85,10 +85,10 @@ namespace osu.Game.Overlays.Direct
shakeContainer.Shake();
break;
case DownloadState.LocallyAvailable:
game.PresentBeatmap(BeatmapSet);
game.PresentBeatmap(BeatmapSet.Value);
break;
default:
beatmaps.Download(BeatmapSet, noVideo);
beatmaps.Download(BeatmapSet.Value, noVideo);
break;
}
};

View File

@ -35,9 +35,9 @@ namespace osu.Game.Overlays.Direct
progressBar.BackgroundColour = Color4.Black.Opacity(0.7f);
progressBar.Current = Progress;
State.BindValueChanged(state =>
State.BindValueChanged(e =>
{
switch (state)
switch (e.NewValue)
{
case DownloadState.NotDownloaded:
progressBar.Current.Value = 0;

View File

@ -37,14 +37,14 @@ namespace osu.Game.Overlays.Direct
{
this.beatmaps = beatmaps;
BeatmapSet.BindValueChanged(set =>
BeatmapSet.BindValueChanged(e =>
{
if (set == null)
if (e.NewValue == null)
attachDownload(null);
else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID).Any())
else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == e.NewValue.OnlineBeatmapSetID).Any())
State.Value = DownloadState.LocallyAvailable;
else
attachDownload(beatmaps.GetExistingDownload(set));
attachDownload(beatmaps.GetExistingDownload(e.NewValue));
}, true);
beatmaps.BeatmapDownloadBegan += download =>

View File

@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Direct
{
DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark;
Ruleset.Value = ruleset ?? rulesets.GetRuleset(0);
Ruleset.Value = ruleset.Value ?? rulesets.GetRuleset(0);
foreach (var r in rulesets.AvailableRulesets)
modeButtons.Add(new RulesetToggleButton(Ruleset, r));
}
@ -68,9 +68,9 @@ namespace osu.Game.Overlays.Direct
private readonly ConstrainedIconContainer iconContainer;
private void Bindable_ValueChanged(RulesetInfo obj)
private void Bindable_ValueChanged(ValueChangedEvent<RulesetInfo> e)
{
iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
iconContainer.FadeTo(Ruleset.ID == e.NewValue?.ID ? 1f : 0.5f, 100);
}
public override bool HandleNonPositionalInput => !bindable.Disabled && base.HandleNonPositionalInput;
@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Direct
Ruleset = ruleset;
bindable.ValueChanged += Bindable_ValueChanged;
Bindable_ValueChanged(bindable.Value);
Bindable_ValueChanged(new ValueChangedEvent<RulesetInfo>(bindable.Value, bindable.Value));
Action = () => bindable.Value = Ruleset;
}

View File

@ -112,12 +112,12 @@ namespace osu.Game.Overlays.Direct
base.OnHoverLost(e);
}
private void playingStateChanged(bool playing)
private void playingStateChanged(ValueChangedEvent<bool> e)
{
icon.Icon = playing ? FontAwesome.fa_stop : FontAwesome.fa_play;
icon.FadeColour(playing || IsHovered ? hoverColour : Color4.White, 120, Easing.InOutQuint);
icon.Icon = e.NewValue ? FontAwesome.fa_stop : FontAwesome.fa_play;
icon.FadeColour(e.NewValue || IsHovered ? hoverColour : Color4.White, 120, Easing.InOutQuint);
if (playing)
if (e.NewValue)
{
if (BeatmapSet == null)
{
@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Direct
preview.Stopped += () => Playing.Value = false;
// user may have changed their mind.
if (Playing)
if (Playing.Value)
preview.Start();
});
}