1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 18:27:26 +08:00

Merge remote-tracking branch 'upstream/master' into channel-selection

This commit is contained in:
Dean Herbert 2017-06-05 17:30:46 +09:00
commit 778865b6eb
46 changed files with 949 additions and 495 deletions

@ -1 +1 @@
Subproject commit e5f0cf73c1e0bbcbd04194bf175d73af47fc850a
Subproject commit 925bbe42bab95078b9d33189205b5b1b76bf8e01

View File

@ -0,0 +1,55 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.ReplaySettings;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseReplaySettingsOverlay : TestCase
{
public override string Description => @"Settings visible in replay/auto";
private ExampleContainer container;
public override void Reset()
{
base.Reset();
Add(new ReplaySettingsOverlay()
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
});
Add(container = new ExampleContainer());
AddStep(@"Add button", () => container.Add(new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = @"Button",
}));
AddStep(@"Add checkbox", () => container.Add(new ReplayCheckbox
{
LabelText = "Checkbox",
}));
AddStep(@"Add textbox", () => container.Add(new FocusedTextBox
{
RelativeSizeAxes = Axes.X,
Height = 30,
PlaceholderText = "Textbox",
HoldFocus = false,
}));
}
private class ExampleContainer : ReplayGroup
{
protected override string Title => @"example";
}
}
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Testing;
using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseSkipButton : TestCase
{
public override string Description => @"Skip skip skippediskip";
public override void Reset()
{
base.Reset();
Add(new SkipButton(Clock.CurrentTime + 5000));
}
}
}

View File

@ -1,92 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Configuration;
using OpenTK;
using osu.Game.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseTooltip : TestCase
{
public override string Description => "tests tooltips on various elements";
public override void Reset()
{
base.Reset();
OsuSliderBar<int> slider;
OsuSliderBar<double> sliderDouble;
const float width = 400;
Children = new Drawable[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new TooltipTextContainer("text with a tooltip"),
new TooltipTextContainer("more text with another tooltip"),
new TooltipTextbox
{
Text = "a textbox with a tooltip",
Size = new Vector2(width,30),
},
slider = new OsuSliderBar<int>
{
Width = width,
},
sliderDouble = new OsuSliderBar<double>
{
Width = width,
},
},
},
};
slider.Current.BindTo(new BindableInt(5)
{
MaxValue = 10,
MinValue = 0
});
sliderDouble.Current.BindTo(new BindableDouble(0.5)
{
MaxValue = 1,
MinValue = 0
});
}
private class TooltipTextContainer : Container, IHasTooltip
{
private readonly OsuSpriteText text;
public string TooltipText => text.Text;
public TooltipTextContainer(string tooltipText)
{
AutoSizeAxes = Axes.Both;
Children = new[]
{
text = new OsuSpriteText
{
Text = tooltipText,
}
};
}
}
private class TooltipTextbox : OsuTextBox, IHasTooltip
{
public string TooltipText => Text;
}
}
}

View File

@ -3,20 +3,18 @@
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseTwoLayerButton : TestCase
{
public override string Description => @"Back and skip and what not";
public override string Description => @"Mostly back button";
public override void Reset()
{
base.Reset();
Add(new BackButton());
Add(new SkipButton(Clock.CurrentTime + 5000));
}
}
}

View File

@ -196,6 +196,7 @@
<Compile Include="Tests\TestCaseMusicController.cs" />
<Compile Include="Tests\TestCaseNotificationManager.cs" />
<Compile Include="Tests\TestCaseOnScreenDisplay.cs" />
<Compile Include="Tests\TestCaseReplaySettingsOverlay.cs" />
<Compile Include="Tests\TestCasePlayer.cs" />
<Compile Include="Tests\TestCaseHitObjects.cs" />
<Compile Include="Tests\TestCaseKeyCounter.cs" />
@ -203,12 +204,12 @@
<Compile Include="Tests\TestCaseReplay.cs" />
<Compile Include="Tests\TestCaseResults.cs" />
<Compile Include="Tests\TestCaseScoreCounter.cs" />
<Compile Include="Tests\TestCaseSkipButton.cs" />
<Compile Include="Tests\TestCaseTabControl.cs" />
<Compile Include="Tests\TestCaseTaikoHitObjects.cs" />
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
<Compile Include="Tests\TestCaseTextAwesome.cs" />
<Compile Include="Tests\TestCasePlaySongSelect.cs" />
<Compile Include="Tests\TestCaseTooltip.cs" />
<Compile Include="Tests\TestCaseTwoLayerButton.cs" />
<Compile Include="VisualTestGame.cs" />
<Compile Include="Platform\TestStorage.cs" />

View File

@ -28,7 +28,14 @@ namespace osu.Game.Rulesets.Catch
{
new CatchModEasy(),
new CatchModNoFail(),
new CatchModHalfTime(),
new MultiMod
{
Mods = new Mod[]
{
new CatchModHalfTime(),
new CatchModDaycore(),
},
},
};
case ModType.DifficultyIncrease:

