mirror of
https://github.com/ppy/osu.git
synced 2025-02-08 15:52:53 +08:00
Combine countless update methods all called together into a single method
This commit is contained in:
parent
1bfb4d4c2b
commit
17b1739ae4
@ -355,11 +355,11 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
public override void OnResuming(ScreenTransitionEvent e)
|
public override void OnResuming(ScreenTransitionEvent e)
|
||||||
{
|
{
|
||||||
base.OnResuming(e);
|
base.OnResuming(e);
|
||||||
|
|
||||||
updateBeatmap();
|
updateBeatmap();
|
||||||
|
updateSpecifics();
|
||||||
|
|
||||||
beginHandlingTrack();
|
beginHandlingTrack();
|
||||||
Scheduler.AddOnce(updateMods);
|
|
||||||
Scheduler.AddOnce(updateRuleset);
|
|
||||||
Scheduler.AddOnce(updateUserStyle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool ExitConfirmed { get; private set; }
|
protected bool ExitConfirmed { get; private set; }
|
||||||
@ -448,9 +448,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
|
|
||||||
updateUserMods();
|
updateUserMods();
|
||||||
updateBeatmap();
|
updateBeatmap();
|
||||||
updateMods();
|
updateSpecifics();
|
||||||
updateRuleset();
|
|
||||||
updateUserStyle();
|
|
||||||
|
|
||||||
if (!item.AllowedMods.Any())
|
if (!item.AllowedMods.Any())
|
||||||
{
|
{
|
||||||
@ -501,43 +499,31 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
|||||||
UserModsSelectOverlay.Beatmap.Value = Beatmap.Value;
|
UserModsSelectOverlay.Beatmap.Value = Beatmap.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMods()
|
private void updateSpecifics()
|
||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen() || SelectedItem.Value is not PlaylistItem)
|
if (!this.IsCurrentScreen() || SelectedItem.Value is not PlaylistItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var rulesetInstance = GetGameplayRuleset().CreateInstance();
|
var rulesetInstance = GetGameplayRuleset().CreateInstance();
|
||||||
Mods.Value = GetGameplayMods().Select(m => m.ToMod(rulesetInstance)).ToArray();
|
Mods.Value = GetGameplayMods().Select(m => m.ToMod(rulesetInstance)).ToArray();
|
||||||
}
|
|
||||||
|
|
||||||
private void updateRuleset()
|
|
||||||
{
|
|
||||||
if (!this.IsCurrentScreen() || SelectedItem.Value is not PlaylistItem)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Ruleset.Value = GetGameplayRuleset();
|
Ruleset.Value = GetGameplayRuleset();
|
||||||
}
|
|
||||||
|
|
||||||
private void updateUserStyle()
|
if (UserStyleDisplayContainer != null)
|
||||||
{
|
|
||||||
if (!this.IsCurrentScreen() || SelectedItem.Value is not PlaylistItem)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (UserStyleDisplayContainer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PlaylistItem gameplayItem = SelectedItem.Value.With(ruleset: GetGameplayRuleset().OnlineID, beatmap: new Optional<IBeatmapInfo>(GetGameplayBeatmap()));
|
|
||||||
PlaylistItem? currentItem = UserStyleDisplayContainer.SingleOrDefault()?.Item;
|
|
||||||
|
|
||||||
if (gameplayItem.Equals(currentItem))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UserStyleDisplayContainer.Child = new DrawableRoomPlaylistItem(gameplayItem)
|
|
||||||
{
|
{
|
||||||
AllowReordering = false,
|
PlaylistItem gameplayItem = SelectedItem.Value.With(ruleset: GetGameplayRuleset().OnlineID, beatmap: new Optional<IBeatmapInfo>(GetGameplayBeatmap()));
|
||||||
AllowEditing = true,
|
PlaylistItem? currentItem = UserStyleDisplayContainer.SingleOrDefault()?.Item;
|
||||||
RequestEdit = _ => OpenStyleSelection()
|
|
||||||
};
|
if (gameplayItem.Equals(currentItem))
|
||||||
|
return;
|
||||||
|
|
||||||
|
UserStyleDisplayContainer.Child = new DrawableRoomPlaylistItem(gameplayItem)
|
||||||
|
{
|
||||||
|
AllowReordering = false,
|
||||||
|
AllowEditing = true,
|
||||||
|
RequestEdit = _ => OpenStyleSelection()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual APIMod[] GetGameplayMods()
|
protected virtual APIMod[] GetGameplayMods()
|
||||||
|
Loading…
Reference in New Issue
Block a user