Merge branch 'master' into modselect

This commit is contained in:
Huo Yaoyuan
2017-03-07 16:10:53 +08:00
212 changed files with 2573 additions and 740 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays
{
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent
{
const float textbox_height = 40;
private const float textbox_height = 40;
private ScheduledDelegate messageRequest;

View File

@ -34,7 +34,7 @@ namespace osu.Game.Overlays
Children = new Drawable[]
{
fill = new Box()
fill = new Box
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,

View File

@ -13,11 +13,11 @@ using OpenTK.Graphics;
namespace osu.Game.Overlays
{
class LoginOverlay : FocusedOverlayContainer
internal class LoginOverlay : FocusedOverlayContainer
{
private LoginOptions optionsSection;
const float transition_time = 400;
private const float transition_time = 400;
public LoginOverlay()
{

View File

@ -105,25 +105,19 @@ namespace osu.Game.Overlays.Mods
if (mod == value) return;
mod = value;
if (mod is MultiMod)
{
mods = ((MultiMod)mod).Mods;
}
else
{
mods = new Mod[] { mod };
}
Mods = (mod as MultiMod)?.Mods ?? new[] { mod };
createIcons();
if (mods.Length > 0)
if (Mods.Length > 0)
{
displayMod(mods[0]);
displayMod(Mods[0]);
}
}
}
private Mod[] mods;
public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod
public Mod[] Mods { get; private set; }
// the mods from Mod, only multiple if Mod is a MultiMod
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
@ -178,7 +172,7 @@ namespace osu.Game.Overlays.Mods
iconsContainer.Clear();
if (Mods.Length > 1)
{
iconsContainer.Add(new[]
iconsContainer.Add(new ModIcon[]
{
new ModIcon
{

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods
}
private Color4 colour = Color4.White;
new public Color4 Colour
public new Color4 Colour
{
get
{

View File

@ -59,7 +59,7 @@ namespace osu.Game.Overlays
protected override bool OnDrag(InputState state)
{
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
@ -246,14 +246,14 @@ namespace osu.Game.Overlays
}
}
void preferUnicode_changed(object sender, EventArgs e)
private void preferUnicode_changed(object sender, EventArgs e)
{
updateDisplay(current, TransformDirection.None);
}
private void workingChanged(object sender = null, EventArgs e = null)
{
progress.IsEnabled = (beatmapSource.Value != null);
progress.IsEnabled = beatmapSource.Value != null;
if (beatmapSource.Value == current) return;
bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmapSource?.Value?.BeatmapInfo) ?? false;
current = beatmapSource.Value;
@ -323,7 +323,7 @@ namespace osu.Game.Overlays
updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev);
}
Action pendingBeatmapSwitch;
private Action pendingBeatmapSwitch;
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
{
@ -384,7 +384,7 @@ namespace osu.Game.Overlays
base.Dispose(isDisposing);
}
const float transition_length = 800;
private const float transition_length = 800;
protected override void PopIn()
{

View File

@ -69,7 +69,7 @@ namespace osu.Game.Overlays
};
}
int runningDepth = 0;
private int runningDepth;
public void Post(Notification notification)
{

View File

@ -43,16 +43,7 @@ namespace osu.Game.Overlays.Notifications
protected Container NotificationContent;
private bool read;
public virtual bool Read
{
get { return read; }
set
{
read = value;
}
}
public virtual bool Read { get; set; }
public Notification()
{
@ -162,7 +153,7 @@ namespace osu.Game.Overlays.Notifications
Expire();
}
class CloseButton : ClickableContainer
private class CloseButton : ClickableContainer
{
private Color4 hoverColour;
@ -176,6 +167,7 @@ namespace osu.Game.Overlays.Notifications
new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_times_circle,
}
};

View File

@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Notifications
countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
}
class ClearAllButton : ClickableContainer
private class ClearAllButton : ClickableContainer
{
private OsuSpriteText text;

View File

@ -168,7 +168,7 @@ namespace osu.Game.Overlays.Notifications
/// </summary>
public Func<bool> CompletionClickAction;
class ProgressBar : Container
private class ProgressBar : Container
{
private Box box;

View File

@ -51,6 +51,7 @@ namespace osu.Game.Overlays.Notifications
iconDrawable = new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = icon,
}
});

View File

@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Options
private Bindable<T> bindable;
void bindable_ValueChanged(object sender, EventArgs e)
private void bindable_ValueChanged(object sender, EventArgs e)
{
dropdown.SelectedValue = bindable.Value;
}
void dropdown_ValueChanged(object sender, EventArgs e)
private void dropdown_ValueChanged(object sender, EventArgs e)
{
bindable.Value = dropdown.SelectedValue;
}

View File

@ -7,7 +7,7 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Options
{
class OptionLabel : OsuSpriteText
internal class OptionLabel : OsuSpriteText
{
[BackgroundDependencyLoader]
private void load(OsuColour colour)

View File

@ -0,0 +1,68 @@
// 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;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Options
{
public class OptionsFooter : FillFlowContainer
{
[BackgroundDependencyLoader]
private void load(OsuGameBase game, OsuColour colours)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Padding = new MarginPadding { Top = 20, Bottom = 30 };
var modes = new List<Drawable>();
foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
modes.Add(new TextAwesome
{
Icon = Ruleset.GetRuleset(m).Icon,
Colour = Color4.Gray,
});
Children = new Drawable[]
{
new FillFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Full,
AutoSizeAxes = Axes.Both,
Children = modes,
Spacing = new Vector2(5),
Padding = new MarginPadding { Bottom = 10 },
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = game.Name,
TextSize = 18,
Font = @"Exo2.0-Bold",
},
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 14,
Text = game.Version,
Colour = game.IsDebug ? colours.Red : Color4.White,
},
};
}
}
}

View File

@ -11,8 +11,7 @@ namespace osu.Game.Overlays.Options
{
public abstract class OptionsSubsection : FillFlowContainer
{
private Container<Drawable> content;
protected override Container<Drawable> Content => content;
protected override Container<Drawable> Content { get; }
protected abstract string Header { get; }
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Options
Margin = new MarginPadding { Bottom = 10 },
Font = @"Exo2.0-Black",
},
content = new FillFlowContainer
Content = new FillFlowContainer
{
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5),

View File

@ -32,12 +32,11 @@ namespace osu.Game.Overlays.Options.Sections.Audio
private void updateItems()
{
var deviceItems = new List<KeyValuePair<string, string>>();
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
var deviceItems = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("Default", string.Empty) };
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
var preferredDeviceName = audio.AudioDevice.Value;
if (!deviceItems.Any(kv => kv.Value == preferredDeviceName))
if (deviceItems.All(kv => kv.Value != preferredDeviceName))
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
dropdown.Items = deviceItems;
@ -51,7 +50,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio
Children = new Drawable[]
{
dropdown = new OptionDropDown<string>()
dropdown = new OptionDropDown<string>
{
Bindable = audio.AudioDevice
},

View File

@ -0,0 +1,28 @@
// 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.Configuration;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Sections.Debug
{
public class GeneralOptions : OptionsSubsection
{
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config)
{
Children = new Drawable[]
{
new OsuCheckbox
{
LabelText = "Bypass caching",
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)
}
};
}
}
}

View File

@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Options.Sections
{
Children = new Drawable[]
{
new GeneralOptions(),
new GCOptions(),
};
}

View File

@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General
}
}
class LoginForm : FillFlowContainer
private class LoginForm : FillFlowContainer
{
private TextBox username;
private TextBox password;

View File

@ -5,7 +5,6 @@ using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections
{
@ -39,20 +38,6 @@ namespace osu.Game.Overlays.Options.Sections
RelativeSizeAxes = Axes.X,
Text = "Run osu! updater",
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
new OptionLabel
{
Text = "osu!lazer",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
}
}
};
}
}