View File

@ -32,6 +32,11 @@ namespace osu.Game.Rulesets.Catch.Mods
}
public class CatchModDaycore : ModDaycore
{
public override double ScoreMultiplier => 0.5;
}
public class CatchModDoubleTime : ModDoubleTime
{
public override double ScoreMultiplier => 1.06;

View File

@ -27,7 +27,14 @@ namespace osu.Game.Rulesets.Mania
{
new ManiaModEasy(),
new ManiaModNoFail(),
new ManiaModHalfTime(),
new MultiMod
{
Mods = new Mod[]
{
new ManiaModHalfTime(),
new ManiaModDaycore(),
},
},
};
case ModType.DifficultyIncrease:

View File

@ -34,6 +34,11 @@ namespace osu.Game.Rulesets.Mania.Mods
}
public class ManiaModDaycore : ModDaycore
{
public override double ScoreMultiplier => 0.3;
}
public class ManiaModDoubleTime : ModDoubleTime
{
public override double ScoreMultiplier => 1.0;

View File

@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.Mods
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
}
public class OsuModDaycore : ModDaycore
{
public override double ScoreMultiplier => 0.5;
}
public class OsuModDoubleTime : ModDoubleTime
{
public override double ScoreMultiplier => 1.12;

View File

@ -46,7 +46,14 @@ namespace osu.Game.Rulesets.Osu
{
new OsuModEasy(),
new OsuModNoFail(),
new OsuModHalfTime(),
new MultiMod
{
Mods = new Mod[]
{
new OsuModHalfTime(),
new OsuModDaycore(),
},
},
};
case ModType.DifficultyIncrease:

View File

@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Taiko.Mods
}
public class TaikoModDaycore : ModDaycore
{
public override double ScoreMultiplier => 0.5;
}
public class TaikoModDoubleTime : ModDoubleTime
{
public override double ScoreMultiplier => 1.12;

View File

@ -28,7 +28,14 @@ namespace osu.Game.Rulesets.Taiko
{
new TaikoModEasy(),
new TaikoModNoFail(),
new TaikoModHalfTime(),
new MultiMod
{
Mods = new Mod[]
{
new TaikoModHalfTime(),
new TaikoModDaycore(),
},
},
};
case ModType.DifficultyIncrease:

View File

@ -20,6 +20,8 @@ namespace osu.Game.Configuration
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10);
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10);
Set(OsuSetting.SelectionRandomType, SelectionRandomType.RandomPermutation);
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
// Online settings
@ -69,6 +71,9 @@ namespace osu.Game.Configuration
Set(OsuSetting.ShowInterface, true);
Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.FloatingComments, false);
Set(OsuSetting.PlaybackSpeed, 1.0, 0.5f, 2);
// Update
Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
@ -88,6 +93,8 @@ namespace osu.Game.Configuration
AutoCursorSize,
DimLevel,
KeyOverlay,
FloatingComments,
PlaybackSpeed,
ShowInterface,
MouseDisableButtons,
MouseDisableWheel,
@ -102,6 +109,7 @@ namespace osu.Game.Configuration
SaveUsername,
DisplayStarsMinimum,
DisplayStarsMaximum,
SelectionRandomType,
SnakingInSliders,
SnakingOutSliders,
ShowFpsDisplay,

View File

@ -0,0 +1,15 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum SelectionRandomType
{
[Description("Never repeat")]
RandomPermutation,
[Description("Random")]
Random
}
}

View File

@ -11,6 +11,6 @@ namespace osu.Game.Graphics.Containers
public class ReverseDepthFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
{
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<T> FlowingChildren => base.FlowingChildren.Reverse();
protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
}
}

View File

@ -93,6 +93,7 @@ namespace osu.Game.Graphics.Cursor
{
private Container cursorContainer;
private Bindable<double> cursorScale;
private const float base_scale = 0.15f;
public Sprite AdditiveLayer;
@ -108,17 +109,15 @@ namespace osu.Game.Graphics.Cursor
{
cursorContainer = new Container
{
Size = new Vector2(32),
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Sprite
{
FillMode = FillMode.Fit,
Texture = textures.Get(@"Cursor/menu-cursor"),
},
AdditiveLayer = new Sprite
{
FillMode = FillMode.Fit,
BlendingMode = BlendingMode.Additive,
Colour = colour.Pink,
Alpha = 0,
@ -129,7 +128,7 @@ namespace osu.Game.Graphics.Cursor
};
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale);
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale);
cursorScale.TriggerChange();
}
}

View File

