mirror of
https://github.com/ppy/osu
synced 2024-12-26 17:02:59 +00:00
Add ScalingContainer back
Don't want to set DHO.Scale or DHO.Rotation because because DHO may be transformed by mods. DHO.Size is also assigned for drawable visualizer
This commit is contained in:
parent
a8e2f35b62
commit
e097b6e61c
@ -21,6 +21,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>();
|
||||
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
|
||||
|
||||
float IHasCatchObjectState.Scale => Scale.X;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
|
||||
/// </summary>
|
||||
@ -43,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
public virtual void CopyStateFrom(IHasCatchObjectState objectState)
|
||||
{
|
||||
HitObject = objectState.HitObject;
|
||||
Scale = objectState.Scale;
|
||||
Scale = new Vector2(objectState.Scale);
|
||||
Rotation = objectState.Rotation;
|
||||
AccentColour.Value = objectState.AccentColour.Value;
|
||||
HyperDash.Value = objectState.HyperDash.Value;
|
||||
|
@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(new SkinnableDrawable(
|
||||
ScalingContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(CatchSkinComponents.Banana),
|
||||
_ => new BananaPiece()));
|
||||
_ => new BananaPiece());
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -44,12 +44,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
const float end_scale = 0.6f;
|
||||
const float random_scale_range = 1.6f;
|
||||
|
||||
this.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3)))
|
||||
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
|
||||
ScalingContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3)))
|
||||
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
|
||||
|
||||
this.RotateTo(getRandomAngle(1))
|
||||
.Then()
|
||||
.RotateTo(getRandomAngle(2), HitObject.TimePreempt);
|
||||
ScalingContainer.RotateTo(getRandomAngle(1))
|
||||
.Then()
|
||||
.RotateTo(getRandomAngle(2), HitObject.TimePreempt);
|
||||
|
||||
float getRandomAngle(int series) => 180 * (RandomSingle(series) * 2 - 1);
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(new SkinnableDrawable(
|
||||
ScalingContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
||||
_ => new DropletPiece()));
|
||||
_ => new DropletPiece());
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
float startRotation = RandomSingle(1) * 20;
|
||||
double duration = HitObject.TimePreempt + 2000;
|
||||
|
||||
this.RotateTo(startRotation).RotateTo(startRotation + 720, duration);
|
||||
ScalingContainer.RotateTo(startRotation).RotateTo(startRotation + 720, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,16 +32,16 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
VisualRepresentation.Value = (FruitVisualRepresentation)(change.NewValue % 4);
|
||||
}, true);
|
||||
|
||||
AddInternal(new SkinnableDrawable(
|
||||
ScalingContainer.Child = new SkinnableDrawable(
|
||||
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
||||
_ => new FruitPiece()));
|
||||
_ => new FruitPiece());
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
{
|
||||
base.UpdateInitialTransforms();
|
||||
|
||||
this.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
||||
ScalingContainer.RotateTo((RandomSingle(1) - 0.5f) * 40);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -30,11 +31,27 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
public float DisplayRadius => CatchHitObject.OBJECT_RADIUS * HitObject.Scale * ScaleFactor;
|
||||
|
||||
/// <summary>
|
||||
/// The container internal transforms (such as scaling based on the circle size) are applied to.
|
||||
/// </summary>
|
||||
protected readonly Container ScalingContainer;
|
||||
|
||||
float IHasCatchObjectState.Scale => HitObject.Scale * ScaleFactor;
|
||||
|
||||
float IHasCatchObjectState.Rotation => ScalingContainer.Rotation;
|
||||
|
||||
protected DrawablePalpableCatchHitObject([CanBeNull] CatchHitObject h)
|
||||
: base(h)
|
||||
{
|
||||
Origin = Anchor.Centre;
|
||||
Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
AddInternal(ScalingContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2)
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -47,7 +64,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
ScaleBindable.BindValueChanged(scale =>
|
||||
{
|
||||
Scale = new Vector2(scale.NewValue * ScaleFactor);
|
||||
ScalingContainer.Scale = new Vector2(scale.NewValue * ScaleFactor);
|
||||
Size = ScalingContainer.Size * ScalingContainer.Scale;
|
||||
}, true);
|
||||
|
||||
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
@ -17,6 +16,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
Bindable<bool> HyperDash { get; }
|
||||
|
||||
float Rotation { get; }
|
||||
Vector2 Scale { get; }
|
||||
float Scale { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user