mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Set banana combo colour using random seed
This commit is contained in:
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Catch.Judgements;
|
using osu.Game.Rulesets.Catch.Judgements;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Utils;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects
|
namespace osu.Game.Rulesets.Catch.Objects
|
||||||
@ -28,17 +28,12 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
Samples = samples;
|
Samples = samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4? colour;
|
// override any external colour changes with banananana
|
||||||
|
Color4 IHasComboInformation.GetComboColour(IReadOnlyList<Color4> comboColours) => getBananaColour();
|
||||||
Color4 IHasComboInformation.GetComboColour(IReadOnlyList<Color4> comboColours)
|
|
||||||
{
|
|
||||||
// override any external colour changes with banananana
|
|
||||||
return colour ??= getBananaColour();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 getBananaColour()
|
private Color4 getBananaColour()
|
||||||
{
|
{
|
||||||
switch (RNG.Next(0, 3))
|
switch (StatelessRNG.NextInt(3, RandomSeed.Value))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return new Color4(255, 240, 0, 255);
|
return new Color4(255, 240, 0, 255);
|
||||||
|
@ -97,6 +97,12 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
set => ScaleBindable.Value = value;
|
set => ScaleBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The seed value used for visual randomness such as fruit rotation.
|
||||||
|
/// By default, <see cref="HitObject.StartTime"/> truncated to an integer is used.
|
||||||
|
/// </summary>
|
||||||
|
public Bindable<int> RandomSeed = new Bindable<int>();
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||||
@ -111,6 +117,10 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
protected CatchHitObject()
|
protected CatchHitObject()
|
||||||
{
|
{
|
||||||
XBindable.BindValueChanged(x => originalX = x.NewValue - xOffset);
|
XBindable.BindValueChanged(x => originalX = x.NewValue - xOffset);
|
||||||
|
StartTimeBindable.BindValueChanged(change =>
|
||||||
|
{
|
||||||
|
RandomSeed.Value = (int)change.NewValue;
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
|
||||||
@ -23,10 +21,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
|
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The seed value used for visual randomness such as fruit rotation.
|
|
||||||
/// By default, <see cref="HitObject.StartTime"/> truncated to an integer is used.
|
|
||||||
/// </summary>
|
|
||||||
public Bindable<int> RandomSeed = new Bindable<int>();
|
public Bindable<int> RandomSeed = new Bindable<int>();
|
||||||
|
|
||||||
protected DrawableCatchHitObject([CanBeNull] CatchHitObject hitObject)
|
protected DrawableCatchHitObject([CanBeNull] CatchHitObject hitObject)
|
||||||
@ -35,15 +29,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
Anchor = Anchor.BottomLeft;
|
Anchor = Anchor.BottomLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
StartTimeBindable.BindValueChanged(change =>
|
|
||||||
{
|
|
||||||
RandomSeed.Value = (int)change.NewValue;
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a random number in range [0,1) based on seed <see cref="RandomSeed"/>.
|
/// Get a random number in range [0,1) based on seed <see cref="RandomSeed"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,6 +39,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
base.OnApply();
|
base.OnApply();
|
||||||
|
|
||||||
XBindable.BindTo(HitObject.XBindable);
|
XBindable.BindTo(HitObject.XBindable);
|
||||||
|
RandomSeed.BindTo(HitObject.RandomSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFree()
|
protected override void OnFree()
|
||||||
@ -61,6 +47,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
base.OnFree();
|
base.OnFree();
|
||||||
|
|
||||||
XBindable.UnbindFrom(HitObject.XBindable);
|
XBindable.UnbindFrom(HitObject.XBindable);
|
||||||
|
RandomSeed.UnbindFrom(HitObject.RandomSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<CatchHitObject, bool> CheckPosition;
|
public Func<CatchHitObject, bool> CheckPosition;
|
||||||
|
Reference in New Issue
Block a user