mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08: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<Color4> AccentColour { get; } = new Bindable<Color4>();
|
||||||
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
|
public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
|
||||||
|
|
||||||
|
float IHasCatchObjectState.Scale => Scale.X;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
|
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -43,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
public virtual void CopyStateFrom(IHasCatchObjectState objectState)
|
public virtual void CopyStateFrom(IHasCatchObjectState objectState)
|
||||||
{
|
{
|
||||||
HitObject = objectState.HitObject;
|
HitObject = objectState.HitObject;
|
||||||
Scale = objectState.Scale;
|
Scale = new Vector2(objectState.Scale);
|
||||||
Rotation = objectState.Rotation;
|
Rotation = objectState.Rotation;
|
||||||
AccentColour.Value = objectState.AccentColour.Value;
|
AccentColour.Value = objectState.AccentColour.Value;
|
||||||
HyperDash.Value = objectState.HyperDash.Value;
|
HyperDash.Value = objectState.HyperDash.Value;
|
||||||
|
@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AddInternal(new SkinnableDrawable(
|
ScalingContainer.Child = new SkinnableDrawable(
|
||||||
new CatchSkinComponent(CatchSkinComponents.Banana),
|
new CatchSkinComponent(CatchSkinComponents.Banana),
|
||||||
_ => new BananaPiece()));
|
_ => new BananaPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -44,10 +44,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
const float end_scale = 0.6f;
|
const float end_scale = 0.6f;
|
||||||
const float random_scale_range = 1.6f;
|
const float random_scale_range = 1.6f;
|
||||||
|
|
||||||
this.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3)))
|
ScalingContainer.ScaleTo(HitObject.Scale * (end_scale + random_scale_range * RandomSingle(3)))
|
||||||
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
|
.Then().ScaleTo(HitObject.Scale * end_scale, HitObject.TimePreempt);
|
||||||
|
|
||||||
this.RotateTo(getRandomAngle(1))
|
ScalingContainer.RotateTo(getRandomAngle(1))
|
||||||
.Then()
|
.Then()
|
||||||
.RotateTo(getRandomAngle(2), HitObject.TimePreempt);
|
.RotateTo(getRandomAngle(2), HitObject.TimePreempt);
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AddInternal(new SkinnableDrawable(
|
ScalingContainer.Child = new SkinnableDrawable(
|
||||||
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
new CatchSkinComponent(CatchSkinComponents.Droplet),
|
||||||
_ => new DropletPiece()));
|
_ => new DropletPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms()
|
protected override void UpdateInitialTransforms()
|
||||||
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
float startRotation = RandomSingle(1) * 20;
|
float startRotation = RandomSingle(1) * 20;
|
||||||
double duration = HitObject.TimePreempt + 2000;
|
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);
|
VisualRepresentation.Value = (FruitVisualRepresentation)(change.NewValue % 4);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
AddInternal(new SkinnableDrawable(
|
ScalingContainer.Child = new SkinnableDrawable(
|
||||||
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
new CatchSkinComponent(CatchSkinComponents.Fruit),
|
||||||
_ => new FruitPiece()));
|
_ => new FruitPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms()
|
protected override void UpdateInitialTransforms()
|
||||||
{
|
{
|
||||||
base.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.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -30,11 +31,27 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
public float DisplayRadius => CatchHitObject.OBJECT_RADIUS * HitObject.Scale * ScaleFactor;
|
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)
|
protected DrawablePalpableCatchHitObject([CanBeNull] CatchHitObject h)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2);
|
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]
|
[BackgroundDependencyLoader]
|
||||||
@ -47,7 +64,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
ScaleBindable.BindValueChanged(scale =>
|
ScaleBindable.BindValueChanged(scale =>
|
||||||
{
|
{
|
||||||
Scale = new Vector2(scale.NewValue * ScaleFactor);
|
ScalingContainer.Scale = new Vector2(scale.NewValue * ScaleFactor);
|
||||||
|
Size = ScalingContainer.Size * ScalingContainer.Scale;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());
|
IndexInBeatmap.BindValueChanged(_ => UpdateComboColour());
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||||
@ -17,6 +16,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
Bindable<bool> HyperDash { get; }
|
Bindable<bool> HyperDash { get; }
|
||||||
|
|
||||||
float Rotation { get; }
|
float Rotation { get; }
|
||||||
Vector2 Scale { get; }
|
float Scale { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user