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

@ -1,6 +1,7 @@
// 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 osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
@ -55,9 +56,9 @@ namespace osu.Game.Rulesets.Catch.Mods
return default_flashlight_size; return default_flashlight_size;
} }
protected override void OnComboChange(int newCombo) protected override void OnComboChange(ValueChangedEvent<int> e)
{ {
this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
} }
protected override string FragmentShader => "CircularFlashlight"; protected override string FragmentShader => "CircularFlashlight";

View File

@ -3,6 +3,7 @@
using System; using System;
using osu.Framework.Caching; using osu.Framework.Caching;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Mods
} }
} }
protected override void OnComboChange(int newCombo) protected override void OnComboChange(ValueChangedEvent<int> e)
{ {
} }

View File

@ -2,6 +2,7 @@
// 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.Linq; using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
@ -75,11 +76,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
AddNested(Tail); AddNested(Tail);
} }
protected override void OnDirectionChanged(ScrollingDirection direction) protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
{ {
base.OnDirectionChanged(direction); base.OnDirectionChanged(e);
bodyPiece.Anchor = bodyPiece.Origin = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
} }
public override Color4 AccentColour public override Color4 AccentColour

View File

@ -41,9 +41,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected override bool ShouldBeAlive => AlwaysAlive || base.ShouldBeAlive; protected override bool ShouldBeAlive => AlwaysAlive || base.ShouldBeAlive;
protected virtual void OnDirectionChanged(ScrollingDirection direction) protected virtual void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
{ {
Anchor = Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
} }
} }

View File

@ -1,6 +1,7 @@
// 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 osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -31,11 +32,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
InternalChild = headPiece = new NotePiece(); InternalChild = headPiece = new NotePiece();
} }
protected override void OnDirectionChanged(ScrollingDirection direction) protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
{ {
base.OnDirectionChanged(direction); base.OnDirectionChanged(e);
headPiece.Anchor = headPiece.Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
} }
public override Color4 AccentColour public override Color4 AccentColour

View File

@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
private void load(IScrollingInfo scrollingInfo) private void load(IScrollingInfo scrollingInfo)
{ {
direction.BindTo(scrollingInfo.Direction); direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(direction => direction.BindValueChanged(e =>
{ {
colouredBox.Anchor = colouredBox.Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; colouredBox.Anchor = colouredBox.Origin = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
}, true); }, true);
} }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Objects
public virtual int Column public virtual int Column
{ {
get => ColumnBindable; get => ColumnBindable.Value;
set => ColumnBindable.Value = value; set => ColumnBindable.Value = value;
} }

View File

@ -82,15 +82,15 @@ namespace osu.Game.Rulesets.Mania.UI
TopLevelContainer.Add(explosionContainer.CreateProxy()); TopLevelContainer.Add(explosionContainer.CreateProxy());
Direction.BindValueChanged(d => Direction.BindValueChanged(e =>
{ {
hitTargetContainer.Padding = new MarginPadding hitTargetContainer.Padding = new MarginPadding
{ {
Top = d == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0, Top = e.NewValue == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0,
Bottom = d == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0, Bottom = e.NewValue == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0,
}; };
keyArea.Anchor = keyArea.Origin= d == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; keyArea.Anchor = keyArea.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
}, true); }, true);
} }
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.UI
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
{ {
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements) if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
return; return;
explosionContainer.Add(new HitExplosion(judgedObject) explosionContainer.Add(new HitExplosion(judgedObject)
@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Mania.UI
public bool OnPressed(ManiaAction action) public bool OnPressed(ManiaAction action)
{ {
if (action != Action) if (action != Action.Value)
return false; return false;
var nextObject = var nextObject =

View File

@ -48,9 +48,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components
}; };
direction.BindTo(scrollingInfo.Direction); direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(direction => direction.BindValueChanged(e =>
{ {
backgroundOverlay.Anchor = backgroundOverlay.Origin = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; backgroundOverlay.Anchor = backgroundOverlay.Origin = direction.Value == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
updateColours(); updateColours();
}, true); }, true);
} }

View File

@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components
private void load(IScrollingInfo scrollingInfo) private void load(IScrollingInfo scrollingInfo)
{ {
direction.BindTo(scrollingInfo.Direction); direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(direction => direction.BindValueChanged(e =>
{ {
Anchor anchor = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; Anchor anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
hitTargetBar.Anchor = hitTargetBar.Origin = anchor; hitTargetBar.Anchor = hitTargetBar.Origin = anchor;
hitTargetLine.Anchor = hitTargetLine.Origin = anchor; hitTargetLine.Anchor = hitTargetLine.Origin = anchor;

View File

@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components
}; };
direction.BindTo(scrollingInfo.Direction); direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(direction => direction.BindValueChanged(e =>
{ {
gradient.Colour = ColourInfo.GradientVertical( gradient.Colour = ColourInfo.GradientVertical(
direction == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), direction.Value == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0),
direction == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); direction.Value == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black);
}, true); }, true);
} }

View File

@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.UI
BarLines.ForEach(Playfield.Add); BarLines.ForEach(Playfield.Add);
Config.BindWith(ManiaSetting.ScrollDirection, configDirection); Config.BindWith(ManiaSetting.ScrollDirection, configDirection);
configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true); configDirection.BindValueChanged(e => Direction.Value = (ScrollingDirection)e.NewValue, true);
Config.BindWith(ManiaSetting.ScrollTime, TimeRange); Config.BindWith(ManiaSetting.ScrollTime, TimeRange);
} }

View File

@ -136,12 +136,12 @@ namespace osu.Game.Rulesets.Mania.UI
AddColumn(column); AddColumn(column);
} }
Direction.BindValueChanged(d => Direction.BindValueChanged(e =>
{ {
barLineContainer.Padding = new MarginPadding barLineContainer.Padding = new MarginPadding
{ {
Top = d == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0, Top = e.NewValue == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0,
Bottom = d == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0, Bottom = e.NewValue == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0,
}; };
}, true); }, true);
} }
@ -185,7 +185,7 @@ namespace osu.Game.Rulesets.Mania.UI
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
{ {
if (!judgedObject.DisplayResult || !DisplayJudgements) if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return; return;
judgements.Clear(); judgements.Clear();

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
PositionBindable.BindValueChanged(_ => UpdatePosition(), true); PositionBindable.BindValueChanged(_ => UpdatePosition(), true);
StackHeightBindable.BindValueChanged(_ => UpdatePosition()); StackHeightBindable.BindValueChanged(_ => UpdatePosition());
ScaleBindable.BindValueChanged(v => Scale = new Vector2(v), true); ScaleBindable.BindValueChanged(e => Scale = new Vector2(e.NewValue), true);
} }
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
body.BorderColour = colours.Yellow; body.BorderColour = colours.Yellow;
PositionBindable.BindValueChanged(_ => updatePosition(), true); PositionBindable.BindValueChanged(_ => updatePosition(), true);
ScaleBindable.BindValueChanged(v => body.PathWidth = v * 64, true); ScaleBindable.BindValueChanged(e => body.PathWidth = e.NewValue * 64, true);
} }
private void updatePosition() => Position = slider.StackedPosition; private void updatePosition() => Position = slider.StackedPosition;

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
PositionBindable.BindValueChanged(_ => updatePosition(), true); PositionBindable.BindValueChanged(_ => updatePosition(), true);
StackHeightBindable.BindValueChanged(_ => updatePosition()); StackHeightBindable.BindValueChanged(_ => updatePosition());
ScaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v), true); ScaleBindable.BindValueChanged(e => ring.Scale = new Vector2(e.NewValue), true);
} }
private void updatePosition() => Position = spinner.Position; private void updatePosition() => Position = spinner.Position;

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{ {
scoreProcessor.Health.ValueChanged += val => { blinds.AnimateClosedness((float)val); }; scoreProcessor.Health.ValueChanged += e => { blinds.AnimateClosedness((float)e.NewValue); };
} }
/// <summary> /// <summary>

