1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-17 17:22:55 +08:00

Update variable names

Also cleans up some weird code
This commit is contained in:
Dean Herbert 2019-02-22 17:51:39 +09:00
parent 2c9e6adfd4
commit 3fe4b8fd1c
69 changed files with 166 additions and 165 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -156,7 +156,7 @@ namespace osu.Game.Graphics.Cursor
};
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
cursorScale.ValueChanged += e => cursorContainer.Scale = new Vector2((float)e.NewValue * base_scale);
cursorScale.ValueChanged += scale => cursorContainer.Scale = new Vector2((float)scale.NewValue * base_scale);
cursorScale.TriggerChange();
}
}

View File

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

View File

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

View File

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

View File

@ -118,9 +118,9 @@ namespace osu.Game.Graphics.UserInterface
}
};
Current.ValueChanged += e =>
Current.ValueChanged += selected =>
{
if (e.NewValue)
if (selected.NewValue)
{
fadeIn();
icon.Icon = FontAwesome.fa_check_circle_o;

View File

@ -97,9 +97,9 @@ namespace osu.Game.Graphics.UserInterface
DisplayedCount = Current.Value;
Current.ValueChanged += e =>
Current.ValueChanged += val =>
{
if (IsLoaded) TransformCount(displayedCount, e.NewValue);
if (IsLoaded) TransformCount(displayedCount, val.NewValue);
};
}

View File

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

View File

@ -175,12 +175,12 @@ namespace osu.Game
// bind config int to database RulesetInfo
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();
ruleset.ValueChanged += e => configRuleset.Value = e.NewValue.ID ?? 0;
ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0;
// bind config int to database SkinInfo
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
SkinManager.CurrentSkinInfo.ValueChanged += e => configSkin.Value = e.NewValue.ID;
configSkin.ValueChanged += e => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == e.NewValue) ?? SkinInfo.Default;
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
configSkin.TriggerChange();
LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust);
@ -516,9 +516,9 @@ namespace osu.Game
};
}
OverlayActivationMode.ValueChanged += e =>
OverlayActivationMode.ValueChanged += mode =>
{
if (e.NewValue != OverlayActivation.All) CloseAllOverlays();
if (mode.NewValue != OverlayActivation.All) CloseAllOverlays();
};
void updateScreenOffset()

View File

@ -209,7 +209,7 @@ namespace osu.Game
// 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.
fpsDisplayVisible = LocalConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay);
fpsDisplayVisible.ValueChanged += e => { FrameStatisticsMode = e.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
fpsDisplayVisible.ValueChanged += visible => { FrameStatisticsMode = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
fpsDisplayVisible.TriggerChange();
}

View File

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

View File

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

View File

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

View File

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

View File

@ -181,8 +181,8 @@ namespace osu.Game.Overlays.BeatmapSet
},
};
Picker.Beatmap.ValueChanged += e => Details.Beatmap = e.NewValue;
Picker.Beatmap.ValueChanged += e => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{e.NewValue?.Ruleset.ShortName}/{e.NewValue?.OnlineBeatmapID}";
Picker.Beatmap.ValueChanged += b => Details.Beatmap = b.NewValue;
Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
}
[BackgroundDependencyLoader]
@ -219,11 +219,12 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateDownloadButtons()
{
if (BeatmapSet.Value == null) return;
switch (State.Value)
{
case DownloadState.LocallyAvailable:
// temporary for UX until new design is implemented.
downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(e.NewValue)
downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value)
{
Width = 50,
RelativeSizeAxes = Axes.Y
@ -232,12 +233,12 @@ namespace osu.Game.Overlays.BeatmapSet
case DownloadState.Downloading:
case DownloadState.Downloaded:
// temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design.
downloadButtonsContainer.Child = new DownloadButton(e.NewValue);
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
break;
default:
downloadButtonsContainer.Child = new DownloadButton(e.NewValue);
downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value);
if (BeatmapSet.Value.OnlineInfo.HasVideo)
downloadButtonsContainer.Add(new DownloadButton(e.NewValue, true));
downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true));
break;
}
}

View File

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

View File

@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat.Selection
joinedColour = colours.Blue;
hoverColour = colours.Yellow;
joinedBind.ValueChanged += e => updateColour(e.NewValue);
joinedBind.ValueChanged += joined => updateColour(joined.NewValue);
joinedBind.BindTo(channel.Joined);
joinedBind.TriggerChange();