@ -0,0 +1,93 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.Cursor
{
public class OsuTooltipContainer : TooltipContainer
{
protected override Tooltip CreateTooltip() => new OsuTooltip();
public OsuTooltipContainer(CursorContainer cursor) : base(cursor)
{
}
public class OsuTooltip : Tooltip
{
private readonly Box background;
private readonly OsuSpriteText text;
public override string TooltipText
{
set
{
if (value == text.Text) return;
text.Text = value;
if (Alpha > 0)
{
AutoSizeDuration = 250;
background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint);
}
else
AutoSizeDuration = 0;
}
}
private const float text_size = 16;
public OsuTooltip()
{
AutoSizeEasing = EasingTypes.OutQuint;
CornerRadius = 5;
Masking = true;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(40),
Radius = 5,
};
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.9f,
},
text = new OsuSpriteText
{
TextSize = text_size,
Padding = new MarginPadding(5),
Font = @"Exo2.0-Regular",
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
background.Colour = colour.Gray3;
}
protected override void PopIn()
{
FadeIn(500, EasingTypes.OutQuint);
}
protected override void PopOut()
{
using (BeginDelayedSequence(150))
FadeOut(500, EasingTypes.OutQuint);
}
}
}
}

View File

@ -1,157 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
using System.Linq;
namespace osu.Game.Graphics.Cursor
{
public class TooltipContainer : Container
{
private readonly CursorContainer cursor;
private readonly Tooltip tooltip;
private ScheduledDelegate findTooltipTask;
private UserInputManager inputManager;
private const int default_appear_delay = 220;
private IHasTooltip currentlyDisplayed;
public TooltipContainer(CursorContainer cursor)
{
this.cursor = cursor;
AlwaysPresent = true;
RelativeSizeAxes = Axes.Both;
Add(tooltip = new Tooltip { Alpha = 0 });
}
[BackgroundDependencyLoader]
private void load(UserInputManager input)
{
inputManager = input;
}
protected override void Update()
{
if (tooltip.IsPresent)
{
if (currentlyDisplayed != null)
tooltip.TooltipText = currentlyDisplayed.TooltipText;
//update the position of the displayed tooltip.
tooltip.Position = ToLocalSpace(cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre) + new Vector2(10);
}
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
updateTooltipState(state);
return base.OnMouseUp(state, args);
}
protected override bool OnMouseMove(InputState state)
{
updateTooltipState(state);
return base.OnMouseMove(state);
}
private void updateTooltipState(InputState state)
{
if (currentlyDisplayed?.Hovering != true)
{
if (currentlyDisplayed != null && !state.Mouse.HasMainButtonPressed)
{
tooltip.Delay(150);
tooltip.FadeOut(500, EasingTypes.OutQuint);
currentlyDisplayed = null;
}
findTooltipTask?.Cancel();
findTooltipTask = Scheduler.AddDelayed(delegate
{
var tooltipTarget = inputManager.HoveredDrawables.OfType<IHasTooltip>().FirstOrDefault();
if (tooltipTarget == null) return;
tooltip.TooltipText = tooltipTarget.TooltipText;
tooltip.FadeIn(500, EasingTypes.OutQuint);
currentlyDisplayed = tooltipTarget;
}, (1 - tooltip.Alpha) * default_appear_delay);
}
}
public class Tooltip : Container
{
private readonly Box background;
private readonly OsuSpriteText text;
public string TooltipText
{
set
{
if (value == text.Text) return;
text.Text = value;
if (Alpha > 0)
{
AutoSizeDuration = 250;
background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint);
}
else
AutoSizeDuration = 0;
}
}
public override bool HandleInput => false;
private const float text_size = 16;
public Tooltip()
{
AutoSizeEasing = EasingTypes.OutQuint;
AutoSizeAxes = Axes.Both;
CornerRadius = 5;
Masking = true;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(40),
Radius = 5,
};
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.9f,
},
text = new OsuSpriteText
{
TextSize = text_size,
Padding = new MarginPadding(5),
Font = @"Exo2.0-Regular",
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
background.Colour = colour.Gray3;
}
}
}
}

View File

@ -1,15 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
namespace osu.Game.Graphics
{
public interface IHasTooltip : IDrawable
{
/// <summary>
/// Tooltip that shows when hovering the drawable
/// </summary>
string TooltipText { get; }
}
}

View File

@ -0,0 +1,114 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface
{
public class IconButton : ClickableContainer
{
private readonly TextAwesome icon;
private readonly Box hover;
private readonly Container content;
public FontAwesome Icon
{
get { return icon.Icon; }
set { icon.Icon = value; }
}
private const float button_size = 30;
private Color4 flashColour;
public Vector2 IconScale
{
get { return icon.Scale; }
set { icon.Scale = value; }
}
public IconButton()
{
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Children = new Drawable[]
{
content = new Container
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2 (button_size),
CornerRadius = 5,
Masking = true,
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.04f),
Type = EdgeEffectType.Shadow,
Radius = 5,
},
Children = new Drawable[]
{
hover = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
},
icon = new TextAwesome
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
TextSize = 18,
}
}
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hover.Colour = colours.Yellow.Opacity(0.6f);
flashColour = colours.Yellow;
}
protected override bool OnHover(InputState state)
{
hover.FadeIn(500, EasingTypes.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
hover.FadeOut(500, EasingTypes.OutQuint);
base.OnHoverLost(state);
}
protected override bool OnClick(InputState state)
{
hover.FlashColour(flashColour, 800, EasingTypes.OutQuint);
return base.OnClick(state);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint);
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
content.ScaleTo(1, 1000, EasingTypes.OutElastic);
return base.OnMouseUp(state, args);
}
}
}