View File

@ -1,6 +1,7 @@
// 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 osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
@ -41,9 +42,9 @@ namespace osu.Game.Rulesets.Osu.Mods
return default_flashlight_size; return default_flashlight_size;
} }
protected override void OnComboChange(int newCombo) protected override void OnComboChange(ValueChangedEvent<int> e)
{ {
this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
} }
protected override string FragmentShader => "CircularFlashlight"; protected override string FragmentShader => "CircularFlashlight";

View File

@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
scaleBindable.BindValueChanged(v => scaleContainer.Scale = new Vector2(v), true); scaleBindable.BindValueChanged(e => scaleContainer.Scale = new Vector2(e.NewValue), true);
positionBindable.BindTo(HitObject.PositionBindable); positionBindable.BindTo(HitObject.PositionBindable);
stackHeightBindable.BindTo(HitObject.StackHeightBindable); stackHeightBindable.BindTo(HitObject.StackHeightBindable);

View File

@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut);
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
scaleBindable.BindValueChanged(v => scaleBindable.BindValueChanged(e =>
{ {
Body.PathWidth = HitObject.Scale * 64; Body.PathWidth = HitObject.Scale * 64;
Ball.Scale = new Vector2(HitObject.Scale); Ball.Scale = new Vector2(HitObject.Scale);

View File

@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
circle.Colour = colours.BlueDark; circle.Colour = colours.BlueDark;
glow.Colour = colours.BlueDark; glow.Colour = colours.BlueDark;
positionBindable.BindValueChanged(v => Position = v); positionBindable.BindValueChanged(e => Position = e.NewValue);
positionBindable.BindTo(HitObject.PositionBindable); positionBindable.BindTo(HitObject.PositionBindable);
} }

View File

@ -54,18 +54,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var spanProgress = slider.ProgressAt(completionProgress); var spanProgress = slider.ProgressAt(completionProgress);
double start = 0; double start = 0;
double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; double end = SnakingIn.Value ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1;
if (span >= slider.SpanCount() - 1) if (span >= slider.SpanCount() - 1)
{ {
if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1) if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1)
{ {
start = 0; start = 0;
end = SnakingOut ? spanProgress : 1; end = SnakingOut.Value ? spanProgress : 1;
} }
else else
{ {
start = SnakingOut ? spanProgress : 0; start = SnakingOut.Value ? spanProgress : 0;
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public virtual Vector2 Position public virtual Vector2 Position
{ {
get => PositionBindable; get => PositionBindable.Value;
set => PositionBindable.Value = value; set => PositionBindable.Value = value;
} }
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public int StackHeight public int StackHeight
{ {
get => StackHeightBindable; get => StackHeightBindable.Value;
set => StackHeightBindable.Value = value; set => StackHeightBindable.Value = value;
} }
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public float Scale public float Scale
{ {
get => ScaleBindable; get => ScaleBindable.Value;
set => ScaleBindable.Value = value; set => ScaleBindable.Value = value;
} }

View File

@ -183,13 +183,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
}; };
this.beatmap.BindTo(beatmap); this.beatmap.BindTo(beatmap);
this.beatmap.ValueChanged += v => calculateScale(); this.beatmap.ValueChanged += e => calculateScale();
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize); cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
cursorScale.ValueChanged += v => calculateScale(); cursorScale.ValueChanged += e => calculateScale();
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize); autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += v => calculateScale(); autoCursorScale.ValueChanged += e => calculateScale();
calculateScale(); calculateScale();
} }
@ -198,7 +198,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
float scale = (float)cursorScale.Value; float scale = (float)cursorScale.Value;
if (autoCursorScale && beatmap.Value != null) if (autoCursorScale.Value && beatmap.Value != null)
{ {
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier. // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY); scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);

View File

@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.UI
private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
{ {
if (!judgedObject.DisplayResult || !DisplayJudgements) if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
return; return;
DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject)

View File

@ -2,6 +2,7 @@
// 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 osu.Framework.Caching; using osu.Framework.Caching;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
@ -48,9 +49,9 @@ namespace osu.Game.Rulesets.Taiko.Mods
return default_flashlight_size; return default_flashlight_size;
} }
protected override void OnComboChange(int newCombo) protected override void OnComboChange(ValueChangedEvent<int> e)
{ {
this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
} }
protected override string FragmentShader => "CircularFlashlight"; protected override string FragmentShader => "CircularFlashlight";

View File

@ -225,7 +225,7 @@ namespace osu.Game.Rulesets.Taiko.UI
internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
{ {
if (!DisplayJudgements) if (!DisplayJudgements.Value)
return; return;
if (!judgedObject.DisplayResult) if (!judgedObject.DisplayResult)

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual
protected override void AddCheckSteps(Func<Player> player) protected override void AddCheckSteps(Func<Player> player)
{ {
base.AddCheckSteps(player); base.AddCheckSteps(player);
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore > 0, "score above zero"); AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore.Value > 0, "score above zero");
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys");
} }

View File

@ -147,7 +147,7 @@ namespace osu.Game.Tests.Visual
private bool selectedBeatmapVisible() private bool selectedBeatmapVisible()
{ {
var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State == CarouselItemState.Selected); var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected);
if (currentlySelected == null) if (currentlySelected == null)
return true; return true;
return currentlySelected.Item.Visible; return currentlySelected.Item.Visible;

View File

@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual
AddStep("show", () => AddStep("show", () =>
{ {
infoWedge.State = Visibility.Visible; infoWedge.State = Visibility.Visible;
infoWedge.Beatmap = Beatmap; infoWedge.Beatmap = Beatmap.Value;
}); });
// select part is redundant, but wait for load isn't // select part is redundant, but wait for load isn't

View File

@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual
}); });
channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel); channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel);
channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.ToString(); channelTabControl.Current.ValueChanged += e => currentText.Text = "Currently selected channel: " + e.NewValue.ToString();
AddStep("Add random private channel", addRandomPrivateChannel); AddStep("Add random private channel", addRandomPrivateChannel);
AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2); AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);

View File

@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual
} }
}; };
drawableDate.Current.ValueChanged += v => flash.FadeOutFromOne(500); drawableDate.Current.ValueChanged += e => flash.FadeOutFromOne(500);
} }
} }
} }

View File

@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual
AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First())); AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First()));
AddStep("Hide overlay", () => failOverlay.Hide()); AddStep("Hide overlay", () => failOverlay.Hide());
AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected)); AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value));
} }
private void press(Key key) private void press(Key key)
@ -106,7 +106,7 @@ namespace osu.Game.Tests.Visual
AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Show overlay", () => pauseOverlay.Show());
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected); AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual
AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Show overlay", () => pauseOverlay.Show());
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
@ -132,11 +132,11 @@ namespace osu.Game.Tests.Visual
AddStep("Show overlay", () => failOverlay.Show()); AddStep("Show overlay", () => failOverlay.Show());
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Hide overlay", () => failOverlay.Hide()); AddStep("Hide overlay", () => failOverlay.Hide());
} }
@ -149,11 +149,11 @@ namespace osu.Game.Tests.Visual
AddStep("Show overlay", () => failOverlay.Show()); AddStep("Show overlay", () => failOverlay.Show());
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Hide overlay", () => failOverlay.Hide()); AddStep("Hide overlay", () => failOverlay.Hide());
} }
@ -169,8 +169,8 @@ namespace osu.Game.Tests.Visual
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton));
AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected); AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected.Value);
AddAssert("Second button selected", () => secondButton.Selected); AddAssert("Second button selected", () => secondButton.Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
@ -190,8 +190,8 @@ namespace osu.Game.Tests.Visual
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton));
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("Second button not selected", () => !secondButton.Selected); AddAssert("Second button not selected", () => !secondButton.Selected.Value);
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton));
AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero)); AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero));
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); // Initial state condition AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); // Initial state condition
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} }

