mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 14:43:22 +08:00
Editor problem solved
This commit is contained in:
parent
c145cff5a0
commit
7deccd1136
@ -3,6 +3,9 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -20,6 +23,20 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopRight,
|
||||
});
|
||||
|
||||
AddRangeInternal([poolHitEditorMode]);
|
||||
}
|
||||
|
||||
private readonly HitPool poolHitEditorMode = new HitPool(50, editorMode: true);
|
||||
|
||||
protected override IDrawablePool? AdditionalPrepareDrawablePool(HitObject hitObject)
|
||||
{
|
||||
switch (hitObject)
|
||||
{
|
||||
// We should to return the editor pool, and suppress non-editor pools.
|
||||
case Hit: return poolHitEditorMode;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,14 +71,15 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
||||
|
||||
public void SetRimState(bool state)
|
||||
{
|
||||
if (SelectedItems.OfType<Hit>().All(h => h.Type == (state ? HitType.Rim : HitType.Centre)))
|
||||
var expectedType = state ? HitType.Rim : HitType.Centre;
|
||||
if (SelectedItems.OfType<Hit>().All(h => h.Type == expectedType))
|
||||
return;
|
||||
|
||||
EditorBeatmap.PerformOnSelection(h =>
|
||||
{
|
||||
if (h is Hit taikoHit)
|
||||
if (h is Hit taikoHit && taikoHit.Type != expectedType)
|
||||
{
|
||||
taikoHit.Type = state ? HitType.Rim : HitType.Centre;
|
||||
taikoHit.Type = expectedType;
|
||||
EditorBeatmap.Update(h);
|
||||
}
|
||||
});
|
||||
|
@ -40,15 +40,18 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private readonly Bindable<HitType> type = new Bindable<HitType>();
|
||||
|
||||
private readonly bool editorMode = false;
|
||||
|
||||
public DrawableHit()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public DrawableHit([CanBeNull] Hit hit)
|
||||
public DrawableHit([CanBeNull] Hit hit, bool editorMode = false)
|
||||
: base(hit)
|
||||
{
|
||||
FillMode = FillMode.Fit;
|
||||
this.editorMode = editorMode;
|
||||
}
|
||||
|
||||
protected override void OnApply()
|
||||
@ -62,6 +65,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
protected override void RestorePieceState()
|
||||
{
|
||||
if (editorMode)
|
||||
{
|
||||
// We in Editor Mode so the performance is not critical and we can recreate piece.
|
||||
if (MainPiece != null) Content.Remove(MainPiece, true);
|
||||
Content.Add(MainPiece = OnLoadCreateMainPiece());
|
||||
}
|
||||
updateActionsFromType();
|
||||
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
/// <summary>
|
||||
/// Moves <see cref="Content"/> to the normal hitobject layer.
|
||||
/// Does nothing is content is not currently proxied.
|
||||
/// Does nothing if content is not currently proxied.
|
||||
/// </summary>
|
||||
protected void UnproxyContent()
|
||||
{
|
||||
|
@ -12,6 +12,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
private readonly HitType hitType;
|
||||
private readonly bool isStrong;
|
||||
private readonly bool editorMode = false;
|
||||
|
||||
public HitPool(int initialSize, bool editorMode) : base(initialSize)
|
||||
{
|
||||
this.editorMode = editorMode;
|
||||
}
|
||||
|
||||
public HitPool(int initialSize, HitType hitType, bool isStrong)
|
||||
: base(initialSize)
|
||||
@ -20,6 +26,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
this.isStrong = isStrong;
|
||||
}
|
||||
|
||||
protected override DrawableHit CreateNewDrawable() => new DrawableHit(new Hit(hitType, isStrong));
|
||||
protected override DrawableHit CreateNewDrawable() => new DrawableHit(new Hit(hitType, isStrong), editorMode);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user