View File

@ -12,13 +12,12 @@ using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class Nub : CircularContainer, IHasCurrentValue<bool>
public class Nub : CircularContainer, IHasCurrentValue<bool>, IHasAccentColour
{
public const float COLLAPSED_SIZE = 20;
public const float EXPANDED_SIZE = 40;
private const float border_width = 3;
private Color4 glowingColour, idleColour;
public Nub()
{
@ -53,33 +52,41 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = idleColour = colours.Pink;
glowingColour = colours.PinkLighter;
AccentColour = colours.Pink;
GlowingAccentColour = colours.PinkLighter;
GlowColour = colours.PinkDarker;
EdgeEffect = new EdgeEffect
{
Colour = colours.PinkDarker,
Colour = GlowColour,
Type = EdgeEffectType.Glow,
Radius = 10,
Roundness = 8,
};
}
protected override void LoadComplete()
{
FadeEdgeEffectTo(0);
}
private bool glowing;
public bool Glowing
{
get { return glowing; }
set
{
glowing = value;
if (value)
{
FadeColour(glowingColour, 500, EasingTypes.OutQuint);
FadeColour(GlowingAccentColour, 500, EasingTypes.OutQuint);
FadeEdgeEffectTo(1, 500, EasingTypes.OutQuint);
}
else
{
FadeEdgeEffectTo(0, 500);
FadeColour(idleColour, 500);
FadeColour(AccentColour, 500);
}
}
}
@ -93,5 +100,43 @@ namespace osu.Game.Graphics.UserInterface
}
public Bindable<bool> Current { get; } = new Bindable<bool>();
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
set
{
accentColour = value;
if (!Glowing)
Colour = value;
}
}
private Color4 glowingAccentColour;
public Color4 GlowingAccentColour
{
get { return glowingAccentColour; }
set
{
glowingAccentColour = value;
if (Glowing)
Colour = value;
}
}
private Color4 glowColour;
public Color4 GlowColour
{
get { return glowColour; }
set
{
glowColour = value;
var effect = EdgeEffect;
effect.Colour = value;
EdgeEffect = effect;
}
}
}
}

View File

@ -51,7 +51,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
private readonly Nub nub;
protected readonly Nub Nub;
private readonly SpriteText labelSpriteText;
private SampleChannel sampleChecked;
private SampleChannel sampleUnchecked;
@ -64,7 +65,7 @@ namespace osu.Game.Graphics.UserInterface
Children = new Drawable[]
{
labelSpriteText = new OsuSpriteText(),
nub = new Nub
Nub = new Nub
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
@ -72,7 +73,7 @@ namespace osu.Game.Graphics.UserInterface
}
};
nub.Current.BindTo(Current);
Nub.Current.BindTo(Current);
Current.ValueChanged += newValue =>
{
@ -90,15 +91,15 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(InputState state)
{
nub.Glowing = true;
nub.Expanded = true;
Nub.Glowing = true;
Nub.Expanded = true;
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
nub.Glowing = false;
nub.Expanded = false;
Nub.Glowing = false;
Nub.Expanded = false;
base.OnHoverLost(state);
}

View File

@ -3,6 +3,7 @@
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@ -11,17 +12,18 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Graphics.UserInterface
{
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip, IHasAccentColour
where T : struct, IEquatable<T>
{
private SampleChannel sample;
private double lastSampleTime;
private T lastSampleValue;
private readonly Nub nub;
protected readonly Nub Nub;
private readonly Box leftBox;
private readonly Box rightBox;
@ -45,6 +47,18 @@ namespace osu.Game.Graphics.UserInterface
}
}
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
set
{
accentColour = value;
leftBox.Colour = value;
rightBox.Colour = value;
}
}
public OsuSliderBar()
{
Height = 12;
@ -70,7 +84,7 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.CentreRight,
Alpha = 0.5f,
},
nub = new Nub
Nub = new Nub
{
Origin = Anchor.TopCentre,
Expanded = true,
@ -87,19 +101,18 @@ namespace osu.Game.Graphics.UserInterface
private void load(AudioManager audio, OsuColour colours)
{
sample = audio.Sample.Get(@"Sliderbar/sliderbar");
leftBox.Colour = colours.Pink;
rightBox.Colour = colours.Pink;
AccentColour = colours.Pink;
}
protected override bool OnHover(InputState state)
{
nub.Glowing = true;
Nub.Glowing = true;
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
nub.Glowing = false;
Nub.Glowing = false;
base.OnHoverLost(state);
}
@ -132,13 +145,13 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
nub.Current.Value = true;
Nub.Current.Value = true;
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
nub.Current.Value = false;
Nub.Current.Value = false;
return base.OnMouseUp(state, args);
}
@ -146,14 +159,14 @@ namespace osu.Game.Graphics.UserInterface
{
base.UpdateAfterChildren();
leftBox.Scale = new Vector2(MathHelper.Clamp(
nub.DrawPosition.X - nub.DrawWidth / 2, 0, DrawWidth), 1);
Nub.DrawPosition.X - Nub.DrawWidth / 2, 0, DrawWidth), 1);
rightBox.Scale = new Vector2(MathHelper.Clamp(
DrawWidth - nub.DrawPosition.X - nub.DrawWidth / 2, 0, DrawWidth), 1);
DrawWidth - Nub.DrawPosition.X - Nub.DrawWidth / 2, 0, DrawWidth), 1);
}
protected override void UpdateValue(float value)
{
nub.MoveToX(RangePadding + UsableWidth * value, 250, EasingTypes.OutQuint);
Nub.MoveToX(RangePadding + UsableWidth * value, 250, EasingTypes.OutQuint);
}
}
}

