mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 00:53:22 +08:00
Merge branch 'master' into add-context-menu-direct-panel
This commit is contained in:
commit
a03a637728
@ -22,26 +22,15 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly Container hitTargetLine;
|
private readonly Drawable hitTarget;
|
||||||
private readonly Drawable hitTargetBar;
|
|
||||||
|
|
||||||
public ColumnHitObjectArea(HitObjectContainer hitObjectContainer)
|
public ColumnHitObjectArea(HitObjectContainer hitObjectContainer)
|
||||||
{
|
{
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
hitTargetBar = new Box
|
hitTarget = new DefaultHitTarget
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = NotePiece.NOTE_HEIGHT,
|
|
||||||
Alpha = 0.6f,
|
|
||||||
Colour = Color4.Black
|
|
||||||
},
|
|
||||||
hitTargetLine = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = hit_target_bar_height,
|
|
||||||
Masking = true,
|
|
||||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
|
||||||
},
|
},
|
||||||
hitObjectContainer
|
hitObjectContainer
|
||||||
};
|
};
|
||||||
@ -55,17 +44,10 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
{
|
{
|
||||||
Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
|
Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
|
||||||
|
|
||||||
hitTargetBar.Anchor = hitTargetBar.Origin = anchor;
|
hitTarget.Anchor = hitTarget.Origin = anchor;
|
||||||
hitTargetLine.Anchor = hitTargetLine.Origin = anchor;
|
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
updateColours();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4 accentColour;
|
||||||
|
|
||||||
public Color4 AccentColour
|
public Color4 AccentColour
|
||||||
@ -78,21 +60,86 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
|
|
||||||
accentColour = value;
|
accentColour = value;
|
||||||
|
|
||||||
updateColours();
|
if (hitTarget is IHasAccentColour colouredHitTarget)
|
||||||
|
colouredHitTarget.AccentColour = accentColour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateColours()
|
private class DefaultHitTarget : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
if (!IsLoaded)
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
return;
|
|
||||||
|
|
||||||
hitTargetLine.EdgeEffect = new EdgeEffectParameters
|
private readonly Container hitTargetLine;
|
||||||
|
private readonly Drawable hitTargetBar;
|
||||||
|
|
||||||
|
public DefaultHitTarget()
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
InternalChildren = new[]
|
||||||
Radius = 5,
|
{
|
||||||
Colour = accentColour.Opacity(0.5f),
|
hitTargetBar = new Box
|
||||||
};
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = NotePiece.NOTE_HEIGHT,
|
||||||
|
Alpha = 0.6f,
|
||||||
|
Colour = Color4.Black
|
||||||
|
},
|
||||||
|
hitTargetLine = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = hit_target_bar_height,
|
||||||
|
Masking = true,
|
||||||
|
Child = new Box { RelativeSizeAxes = Axes.Both }
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
|
{
|
||||||
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
|
direction.BindValueChanged(dir =>
|
||||||
|
{
|
||||||
|
Anchor anchor = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
|
||||||
|
|
||||||
|
hitTargetBar.Anchor = hitTargetBar.Origin = anchor;
|
||||||
|
hitTargetLine.Anchor = hitTargetLine.Origin = anchor;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
updateColours();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 accentColour;
|
||||||
|
|
||||||
|
public Color4 AccentColour
|
||||||
|
{
|
||||||
|
get => accentColour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (accentColour == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
accentColour = value;
|
||||||
|
|
||||||
|
updateColours();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateColours()
|
||||||
|
{
|
||||||
|
if (!IsLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hitTargetLine.EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Radius = 5,
|
||||||
|
Colour = accentColour.Opacity(0.5f),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Cursor;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.SearchableList
|
namespace osu.Game.Overlays.SearchableList
|
||||||
{
|
{
|
||||||
@ -61,21 +62,20 @@ namespace osu.Game.Overlays.SearchableList
|
|||||||
scrollContainer = new Container
|
scrollContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Child = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
new OsuScrollContainer
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
Child = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
Children = new[]
|
Child = ScrollFlow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
ScrollFlow = new FillFlowContainer
|
RelativeSizeAxes = Axes.X,
|
||||||
{
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
Padding = new MarginPadding { Horizontal = WIDTH_PADDING, Bottom = 50 },
|
||||||
AutoSizeAxes = Axes.Y,
|
Direction = FillDirection.Vertical,
|
||||||
Padding = new MarginPadding { Horizontal = WIDTH_PADDING, Bottom = 50 },
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user