mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Change logic for parentscreen/subscreen relation
This commit is contained in:
parent
b1243d6a87
commit
358345cee7
@ -16,7 +16,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
var match = CreateSampleMatch();
|
||||
|
||||
Add(new SeedingEditorScreen(match.Team1.Value)
|
||||
Add(new SeedingEditorScreen(match.Team1.Value, new TeamEditorScreen())
|
||||
{
|
||||
Width = 0.85f // create room for control panel
|
||||
});
|
||||
|
@ -28,11 +28,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved(canBeNull: true)]
|
||||
private TournamentSceneManager sceneManager { get; set; }
|
||||
|
||||
protected override bool IsSubScreen => true;
|
||||
|
||||
protected override System.Type ParentScreen => typeof(TeamEditorScreen);
|
||||
|
||||
public SeedingEditorScreen(TournamentTeam team)
|
||||
public SeedingEditorScreen(TournamentTeam team, TournamentScreen parentScreen)
|
||||
: base(parentScreen)
|
||||
{
|
||||
this.team = team;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
});
|
||||
}
|
||||
|
||||
protected override TeamRow CreateDrawable(TournamentTeam model) => new TeamRow(model);
|
||||
protected override TeamRow CreateDrawable(TournamentTeam model) => new TeamRow(model, this);
|
||||
|
||||
private void addAllCountries()
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; }
|
||||
|
||||
public TeamRow(TournamentTeam team)
|
||||
public TeamRow(TournamentTeam team, TournamentScreen parent)
|
||||
{
|
||||
Model = team;
|
||||
|
||||
@ -154,7 +154,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Text = "Edit seeding results",
|
||||
Action = () =>
|
||||
{
|
||||
sceneManager?.SetScreen(new SeedingEditorScreen(team));
|
||||
sceneManager?.SetScreen(new SeedingEditorScreen(team, parent));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -33,13 +33,15 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
protected ControlPanel ControlPanel;
|
||||
|
||||
protected virtual bool IsSubScreen => false;
|
||||
|
||||
protected virtual System.Type ParentScreen { get; set; }
|
||||
|
||||
private readonly TournamentScreen parentScreen;
|
||||
private BackButton backButton;
|
||||
|
||||
private System.Action backAction => () => sceneManager?.SetScreen(ParentScreen);
|
||||
private System.Action backAction => () => sceneManager?.SetScreen(parentScreen.GetType());
|
||||
|
||||
protected TournamentEditorScreen(TournamentScreen parentScreen = null)
|
||||
{
|
||||
this.parentScreen = parentScreen;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -51,7 +53,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () =>
|
||||
{
|
||||
if (IsSubScreen)
|
||||
if (parentScreen != null)
|
||||
backAction.Invoke();
|
||||
}
|
||||
};
|
||||
@ -98,7 +100,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
}
|
||||
});
|
||||
|
||||
if (IsSubScreen)
|
||||
if (parentScreen != null)
|
||||
backButton.Show();
|
||||
|
||||
Storage.CollectionChanged += (_, args) =>
|
||||
|
Loading…
Reference in New Issue
Block a user