View File

@ -100,7 +100,8 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = sections,
}
},
new OptionsFooter()
}
}
}

View File

@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar
Children = new Drawable[]
{
new ToolbarSettingsButton(),
new ToolbarHomeButton()
new ToolbarHomeButton
{
Action = () => OnHome?.Invoke()
},
@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Toolbar
FadeOut(transition_time);
}
class PassThroughFlowContainer : FillFlowContainer
private class PassThroughFlowContainer : FillFlowContainer
{
//needed to get input to the login overlay.
public override bool Contains(Vector2 screenSpacePos) => true;

View File

@ -5,7 +5,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarHomeButton : ToolbarButton
internal class ToolbarHomeButton : ToolbarButton
{
public ToolbarHomeButton()
{

View File

@ -15,9 +15,9 @@ using OpenTK.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarModeSelector : Container
internal class ToolbarModeSelector : Container
{
const float padding = 10;
private const float padding = 10;
private FillFlowContainer modeButtons;
private Drawable modeButtonLine;
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Toolbar
{
RelativeSizeAxes = Axes.Y;
Children = new Drawable[]
Children = new[]
{
new OpaqueBackground(),
modeButtons = new FillFlowContainer

View File

@ -6,7 +6,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarMusicButton : ToolbarOverlayToggleButton
internal class ToolbarMusicButton : ToolbarOverlayToggleButton
{
public ToolbarMusicButton()
{

View File

@ -7,7 +7,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarNotificationButton : ToolbarOverlayToggleButton
internal class ToolbarNotificationButton : ToolbarOverlayToggleButton
{
protected override Anchor TooltipAnchor => Anchor.TopRight;

View File

@ -9,7 +9,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarOverlayToggleButton : ToolbarButton
internal class ToolbarOverlayToggleButton : ToolbarButton
{
private Box stateBackground;

View File

@ -6,7 +6,7 @@ using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarSettingsButton : ToolbarOverlayToggleButton
internal class ToolbarSettingsButton : ToolbarOverlayToggleButton
{
public ToolbarSettingsButton()
{

View File

@ -8,7 +8,7 @@ using OpenTK;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarUserArea : Container
internal class ToolbarUserArea : Container
{
public LoginOverlay LoginOverlay;
private ToolbarUserButton button;

View File

@ -14,7 +14,7 @@ using OpenTK.Graphics;
namespace osu.Game.Overlays.Toolbar
{
class ToolbarUserButton : ToolbarButton, IOnlineComponent
internal class ToolbarUserButton : ToolbarButton, IOnlineComponent
{
private Avatar avatar;

View File

@ -134,19 +134,23 @@ namespace osu.Game.Overlays
foreach (var w in wavesContainer.Children)
w.State = Visibility.Visible;
contentContainer.FadeIn(APPEAR_DURATION, EasingTypes.OutQuint);
FadeIn(100, EasingTypes.OutQuint);
contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint);
FadeIn(100, EasingTypes.OutQuint);
}
protected override void PopOut()
{
base.PopOut();
contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In);
FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint);
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In);
foreach (var w in wavesContainer.Children)
w.State = Visibility.Hidden;
FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint);
}
protected override void UpdateAfterChildren()