View File

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

View File

@ -162,8 +162,8 @@ namespace osu.Game.Overlays
},
};
channelTabControl.Current.ValueChanged += e => channelManager.CurrentChannel.Value = e.NewValue;
channelTabControl.ChannelSelectorActive.ValueChanged += e => channelSelectionOverlay.State = e.NewValue ? Visibility.Visible : Visibility.Hidden;
channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue;
channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State = active.NewValue ? Visibility.Visible : Visibility.Hidden;
channelSelectionOverlay.StateChanged += state =>
{
if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null)
@ -328,11 +328,11 @@ namespace osu.Game.Overlays
private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager)
{
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
ChatHeight.ValueChanged += e =>
ChatHeight.ValueChanged += height =>
{
chatContainer.Height = (float)e.NewValue;
channelSelectionContainer.Height = 1f - (float)e.NewValue;
tabBackground.FadeTo(e.NewValue == 1 ? 1 : 0.8f, 200);
chatContainer.Height = (float)height.NewValue;
channelSelectionContainer.Height = 1f - (float)height.NewValue;
tabBackground.FadeTo(height.NewValue == 1 ? 1 : 0.8f, 200);
};
ChatHeight.TriggerChange();

View File

@ -127,8 +127,11 @@ namespace osu.Game.Overlays.Direct
base.LoadComplete();
this.FadeInFromZero(200, Easing.Out);
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);
PreviewPlaying.ValueChanged += playing =>
{
PlayButton.FadeTo(playing.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint);
PreviewBar.FadeTo(playing.NewValue ? 1 : 0, 120, Easing.InOutQuint);
};
}
protected List<DifficultyIcon> GetDifficultyIcons()

View File

@ -116,9 +116,9 @@ namespace osu.Game.Overlays
},
};
Filter.Search.Current.ValueChanged += e =>
Filter.Search.Current.ValueChanged += text =>
{
if (e.NewValue != string.Empty)
if (text.NewValue != string.Empty)
{
Header.Tabs.Current.Value = DirectTab.Search;
@ -133,13 +133,13 @@ namespace osu.Game.Overlays
Filter.Tabs.Current.Value = DirectSortCriteria.Ranked;
}
};
((FilterControl)Filter).Ruleset.ValueChanged += e => Scheduler.AddOnce(updateSearch);
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch);
((FilterControl)Filter).Ruleset.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
Header.Tabs.Current.ValueChanged += e =>
Header.Tabs.Current.ValueChanged += tab =>
{
if (e.NewValue != DirectTab.Search)
if (tab.NewValue != DirectTab.Search)
{
currentQuery.Value = string.Empty;
Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
@ -147,11 +147,11 @@ namespace osu.Game.Overlays
}
};
currentQuery.ValueChanged += e =>
currentQuery.ValueChanged += text =>
{
queryChangedDebounce?.Cancel();
if (string.IsNullOrEmpty(e.NewValue))
if (string.IsNullOrEmpty(text.NewValue))
Scheduler.AddOnce(updateSearch);
else
{
@ -164,9 +164,9 @@ namespace osu.Game.Overlays
currentQuery.BindTo(Filter.Search.Current);
Filter.Tabs.Current.ValueChanged += e =>
Filter.Tabs.Current.ValueChanged += tab =>
{
if (Header.Tabs.Current.Value != DirectTab.Search && e.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value)
if (Header.Tabs.Current.Value != DirectTab.Search && tab.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value)
Header.Tabs.Current.Value = DirectTab.Search;
Scheduler.AddOnce(updateSearch);

View File

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

View File

@ -63,10 +63,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
}
};
this.user.ValueChanged += e =>
this.user.ValueChanged += u =>
{
total.Count = e.NewValue?.Kudosu.Total ?? 0;
avaliable.Count = e.NewValue?.Kudosu.Available ?? 0;
total.Count = u.NewValue?.Kudosu.Total ?? 0;
avaliable.Count = u.NewValue?.Kudosu.Available ?? 0;
};
}

View File