View File

@ -158,7 +158,7 @@ namespace osu.Game
Children = new Drawable[]
{
Cursor = new MenuCursor(),
new TooltipContainer(Cursor) { Depth = -1 },
new OsuTooltipContainer(Cursor) { Depth = -1 },
}
},
}

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Chat;
@ -43,11 +44,15 @@ namespace osu.Game.Overlays.Chat
channel.NewMessagesArrived += newMessagesArrived;
}
[BackgroundDependencyLoader]
private void load()
{
newMessagesArrived(Channel.Messages);
}
protected override void LoadComplete()
{
base.LoadComplete();
newMessagesArrived(Channel.Messages);
scrollToEnd();
}
@ -59,13 +64,13 @@ namespace osu.Game.Overlays.Chat
private void newMessagesArrived(IEnumerable<Message> newMessages)
{
if (!IsLoaded) return;
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
//up to last Channel.MAX_HISTORY messages
flow.Add(displayMessages.Select(m => new ChatLine(m)));
if (!IsLoaded) return;
if (scroll.IsScrolledToEnd(10) || !flow.Children.Any())
scrollToEnd();

View File

@ -326,20 +326,30 @@ namespace osu.Game.Overlays
if (channelTabs.ChannelSelectorActive) return;
if (currentChannel != null)
currentChannelContainer.Clear(false);
currentChannel = value;
inputTextBox.Current.Disabled = currentChannel.ReadOnly;
channelTabs.Current.Value = value;
var loaded = loadedChannels.Find(d => d.Channel == value);
if (loaded == null)
loadedChannels.Add(loaded = new DrawableChannel(currentChannel));
{
currentChannelContainer.FadeOut(500, EasingTypes.OutQuint);
inputTextBox.Current.Disabled = currentChannel.ReadOnly;
currentChannelContainer.Add(loaded);
channelTabs.Current.Value = value;
loaded = new DrawableChannel(currentChannel);
loadedChannels.Add(loaded);
LoadComponentAsync(loaded, l =>
{
currentChannelContainer.Clear(false);
currentChannelContainer.Add(l);
currentChannelContainer.FadeIn(500, EasingTypes.OutQuint);
});
}
else
{
currentChannelContainer.Clear(false);
currentChannelContainer.Add(loaded);
}
}
}

View File

@ -16,7 +16,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using System;
using System.Linq;
using osu.Game.Graphics;
using osu.Framework.Graphics.Cursor;
namespace osu.Game.Overlays.Mods
{

View File

@ -0,0 +1,73 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Music
{
public class CollectionsDropdown<T> : OsuDropdown<T>
{
protected override DropdownHeader CreateHeader() => new CollectionsHeader { AccentColour = AccentColour };
protected override Menu CreateMenu() => new CollectionsMenu();
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Gray6;
}
private class CollectionsHeader : OsuDropdownHeader
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.Gray4;
}
public CollectionsHeader()
{
CornerRadius = 5;
Height = 30;
Icon.TextSize = 14;
Icon.Margin = new MarginPadding(0);
Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4, Left = 10, Right = 10 };
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.3f),
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
private class CollectionsMenu : OsuMenu
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Background.Colour = colours.Gray4;
}
public CollectionsMenu()
{
CornerRadius = 5;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.3f),
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
}
}

View File