View File

@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual
}, },
}; };
idleTracker.IsIdle.BindValueChanged(idle => box.Colour = idle ? Color4.White : Color4.Black, true); idleTracker.IsIdle.BindValueChanged(e => box.Colour = e.NewValue ? Color4.White : Color4.Black, true);
} }
} }
} }

View File

@ -52,16 +52,16 @@ namespace osu.Game.Tests.Visual
Room.Playlist.Clear(); Room.Playlist.Clear();
}); });
AddAssert("button disabled", () => !settings.ApplyButton.Enabled); AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
AddStep("set name", () => Room.Name.Value = "Room name"); AddStep("set name", () => Room.Name.Value = "Room name");
AddAssert("button disabled", () => !settings.ApplyButton.Enabled); AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap().BeatmapInfo })); AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap().BeatmapInfo }));
AddAssert("button enabled", () => settings.ApplyButton.Enabled); AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value);
AddStep("clear name", () => Room.Name.Value = ""); AddStep("clear name", () => Room.Name.Value = "");
AddAssert("button disabled", () => !settings.ApplyButton.Enabled); AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value);
} }
[Test] [Test]

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual
void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state);
void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected);
manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; }; manager.UnreadCount.ValueChanged += e => { displayedCount.Text = $"displayed count: {e.NewValue}"; };
setState(Visibility.Visible); setState(Visibility.Visible);
AddStep(@"simple #1", sendHelloNotification); AddStep(@"simple #1", sendHelloNotification);

View File

@ -187,8 +187,8 @@ namespace osu.Game.Tests.Visual
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex); AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
AddAssert("empty mods", () => !selectedMods.Value.Any()); AddAssert("empty mods", () => !selectedMods.Value.Any());
void onModChange(IEnumerable<Mod> mods) => modChangeIndex = actionIndex++; void onModChange(ValueChangedEvent<IEnumerable<Mod>> e) => modChangeIndex = actionIndex++;
void onRulesetChange(RulesetInfo ruleset) => rulesetChangeIndex = actionIndex--; void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
} }
[Test] [Test]

View File

@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual
AddStep(@"Hit! :D", delegate AddStep(@"Hit! :D", delegate
{ {
score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0); score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current.Value > 0 ? comboCounter.Current.Value - 1 : 0) / 25.0);
comboCounter.Increment(); comboCounter.Increment();
numerator++; numerator++;
denominator++; denominator++;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual
}, },
}; };
breadcrumbs.Current.ValueChanged += s => titleText.Text = $"Changed to {s.ToString()}"; breadcrumbs.Current.ValueChanged += e => titleText.Text = $"Changed to {e.NewValue.ToString()}";
breadcrumbs.Current.TriggerChange(); breadcrumbs.Current.TriggerChange();
waitForCurrent(); waitForCurrent();

View File

@ -3,6 +3,7 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -58,15 +59,15 @@ namespace osu.Game.Tests.Visual
Beatmap.ValueChanged += beatmapChanged; Beatmap.ValueChanged += beatmapChanged;
} }
private void beatmapChanged(WorkingBeatmap working) private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
=> loadStoryboard(working); => loadStoryboard(e.NewValue);
private void restart() private void restart()
{ {
var track = Beatmap.Value.Track; var track = Beatmap.Value.Track;
track.Reset(); track.Reset();
loadStoryboard(Beatmap); loadStoryboard(Beatmap.Value);
track.Start(); track.Start();
} }
@ -78,7 +79,7 @@ namespace osu.Game.Tests.Visual
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true }; var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
storyboardContainer.Clock = decoupledClock; storyboardContainer.Clock = decoupledClock;
storyboard = working.Storyboard.CreateDrawable(Beatmap); storyboard = working.Storyboard.CreateDrawable(Beatmap.Value);
storyboard.Passing = false; storyboard.Passing = false;
storyboardContainer.Add(storyboard); storyboardContainer.Add(storyboard);

View File

@ -33,9 +33,9 @@ namespace osu.Game.Tests.Visual
filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.All);
filter.PinItem(GroupMode.RecentlyPlayed); filter.PinItem(GroupMode.RecentlyPlayed);
filter.Current.ValueChanged += newFilter => filter.Current.ValueChanged += e =>
{ {
text.Text = "Currently Selected: " + newFilter.ToString(); text.Text = "Currently Selected: " + e.NewValue.ToString();
}; };
} }
} }

View File

@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps
this.audioManager = audioManager; this.audioManager = audioManager;
ValueChanged += registerAudioTrack; ValueChanged += e => registerAudioTrack(e.NewValue);
// If the track has changed prior to this being called, let's register it // If the track has changed prior to this being called, let's register it
if (Value != Default) if (Value != Default)

View File

@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps.Drawables
public UpdateableBeatmapBackgroundSprite() public UpdateableBeatmapBackgroundSprite()
{ {
Beatmap.BindValueChanged(b => Model = b); Beatmap.BindValueChanged(e => Model = e.NewValue);
} }
protected override Drawable CreateDrawable(BeatmapInfo model) protected override Drawable CreateDrawable(BeatmapInfo model)

View File

@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps
BeatmapSetInfo = beatmapInfo.BeatmapSet; BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
Mods.ValueChanged += mods => applyRateAdjustments(); Mods.ValueChanged += e => applyRateAdjustments();
beatmap = new RecyclableLazy<IBeatmap>(() => beatmap = new RecyclableLazy<IBeatmap>(() =>
{ {

View File

@ -60,9 +60,9 @@ namespace osu.Game.Configuration
databasedSettings.Add(setting); databasedSettings.Add(setting);
} }
bindable.ValueChanged += v => bindable.ValueChanged += e =>
{ {
setting.Value = v; setting.Value = e.NewValue;
settings.Update(setting); settings.Update(setting);
}; };
} }

View File

@ -33,14 +33,14 @@ namespace osu.Game.Configuration
Set(OsuSetting.Username, string.Empty); Set(OsuSetting.Username, string.Empty);
Set(OsuSetting.Token, string.Empty); Set(OsuSetting.Token, string.Empty);
Set(OsuSetting.SavePassword, false).ValueChanged += val => Set(OsuSetting.SavePassword, false).ValueChanged += e =>
{ {
if (val) Set(OsuSetting.SaveUsername, true); if (e.NewValue) Set(OsuSetting.SaveUsername, true);
}; };
Set(OsuSetting.SaveUsername, true).ValueChanged += val => Set(OsuSetting.SaveUsername, true).ValueChanged += e =>
{ {
if (!val) Set(OsuSetting.SavePassword, false); if (!e.NewValue) Set(OsuSetting.SavePassword, false);
}; };
Set(OsuSetting.ExternalLinkWarning, true); Set(OsuSetting.ExternalLinkWarning, true);

View File

