1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +08:00

Remove caching for ConfigColourCodedNotes

This commit is contained in:
Justus Franklin Tumacder 2021-04-25 08:32:21 +08:00
parent d3db19c3ce
commit 8b9d2a6cff
7 changed files with 7 additions and 66 deletions

View File

@ -4,12 +4,10 @@
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
@ -30,9 +28,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Cached(typeof(IScrollingInfo))]
private IScrollingInfo scrollingInfo;
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
protected ManiaPlacementBlueprintTestScene()
{
scrollingInfo = ((ScrollingTestContainer)HitObjectContainer).ScrollingInfo;
@ -46,13 +41,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
});
}
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint)
{
var time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position);

View File

@ -2,10 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual;
using osuTK.Graphics;
@ -17,9 +15,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
[Cached(Type = typeof(IAdjustableClock))]
private readonly IAdjustableClock clock = new StopwatchClock();
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
protected ManiaSelectionBlueprintTestScene()
{
Add(new Column(0)
@ -31,13 +26,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
});
}
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
public ManiaPlayfield Playfield => null;
}
}

View File

@ -1,12 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests
@ -16,21 +13,11 @@ namespace osu.Game.Rulesets.Mania.Tests
private readonly Container<Drawable> content;
protected override Container<Drawable> Content => content ?? base.Content;
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
protected ManiaInputTestScene(int keys)
{
base.Content.Add(content = new LocalInputManager(keys));
}
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
private class LocalInputManager : ManiaInputManager
{
public LocalInputManager(int variant)

View File

@ -7,7 +7,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.UI.Scrolling.Algorithms;
using osu.Game.Tests.Visual;
@ -25,9 +24,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[Cached(Type = typeof(IScrollingInfo))]
private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo();
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
protected override Ruleset CreateRulesetForSkinProvider() => new ManiaRuleset();
protected ManiaSkinnableTestScene()
@ -42,13 +38,6 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
});
}
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
[Test]
public void TestScrollingDown()
{

View File

@ -15,7 +15,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
@ -30,16 +29,6 @@ namespace osu.Game.Rulesets.Mania.Tests
[TestFixture]
public class TestSceneNotes : OsuTestScene
{
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
[BackgroundDependencyLoader]
private void load(RulesetConfigCache configCache)
{
var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance());
config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
[Test]
public void TestVariousNotes()
{

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Skinning.Default;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
@ -25,8 +26,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
[Resolved]
private OsuColour colours { get; set; }
[Resolved]
private Bindable<bool> configColourCodedNotes { get; set; }
[Resolved(canBeNull: true)]
private ManiaRulesetConfigManager config { get; set; }
private readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
[Resolved(canBeNull: true)]
private SnapFinder snapFinder { get; set; }
@ -56,6 +59,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (snapFinder != null)
{
config?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
HitObject.StartTimeBindable.BindValueChanged(_ => Snap.Value = snapFinder.FindSnap(HitObject), true);
Snap.BindValueChanged(_ => updateSnapColour(), true);

View File

@ -54,9 +54,6 @@ namespace osu.Game.Rulesets.Mania.UI
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
[Cached]
protected readonly Bindable<bool> ConfigColourCodedNotes = new Bindable<bool>();
public ScrollVisualisationMethod ScrollMethod
{
get => scrollMethod;
@ -111,8 +108,6 @@ namespace osu.Game.Rulesets.Mania.UI
configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true);
Config.BindWith(ManiaRulesetSetting.ScrollTime, configTimeRange);
Config.BindWith(ManiaRulesetSetting.ColourCodedNotes, ConfigColourCodedNotes);
}
protected override void AdjustScrollSpeed(int amount)