@ -152,9 +152,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
panel.Status.BindTo(api.LocalUser.Value.Status);
dropdown.Current.ValueChanged += e =>
dropdown.Current.ValueChanged += action =>
{
switch (e.NewValue)
switch (action.NewValue)
{
case UserAction.Online:
api.LocalUser.Value.Status.Value = new UserStatusOnline();

View File

@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
/// <returns>A bindable which will propagate updates with a delay.</returns>
private void bindPreviewEvent(Bindable<float> bindable)
{
bindable.ValueChanged += e =>
bindable.ValueChanged += _ =>
{
switch (scalingMode.Value)
{

View File

@ -56,19 +56,19 @@ namespace osu.Game.Overlays.Settings.Sections.Input
},
};
rawInputToggle.ValueChanged += e =>
rawInputToggle.ValueChanged += enabled =>
{
// this is temporary until we support per-handler settings.
const string raw_mouse_handler = @"OsuTKRawMouseHandler";
const string standard_mouse_handler = @"OsuTKMouseHandler";
ignoredInputHandler.Value = e.NewValue ? standard_mouse_handler : raw_mouse_handler;
ignoredInputHandler.Value = enabled.NewValue ? standard_mouse_handler : raw_mouse_handler;
};
ignoredInputHandler = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
ignoredInputHandler.ValueChanged += e =>
ignoredInputHandler.ValueChanged += handler =>
{
bool raw = !e.NewValue.Contains("Raw");
bool raw = !handler.NewValue.Contains("Raw");
rawInputToggle.Value = raw;
sensitivity.Bindable.Disabled = !raw;
};

View File

@ -104,15 +104,15 @@ namespace osu.Game.Overlays
{
AddInternal(Sidebar = new Sidebar { Width = sidebar_width });
SectionsContainer.SelectedSection.ValueChanged += e =>
SectionsContainer.SelectedSection.ValueChanged += section =>
{
selectedSidebarButton.Selected = false;
selectedSidebarButton = Sidebar.Children.Single(b => b.Section == e.NewValue);
selectedSidebarButton = Sidebar.Children.Single(b => b.Section == section.NewValue);
selectedSidebarButton.Selected = true;
};
}
searchTextBox.Current.ValueChanged += e => SectionsContainer.SearchContainer.SearchTerm = e.NewValue;
searchTextBox.Current.ValueChanged += term => SectionsContainer.SearchContainer.SearchTerm = term.NewValue;
CreateSections()?.ForEach(AddSection);
}

View File

@ -55,9 +55,9 @@ namespace osu.Game.Overlays
Add(loading = new LoadingAnimation());
Filter.Search.Current.ValueChanged += e =>
Filter.Search.Current.ValueChanged += text =>
{
if (!string.IsNullOrEmpty(e.NewValue))
if (!string.IsNullOrEmpty(text.NewValue))
{
// force searching in players until searching for friends is supported
Header.Tabs.Current.Value = SocialTab.AllPlayers;
@ -71,14 +71,14 @@ namespace osu.Game.Overlays
Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch);
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch);
currentQuery.ValueChanged += e =>
currentQuery.ValueChanged += query =>
{
queryChangedDebounce?.Cancel();
if (string.IsNullOrEmpty(e.NewValue))
if (string.IsNullOrEmpty(query.NewValue))
Scheduler.AddOnce(updateSearch);
else
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);

View File

@ -45,13 +45,13 @@ namespace osu.Game.Overlays.Toolbar
if (notificationOverlay != null)
NotificationCount.BindTo(notificationOverlay.UnreadCount);
NotificationCount.ValueChanged += e =>
NotificationCount.ValueChanged += count =>
{
if (e.NewValue == 0)
if (count.NewValue == 0)
countDisplay.FadeOut(200, Easing.OutQuint);
else
{
countDisplay.Count = e.NewValue;
countDisplay.Count = count.NewValue;
countDisplay.FadeIn(200, Easing.OutQuint);
}
};

View File

@ -126,16 +126,16 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both
}
});
sectionsContainer.SelectedSection.ValueChanged += e =>
sectionsContainer.SelectedSection.ValueChanged += section =>
{
if (lastSection != e.NewValue)
if (lastSection != section.NewValue)
{
lastSection = e.NewValue;
lastSection = section.NewValue;
tabs.Current.Value = lastSection;
}
};
tabs.Current.ValueChanged += e =>
tabs.Current.ValueChanged += section =>
{
if (lastSection == null)
{
@ -144,9 +144,9 @@ namespace osu.Game.Overlays
tabs.Current.Value = lastSection;
return;
}
if (lastSection != e.NewValue)
if (lastSection != section.NewValue)
{
lastSection = e.NewValue;
lastSection = section.NewValue;
sectionsContainer.ScrollTo(lastSection);
}
};