@ -90,7 +90,7 @@ namespace osu.Game.Graphics.Containers
switch (visibility) switch (visibility)
{ {
case Visibility.Visible: case Visibility.Visible:
if (OverlayActivationMode != OverlayActivation.Disabled) if (OverlayActivationMode.Value != OverlayActivation.Disabled)
{ {
if (PlaySamplesOnStateChange) samplePopIn?.Play(); if (PlaySamplesOnStateChange) samplePopIn?.Play();
} }

View File

@ -45,7 +45,7 @@ namespace osu.Game.Graphics.Containers
parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax); parallaxEnabled = config.GetBindable<bool>(OsuSetting.MenuParallax);
parallaxEnabled.ValueChanged += delegate parallaxEnabled.ValueChanged += delegate
{ {
if (!parallaxEnabled) if (!parallaxEnabled.Value)
{ {
content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, Easing.OutQuint); content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, Easing.OutQuint);
content.Scale = new Vector2(1 + System.Math.Abs(ParallaxAmount)); content.Scale = new Vector2(1 + System.Math.Abs(ParallaxAmount));
@ -65,7 +65,7 @@ namespace osu.Game.Graphics.Containers
{ {
base.Update(); base.Update();
if (parallaxEnabled) if (parallaxEnabled.Value)
{ {
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount; Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount;

View File

@ -74,10 +74,10 @@ namespace osu.Game.Graphics.Containers
} }
} }
private void scaleChanged(float value) private void scaleChanged(ValueChangedEvent<float> args)
{ {
this.ScaleTo(new Vector2(value), 500, Easing.Out); this.ScaleTo(new Vector2(args.NewValue), 500, Easing.Out);
this.ResizeTo(new Vector2(1 / value), 500, Easing.Out); this.ResizeTo(new Vector2(1 / args.NewValue), 500, Easing.Out);
} }
} }
@ -108,7 +108,7 @@ namespace osu.Game.Graphics.Containers
sizableContainer.FinishTransforms(); sizableContainer.FinishTransforms();
} }
private bool requiresBackgroundVisible => (scalingMode == ScalingMode.Everything || scalingMode == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1); private bool requiresBackgroundVisible => (scalingMode.Value == ScalingMode.Everything || scalingMode.Value == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1);
private void updateSize() private void updateSize()
{ {
@ -137,8 +137,8 @@ namespace osu.Game.Graphics.Containers
bool scaling = targetMode == null || scalingMode.Value == targetMode; bool scaling = targetMode == null || scalingMode.Value == targetMode;
var targetSize = scaling ? new Vector2(sizeX, sizeY) : Vector2.One; var targetSize = scaling ? new Vector2(sizeX.Value, sizeY.Value) : Vector2.One;
var targetPosition = scaling ? new Vector2(posX, posY) * (Vector2.One - targetSize) : Vector2.Zero; var targetPosition = scaling ? new Vector2(posX.Value, posY.Value) * (Vector2.One - targetSize) : Vector2.Zero;
bool requiresMasking = scaling && targetSize != Vector2.One; bool requiresMasking = scaling && targetSize != Vector2.One;
if (requiresMasking) if (requiresMasking)

View File

@ -80,7 +80,7 @@ namespace osu.Game.Graphics.Cursor
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
} }
if (e.Button == MouseButton.Left && cursorRotate) if (e.Button == MouseButton.Left && cursorRotate.Value)
{ {
dragRotationState = DragRotationState.DragStarted; dragRotationState = DragRotationState.DragStarted;
positionMouseDown = e.MousePosition; positionMouseDown = e.MousePosition;
@ -156,7 +156,7 @@ namespace osu.Game.Graphics.Cursor
}; };
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize); cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.ValueChanged += e => cursorContainer.Scale = new Vector2((float)e.NewValue * base_scale);
cursorScale.TriggerChange(); cursorScale.TriggerChange();
} }
} }

View File

@ -127,7 +127,7 @@ namespace osu.Game.Graphics
{ {
base.Update(); base.Update();
if (cursorVisibility == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0) if (cursorVisibility.Value == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0)
cursorVisibility.Value = true; cursorVisibility.Value = true;
} }

View File

@ -27,12 +27,12 @@ namespace osu.Game.Graphics.UserInterface
{ {
Height = 32; Height = 32;
TabContainer.Spacing = new Vector2(padding, 0f); TabContainer.Spacing = new Vector2(padding, 0f);
Current.ValueChanged += tab => Current.ValueChanged += e =>
{ {
foreach (var t in TabContainer.Children.OfType<BreadcrumbTabItem>()) foreach (var t in TabContainer.Children.OfType<BreadcrumbTabItem>())
{ {
var tIndex = TabContainer.IndexOf(t); var tIndex = TabContainer.IndexOf(t);
var tabIndex = TabContainer.IndexOf(TabMap[tab]); var tabIndex = TabContainer.IndexOf(TabMap[e.NewValue]);
t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible;
t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint); t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint);

View File

@ -242,9 +242,9 @@ namespace osu.Game.Graphics.UserInterface
Selected.Value = false; Selected.Value = false;
} }
private void selectionChanged(bool isSelected) private void selectionChanged(ValueChangedEvent<bool> args)
{ {
if (isSelected) if (args.NewValue)
{ {
spriteText.TransformSpacingTo(hoverSpacing, hover_duration, Easing.OutElastic); spriteText.TransformSpacingTo(hoverSpacing, hover_duration, Easing.OutElastic);
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, Easing.OutElastic); colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, Easing.OutElastic);

View File

@ -41,9 +41,9 @@ namespace osu.Game.Graphics.UserInterface
}, },
}; };
Current.ValueChanged += newValue => Current.ValueChanged += e =>
{ {
if (newValue) if (e.NewValue)
fill.FadeIn(200, Easing.OutQuint); fill.FadeIn(200, Easing.OutQuint);
else else
fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times

View File

@ -73,7 +73,7 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); Enabled.BindValueChanged(e => this.FadeColour(e.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true);
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)

View File

@ -2,6 +2,7 @@
// 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 osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -46,13 +47,13 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds(HoverSampleSet.Loud), new HoverClickSounds(HoverSampleSet.Loud),
}); });
Enabled.ValueChanged += enabled_ValueChanged; Enabled.ValueChanged += enabledChanged;
Enabled.TriggerChange(); Enabled.TriggerChange();
} }
private void enabled_ValueChanged(bool enabled) private void enabledChanged(ValueChangedEvent<bool> e)
{ {
this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)

View File

@ -86,9 +86,9 @@ namespace osu.Game.Graphics.UserInterface
{ {
base.LoadComplete(); base.LoadComplete();
Current.ValueChanged += newValue => Current.ValueChanged += e =>
{ {
if (newValue) if (e.NewValue)
sampleChecked?.Play(); sampleChecked?.Play();
else else
sampleUnchecked?.Play(); sampleUnchecked?.Play();

View File

@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
CurrentNumber.BindValueChanged(updateTooltipText, true); CurrentNumber.BindValueChanged(e => updateTooltipText(e.NewValue), true);
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)

View File

@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface
set set
{ {
accentColour = value; accentColour = value;
if (!Active) if (!Active.Value)
Text.Colour = value; Text.Colour = value;
} }
} }
@ -128,14 +128,14 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (!Active) if (!Active.Value)
fadeActive(); fadeActive();
return true; return true;
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Active) if (!Active.Value)
fadeInactive(); fadeInactive();
} }
@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds() new HoverClickSounds()
}; };
Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); Active.BindValueChanged(e => Text.Font = e.NewValue ? "Exo2.0-Bold" : @"Exo2.0", true);
} }
protected override void OnActivated() => fadeActive(); protected override void OnActivated() => fadeActive();

View File

