mirror of
https://github.com/ppy/osu
synced 2025-01-12 09:09:44 +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();
|
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
|
Width = 0.85f // create room for control panel
|
||||||
});
|
});
|
||||||
|
@ -28,11 +28,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private TournamentSceneManager sceneManager { get; set; }
|
private TournamentSceneManager sceneManager { get; set; }
|
||||||
|
|
||||||
protected override bool IsSubScreen => true;
|
public SeedingEditorScreen(TournamentTeam team, TournamentScreen parentScreen)
|
||||||
|
: base(parentScreen)
|
||||||
protected override System.Type ParentScreen => typeof(TeamEditorScreen);
|
|
||||||
|
|
||||||
public SeedingEditorScreen(TournamentTeam team)
|
|
||||||
{
|
{
|
||||||
this.team = team;
|
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()
|
private void addAllCountries()
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private LadderInfo ladderInfo { get; set; }
|
private LadderInfo ladderInfo { get; set; }
|
||||||
|
|
||||||
public TeamRow(TournamentTeam team)
|
public TeamRow(TournamentTeam team, TournamentScreen parent)
|
||||||
{
|
{
|
||||||
Model = team;
|
Model = team;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
Text = "Edit seeding results",
|
Text = "Edit seeding results",
|
||||||
Action = () =>
|
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 ControlPanel ControlPanel;
|
||||||
|
|
||||||
protected virtual bool IsSubScreen => false;
|
private readonly TournamentScreen parentScreen;
|
||||||
|
|
||||||
protected virtual System.Type ParentScreen { get; set; }
|
|
||||||
|
|
||||||
private BackButton backButton;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
@ -51,7 +53,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
if (IsSubScreen)
|
if (parentScreen != null)
|
||||||
backAction.Invoke();
|
backAction.Invoke();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -98,7 +100,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (IsSubScreen)
|
if (parentScreen != null)
|
||||||
backButton.Show();
|
backButton.Show();
|
||||||
|
|
||||||
Storage.CollectionChanged += (_, args) =>
|
Storage.CollectionChanged += (_, args) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user