mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Merge pull request #293 from peppy/general-fixes
Fix some nullrefs when running visualtests with no maps loaded.
This commit is contained in:
commit
8987a09741
@ -42,14 +42,13 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
var h = new HitCircle
|
||||
{
|
||||
StartTime = Clock.CurrentTime + 1000 + i * 80,
|
||||
StartTime = Clock.CurrentTime + 600 + i * 80,
|
||||
Position = new Vector2((i - count / 2) * 14),
|
||||
};
|
||||
|
||||
DrawableHitCircle d = new DrawableHitCircle(h)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Depth = i,
|
||||
State = ArmedState.Hit,
|
||||
Judgement = new OsuJudgementInfo { Result = HitResult.Hit }
|
||||
|
@ -41,7 +41,11 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (oldDb != null)
|
||||
{
|
||||
Dependencies.Cache(oldDb, true);
|
||||
db = null;
|
||||
}
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDatabase db)
|
||||
{
|
||||
beatmap = db.GetWorkingBeatmap(db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault());
|
||||
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
|
||||
if (beatmapInfo != null)
|
||||
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
//ensure we are at offset 0
|
||||
Clock = new FramedClock();
|
||||
|
||||
if (beatmap == null)
|
||||
if (beatmap?.Track == null)
|
||||
{
|
||||
|
||||
var objects = new List<HitObject>();
|
||||
|
||||
int time = 1500;
|
||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
Texture = working.Background;
|
||||
if (working.Background != null)
|
||||
Texture = working.Background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
if (background != null) return background;
|
||||
|
||||
if (BeatmapInfo.Metadata?.BackgroundFile == null) return null;
|
||||
|
||||
try
|
||||
{
|
||||
using (var reader = GetReader())
|
||||
|
@ -43,8 +43,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
||||
state = value;
|
||||
|
||||
UpdateState(state);
|
||||
|
||||
Expire();
|
||||
if (IsLoaded)
|
||||
Expire();
|
||||
|
||||
if (State == ArmedState.Hit)
|
||||
PlaySample();
|
||||
@ -56,8 +56,8 @@ namespace osu.Game.Modes.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
string hitType = (HitObject.Sample.Type == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
||||
string sampleSet = HitObject.Sample.Set.ToString().ToLower();
|
||||
string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
|
||||
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
|
||||
|
||||
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
|
||||
}
|
||||
|
@ -168,14 +168,17 @@ namespace osu.Game.Overlays.Options
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = idleColour = colours.Pink;
|
||||
glowingColour = colours.PinkLighter;
|
||||
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Colour = glowingColour = colours.PinkDarker,
|
||||
Colour = colours.PinkDarker,
|
||||
Type = EdgeEffectType.Glow,
|
||||
Radius = 10,
|
||||
Roundness = 8,
|
||||
};
|
||||
|
||||
FadeGlowTo(0);
|
||||
}
|
||||
|
||||
public bool Glowing
|
||||
|
Loading…
Reference in New Issue
Block a user