@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
accentColour = value; accentColour = value;
if (Current) if (Current.Value)
{ {
text.Colour = AccentColour; text.Colour = AccentColour;
icon.Colour = AccentColour; icon.Colour = AccentColour;
@ -67,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Current) if (!Current.Value)
fadeOut(); fadeOut();
base.OnHoverLost(e); base.OnHoverLost(e);
@ -118,9 +118,9 @@ namespace osu.Game.Graphics.UserInterface
} }
}; };
Current.ValueChanged += v => Current.ValueChanged += e =>
{ {
if (v) if (e.NewValue)
{ {
fadeIn(); fadeIn();
icon.Icon = FontAwesome.fa_check_circle_o; icon.Icon = FontAwesome.fa_check_circle_o;

View File

@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds() new HoverClickSounds()
}; };
Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); Active.BindValueChanged(e => Text.Font = e.NewValue ? @"Exo2.0-Bold" : @"Exo2.0", true);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -70,14 +70,14 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (!Active) if (!Active.Value)
slideActive(); slideActive();
return true; return true;
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Active) if (!Active.Value)
slideInactive(); slideInactive();
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Increment(double amount) public override void Increment(double amount)
{ {
Current.Value = Current + amount; Current.Value = Current.Value + amount;
} }
} }
} }

View File

@ -95,11 +95,11 @@ namespace osu.Game.Graphics.UserInterface
TextSize = 40; TextSize = 40;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
DisplayedCount = Current; DisplayedCount = Current.Value;
Current.ValueChanged += newValue => Current.ValueChanged += e =>
{ {
if (IsLoaded) TransformCount(displayedCount, newValue); if (IsLoaded) TransformCount(displayedCount, e.NewValue);
}; };
} }
@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
base.LoadComplete(); base.LoadComplete();
DisplayedCountSpriteText.Text = FormatCount(Current); DisplayedCountSpriteText.Text = FormatCount(Current.Value);
} }
/// <summary> /// <summary>
@ -126,7 +126,7 @@ namespace osu.Game.Graphics.UserInterface
public virtual void StopRolling() public virtual void StopRolling()
{ {
FinishTransforms(false, nameof(DisplayedCount)); FinishTransforms(false, nameof(DisplayedCount));
DisplayedCount = Current; DisplayedCount = Current.Value;
} }
/// <summary> /// <summary>

View File

@ -52,7 +52,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Increment(double amount) public override void Increment(double amount)
{ {
Current.Value = Current + amount; Current.Value = Current.Value + amount;
} }
} }
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
onPushed(null, stack.CurrentScreen); onPushed(null, stack.CurrentScreen);
Current.ValueChanged += newScreen => newScreen.MakeCurrent(); Current.ValueChanged += e => e.NewValue.MakeCurrent();
} }
private void onPushed(IScreen lastScreen, IScreen newScreen) private void onPushed(IScreen lastScreen, IScreen newScreen)

View File

@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Increment(int amount) public override void Increment(int amount)
{ {
Current.Value = Current + amount; Current.Value = Current.Value + amount;
} }
} }
} }

View File

@ -64,7 +64,7 @@ namespace osu.Game.Online.API
thread.Start(); thread.Start();
} }
private void onTokenChanged(OAuthToken token) => config.Set(OsuSetting.Token, config.Get<bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty); private void onTokenChanged(ValueChangedEvent<OAuthToken> e) => config.Set(OsuSetting.Token, config.Get<bool>(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty);
private readonly List<IOnlineComponent> components = new List<IOnlineComponent>(); private readonly List<IOnlineComponent> components = new List<IOnlineComponent>();

View File

@ -55,7 +55,7 @@ namespace osu.Game.Online.Chat
{ {
CurrentChannel.ValueChanged += currentChannelChanged; CurrentChannel.ValueChanged += currentChannelChanged;
HighPollRate.BindValueChanged(high => TimeBetweenPolls = high ? 1000 : 6000, true); HighPollRate.BindValueChanged(e => TimeBetweenPolls = e.NewValue ? 1000 : 6000, true);
} }
/// <summary> /// <summary>
@ -84,7 +84,7 @@ namespace osu.Game.Online.Chat
?? new Channel(user); ?? new Channel(user);
} }
private void currentChannelChanged(Channel channel) => JoinChannel(channel); private void currentChannelChanged(ValueChangedEvent<Channel> e) => JoinChannel(e.NewValue);
/// <summary> /// <summary>
/// Ensure we run post actions in sequence, once at a time. /// Ensure we run post actions in sequence, once at a time.
@ -131,7 +131,7 @@ namespace osu.Game.Online.Chat
target.AddLocalEcho(message); target.AddLocalEcho(message);
// if this is a PM and the first message, we need to do a special request to create the PM channel // if this is a PM and the first message, we need to do a special request to create the PM channel
if (target.Type == ChannelType.PM && !target.Joined) if (target.Type == ChannelType.PM && !target.Joined.Value)
{ {
var createNewPrivateMessageRequest = new CreateNewPrivateMessageRequest(target.Users.First(), message); var createNewPrivateMessageRequest = new CreateNewPrivateMessageRequest(target.Users.First(), message);
@ -331,7 +331,7 @@ namespace osu.Game.Online.Chat
switch (channel.Type) switch (channel.Type)
{ {
case ChannelType.Public: case ChannelType.Public:
var req = new JoinChannelRequest(channel, api.LocalUser); var req = new JoinChannelRequest(channel, api.LocalUser.Value);
req.Success += () => JoinChannel(channel, true); req.Success += () => JoinChannel(channel, true);
req.Failure += ex => LeaveChannel(channel); req.Failure += ex => LeaveChannel(channel);
api.Queue(req); api.Queue(req);
@ -363,7 +363,7 @@ namespace osu.Game.Online.Chat
if (channel.Joined.Value) if (channel.Joined.Value)
{ {
api.Queue(new LeaveChannelRequest(channel, api.LocalUser)); api.Queue(new LeaveChannelRequest(channel, api.LocalUser.Value));
channel.Joined.Value = false; channel.Joined.Value = false;
} }
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat
public void OpenUrlExternally(string url) public void OpenUrlExternally(string url)
{ {
if (externalLinkWarning) if (externalLinkWarning.Value)
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url))); dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url)));
else else
host.OpenUrlExternally(url); host.OpenUrlExternally(url);

View File

