mirror of
https://github.com/osukey/osukey.git
synced 2025-05-03 20:57:28 +09:00
Moved Info and Background into own container
This commit is contained in:
parent
de04caeace
commit
9fba87f67a
@ -135,15 +135,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private void selectBeatmap([CanBeNull] IBeatmap b)
|
private void selectBeatmap([CanBeNull] IBeatmap b)
|
||||||
{
|
{
|
||||||
BeatmapInfoWedge.BufferedWedgeBackground backgroundBefore = null;
|
BeatmapInfoWedge.BeatmapInfoWedgeContainer containerBefore = null;
|
||||||
|
|
||||||
AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () =>
|
AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () =>
|
||||||
{
|
{
|
||||||
backgroundBefore = infoWedge.Background;
|
containerBefore = infoWedge.Container;
|
||||||
infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : CreateWorkingBeatmap(b);
|
infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : CreateWorkingBeatmap(b);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for async load", () => infoWedge.Background != backgroundBefore);
|
AddUntilStep("wait for async load", () => infoWedge.Container != containerBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBeatmap createTestBeatmap(RulesetInfo ruleset)
|
private IBeatmap createTestBeatmap(RulesetInfo ruleset)
|
||||||
@ -196,6 +196,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
public new BufferedWedgeBackground Background => base.Background;
|
public new BufferedWedgeBackground Background => base.Background;
|
||||||
|
|
||||||
public new WedgeInfoText Info => base.Info;
|
public new WedgeInfoText Info => base.Info;
|
||||||
|
|
||||||
|
public new BeatmapInfoWedgeContainer Container => base.Container;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestHitObject : ConvertHitObject, IHasPosition
|
private class TestHitObject : ConvertHitObject, IHasPosition
|
||||||
|
@ -41,8 +41,9 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
protected BufferedWedgeBackground Background;
|
protected BeatmapInfoWedgeContainer Container;
|
||||||
protected WedgeInfoText Info;
|
protected WedgeInfoText Info => Container.Info;
|
||||||
|
protected BufferedWedgeBackground Background => Container.Background;
|
||||||
|
|
||||||
public BeatmapInfoWedge()
|
public BeatmapInfoWedge()
|
||||||
{
|
{
|
||||||
@ -94,9 +95,9 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsPresent => base.IsPresent || Background == null; // Visibility is updated in the LoadComponentAsync callback
|
public override bool IsPresent => base.IsPresent || Container == null; // Visibility is updated in the LoadComponentAsync callback
|
||||||
|
|
||||||
private BufferedWedgeBackground loadingInfo;
|
private BeatmapInfoWedgeContainer loadingInfo;
|
||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
@ -108,13 +109,9 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
||||||
|
|
||||||
Info?.FadeOut(250);
|
Container?.FadeOut(250);
|
||||||
Info?.Expire();
|
Container?.Expire();
|
||||||
Info = null;
|
Container = null;
|
||||||
|
|
||||||
Background?.FadeOut(250);
|
|
||||||
Background?.Expire();
|
|
||||||
Background = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap == null)
|
if (beatmap == null)
|
||||||
@ -123,25 +120,50 @@ namespace osu.Game.Screens.Select
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadComponentAsync(loadingInfo = new BufferedWedgeBackground(beatmap)
|
LoadComponentAsync(loadingInfo = new BeatmapInfoWedgeContainer(beatmap, ruleset.Value)
|
||||||
{
|
{
|
||||||
Shear = -Shear,
|
Shear = -Shear,
|
||||||
Depth = Background?.Depth + 1 ?? 0
|
|
||||||
}, loaded =>
|
}, loaded =>
|
||||||
{
|
{
|
||||||
// ensure we are the most recent loaded wedge.
|
// ensure we are the most recent loaded wedge.
|
||||||
if (loaded != loadingInfo) return;
|
if (loaded != loadingInfo) return;
|
||||||
|
|
||||||
removeOldInfo();
|
removeOldInfo();
|
||||||
Add(Background = loaded);
|
Add(Container = loaded);
|
||||||
Add(Info = new WedgeInfoText(beatmap, ruleset.Value)
|
|
||||||
{
|
|
||||||
Shear = -Shear
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BeatmapInfoWedgeContainer : Container
|
||||||
|
{
|
||||||
|
private readonly WorkingBeatmap beatmap;
|
||||||
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
|
internal BufferedWedgeBackground Background;
|
||||||
|
internal WedgeInfoText Info;
|
||||||
|
|
||||||
|
public BeatmapInfoWedgeContainer(WorkingBeatmap beatmap, RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
this.ruleset = ruleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
Background = new BufferedWedgeBackground(beatmap)
|
||||||
|
{
|
||||||
|
Depth = Background?.Depth + 1 ?? 0,
|
||||||
|
},
|
||||||
|
Info = new WedgeInfoText(beatmap, ruleset),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class WedgeInfoText : Container
|
public class WedgeInfoText : Container
|
||||||
{
|
{
|
||||||
public FillFlowContainer MapperContainer { get; private set; }
|
public FillFlowContainer MapperContainer { get; private set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user