View File

@ -69,10 +69,10 @@ namespace osu.Game.Overlays.Volume
}
});
Current.ValueChanged += e =>
Current.ValueChanged += muted =>
{
icon.Icon = e.NewValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up;
icon.Margin = new MarginPadding { Left = e.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths
icon.Icon = muted.NewValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up;
icon.Margin = new MarginPadding { Left = muted.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths
};
Current.TriggerChange();
}

View File

@ -175,10 +175,10 @@ namespace osu.Game.Overlays.Volume
}
}
};
Bindable.ValueChanged += e =>
Bindable.ValueChanged += volume =>
{
this.TransformTo("DisplayVolume",
e.NewValue,
volume.NewValue,
400,
Easing.OutQuint);
};

View File

@ -74,9 +74,9 @@ namespace osu.Game.Overlays
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
muteButton.Current.ValueChanged += e =>
muteButton.Current.ValueChanged += muted =>
{
if (e.NewValue)
if (muted.NewValue)
audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
else
audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);

View File

@ -124,14 +124,14 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
base.LoadComplete();
State.ValueChanged += e =>
State.ValueChanged += armed =>
{
UpdateState(e.NewValue);
UpdateState(armed.NewValue);
// apply any custom state overrides
ApplyCustomUpdateState?.Invoke(this, e.NewValue);
ApplyCustomUpdateState?.Invoke(this, armed.NewValue);
if (e.NewValue == ArmedState.Hit)
if (armed.NewValue == ArmedState.Hit)
PlaySamples();
};

View File

@ -94,12 +94,12 @@ namespace osu.Game.Rulesets.UI
Ruleset = ruleset;
playfield = new Lazy<Playfield>(CreatePlayfield);
IsPaused.ValueChanged += e =>
IsPaused.ValueChanged += paused =>
{
if (HasReplayLoaded.Value)
return;
KeyBindingInputManager.UseParentInput = !e.NewValue;
KeyBindingInputManager.UseParentInput = !paused.NewValue;
};
Cursor = CreateCursor();

View File

@ -61,7 +61,7 @@ namespace osu.Game.Screens.Edit.Components
}
};
tabs.Current.ValueChanged += e => Beatmap.Value.Track.Tempo.Value = e.NewValue;
tabs.Current.ValueChanged += tempo => Beatmap.Value.Track.Tempo.Value = tempo.NewValue;
}
protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -80,10 +80,10 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
{
base.LoadComplete();
button.Selected.ValueChanged += e =>
button.Selected.ValueChanged += selected =>
{
updateSelectionState();
if (e.NewValue)
if (selected.NewValue)
Selected?.Invoke(button);
};

View File

@ -44,9 +44,9 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
private RadioButton currentlySelected;
private void addButton(RadioButton button)
{
button.Selected.ValueChanged += e =>
button.Selected.ValueChanged += selected =>
{
if (e.NewValue)
if (selected.NewValue)
{
currentlySelected?.Deselect();
currentlySelected = button;

View File

@ -24,10 +24,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
Beatmap.ValueChanged += e =>
Beatmap.ValueChanged += b =>
{
updateRelativeChildSize();
LoadBeatmap(e.NewValue);
LoadBeatmap(b.NewValue);
};
}

View File

@ -157,12 +157,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override void LoadComplete()
{
base.LoadComplete();
beatDivisor.ValueChanged += e => updateText();
updateText();
beatDivisor.BindValueChanged(val => Text = $"1/{val.NewValue}", true);
}
private void updateText() => Text = $"1/{beatDivisor.Value}";
}
private class DivisorButton : IconButton
@ -219,9 +215,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
AddInternal(marker = new Marker());
CurrentNumber.ValueChanged += e =>
CurrentNumber.ValueChanged += div =>
{
marker.MoveToX(getMappedPosition(e.NewValue), 100, Easing.OutQuint);
marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint);
marker.Flash();
};
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// We don't want the centre marker to scroll
AddInternal(new CentreMarker());
WaveformVisible.ValueChanged += e => waveform.FadeTo(e.NewValue ? 1 : 0, 200, Easing.OutQuint);
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
Beatmap.BindTo(beatmap);
Beatmap.BindValueChanged(e =>

View File

@ -117,7 +117,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio, IdleTracker idleTracker)
{
isIdle.ValueChanged += e => updateIdleState(e.NewValue);
isIdle.ValueChanged += idle => updateIdleState(idle.NewValue);
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);

View File

@ -85,10 +85,10 @@ namespace osu.Game.Screens.Multi
},
};
breadcrumbs.Current.ValueChanged += e =>
breadcrumbs.Current.ValueChanged += scren =>
{
if (e.NewValue is IMultiplayerSubScreen mpScreen)
screenType.Text = mpScreen.ShortTitle.ToLowerInvariant();
if (scren.NewValue is IMultiplayerSubScreen multiScreen)
screenType.Text = multiScreen.ShortTitle.ToLowerInvariant();
};
breadcrumbs.Current.TriggerChange();