@ -90,9 +90,9 @@ namespace osu.Game.Online.Chat
return; return;
if (text[0] == '/') if (text[0] == '/')
ChannelManager?.PostCommand(text.Substring(1), Channel); ChannelManager?.PostCommand(text.Substring(1), Channel.Value);
else else
ChannelManager?.PostMessage(text, target: Channel); ChannelManager?.PostMessage(text, target: Channel.Value);
textbox.Text = string.Empty; textbox.Text = string.Empty;
} }
@ -111,13 +111,13 @@ namespace osu.Game.Online.Chat
protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message); protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message);
private void channelChanged(Channel channel) private void channelChanged(ValueChangedEvent<Channel> e)
{ {
drawableChannel?.Expire(); drawableChannel?.Expire();
if (channel == null) return; if (e.NewValue == null) return;
AddInternal(drawableChannel = new StandAloneDrawableChannel(channel) AddInternal(drawableChannel = new StandAloneDrawableChannel(e.NewValue)
{ {
CreateChatLineAction = CreateMessage, CreateChatLineAction = CreateMessage,
Padding = new MarginPadding { Bottom = postingTextbox ? textbox_height : 0 } Padding = new MarginPadding { Bottom = postingTextbox ? textbox_height : 0 }

View File

@ -86,7 +86,7 @@ namespace osu.Game.Online.Multiplayer
[JsonProperty("participant_count")] [JsonProperty("participant_count")]
private int? participantCount private int? participantCount
{ {
get => ParticipantCount; get => ParticipantCount.Value;
set => ParticipantCount.Value = value ?? 0; set => ParticipantCount.Value = value ?? 0;
} }
@ -106,7 +106,7 @@ namespace osu.Game.Online.Multiplayer
[JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)]
private int? maxAttempts private int? maxAttempts
{ {
get => MaxAttempts; get => MaxAttempts.Value;
set => MaxAttempts.Value = value; set => MaxAttempts.Value = value;
} }
@ -118,19 +118,19 @@ namespace osu.Game.Online.Multiplayer
public void CopyFrom(Room other) public void CopyFrom(Room other)
{ {
RoomID.Value = other.RoomID; RoomID.Value = other.RoomID.Value;
Name.Value = other.Name; Name.Value = other.Name.Value;
if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id) if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id)
Host.Value = other.Host; Host.Value = other.Host.Value;
Status.Value = other.Status; Status.Value = other.Status.Value;
Availability.Value = other.Availability; Availability.Value = other.Availability.Value;
Type.Value = other.Type; Type.Value = other.Type.Value;
MaxParticipants.Value = other.MaxParticipants; MaxParticipants.Value = other.MaxParticipants.Value;
ParticipantCount.Value = other.ParticipantCount.Value; ParticipantCount.Value = other.ParticipantCount.Value;
Participants.Value = other.Participants.Value.ToArray(); Participants.Value = other.Participants.Value.ToArray();
EndDate.Value = other.EndDate; EndDate.Value = other.EndDate.Value;
if (DateTimeOffset.Now >= EndDate.Value) if (DateTimeOffset.Now >= EndDate.Value)
Status.Value = new RoomStatusEnded(); Status.Value = new RoomStatusEnded();

View File

@ -174,17 +174,17 @@ namespace osu.Game
// bind config int to database RulesetInfo // bind config int to database RulesetInfo
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset); configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; ruleset.ValueChanged += e => configRuleset.Value = e.NewValue.ID ?? 0;
// bind config int to database SkinInfo // bind config int to database SkinInfo
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin); configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
SkinManager.CurrentSkinInfo.ValueChanged += s => configSkin.Value = s.ID; SkinManager.CurrentSkinInfo.ValueChanged += e => configSkin.Value = e.NewValue.ID;
configSkin.ValueChanged += id => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == id) ?? SkinInfo.Default; configSkin.ValueChanged += e => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == e.NewValue) ?? SkinInfo.Default;
configSkin.TriggerChange(); configSkin.TriggerChange();
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
IsActive.BindValueChanged(updateActiveState, true); IsActive.BindValueChanged(e => updateActiveState(e.NewValue), true);
} }
private ExternalLinkOpener externalLinkOpener; private ExternalLinkOpener externalLinkOpener;
@ -515,9 +515,9 @@ namespace osu.Game
}; };
} }
OverlayActivationMode.ValueChanged += v => OverlayActivationMode.ValueChanged += e =>
{ {
if (v != OverlayActivation.All) CloseAllOverlays(); if (e.NewValue != OverlayActivation.All) CloseAllOverlays();
}; };
void updateScreenOffset() void updateScreenOffset()

View File

@ -209,7 +209,7 @@ namespace osu.Game
// TODO: This is temporary until we reimplement the local FPS display. // TODO: This is temporary until we reimplement the local FPS display.
// It's just to allow end-users to access the framework FPS display without knowing the shortcut key. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay); fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
fpsDisplayVisible.ValueChanged += val => { FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.ValueChanged += e => { FrameStatisticsMode = e.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
fpsDisplayVisible.TriggerChange(); fpsDisplayVisible.TriggerChange();
} }

View File

@ -135,7 +135,7 @@ namespace osu.Game.Overlays.AccountCreation
characterCheckText = passwordDescription.AddText("8 characters long"); characterCheckText = passwordDescription.AddText("8 characters long");
passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song."); passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song.");
passwordTextBox.Current.ValueChanged += text => { characterCheckText.ForEach(s => s.Colour = text.Length == 0 ? Color4.White : Interpolation.ValueAt(text.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); }; passwordTextBox.Current.ValueChanged += e => { characterCheckText.ForEach(s => s.Colour = e.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(e.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); };
} }
protected override void Update() protected override void Update()

View File

@ -138,9 +138,9 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}; };
Beatmap.ValueChanged += b => Beatmap.ValueChanged += e =>
{ {
showBeatmap(b); showBeatmap(e.NewValue);
updateDifficultyButtons(); updateDifficultyButtons();
}; };
} }

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
private readonly bool noVideo; private readonly bool noVideo;
public string TooltipText => button.Enabled ? "Download this beatmap" : "Login to download"; public string TooltipText => button.Enabled.Value ? "Download this beatmap" : "Login to download";
private readonly IBindable<User> localUser = new Bindable<User>(); private readonly IBindable<User> localUser = new Bindable<User>();
@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
}, },
} }
}, },
new DownloadProgressBar(BeatmapSet) new DownloadProgressBar(BeatmapSet.Value)
{ {
Depth = -2, Depth = -2,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
@ -101,16 +101,16 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
return; return;
} }
beatmaps.Download(BeatmapSet, noVideo); beatmaps.Download(BeatmapSet.Value, noVideo);
}; };
localUser.BindTo(api.LocalUser); localUser.BindTo(api.LocalUser);
localUser.BindValueChanged(userChanged, true); localUser.BindValueChanged(userChanged, true);
button.Enabled.BindValueChanged(enabledChanged, true); button.Enabled.BindValueChanged(enabledChanged, true);
State.BindValueChanged(state => State.BindValueChanged(e =>
{ {
switch (state) switch (e.NewValue)
{ {
case DownloadState.Downloading: case DownloadState.Downloading:
textSprites.Children = new Drawable[] textSprites.Children = new Drawable[]
@ -159,8 +159,8 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
}, true); }, true);
} }
private void userChanged(User user) => button.Enabled.Value = !(user is GuestUser); private void userChanged(ValueChangedEvent<User> e) => button.Enabled.Value = !(e.NewValue is GuestUser);
private void enabledChanged(bool enabled) => this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); private void enabledChanged(ValueChangedEvent<bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
} }
} }

View File

@ -53,9 +53,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
}, },
}); });
Favourited.ValueChanged += value => Favourited.ValueChanged += e =>
{ {
if (value) if (e.NewValue)
{ {
pink.FadeIn(200); pink.FadeIn(200);
icon.Icon = FontAwesome.fa_heart; icon.Icon = FontAwesome.fa_heart;

View File

@ -67,7 +67,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
}; };
Action = () => playButton.Click(); Action = () => playButton.Click();
Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); Playing.ValueChanged += e => progress.FadeTo(e.NewValue ? 1 : 0, 100);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -181,8 +181,8 @@ namespace osu.Game.Overlays.BeatmapSet
}, },
}; };
Picker.Beatmap.ValueChanged += b => Details.Beatmap = b; Picker.Beatmap.ValueChanged += e => Details.Beatmap = e.NewValue;
Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b?.Ruleset.ShortName}/{b?.OnlineBeatmapID}"; Picker.Beatmap.ValueChanged += e => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{e.NewValue?.Ruleset.ShortName}/{e.NewValue?.OnlineBeatmapID}";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -192,16 +192,16 @@ namespace osu.Game.Overlays.BeatmapSet
State.BindValueChanged(_ => updateDownloadButtons()); State.BindValueChanged(_ => updateDownloadButtons());
BeatmapSet.BindValueChanged(beatmapSet => BeatmapSet.BindValueChanged(e =>
{ {
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = beatmapSet; Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = e.NewValue;
title.Text = beatmapSet?.Metadata.Title ?? string.Empty; title.Text = e.NewValue?.Metadata.Title ?? string.Empty;
artist.Text = beatmapSet?.Metadata.Artist ?? string.Empty; artist.Text = e.NewValue?.Metadata.Artist ?? string.Empty;
onlineStatusPill.Status = beatmapSet?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; onlineStatusPill.Status = e.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None;
cover.BeatmapSet = beatmapSet; cover.BeatmapSet = e.NewValue;
if (beatmapSet != null) if (e.NewValue != null)
{ {
downloadButtonsContainer.FadeIn(transition_duration); downloadButtonsContainer.FadeIn(transition_duration);
favouriteButton.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration);
@ -223,7 +223,7 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
case DownloadState.LocallyAvailable: case DownloadState.LocallyAvailable:
// temporary for UX until new design is implemented. // temporary for UX until new design is implemented.
downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet) downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value)
{ {
Width = 50, Width = 50,
RelativeSizeAxes = Axes.Y RelativeSizeAxes = Axes.Y
@ -232,12 +232,12 @@ namespace osu.Game.Overlays.BeatmapSet
case DownloadState.Downloading: case DownloadState.Downloading:
case DownloadState.Downloaded: case DownloadState.Downloaded:
// temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design.
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet); downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
break; break;
default: default:
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet); downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
if (BeatmapSet.Value.OnlineInfo.HasVideo) if (BeatmapSet.Value.OnlineInfo.HasVideo)
downloadButtonsContainer.Add(new DownloadButton(BeatmapSet, true)); downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true));
break; break;
} }
} }