@ -3,10 +3,8 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
@ -74,63 +72,5 @@ namespace osu.Game.Overlays.Music
backgroundColour = colours.Gray2;
}
}
private class CollectionsDropdown<T> : OsuDropdown<T>
{
protected override DropdownHeader CreateHeader() => new CollectionsHeader { AccentColour = AccentColour };
protected override Menu CreateMenu() => new CollectionsMenu();
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Gray6;
}
private class CollectionsHeader : OsuDropdownHeader
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.Gray4;
}
public CollectionsHeader()
{
CornerRadius = 5;
Height = 30;
Icon.TextSize = 14;
Icon.Margin = new MarginPadding(0);
Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4, Left = 10, Right = 10 };
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.3f),
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
private class CollectionsMenu : OsuMenu
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Background.Colour = colours.Gray4;
}
public CollectionsMenu()
{
CornerRadius = 5;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.3f),
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
}
}
}

View File

@ -22,6 +22,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Threading;
using osu.Game.Overlays.Music;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays
{
@ -38,8 +39,8 @@ namespace osu.Game.Overlays
private Drawable currentBackground;
private DragBar progressBar;
private Button playButton;
private Button playlistButton;
private IconButton playButton;
private IconButton playlistButton;
private SpriteText title, artist;
@ -143,7 +144,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomCentre,
Children = new Drawable[]
{
new FillFlowContainer<Button>
new FillFlowContainer<IconButton>
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
@ -152,26 +153,26 @@ namespace osu.Game.Overlays
Anchor = Anchor.Centre,
Children = new[]
{
new Button
new IconButton
{
Action = prev,
Icon = FontAwesome.fa_step_backward,
},
playButton = new Button
playButton = new IconButton
{
Scale = new Vector2(1.4f),
IconScale = new Vector2(1.4f),
Action = play,
Icon = FontAwesome.fa_play_circle_o,
},
new Button
new IconButton
{
Action = next,
Icon = FontAwesome.fa_step_forward,
},
}
},
playlistButton = new Button
playlistButton = new IconButton
{
Origin = Anchor.Centre,
Anchor = Anchor.CentreRight,
@ -415,105 +416,5 @@ namespace osu.Game.Overlays
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
}
}
private class Button : ClickableContainer
{
private readonly TextAwesome icon;
private readonly Box hover;
private readonly Container content;
public FontAwesome Icon
{
get { return icon.Icon; }
set { icon.Icon = value; }
}
private const float button_size = 30;
private Color4 flashColour;
public Vector2 IconScale
{
get { return icon.Scale; }
set { icon.Scale = value; }
}
public Button()
{
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Children = new Drawable[]
{
content = new Container
{
Size = new Vector2(button_size),
CornerRadius = 5,
Masking = true,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
EdgeEffect = new EdgeEffect
{
Colour = Color4.Black.Opacity(0.04f),
Type = EdgeEffectType.Shadow,
Radius = 5,
},
Children = new Drawable[]
{
hover = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
},
icon = new TextAwesome
{
TextSize = 18,
Origin = Anchor.Centre,
Anchor = Anchor.Centre
}
}
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
hover.Colour = colours.Yellow.Opacity(0.6f);
flashColour = colours.Yellow;
}
protected override bool OnHover(InputState state)
{
hover.FadeIn(500, EasingTypes.OutQuint);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
hover.FadeOut(500, EasingTypes.OutQuint);
base.OnHoverLost(state);
}
protected override bool OnClick(InputState state)
{
hover.FlashColour(flashColour, 800, EasingTypes.OutQuint);
return base.OnClick(state);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint);
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
content.ScaleTo(1, 1000, EasingTypes.OutElastic);
return base.OnMouseUp(state, args);
}
}
}
}

View File

@ -27,6 +27,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
LabelText = "up to",
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum)
},
new SettingsEnumDropdown<SelectionRandomType>
{
LabelText = "Random beatmap selection",
Bindable = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType),
},
};
}

View File

@ -0,0 +1,25 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Audio;
using osu.Framework.Timing;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModDaycore : ModHalfTime
{
public override string Name => "Daycore";
public override FontAwesome Icon => FontAwesome.fa_question;
public override string Description => "whoaaaaa";
public override void ApplyToClock(IAdjustableClock clock)
{
var pitchAdjust = clock as IHasPitchAdjust;
if (pitchAdjust != null)
pitchAdjust.PitchAdjust = 0.75;
else
base.ApplyToClock(clock);
}
}
}

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mods
public override double ScoreMultiplier => 1.12;
public void ApplyToClock(IAdjustableClock clock)
public virtual void ApplyToClock(IAdjustableClock clock)
{
clock.Rate = 0.75;
}

View File