View File

@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play
}
};
button.Selected.ValueChanged += e => buttonSelectionChanged(button, e.NewValue);
button.Selected.ValueChanged += selected => buttonSelectionChanged(button, selected.NewValue);
InternalButtons.Add(button);
}
@ -191,6 +191,7 @@ namespace osu.Game.Screens.Play
if (_selectionIndex == value)
return;
// Deselect the previously-selected button
if (_selectionIndex != -1)
InternalButtons[_selectionIndex].Selected.Value = false;

View File

@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play.HUD
TextSize = 80;
Current.ValueChanged += e => updateCount(e.NewValue == 0);
Current.ValueChanged += combo => updateCount(combo.NewValue == 0);
}
protected override void LoadComplete()

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.HUD
protected HealthDisplay()
{
Current.ValueChanged += e => SetHealth((float)e.NewValue);
Current.ValueChanged += health => SetHealth((float)health.NewValue);
}
protected abstract void SetHealth(float value);

View File

@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play.HUD
private void bind()
{
circularProgress.Current.BindTo(Progress);
Progress.ValueChanged += e => icon.Scale = new Vector2(1 + (float)e.NewValue * 0.2f);
Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f);
}
private bool pendingAnimation;

View File

@ -65,10 +65,10 @@ namespace osu.Game.Screens.Play.HUD
}
};
Current.ValueChanged += e =>
Current.ValueChanged += mods =>
{
iconsContainer.Clear();
foreach (Mod mod in e.NewValue)
foreach (Mod mod in mods.NewValue)
{
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });
}

View File

@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
{
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
showHud.ValueChanged += e => visibilityContainer.FadeTo(e.NewValue ? 1 : 0, duration);
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
showHud.TriggerChange();
if (!showHud.Value && !hasShownNotificationOnce)

View File

@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play
// the final usable gameplay clock with user-set offsets applied.
var offsetClock = new FramedOffsetClock(platformOffsetClock);
userAudioOffset.ValueChanged += e => offsetClock.Offset = e.NewValue;
userAudioOffset.ValueChanged += offset => offsetClock.Offset = offset.NewValue;
userAudioOffset.TriggerChange();
ScoreProcessor = RulesetContainer.CreateScoreProcessor();

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
public IAdjustableClock AdjustableClock { set; get; }
private readonly PlayerSliderBar<double> sliderbar;
private readonly PlayerSliderBar<double> rateSlider;
private readonly OsuSpriteText multiplierText;
@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
}
},
},
sliderbar = new PlayerSliderBar<double>
rateSlider = new PlayerSliderBar<double>
{
Bindable = new BindableDouble(1)
{
@ -69,9 +69,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
var clockRate = AdjustableClock.Rate;
// can't trigger this line instantly as the underlying clock may not be ready to accept adjustments yet.
sliderbar.Bindable.ValueChanged += e => AdjustableClock.Rate = clockRate * e.NewValue;
rateSlider.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier.NewValue;
sliderbar.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true);
rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true);
}
}
}

View File