View File

@ -101,10 +101,10 @@ namespace osu.Game.Overlays
}, },
}; };
header.Picker.Beatmap.ValueChanged += b => header.Picker.Beatmap.ValueChanged += e =>
{ {
info.Beatmap = b; info.Beatmap = e.NewValue;
scores.Beatmap = b; scores.Beatmap = e.NewValue;
}; };
} }

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Chat.Selection
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; Action = () => { (channel.Joined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); };
Children = new Drawable[] Children = new Drawable[]
{ {
@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat.Selection
joinedColour = colours.Blue; joinedColour = colours.Blue;
hoverColour = colours.Yellow; hoverColour = colours.Yellow;
joinedBind.ValueChanged += updateColour; joinedBind.ValueChanged += e => updateColour(e.NewValue);
joinedBind.BindTo(channel.Joined); joinedBind.BindTo(channel.Joined);
joinedBind.TriggerChange(); joinedBind.TriggerChange();

View File

@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Chat.Selection
}, },
}; };
search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue; search.Current.ValueChanged += e => sectionsFlow.SearchTerm = e.NewValue;
} }
public void UpdateAvailableChannels(IEnumerable<Channel> channels) public void UpdateAvailableChannels(IEnumerable<Channel> channels)

View File

@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Chat.Tabs
if (tab == SelectedTab && totalTabs > 1) if (tab == SelectedTab && totalTabs > 1)
// Select the tab after tab-to-be-removed's index, or the tab before if current == last // Select the tab after tab-to-be-removed's index, or the tab before if current == last
SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]); SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]);
else if (totalTabs == 1 && !selectorTab.Active) else if (totalTabs == 1 && !selectorTab.Active.Value)
// Open channel selection overlay if all channel tabs will be closed after removing this tab // Open channel selection overlay if all channel tabs will be closed after removing this tab
SelectTab(selectorTab); SelectTab(selectorTab);

View File

@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Chat.Tabs
if (IsRemovable && ShowCloseOnHover) if (IsRemovable && ShowCloseOnHover)
CloseButton.FadeIn(200, Easing.OutQuint); CloseButton.FadeIn(200, Easing.OutQuint);
if (!Active) if (!Active.Value)
box.FadeColour(backgroundHover, TRANSITION_LENGTH, Easing.OutQuint); box.FadeColour(backgroundHover, TRANSITION_LENGTH, Easing.OutQuint);
return true; return true;
} }
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Chat.Tabs
private void updateState() private void updateState()
{ {
if (Active) if (Active.Value)
FadeActive(); FadeActive();
else else
FadeInactive(); FadeInactive();

View File

@ -162,8 +162,8 @@ namespace osu.Game.Overlays
}, },
}; };
channelTabControl.Current.ValueChanged += chat => channelManager.CurrentChannel.Value = chat; channelTabControl.Current.ValueChanged += e => channelManager.CurrentChannel.Value = e.NewValue;
channelTabControl.ChannelSelectorActive.ValueChanged += value => channelSelectionOverlay.State = value ? Visibility.Visible : Visibility.Hidden; channelTabControl.ChannelSelectorActive.ValueChanged += e => channelSelectionOverlay.State = e.NewValue ? Visibility.Visible : Visibility.Hidden;
channelSelectionOverlay.StateChanged += state => channelSelectionOverlay.StateChanged += state =>
{ {
if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null) if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null)
@ -189,9 +189,9 @@ namespace osu.Game.Overlays
channelSelectionOverlay.OnRequestLeave = channel => channelManager.LeaveChannel(channel); channelSelectionOverlay.OnRequestLeave = channel => channelManager.LeaveChannel(channel);
} }
private void currentChannelChanged(Channel channel) private void currentChannelChanged(ValueChangedEvent<Channel> e)
{ {
if (channel == null) if (e.NewValue == null)
{ {
textbox.Current.Disabled = true; textbox.Current.Disabled = true;
currentChannelContainer.Clear(false); currentChannelContainer.Clear(false);
@ -199,18 +199,18 @@ namespace osu.Game.Overlays
return; return;
} }
textbox.Current.Disabled = channel.ReadOnly; textbox.Current.Disabled = e.NewValue.ReadOnly;
if (channelTabControl.Current.Value != channel) if (channelTabControl.Current.Value != e.NewValue)
Scheduler.Add(() => channelTabControl.Current.Value = channel); Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue);
var loaded = loadedChannels.Find(d => d.Channel == channel); var loaded = loadedChannels.Find(d => d.Channel == e.NewValue);
if (loaded == null) if (loaded == null)
{ {
currentChannelContainer.FadeOut(500, Easing.OutQuint); currentChannelContainer.FadeOut(500, Easing.OutQuint);
loading.Show(); loading.Show();
loaded = new DrawableChannel(channel); loaded = new DrawableChannel(e.NewValue);
loadedChannels.Add(loaded); loadedChannels.Add(loaded);
LoadComponentAsync(loaded, l => LoadComponentAsync(loaded, l =>
{ {
@ -328,11 +328,11 @@ namespace osu.Game.Overlays
private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager)
{ {
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight); ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
ChatHeight.ValueChanged += h => ChatHeight.ValueChanged += e =>
{ {
chatContainer.Height = (float)h; chatContainer.Height = (float)e.NewValue;
channelSelectionContainer.Height = 1f - (float)h; channelSelectionContainer.Height = 1f - (float)e.NewValue;
tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200); tabBackground.FadeTo(e.NewValue == 1 ? 1 : 0.8f, 200);
}; };
ChatHeight.TriggerChange(); ChatHeight.TriggerChange();

View File

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

View File

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

View File

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

View File

@ -37,14 +37,14 @@ namespace osu.Game.Overlays.Direct
{ {
this.beatmaps = beatmaps; this.beatmaps = beatmaps;
BeatmapSet.BindValueChanged(set => BeatmapSet.BindValueChanged(e =>
{ {
if (set == null) if (e.NewValue == null)
attachDownload(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; State.Value = DownloadState.LocallyAvailable;
else else
attachDownload(beatmaps.GetExistingDownload(set)); attachDownload(beatmaps.GetExistingDownload(e.NewValue));
}, true); }, true);
beatmaps.BeatmapDownloadBegan += download => beatmaps.BeatmapDownloadBegan += download =>

View File

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

View File

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

View File

@ -116,9 +116,9 @@ namespace osu.Game.Overlays
}, },
}; };
Filter.Search.Current.ValueChanged += text => Filter.Search.Current.ValueChanged += e =>
{ {
if (text != string.Empty) if (e.NewValue != string.Empty)
{ {
Header.Tabs.Current.Value = DirectTab.Search; Header.Tabs.Current.Value = DirectTab.Search;
@ -133,13 +133,13 @@ namespace osu.Game.Overlays
Filter.Tabs.Current.Value = DirectSortCriteria.Ranked; Filter.Tabs.Current.Value = DirectSortCriteria.Ranked;
} }
}; };
((FilterControl)Filter).Ruleset.ValueChanged += ruleset => Scheduler.AddOnce(updateSearch); ((FilterControl)Filter).Ruleset.ValueChanged += e => Scheduler.AddOnce(updateSearch);
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch);
Header.Tabs.Current.ValueChanged += tab => Header.Tabs.Current.ValueChanged += e =>
{ {
if (tab != DirectTab.Search) if (e.NewValue != DirectTab.Search)
{ {
currentQuery.Value = string.Empty; currentQuery.Value = string.Empty;
Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value; Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
@ -147,11 +147,11 @@ namespace osu.Game.Overlays
} }
}; };
currentQuery.ValueChanged += v => currentQuery.ValueChanged += e =>
{ {
queryChangedDebounce?.Cancel(); queryChangedDebounce?.Cancel();
if (string.IsNullOrEmpty(v)) if (string.IsNullOrEmpty(e.NewValue))
Scheduler.AddOnce(updateSearch); Scheduler.AddOnce(updateSearch);
else else
{ {
@ -164,9 +164,9 @@ namespace osu.Game.Overlays
currentQuery.BindTo(Filter.Search.Current); currentQuery.BindTo(Filter.Search.Current);
Filter.Tabs.Current.ValueChanged += sortCriteria => Filter.Tabs.Current.ValueChanged += e =>
{ {
if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value) if (Header.Tabs.Current.Value != DirectTab.Search && e.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value)
Header.Tabs.Current.Value = DirectTab.Search; Header.Tabs.Current.Value = DirectTab.Search;
Scheduler.AddOnce(updateSearch); Scheduler.AddOnce(updateSearch);
@ -274,7 +274,7 @@ namespace osu.Game.Overlays
if (api == null) if (api == null)
return; return;
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery.Value == string.Empty))
return; return;
previewTrackManager.StopAnyPlaying(this); previewTrackManager.StopAnyPlaying(this);

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays
} }
}; };
Progress.ValueChanged += v => overlay.Alpha = (float)v; Progress.ValueChanged += e => overlay.Alpha = (float)e.NewValue;
} }
} }
} }