@ -31,6 +31,7 @@ namespace osu.Game.Screens.Play
public readonly ModDisplay ModDisplay;
private Bindable<bool> showHud;
private bool replayLoaded;
private static bool hasShownNotificationOnce;
@ -41,6 +42,7 @@ namespace osu.Game.Screens.Play
protected abstract HealthDisplay CreateHealthDisplay();
protected abstract SongProgress CreateProgress();
protected abstract ModDisplay CreateModsContainer();
//protected abstract ReplaySettingsOverlay CreateReplaySettingsOverlay();
protected HUDOverlay()
{
@ -59,6 +61,7 @@ namespace osu.Game.Screens.Play
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
//ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
}
});
}
@ -93,10 +96,14 @@ namespace osu.Game.Screens.Play
{
hitRenderer.InputManager.Add(KeyCounter.GetReceptor());
replayLoaded = hitRenderer.HasReplayLoaded;
// in the case a replay isn't loaded, we want some elements to only appear briefly.
if (!hitRenderer.HasReplayLoaded)
if (!replayLoaded)
{
using (ModDisplay.BeginDelayedSequence(2000))
ModDisplay.FadeOut(200);
}
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -0,0 +1,33 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Music;
using System.Collections.Generic;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class CollectionSettings : ReplayGroup
{
protected override string Title => @"collections";
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new OsuSpriteText
{
Text = @"Add current song to",
},
new CollectionsDropdown<PlaylistCollection>
{
RelativeSizeAxes = Axes.X,
Items = new[] { new KeyValuePair<string, PlaylistCollection>(@"All", PlaylistCollection.All) },
},
};
}
}
}

View File

@ -0,0 +1,35 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class DiscussionSettings : ReplayGroup
{
protected override string Title => @"discussions";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new ReplayCheckbox
{
LabelText = "Show floating comments",
Bindable = config.GetBindable<bool>(OsuSetting.FloatingComments)
},
new FocusedTextBox
{
RelativeSizeAxes = Axes.X,
Height = 30,
PlaceholderText = "Add Comment",
HoldFocus = false,
},
};
}
}
}

View File

@ -0,0 +1,27 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class PlaybackSettings : ReplayGroup
{
protected override string Title => @"playback";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new ReplaySliderBar<double>()
{
LabelText = "Playback speed",
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed)
}
};
}
}
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class ReplayCheckbox : OsuCheckbox
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Nub.AccentColour = colours.Yellow;
Nub.GlowingAccentColour = colours.YellowLighter;
Nub.GlowColour = colours.YellowDarker;
}
}
}

View File

@ -0,0 +1,132 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.ReplaySettings
{
public abstract class ReplayGroup : Container
{
/// <summary>
/// The title to be displayed in the header of this group.
/// </summary>
protected abstract string Title { get; }
private const float transition_duration = 250;
private const int container_width = 270;
private const int border_thickness = 2;
private const int header_height = 30;
private const int corner_radius = 5;
private readonly FillFlowContainer content;
private readonly IconButton button;
private bool expanded = true;
private Color4 buttonActiveColour;
protected ReplayGroup()
{
AutoSizeAxes = Axes.Y;
Width = container_width;
Masking = true;
CornerRadius = corner_radius;
BorderColour = Color4.Black;
BorderThickness = border_thickness;
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f,
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new Container
{
Name = @"Header",
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = header_height,
Children = new Drawable[]
{
new OsuSpriteText
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = Title.ToUpper(),
TextSize = 17,
Font = @"Exo2.0-Bold",
Margin = new MarginPadding { Left = 10 },
},
button = new IconButton
{
Origin = Anchor.Centre,
Anchor = Anchor.CentreRight,
Position = new Vector2(-15,0),
Icon = FontAwesome.fa_bars,
Scale = new Vector2(0.75f),
Action = toggleContentVisibility,
},
}
},
content = new FillFlowContainer
{
Name = @"Content",
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeDuration = transition_duration,
AutoSizeEasing = EasingTypes.OutQuint,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(15),
Spacing = new Vector2(0, 15),
}
}
},
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
button.Colour = buttonActiveColour = colours.Yellow;
}
protected override Container<Drawable> Content => content;
private void toggleContentVisibility()
{
content.ClearTransforms();
expanded = !expanded;
if (expanded)
content.AutoSizeAxes = Axes.Y;
else
{
content.AutoSizeAxes = Axes.None;
content.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint);
}
button.FadeColour(expanded ? buttonActiveColour : Color4.White, 200, EasingTypes.OutQuint);
}
}
}

View File

@ -0,0 +1,34 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Graphics.UserInterface;
using System;
using osu.Game.Graphics;
using osu.Framework.Graphics;
using osu.Game.Overlays.Settings;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class ReplaySliderBar<T> : SettingsSlider<T>
where T : struct, IEquatable<T>
{
protected override Drawable CreateControl() => new Sliderbar()
{
Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X
};
private class Sliderbar : OsuSliderBar<T>
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Yellow;
Nub.AccentColour = colours.Yellow;
Nub.GlowingAccentColour = colours.YellowLighter;
Nub.GlowColour = colours.YellowDarker;
}
}
}
}

View File

@ -0,0 +1,24 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Play.ReplaySettings;
using OpenTK;
namespace osu.Game.Screens.Play
{
public class ReplaySettingsOverlay : FillFlowContainer
{
public ReplaySettingsOverlay()
{
Direction = FillDirection.Vertical;
AutoSizeAxes = Axes.Both;
Spacing = new Vector2(0, 20);
Add(new CollectionSettings());
Add(new DiscussionSettings());
Add(new PlaybackSettings());
}
}
}