@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play
{
State = Visibility.Visible;
replayLoaded.ValueChanged += e => AllowSeeking = e.NewValue;
replayLoaded.ValueChanged += loaded => AllowSeeking = loaded.NewValue;
replayLoaded.TriggerChange();
}

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
RightClickScrollingEnabled.ValueChanged += e => RightMouseScrollbar = e.NewValue;
RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.TriggerChange();
}
@ -509,9 +509,9 @@ namespace osu.Game.Screens.Select
foreach (var c in set.Beatmaps)
{
c.State.ValueChanged += e =>
c.State.ValueChanged += state =>
{
if (e.NewValue == CarouselItemState.Selected)
if (state.NewValue == CarouselItemState.Selected)
{
selectedBeatmapSet = set;
SelectionChanged?.Invoke(c.Beatmap);

View File

@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select
},
};
tabs.Current.ValueChanged += e => invokeOnFilter();
modsCheckbox.Current.ValueChanged += e => invokeOnFilter();
tabs.Current.ValueChanged += _ => invokeOnFilter();
modsCheckbox.Current.ValueChanged += _ => invokeOnFilter();
}
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel
public virtual void AddChild(CarouselItem i)
{
i.State.ValueChanged += e => ChildItemStateChanged(i, e.NewValue);
i.State.ValueChanged += state => ChildItemStateChanged(i, state.NewValue);
i.ChildID = ++currentChildID;
InternalChildren.Add(i);
}
@ -58,9 +58,9 @@ namespace osu.Game.Screens.Select.Carousel
{
if (items != null) InternalChildren = items;
State.ValueChanged += e =>
State.ValueChanged += state =>
{
switch (e.NewValue)
switch (state.NewValue)
{
case CarouselItemState.Collapsed:
case CarouselItemState.NotSelected:

View File

@ -13,9 +13,9 @@ namespace osu.Game.Screens.Select.Carousel
{
public CarouselGroupEagerSelect()
{
State.ValueChanged += e =>
State.ValueChanged += state =>
{
if (e.NewValue == CarouselItemState.Selected)
if (state.NewValue == CarouselItemState.Selected)
attemptSelection();
};
}

View File

@ -37,9 +37,9 @@ namespace osu.Game.Screens.Select.Carousel
{
DrawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
Filtered.ValueChanged += e =>
Filtered.ValueChanged += filtered =>
{
if (e.NewValue && State.Value == CarouselItemState.Selected)
if (filtered.NewValue && State.Value == CarouselItemState.Selected)
State.Value = CarouselItemState.NotSelected;
};
}

View File

@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select.Carousel
: base(item.Beatmap)
{
filtered.BindTo(item.Filtered);
filtered.ValueChanged += e => Schedule(() => this.FadeTo(e.NewValue ? 0.1f : 1, 100));
filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100));
filtered.TriggerChange();
}
}

View File

@ -146,12 +146,12 @@ namespace osu.Game.Screens.Select
}
};
searchTextBox.Current.ValueChanged += e => FilterChanged?.Invoke(CreateCriteria());
searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());
groupTabs.PinItem(GroupMode.All);
groupTabs.PinItem(GroupMode.RecentlyPlayed);
groupTabs.Current.ValueChanged += e => Group = e.NewValue;
sortTabs.Current.ValueChanged += e => Sort = e.NewValue;
groupTabs.Current.ValueChanged += group => Group = group.NewValue;
sortTabs.Current.ValueChanged += sort => Sort = sort.NewValue;
}
public void Deactivate()
@ -178,7 +178,7 @@ namespace osu.Game.Screens.Select
sortTabs.AccentColour = colours.GreenLight;
showConverted = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps);
showConverted.ValueChanged += e => updateCriteria();
showConverted.ValueChanged += _ => updateCriteria();
ruleset.BindTo(parentRuleset);
ruleset.BindValueChanged(_ => updateCriteria(), true);

View File

@ -598,9 +598,9 @@ namespace osu.Game.Screens.Select
{
// manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
Ruleset.ValueChanged += e => updateSelectedRuleset(e.NewValue);
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += e => Ruleset.Value = e.NewValue;
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);

View File

@ -42,10 +42,10 @@ namespace osu.Game.Skinning
CurrentSkinInfo.Value = SkinInfo.Default;
};
CurrentSkinInfo.ValueChanged += e => CurrentSkin.Value = getSkin(e.NewValue);
CurrentSkin.ValueChanged += e =>
CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = getSkin(skin.NewValue);
CurrentSkin.ValueChanged += skin =>
{
if (e.NewValue.SkinInfo != CurrentSkinInfo.Value)
if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead.");
SourceChanged?.Invoke();

View File

@ -191,8 +191,8 @@ namespace osu.Game.Users
});
}
Status.ValueChanged += e => displayStatus(e.NewValue);
Status.ValueChanged += e => statusBg.FadeColour(e.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
Status.ValueChanged += status => displayStatus(status.NewValue);
Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint);
base.Action = ViewProfile = () =>
{