View File

@ -74,28 +74,28 @@ namespace osu.Game.Overlays.Mods
SelectedMods.UnbindAll(); SelectedMods.UnbindAll();
} }
private void rulesetChanged(RulesetInfo newRuleset) private void rulesetChanged(ValueChangedEvent<RulesetInfo> e)
{ {
if (newRuleset == null) return; if (e.NewValue == null) return;
var instance = newRuleset.CreateInstance(); var instance = e.NewValue.CreateInstance();
foreach (ModSection section in ModSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.Mods = instance.GetModsFor(section.ModType); section.Mods = instance.GetModsFor(section.ModType);
// attempt to re-select any already selected mods. // attempt to re-select any already selected mods.
// this may be the first time we are receiving the ruleset, in which case they will still match. // this may be the first time we are receiving the ruleset, in which case they will still match.
selectedModsChanged(SelectedMods.Value); selectedModsChanged(new ValueChangedEvent<IEnumerable<Mod>>(SelectedMods.Value, SelectedMods.Value));
// write the mods back to the SelectedMods bindable in the case a change was not applicable. // write the mods back to the SelectedMods bindable in the case a change was not applicable.
// this generally isn't required as the previous line will perform deselection; just here for safety. // this generally isn't required as the previous line will perform deselection; just here for safety.
refreshSelectedMods(); refreshSelectedMods();
} }
private void selectedModsChanged(IEnumerable<Mod> obj) private void selectedModsChanged(ValueChangedEvent<IEnumerable<Mod>> e)
{ {
foreach (ModSection section in ModSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.SelectTypes(obj.Select(m => m.GetType()).ToList()); section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList());
updateMods(); updateMods();
} }

View File

@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using System; using System;
using osu.Framework.Configuration;
namespace osu.Game.Overlays.Music namespace osu.Game.Overlays.Music
{ {
@ -44,7 +45,7 @@ namespace osu.Game.Overlays.Music
Search.Current.ValueChanged += current_ValueChanged; Search.Current.ValueChanged += current_ValueChanged;
} }
private void current_ValueChanged(string newValue) => FilterChanged?.Invoke(newValue); private void current_ValueChanged(ValueChangedEvent<string> e) => FilterChanged?.Invoke(e.NewValue);
public Action ExitRequested; public Action ExitRequested;

View File

@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Music
titleBind = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); titleBind = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title)));
artistBind = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); artistBind = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist)));
artistBind.BindValueChanged(newText => recreateText(), true); artistBind.BindValueChanged(e => recreateText(), true);
} }
private void recreateText() private void recreateText()

View File

@ -317,13 +317,13 @@ namespace osu.Game.Overlays
private WorkingBeatmap current; private WorkingBeatmap current;
private TransformDirection? queuedDirection; private TransformDirection? queuedDirection;
private void beatmapChanged(WorkingBeatmap beatmap) private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
{ {
TransformDirection direction = TransformDirection.None; TransformDirection direction = TransformDirection.None;
if (current != null) if (current != null)
{ {
bool audioEquals = beatmap?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; bool audioEquals = e.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
if (audioEquals) if (audioEquals)
direction = TransformDirection.None; direction = TransformDirection.None;
@ -336,13 +336,13 @@ namespace osu.Game.Overlays
{ {
//figure out the best direction based on order in playlist. //figure out the best direction based on order in playlist.
var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count(); var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != e.NewValue.BeatmapSetInfo?.ID).Count();
direction = last > next ? TransformDirection.Prev : TransformDirection.Next; direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
} }
} }
current = beatmap; current = e.NewValue;
progressBar.CurrentTime = 0; progressBar.CurrentTime = 0;

View File

@ -80,7 +80,7 @@ namespace osu.Game.Overlays
private ScheduledDelegate notificationsEnabler; private ScheduledDelegate notificationsEnabler;
private void updateProcessingMode() private void updateProcessingMode()
{ {
bool enabled = OverlayActivationMode == OverlayActivation.All || State == Visibility.Visible; bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State == Visibility.Visible;
notificationsEnabler?.Cancel(); notificationsEnabler?.Cancel();

View File

@ -91,11 +91,11 @@ namespace osu.Game.Overlays.Profile.Header
graph.Colour = colours.Yellow; graph.Colour = colours.Yellow;
} }
private void userChanged(User user) private void userChanged(ValueChangedEvent<User> e)
{ {
placeholder.FadeIn(fade_duration, Easing.Out); placeholder.FadeIn(fade_duration, Easing.Out);
if (user?.Statistics?.Ranks.Global == null) if (e.NewValue?.Statistics?.Ranks.Global == null)
{ {
rankText.Text = string.Empty; rankText.Text = string.Empty;
performanceText.Text = string.Empty; performanceText.Text = string.Empty;
@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Profile.Header
return; return;
} }
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Ranks.Global.Value }; int[] userRanks = e.NewValue.RankHistory?.Data ?? new[] { e.NewValue.Statistics.Ranks.Global.Value };
ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray(); ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray();
if (ranks.Length > 1) if (ranks.Length > 1)

Some files were not shown because too many files have changed in this diff Show More