View File

@ -45,7 +45,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Y = - TwoLayerButton.SIZE_RETRACTED.Y,
Y = -TwoLayerButton.SIZE_RETRACTED.Y,
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
@ -71,6 +71,13 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding { Top = 20, Right = 10 },
};
//protected override ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay
//{
// Anchor = Anchor.TopRight,
// Origin = Anchor.TopRight,
// Margin = new MarginPadding { Top = 100, Right = 10 },
//};
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{

View File

@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Configuration;
using osu.Framework.Input;
using OpenTK.Input;
using System.Collections;
@ -17,6 +18,7 @@ using System.Diagnostics;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Threading;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Select
{
@ -70,6 +72,9 @@ namespace osu.Game.Screens.Select
private readonly List<BeatmapGroup> groups = new List<BeatmapGroup>();
private Bindable<SelectionRandomType> randomType;
private readonly List<BeatmapGroup> seenGroups = new List<BeatmapGroup>();
private readonly List<Panel> panels = new List<Panel>();
private BeatmapGroup selectedGroup;
@ -167,11 +172,26 @@ namespace osu.Game.Screens.Select
public void SelectRandom()
{
List<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden).ToList();
if (visibleGroups.Count < 1)
IEnumerable<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
if (!visibleGroups.Any())
return;
BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)];
BeatmapGroup group;
if (randomType == SelectionRandomType.RandomPermutation)
{
IEnumerable<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups);
if (!notSeenGroups.Any())
{
seenGroups.Clear();
notSeenGroups = visibleGroups;
}
group = notSeenGroups.ElementAt(RNG.Next(notSeenGroups.Count()));
seenGroups.Add(group);
}
else
group = visibleGroups.ElementAt(RNG.Next(visibleGroups.Count()));
BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)];
selectGroup(group, panel);
@ -239,9 +259,10 @@ namespace osu.Game.Screens.Select
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapDatabase database)
private void load(BeatmapDatabase database, OsuConfigManager config)
{
this.database = database;
randomType = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType);
}
private void addGroup(BeatmapGroup group)

View File

@ -74,9 +74,12 @@
<Compile Include="Audio\SampleInfoList.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
<Compile Include="Graphics\UserInterface\IconButton.cs" />
<Compile Include="Configuration\SelectionRandomType.cs" />
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
<Compile Include="Online\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
<Compile Include="Overlays\Music\CollectionsDropdown.cs" />
<Compile Include="Overlays\Music\FilterControl.cs" />
<Compile Include="Overlays\Music\PlaylistItem.cs" />
<Compile Include="Overlays\Music\PlaylistList.cs" />
@ -104,7 +107,6 @@
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
<Compile Include="Graphics\IHasAccentColour.cs" />
<Compile Include="Graphics\IHasTooltip.cs" />
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
<Compile Include="Graphics\UserInterface\BackButton.cs" />
@ -117,7 +119,7 @@
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
<Compile Include="Graphics\UserInterface\SimpleComboCounter.cs" />
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
<Compile Include="Graphics\Cursor\TooltipContainer.cs" />
<Compile Include="Graphics\Cursor\OsuTooltipContainer.cs" />
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
<Compile Include="IO\Legacy\SerializationReader.cs" />
@ -125,6 +127,7 @@
<Compile Include="IO\Serialization\IJsonSerializable.cs" />
<Compile Include="IPC\ScoreIPCChannel.cs" />
<Compile Include="Rulesets\BeatmapStatistic.cs" />
<Compile Include="Rulesets\Mods\ModDaycore.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\ConvertHit.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\ConvertHitObjectParser.cs" />
<Compile Include="Rulesets\Objects\Legacy\Catch\ConvertSlider.cs" />
@ -239,6 +242,13 @@
<Compile Include="Screens\Charts\ChartInfo.cs" />
<Compile Include="Screens\Edit\Editor.cs" />
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
<Compile Include="Screens\Play\ReplaySettings\CollectionSettings.cs" />
<Compile Include="Screens\Play\ReplaySettings\DiscussionSettings.cs" />
<Compile Include="Screens\Play\ReplaySettings\ReplayGroup.cs" />
<Compile Include="Screens\Play\ReplaySettingsOverlay.cs" />
<Compile Include="Screens\Play\ReplaySettings\ReplaySliderBar.cs" />
<Compile Include="Screens\Play\ReplaySettings\PlaybackSettings.cs" />
<Compile Include="Screens\Play\ReplaySettings\ReplayCheckbox.cs" />
<Compile Include="Screens\Play\PauseContainer.cs" />
<Compile Include="Screens\Play\SongProgressInfo.cs" />
<Compile Include="Screens\Play\HUD\ModDisplay.cs" />