1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:42:56 +08:00

Merge branch 'master' into editor-wheel-movement

This commit is contained in:
Dean Herbert 2018-03-16 18:19:42 +09:00 committed by GitHub
commit e8f7f2c8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 49 additions and 58 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft; Origin = Anchor.BottomLeft;
X = 0; X = 0;
Child = bananaContainer = new Container { RelativeSizeAxes = Axes.Both }; InternalChild = bananaContainer = new Container { RelativeSizeAxes = Axes.Both };
foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>()) foreach (var b in s.NestedHitObjects.Cast<BananaShower.Banana>())
AddNested(getVisualRepresentation?.Invoke(b)); AddNested(getVisualRepresentation?.Invoke(b));

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Child = new Pulp InternalChild = new Pulp
{ {
AccentColour = AccentColour, AccentColour = AccentColour,
Size = Size Size = Size

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Children = new[] InternalChildren = new[]
{ {
createPulp(HitObject.VisualRepresentation), createPulp(HitObject.VisualRepresentation),
border = new Circle border = new Circle
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
if (HitObject.HyperDash) if (HitObject.HyperDash)
{ {
Add(new Pulp AddInternal(new Pulp
{ {
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Origin = Anchor.BottomLeft; Origin = Anchor.BottomLeft;
X = 0; X = 0;
Child = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, }; InternalChild = dropletContainer = new Container { RelativeSizeAxes = Axes.Both, };
foreach (var o in s.NestedHitObjects.Cast<CatchHitObject>()) foreach (var o in s.NestedHitObjects.Cast<CatchHitObject>())
AddNested(getVisualRepresentation?.Invoke(o)); AddNested(getVisualRepresentation?.Invoke(o));

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 1; Height = 1;
Add(new Box AddInternal(new Box
{ {
Name = "Bar line", Name = "Bar line",
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (isMajor) if (isMajor)
{ {
Add(new EquilateralTriangle AddInternal(new EquilateralTriangle
{ {
Name = "Left triangle", Name = "Left triangle",
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Rotation = 90 Rotation = 90
}); });
Add(new EquilateralTriangle AddInternal(new EquilateralTriangle
{ {
Name = "Right triangle", Name = "Right triangle",
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AddRange(new Drawable[] InternalChildren = new Drawable[]
{ {
// The hit object itself cannot be used for various elements because the tail overshoots it // The hit object itself cannot be used for various elements because the tail overshoots it
// So a specialized container that is updated to contain the tail height is used // So a specialized container that is updated to contain the tail height is used
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
} }
}); };
foreach (var tick in HitObject.NestedHitObjects.OfType<HoldNoteTick>()) foreach (var tick in HitObject.NestedHitObjects.OfType<HoldNoteTick>())
{ {

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Size = new Vector2(1); Size = new Vector2(1);
Children = new[] InternalChildren = new[]
{ {
glowContainer = new CircularContainer glowContainer = new CircularContainer
{ {

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
laneGlowPiece = new LaneGlowPiece laneGlowPiece = new LaneGlowPiece
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Position = HitObject.StackedPosition; Position = HitObject.StackedPosition;
Scale = new Vector2(h.Scale); Scale = new Vector2(h.Scale);
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
glow = new GlowPiece glow = new GlowPiece
{ {

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Blending = BlendingMode.Additive; Blending = BlendingMode.Additive;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
new SpriteIcon new SpriteIcon
{ {

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Container<DrawableSliderTick> ticks; Container<DrawableSliderTick> ticks;
Container<DrawableRepeatPoint> repeatPoints; Container<DrawableRepeatPoint> repeatPoints;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
Body = new SliderBody(s) Body = new SliderBody(s)
{ {

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
BorderThickness = 2; BorderThickness = 2;
BorderColour = Color4.White; BorderColour = Color4.White;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box new Box
{ {

View File

@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Spinner = s; Spinner = s;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
circleContainer = new Container circleContainer = new Container
{ {

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = tracker_width; Width = tracker_width;
Children = new[] InternalChildren = new[]
{ {
Tracker = new Box Tracker = new Box
{ {

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public DrawableBarLineMajor(BarLine barLine) public DrawableBarLineMajor(BarLine barLine)
: base(barLine) : base(barLine)
{ {
Add(triangleContainer = new Container AddInternal(triangleContainer = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (state) switch (state)
{ {
case ArmedState.Hit: case ArmedState.Hit:
Content.ScaleTo(0, 100, Easing.OutQuint).Expire(); this.ScaleTo(0, 100, Easing.OutQuint).Expire();
break; break;
} }
} }

View File

@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
const float gravity_time = 300; const float gravity_time = 300;
const float gravity_travel_height = 200; const float gravity_travel_height = 200;
Content.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad); this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out) this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
.Then() .Then()

View File

@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
FillMode = FillMode.Fit; FillMode = FillMode.Fit;
Add(bodyContainer = new Container AddInternal(bodyContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = 1, Depth = 1,

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE); Size = BaseSize = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
Add(MainPiece = CreateMainPiece()); InternalChild = MainPiece = CreateMainPiece();
MainPiece.KiaiMode = HitObject.Kiai; MainPiece.KiaiMode = HitObject.Kiai;
} }

View File

@ -140,12 +140,12 @@ namespace osu.Game.Tests.Visual
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Add(new Box InternalChild = new Box
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}); };
switch (direction) switch (direction)
{ {
@ -175,7 +175,7 @@ namespace osu.Game.Tests.Visual
Origin = Anchor.Centre; Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Add(new Box { Size = new Vector2(75) }); InternalChild = new Box { Size = new Vector2(75) };
} }
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)

View File

@ -27,14 +27,8 @@ namespace osu.Game.Overlays.Mods
public string Header public string Header
{ {
get get => headerLabel.Text;
{ set => headerLabel.Text = value;
return headerLabel.Text;
}
set
{
headerLabel.Text = value;
}
} }
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null); public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
@ -47,7 +41,7 @@ namespace osu.Game.Overlays.Mods
{ {
if (m == null) if (m == null)
return new ModButtonEmpty(); return new ModButtonEmpty();
else
return new ModButton(m) return new ModButton(m)
{ {
SelectedColour = selectedColour, SelectedColour = selectedColour,
@ -65,10 +59,7 @@ namespace osu.Game.Overlays.Mods
private Color4 selectedColour = Color4.White; private Color4 selectedColour = Color4.White;
public Color4 SelectedColour public Color4 SelectedColour
{ {
get get => selectedColour;
{
return selectedColour;
}
set set
{ {
if (value == selectedColour) return; if (value == selectedColour) return;
@ -102,31 +93,31 @@ namespace osu.Game.Overlays.Mods
{ {
Mod selected = button.SelectedMod; Mod selected = button.SelectedMod;
if (selected == null) continue; if (selected == null) continue;
foreach (Type type in modTypes) foreach (var type in modTypes)
if (type.IsInstanceOfType(selected)) if (type.IsInstanceOfType(selected))
{ {
if (immediate) if (immediate)
button.Deselect(); button.Deselect();
else else
Scheduler.AddDelayed(() => button.Deselect(), delay += 50); Scheduler.AddDelayed(button.Deselect, delay += 50);
} }
} }
} }
/// <summary> /// <summary>
/// Select one or more mods in this section. /// Select one or more mods in this section and deselects all other ones.
/// </summary> /// </summary>
/// <param name="mods">The types of <see cref="Mod"/>s which should be deselected.</param> /// <param name="modTypes">The types of <see cref="Mod"/>s which should be selected.</param>
public void SelectTypes(IEnumerable<Mod> mods) public void SelectTypes(IEnumerable<Type> modTypes)
{ {
foreach (var button in buttons) foreach (var button in buttons)
{ {
for (int i = 0; i < button.Mods.Length; i++) int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m)));
{
foreach (var mod in mods) if (i >= 0)
if (mod.GetType().IsInstanceOfType(button.Mods[i]))
button.SelectAt(i); button.SelectAt(i);
} else
button.Deselect();
} }
} }

View File

@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Mods
private void selectedModsChanged(IEnumerable<Mod> obj) private void selectedModsChanged(IEnumerable<Mod> obj)
{ {
foreach (ModSection section in ModSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.SelectTypes(obj); section.SelectTypes(obj.Select(m => m.GetType()).ToList());
updateMods(); updateMods();
} }

View File

@ -19,7 +19,7 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables namespace osu.Game.Rulesets.Objects.Drawables
{ {
public abstract class DrawableHitObject : Container, IHasAccentColour public abstract class DrawableHitObject : CompositeDrawable, IHasAccentColour
{ {
public readonly HitObject HitObject; public readonly HitObject HitObject;

View File

@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select
if (removeAutoModOnResume) if (removeAutoModOnResume)
{ {
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType(); var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
SelectedMods.Value = SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray(); modSelect.DeselectTypes(new[] { autoType }, true);
removeAutoModOnResume = false; removeAutoModOnResume = false;
} }