From 31890a1e013cad367f6f4f77d3748ba0b6d4a57c Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 18:06:25 -0300 Subject: [PATCH 01/61] =?UTF-8?q?Initial=20layout,=C2=A0channels=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Game/Overlays/Chat/ChannelListItem.cs | 143 ++++++++++++++++++ .../Overlays/Chat/ChannelSelectionOverlay.cs | 120 +++++++++++++++ osu.Game/osu.Game.csproj | 2 + 3 files changed, 265 insertions(+) create mode 100644 osu.Game/Overlays/Chat/ChannelListItem.cs create mode 100644 osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs new file mode 100644 index 0000000000..f8a058c444 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -0,0 +1,143 @@ +// 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.Game.Graphics; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Chat +{ + public class ChannelListItem : ClickableContainer + { + private const float channel_width = 150; + private const float topic_width = 380; + private const float text_size = 15; + private const float transition_duration = 100; + + private readonly OsuSpriteText topic; + private readonly TextAwesome joinedCheckmark; + + private Color4? joinedColour; + private Color4? topicColour; + + private bool joined; + public bool Joined + { + get { return joined; } + set + { + if (value == joined) return; + joined = value; + + updateColour(); + } + } + + public ChannelListItem() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Padding = new MarginPadding { Left = ChannelSelectionOverlay.WIDTH_PADDING, Right = ChannelSelectionOverlay.WIDTH_PADDING }, + Children = new Drawable[] + { + new Container + { + Children = new[] + { + joinedCheckmark = new TextAwesome + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Icon = FontAwesome.fa_check_circle, + TextSize = text_size, + Margin = new MarginPadding { Right = 10f }, + Alpha = 0f, + }, + }, + }, + new Container + { + Width = channel_width, + AutoSizeAxes = Axes.Y, + Children = new[] + { + new OsuSpriteText + { + Text = @"#osu!", + TextSize = text_size, + Font = @"Exo2.0-Bold", + }, + }, + }, + new Container + { + Width = topic_width, + AutoSizeAxes = Axes.Y, + Children = new[] + { + topic = new OsuSpriteText + { + Text = @"I dunno, the default channel I guess?", + TextSize = text_size, + Font = @"Exo2.0-SemiBold", + Alpha = 0.8f, + }, + }, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(3f, 0f), + Children = new Drawable[] + { + new TextAwesome + { + Icon = FontAwesome.fa_user, + TextSize = text_size - 2, + Margin = new MarginPadding { Top = 1 }, + }, + new OsuSpriteText + { + Text = @"543145", + TextSize = text_size, + Font = @"Exo2.0-SemiBold", + }, + }, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + topicColour = colours.Gray9; + joinedColour = colours.Blue; + + updateColour(); + } + + private void updateColour() + { + joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration); + topic.FadeTo(joined ? 0.8f : 1f, transition_duration); + topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration); + FadeColour(joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); + } + } +} diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs new file mode 100644 index 0000000000..217200ec44 --- /dev/null +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -0,0 +1,120 @@ +// 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.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Chat +{ + public class ChannelSelectionOverlay : OverlayContainer + { + public static readonly float WIDTH_PADDING = 170; + + private readonly Box bg; + private readonly Box headerBg; + private readonly SearchTextBox search; + + public ChannelSelectionOverlay() + { + RelativeSizeAxes = Axes.X; + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.25f), + Radius = 5, + }, + Children = new[] + { + bg = new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + headerBg = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 10f), + Padding = new MarginPadding { Top = 10f, Bottom = 10f, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = @"Chat Channels", + TextSize = 20, + }, + search = new HeaderSearchTextBox + { + RelativeSizeAxes = Axes.X, + PlaceholderText = @"Search", + }, + }, + }, + }, + }, + new ChannelListItem + { + Anchor = Anchor.Centre, + Origin = Anchor.BottomCentre, + Joined = false, + }, + new ChannelListItem + { + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + Joined = true, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + bg.Colour = colours.Gray3; + headerBg.Colour = colours.Gray2.Opacity(0.75f); + } + + protected override void PopIn() + { + search.HoldFocus = true; + Schedule(() => search.TriggerFocus()); + } + + protected override void PopOut() + { + search.HoldFocus = false; + } + + private class HeaderSearchTextBox : SearchTextBox + { + protected override Color4 BackgroundFocused => Color4.Black.Opacity(0.2f); + protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.2f); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ee906caa9b..89e32a478f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -428,6 +428,8 @@ <Compile Include="Overlays\Music\PlaylistOverlay.cs" /> <Compile Include="Rulesets\Replays\IAutoGenerator.cs" /> <Compile Include="Rulesets\Replays\AutoGenerator.cs" /> + <Compile Include="Overlays\Chat\ChannelSelectionOverlay.cs" /> + <Compile Include="Overlays\Chat\ChannelListItem.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> From 6a8d745db18d8442404190dfe82fddbdb8816835 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 18:29:57 -0300 Subject: [PATCH 02/61] Use Channels in ChannelListItems, ChannelSection, fix ChannelListItem being misaligned --- osu.Game/Overlays/Chat/ChannelListItem.cs | 14 +++-- osu.Game/Overlays/Chat/ChannelSection.cs | 57 +++++++++++++++++++ .../Overlays/Chat/ChannelSelectionOverlay.cs | 20 ++++--- osu.Game/osu.Game.csproj | 1 + 4 files changed, 77 insertions(+), 15 deletions(-) create mode 100644 osu.Game/Overlays/Chat/ChannelSection.cs diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index f8a058c444..ce46c73574 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -8,11 +8,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { public class ChannelListItem : ClickableContainer { + private const float width_padding = 5; private const float channel_width = 150; private const float topic_width = 380; private const float text_size = 15; @@ -37,7 +39,7 @@ namespace osu.Game.Overlays.Chat } } - public ChannelListItem() + public ChannelListItem(Channel channel) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -49,8 +51,6 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Padding = new MarginPadding { Left = ChannelSelectionOverlay.WIDTH_PADDING, Right = ChannelSelectionOverlay.WIDTH_PADDING }, Children = new Drawable[] { new Container @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Chat { new OsuSpriteText { - Text = @"#osu!", + Text = $@"#{channel.Name}", TextSize = text_size, Font = @"Exo2.0-Bold", }, @@ -86,11 +86,12 @@ namespace osu.Game.Overlays.Chat { Width = topic_width, AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = width_padding }, Children = new[] { topic = new OsuSpriteText { - Text = @"I dunno, the default channel I guess?", + Text = channel.Topic, TextSize = text_size, Font = @"Exo2.0-SemiBold", Alpha = 0.8f, @@ -101,6 +102,7 @@ namespace osu.Game.Overlays.Chat { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, + Margin = new MarginPadding { Left = width_padding }, Spacing = new Vector2(3f, 0f), Children = new Drawable[] { @@ -133,7 +135,7 @@ namespace osu.Game.Overlays.Chat } private void updateColour() - { + { joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration); topic.FadeTo(joined ? 0.8f : 1f, transition_duration); topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration); diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs new file mode 100644 index 0000000000..cbb197e84c --- /dev/null +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -0,0 +1,57 @@ +// 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.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; + +namespace osu.Game.Overlays.Chat +{ + public class ChannelSection : Container + { + private readonly FillFlowContainer<ChannelListItem> items; + private readonly OsuSpriteText header; + + public string Header + { + set + { + header.Text = value; + } + } + + public IEnumerable<Channel> Channels + { + set + { + items.Children = value.Select(c => new ChannelListItem(c)); + } + } + + public ChannelSection() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + + Children = new Drawable[] + { + header = new OsuSpriteText + { + TextSize = 15, + Font = @"Exo2.0-Bold", + }, + items = new FillFlowContainer<ChannelListItem> + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Top = 25 }, + Spacing = new Vector2(0f, 5f), + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 217200ec44..fbed51cae8 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { @@ -78,17 +79,18 @@ namespace osu.Game.Overlays.Chat }, }, }, - new ChannelListItem + new ChannelSection { Anchor = Anchor.Centre, - Origin = Anchor.BottomCentre, - Joined = false, - }, - new ChannelListItem - { - Anchor = Anchor.Centre, - Origin = Anchor.TopCentre, - Joined = true, + Origin = Anchor.Centre, + Padding = new MarginPadding { Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Header = @"GENERAL CHANNELS", + Channels = new[] + { + new Channel { Name = @"announcements", Topic = @"Automated announcement of stuff going on in osu!" }, + new Channel { Name = @"osu!", Topic = @"I dunno, the default channel I guess?" }, + new Channel { Name = @"lobby", Topic = @"Look for trouble here" }, + }, }, }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 89e32a478f..84ef48d481 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -430,6 +430,7 @@ <Compile Include="Rulesets\Replays\AutoGenerator.cs" /> <Compile Include="Overlays\Chat\ChannelSelectionOverlay.cs" /> <Compile Include="Overlays\Chat\ChannelListItem.cs" /> + <Compile Include="Overlays\Chat\ChannelSection.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj"> From 3cc51006cc496bce41a513e9ac6f35c5150820ac Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 19:30:40 -0300 Subject: [PATCH 03/61] Add settings button, background triangles, proper displaying of Channels --- osu.Game/Overlays/Chat/ChannelListItem.cs | 4 +- .../Overlays/Chat/ChannelSelectionOverlay.cs | 145 ++++++++++++++++-- 2 files changed, 134 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index ce46c73574..56a0e74c35 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Chat { new OsuSpriteText { - Text = $@"#{channel.Name}", + Text = channel.ToString(), TextSize = text_size, Font = @"Exo2.0-Bold", }, @@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Chat }, new OsuSpriteText { - Text = @"543145", + Text = @"0", TextSize = text_size, Font = @"Exo2.0-SemiBold", }, diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index fbed51cae8..23408259ff 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -1,17 +1,22 @@ // 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.Collections.Generic; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio.Track; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { @@ -20,8 +25,18 @@ namespace osu.Game.Overlays.Chat public static readonly float WIDTH_PADDING = 170; private readonly Box bg; + private readonly Triangles triangles; private readonly Box headerBg; private readonly SearchTextBox search; + private readonly FillFlowContainer<ChannelSection> sectionsFlow; + + public IEnumerable<ChannelSection> Sections + { + set + { + sectionsFlow.Children = value; + } + } public ChannelSelectionOverlay() { @@ -38,12 +53,34 @@ namespace osu.Game.Overlays.Chat Colour = Color4.Black.Opacity(0.25f), Radius = 5, }, - Children = new[] + Children = new Drawable[] { bg = new Box { RelativeSizeAxes = Axes.Both, }, + triangles = new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 5, + }, + }, + }, + new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, + Padding = new MarginPadding { Top = 85 }, + Children = new[] + { + sectionsFlow = new FillFlowContainer<ChannelSection> + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 20f), + Padding = new MarginPadding { Top = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + }, }, }, new Container @@ -74,23 +111,15 @@ namespace osu.Game.Overlays.Chat { RelativeSizeAxes = Axes.X, PlaceholderText = @"Search", + Exit = Hide, }, }, }, }, }, - new ChannelSection + new SettingsButton { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Padding = new MarginPadding { Left = WIDTH_PADDING, Right = WIDTH_PADDING }, - Header = @"GENERAL CHANNELS", - Channels = new[] - { - new Channel { Name = @"announcements", Topic = @"Automated announcement of stuff going on in osu!" }, - new Channel { Name = @"osu!", Topic = @"I dunno, the default channel I guess?" }, - new Channel { Name = @"lobby", Topic = @"Look for trouble here" }, - }, + Margin = new MarginPadding { Top = 160 }, }, }; } @@ -99,6 +128,9 @@ namespace osu.Game.Overlays.Chat private void load(OsuColour colours) { bg.Colour = colours.Gray3; + triangles.ColourDark = colours.Gray3; + triangles.ColourLight = OsuColour.FromHex(@"353535"); + headerBg.Colour = colours.Gray2.Opacity(0.75f); } @@ -118,5 +150,92 @@ namespace osu.Game.Overlays.Chat protected override Color4 BackgroundFocused => Color4.Black.Opacity(0.2f); protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.2f); } + + private class SettingsButton : ClickableContainer + { + private const float width = 60f; + + private readonly Box bg; + private readonly Container bgContainer; + + private SampleChannel clickSample; + + public SettingsButton() + { + Size = new Vector2(width, 50f); + + Children = new Drawable[] + { + bgContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(0.2f, 0f), + Masking = true, + MaskingSmoothness = 2, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Offset = new Vector2(2, 0), + Radius = 2, + }, + Children = new[] + { + bg = new Box + { + RelativeSizeAxes = Axes.Both, + EdgeSmoothness = new Vector2(2f, 0f), + }, + }, + }, + new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_osu_gear, + TextSize = 20, + Shadow = true, + UseFullGlyphHeight = false, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, AudioManager audio) + { + bg.Colour = colours.Pink; + clickSample = audio.Sample.Get(@"Menu/menuclick"); + } + + protected override bool OnHover(InputState state) + { + ResizeWidthTo(width + 20f, 500, EasingTypes.OutElastic); + + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + ResizeWidthTo(width, 500, EasingTypes.OutElastic); + } + + protected override bool OnClick(InputState state) + { + var flash = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White.Opacity(0.5f), + }; + + bgContainer.Add(flash); + + flash.Alpha = 1; + flash.FadeOut(500, EasingTypes.OutQuint); + flash.Expire(); + + clickSample.Play(); + return base.OnClick(state); + } + } } } From 7eba619f80c2e6919c2a556020e5f2d2857d3455 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 19:37:11 -0300 Subject: [PATCH 04/61] Move Joined to Channel --- osu.Game/Online/Chat/Channel.cs | 4 ++-- osu.Game/Overlays/Chat/ChannelListItem.cs | 27 ++++++++++++----------- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 2925c3ccb4..bffd98ee2c 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -23,9 +23,9 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; - public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id)); + public bool Joined; - //internal bool Joined; + public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id)); public bool ReadOnly => Name != "#lazer"; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 56a0e74c35..ba1c890747 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -21,25 +21,28 @@ namespace osu.Game.Overlays.Chat private const float transition_duration = 100; private readonly OsuSpriteText topic; + private readonly OsuSpriteText name; private readonly TextAwesome joinedCheckmark; private Color4? joinedColour; private Color4? topicColour; - private bool joined; - public bool Joined + private Channel channel; + public Channel Channel { - get { return joined; } + get { return channel; } set { - if (value == joined) return; - joined = value; + if (value == channel) return; + channel = value; + name.Text = Channel.ToString(); + topic.Text = Channel.Topic; updateColour(); } } - public ChannelListItem(Channel channel) + public ChannelListItem() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -74,9 +77,8 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Y, Children = new[] { - new OsuSpriteText + name = new OsuSpriteText { - Text = channel.ToString(), TextSize = text_size, Font = @"Exo2.0-Bold", }, @@ -91,7 +93,6 @@ namespace osu.Game.Overlays.Chat { topic = new OsuSpriteText { - Text = channel.Topic, TextSize = text_size, Font = @"Exo2.0-SemiBold", Alpha = 0.8f, @@ -136,10 +137,10 @@ namespace osu.Game.Overlays.Chat private void updateColour() { - joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration); - topic.FadeTo(joined ? 0.8f : 1f, transition_duration); - topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration); - FadeColour(joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); + joinedCheckmark.FadeTo(Channel.Joined ? 1f : 0f, transition_duration); + topic.FadeTo(Channel.Joined ? 0.8f : 1f, transition_duration); + topic.FadeColour(Channel.Joined ? Color4.White : topicColour ?? Color4.White, transition_duration); + FadeColour(Channel.Joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); } } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index cbb197e84c..af61f67c99 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Chat { set { - items.Children = value.Select(c => new ChannelListItem(c)); + items.Children = value.Select(c => new ChannelListItem { Channel = c }); } } From 47dfc0d7bc0f73ab716751e06f4890c8b43053ce Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 20:05:28 -0300 Subject: [PATCH 05/61] Added transition --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 23408259ff..4d0fcb52d9 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -7,7 +7,6 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Audio.Track; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -41,18 +40,13 @@ namespace osu.Game.Overlays.Chat public ChannelSelectionOverlay() { RelativeSizeAxes = Axes.X; + Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.25f), - Radius = 5, - }, Children = new Drawable[] { bg = new Box @@ -138,11 +132,17 @@ namespace osu.Game.Overlays.Chat { search.HoldFocus = true; Schedule(() => search.TriggerFocus()); + + FadeIn(100, EasingTypes.OutQuint); + MoveToY(0, 800, EasingTypes.OutQuint); } protected override void PopOut() { search.HoldFocus = false; + + FadeOut(500, EasingTypes.InQuint); + MoveToY(DrawHeight, 500, EasingTypes.In); } private class HeaderSearchTextBox : SearchTextBox From 2e1d01a2681973567744727e7174b2cbb306f063 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 20:22:55 -0300 Subject: [PATCH 06/61] Added searching --- osu.Game/Overlays/Chat/ChannelListItem.cs | 11 ++++++++- osu.Game/Overlays/Chat/ChannelSection.cs | 23 +++++++++++-------- .../Overlays/Chat/ChannelSelectionOverlay.cs | 8 +++++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index ba1c890747..5318d2e592 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -12,7 +12,7 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelListItem : ClickableContainer + public class ChannelListItem : ClickableContainer, IFilterable { private const float width_padding = 5; private const float channel_width = 150; @@ -27,6 +27,15 @@ namespace osu.Game.Overlays.Chat private Color4? joinedColour; private Color4? topicColour; + public string[] FilterTerms => new[] { Channel.Name }; + public bool MatchingCurrentFilter + { + set + { + FadeTo(value ? 1f : 0f, 100); + } + } + private Channel channel; public Channel Channel { diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index af61f67c99..4bbf25d96e 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -11,25 +11,30 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelSection : Container + public class ChannelSection : Container, IHasFilterableChildren { private readonly FillFlowContainer<ChannelListItem> items; private readonly OsuSpriteText header; + public IEnumerable<IFilterable> FilterableChildren => items.Children.OfType<IFilterable>(); + public string[] FilterTerms => new[] { Header }; + public bool MatchingCurrentFilter + { + set + { + FadeTo(value ? 1f : 0f, 100); + } + } + public string Header { - set - { - header.Text = value; - } + get { return header.Text; } + set { header.Text = value; } } public IEnumerable<Channel> Channels { - set - { - items.Children = value.Select(c => new ChannelListItem { Channel = c }); - } + set { items.Children = value.Select(c => new ChannelListItem { Channel = c }); } } public ChannelSection() diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 4d0fcb52d9..4d8cc59ad0 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Chat private readonly Triangles triangles; private readonly Box headerBg; private readonly SearchTextBox search; - private readonly FillFlowContainer<ChannelSection> sectionsFlow; + private readonly SearchContainer<ChannelSection> sectionsFlow; public IEnumerable<ChannelSection> Sections { @@ -67,11 +67,13 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Top = 85 }, Children = new[] { - sectionsFlow = new FillFlowContainer<ChannelSection> + sectionsFlow = new SearchContainer<ChannelSection> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, + LayoutDuration = 200, + LayoutEasing = EasingTypes.OutQuint, Spacing = new Vector2(0f, 20f), Padding = new MarginPadding { Top = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, }, @@ -116,6 +118,8 @@ namespace osu.Game.Overlays.Chat Margin = new MarginPadding { Top = 160 }, }, }; + + search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue; } [BackgroundDependencyLoader] From 4a166c1949ae81d9edd26a2484ccfe281d3cb48e Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 20:48:36 -0300 Subject: [PATCH 07/61] Make ChannelSelectionOverlay a FocusedOverlayContainer --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 4d8cc59ad0..9746ae2ae8 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -19,7 +19,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Chat { - public class ChannelSelectionOverlay : OverlayContainer + public class ChannelSelectionOverlay : FocusedOverlayContainer { public static readonly float WIDTH_PADDING = 170; @@ -134,6 +134,8 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { + base.PopIn(); + search.HoldFocus = true; Schedule(() => search.TriggerFocus()); @@ -143,6 +145,8 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { + base.PopOut(); + search.HoldFocus = false; FadeOut(500, EasingTypes.InQuint); From a60d1efc21911e856cb3e6914d9dd2ceb616eca7 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 21:26:39 -0300 Subject: [PATCH 08/61] Basic channel joining (ignore layout in ChatOverlay, temporary) --- osu.Game/Online/Chat/Channel.cs | 3 ++- osu.Game/Overlays/Chat/ChannelListItem.cs | 27 ++++++++++++++----- osu.Game/Overlays/Chat/ChannelSection.cs | 12 +++++---- .../Overlays/Chat/ChannelSelectionOverlay.cs | 12 +++++++++ osu.Game/Overlays/ChatOverlay.cs | 22 +++++++++++++++ 5 files changed, 63 insertions(+), 13 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index bffd98ee2c..b548d72389 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; +using osu.Framework.Configuration; using osu.Framework.Lists; namespace osu.Game.Online.Chat @@ -23,7 +24,7 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; - public bool Joined; + public Bindable<bool> Joined = new Bindable<bool>(); public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id)); diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 5318d2e592..94e3438d87 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -1,6 +1,7 @@ // 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 OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -36,6 +37,8 @@ namespace osu.Game.Overlays.Chat } } + public Action<Channel> OnRequestJoin; + private Channel channel; public Channel Channel { @@ -43,11 +46,13 @@ namespace osu.Game.Overlays.Chat set { if (value == channel) return; + if (channel != null) channel.Joined.ValueChanged -= updateColour; channel = value; name.Text = Channel.ToString(); topic.Text = Channel.Topic; - updateColour(); + channel.Joined.ValueChanged += updateColour; + updateColour(Channel.Joined); } } @@ -56,6 +61,8 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; + Action = () => { if (!Channel.Joined) OnRequestJoin?.Invoke(Channel); }; + Children = new Drawable[] { new FillFlowContainer @@ -141,15 +148,21 @@ namespace osu.Game.Overlays.Chat topicColour = colours.Gray9; joinedColour = colours.Blue; - updateColour(); + updateColour(Channel.Joined); } - private void updateColour() + protected override void Dispose(bool isDisposing) { - joinedCheckmark.FadeTo(Channel.Joined ? 1f : 0f, transition_duration); - topic.FadeTo(Channel.Joined ? 0.8f : 1f, transition_duration); - topic.FadeColour(Channel.Joined ? Color4.White : topicColour ?? Color4.White, transition_duration); - FadeColour(Channel.Joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); + if(channel != null) channel.Joined.ValueChanged -= updateColour; + base.Dispose(isDisposing); + } + + private void updateColour(bool joined) + { + joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration); + topic.FadeTo(joined ? 0.8f : 1f, transition_duration); + topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration); + FadeColour(joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); } } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 4bbf25d96e..60fabdf187 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -13,14 +13,15 @@ namespace osu.Game.Overlays.Chat { public class ChannelSection : Container, IHasFilterableChildren { - private readonly FillFlowContainer<ChannelListItem> items; private readonly OsuSpriteText header; - public IEnumerable<IFilterable> FilterableChildren => items.Children.OfType<IFilterable>(); + public readonly FillFlowContainer<ChannelListItem> ChannelFlow; + + public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children.OfType<ChannelListItem>(); public string[] FilterTerms => new[] { Header }; public bool MatchingCurrentFilter { - set + set { FadeTo(value ? 1f : 0f, 100); } @@ -34,9 +35,10 @@ namespace osu.Game.Overlays.Chat public IEnumerable<Channel> Channels { - set { items.Children = value.Select(c => new ChannelListItem { Channel = c }); } + set { ChannelFlow.Children = value.Select(c => new ChannelListItem { Channel = c }); } } + public ChannelSection() { RelativeSizeAxes = Axes.X; @@ -49,7 +51,7 @@ namespace osu.Game.Overlays.Chat TextSize = 15, Font = @"Exo2.0-Bold", }, - items = new FillFlowContainer<ChannelListItem> + ChannelFlow = new FillFlowContainer<ChannelListItem> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 9746ae2ae8..7187b9df40 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -1,6 +1,7 @@ // 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 OpenTK; using OpenTK.Graphics; @@ -16,6 +17,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { @@ -29,11 +31,21 @@ namespace osu.Game.Overlays.Chat private readonly SearchTextBox search; private readonly SearchContainer<ChannelSection> sectionsFlow; + public Action<Channel> OnRequestJoin; + public IEnumerable<ChannelSection> Sections { set { sectionsFlow.Children = value; + + foreach (ChannelSection s in sectionsFlow.Children) + { + foreach (ChannelListItem c in s.ChannelFlow.Children) + { + c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); }; + } + } } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 2836be22ae..67a807103d 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -53,6 +53,10 @@ namespace osu.Game.Overlays private Bindable<double> chatHeight; + private readonly ChannelSelectionOverlay channelSelection; + + protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || channelSelection.Contains(screenSpacePos); + public ChatOverlay() { RelativeSizeAxes = Axes.Both; @@ -65,6 +69,12 @@ namespace osu.Game.Overlays Children = new Drawable[] { + channelSelection = new ChannelSelectionOverlay + { + Origin = Anchor.BottomLeft, + Height = 400, + State = Visibility.Visible, + }, new Container { Name = @"chat area", @@ -233,6 +243,16 @@ namespace osu.Game.Overlays addChannel(channels.Find(c => c.Name == @"#lazer")); addChannel(channels.Find(c => c.Name == @"#osu")); addChannel(channels.Find(c => c.Name == @"#lobby")); + + channelSelection.OnRequestJoin = channel => addChannel(channel); + channelSelection.Sections = new[] + { + new ChannelSection + { + Header = @"ALL CHANNELS", + Channels = channels, + }, + }; }); messageRequest = Scheduler.AddDelayed(fetchNewMessages, 1000, true); @@ -294,6 +314,8 @@ namespace osu.Game.Overlays if (CurrentChannel == null) CurrentChannel = channel; + + channel.Joined.Value = true; } private void fetchInitialMessages(Channel channel) From 51bc3dfe72e25e1dc7897c78885a01bc2f1cbc48 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 20 May 2017 21:38:36 -0300 Subject: [PATCH 09/61] Padding below channel list, remove text shadows, fix search box focusing --- osu.Game/Overlays/Chat/ChannelListItem.cs | 7 ++++++- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 11 ++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 94e3438d87..ba6818026e 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. +// 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; @@ -82,6 +82,7 @@ namespace osu.Game.Overlays.Chat Origin = Anchor.TopRight, Icon = FontAwesome.fa_check_circle, TextSize = text_size, + Shadow = false, Margin = new MarginPadding { Right = 10f }, Alpha = 0f, }, @@ -97,6 +98,7 @@ namespace osu.Game.Overlays.Chat { TextSize = text_size, Font = @"Exo2.0-Bold", + Shadow = false, }, }, }, @@ -111,6 +113,7 @@ namespace osu.Game.Overlays.Chat { TextSize = text_size, Font = @"Exo2.0-SemiBold", + Shadow = false, Alpha = 0.8f, }, }, @@ -127,6 +130,7 @@ namespace osu.Game.Overlays.Chat { Icon = FontAwesome.fa_user, TextSize = text_size - 2, + Shadow = false, Margin = new MarginPadding { Top = 1 }, }, new OsuSpriteText @@ -134,6 +138,7 @@ namespace osu.Game.Overlays.Chat Text = @"0", TextSize = text_size, Font = @"Exo2.0-SemiBold", + Shadow = false, }, }, }, diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 7187b9df40..249bd13094 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. +// 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; @@ -21,7 +21,7 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelSelectionOverlay : FocusedOverlayContainer + public class ChannelSelectionOverlay : OverlayContainer { public static readonly float WIDTH_PADDING = 170; @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Chat LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, Spacing = new Vector2(0f, 20f), - Padding = new MarginPadding { Top = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Padding = new MarginPadding { Top = 20, Bottom = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, }, }, }, @@ -114,6 +114,7 @@ namespace osu.Game.Overlays.Chat { Text = @"Chat Channels", TextSize = 20, + Shadow = false, }, search = new HeaderSearchTextBox { @@ -146,8 +147,6 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { - base.PopIn(); - search.HoldFocus = true; Schedule(() => search.TriggerFocus()); @@ -157,8 +156,6 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { - base.PopOut(); - search.HoldFocus = false; FadeOut(500, EasingTypes.InQuint); From 62897d302e27af3a28c8b9e325deb4e91f75b08a Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 22 May 2017 22:37:25 -0300 Subject: [PATCH 10/61] Remove SettingsButton(old and outdated design), fix channel list scrolling under the header --- .../Overlays/Chat/ChannelSelectionOverlay.cs | 121 +++--------------- 1 file changed, 17 insertions(+), 104 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 249bd13094..9b010e1794 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -6,13 +6,10 @@ using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -72,22 +69,29 @@ namespace osu.Game.Overlays.Chat }, }, }, - new ScrollContainer + new Container { RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, Padding = new MarginPadding { Top = 85 }, Children = new[] { - sectionsFlow = new SearchContainer<ChannelSection> + new ScrollContainer { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - LayoutDuration = 200, - LayoutEasing = EasingTypes.OutQuint, - Spacing = new Vector2(0f, 20f), - Padding = new MarginPadding { Top = 20, Bottom = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + RelativeSizeAxes = Axes.Both, + ScrollDraggerVisible = false, + Children = new[] + { + sectionsFlow = new SearchContainer<ChannelSection> + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + LayoutDuration = 200, + LayoutEasing = EasingTypes.OutQuint, + Spacing = new Vector2(0f, 20f), + Padding = new MarginPadding { Top = 20, Bottom = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + }, + }, }, }, }, @@ -126,10 +130,6 @@ namespace osu.Game.Overlays.Chat }, }, }, - new SettingsButton - { - Margin = new MarginPadding { Top = 160 }, - }, }; search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue; @@ -167,92 +167,5 @@ namespace osu.Game.Overlays.Chat protected override Color4 BackgroundFocused => Color4.Black.Opacity(0.2f); protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.2f); } - - private class SettingsButton : ClickableContainer - { - private const float width = 60f; - - private readonly Box bg; - private readonly Container bgContainer; - - private SampleChannel clickSample; - - public SettingsButton() - { - Size = new Vector2(width, 50f); - - Children = new Drawable[] - { - bgContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Shear = new Vector2(0.2f, 0f), - Masking = true, - MaskingSmoothness = 2, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.2f), - Offset = new Vector2(2, 0), - Radius = 2, - }, - Children = new[] - { - bg = new Box - { - RelativeSizeAxes = Axes.Both, - EdgeSmoothness = new Vector2(2f, 0f), - }, - }, - }, - new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Icon = FontAwesome.fa_osu_gear, - TextSize = 20, - Shadow = true, - UseFullGlyphHeight = false, - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) - { - bg.Colour = colours.Pink; - clickSample = audio.Sample.Get(@"Menu/menuclick"); - } - - protected override bool OnHover(InputState state) - { - ResizeWidthTo(width + 20f, 500, EasingTypes.OutElastic); - - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - ResizeWidthTo(width, 500, EasingTypes.OutElastic); - } - - protected override bool OnClick(InputState state) - { - var flash = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White.Opacity(0.5f), - }; - - bgContainer.Add(flash); - - flash.Alpha = 1; - flash.FadeOut(500, EasingTypes.OutQuint); - flash.Expire(); - - clickSample.Play(); - return base.OnClick(state); - } - } } } From fb0b54e66a9f0d22f4cc9c3beb17b7c116085d99 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 03:28:09 -0300 Subject: [PATCH 11/61] Remove merge error --- osu.Game/Online/Chat/Channel.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index d48de42fa1..ba410948cc 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -28,8 +28,6 @@ namespace osu.Game.Online.Chat public readonly SortedList<Message> Messages = new SortedList<Message>(Comparer<Message>.Default); - public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id)); - public bool ReadOnly => Name != "#lazer"; public const int MAX_HISTORY = 300; From d29ebb139ffcb745c02d8f84ff0750be87d66f4c Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 03:38:52 -0300 Subject: [PATCH 12/61] Cleanup --- osu.Game/Online/Chat/Channel.cs | 4 ++-- osu.Game/Overlays/Chat/ChannelListItem.cs | 6 +++--- osu.Game/Overlays/ChatOverlay.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index ba410948cc..01685cc7dc 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -24,10 +24,10 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; - public Bindable<bool> Joined = new Bindable<bool>(); - public readonly SortedList<Message> Messages = new SortedList<Message>(Comparer<Message>.Default); + public Bindable<bool> Joined = new Bindable<bool>(); + public bool ReadOnly => Name != "#lazer"; public const int MAX_HISTORY = 300; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index ba6818026e..cc9aacc643 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -29,10 +29,10 @@ namespace osu.Game.Overlays.Chat private Color4? topicColour; public string[] FilterTerms => new[] { Channel.Name }; - public bool MatchingCurrentFilter - { + public bool MatchingCurrentFilter + { set - { + { FadeTo(value ? 1f : 0f, 100); } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 7af37fb955..193b18dd12 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { - channelSelection = new ChannelSelectionOverlay + channelSelection = new ChannelSelectionOverlay //todo: temporary placement { Origin = Anchor.BottomLeft, Height = 400, From 21e900df73bd3f0de111b18962d7b826f8235431 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 03:46:50 -0300 Subject: [PATCH 13/61] Transition code cleanup --- osu.Game/Overlays/Chat/ChannelListItem.cs | 18 ++++++++++++++---- osu.Game/Overlays/Chat/ChannelSection.cs | 11 +++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index cc9aacc643..fe058e131a 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -164,10 +164,20 @@ namespace osu.Game.Overlays.Chat private void updateColour(bool joined) { - joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration); - topic.FadeTo(joined ? 0.8f : 1f, transition_duration); - topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration); - FadeColour(joined ? joinedColour ?? Color4.White : Color4.White, transition_duration); + if (joined) + { + joinedCheckmark.FadeTo(1f, transition_duration); + topic.FadeTo(0.8f, transition_duration); + topic.FadeColour(Color4.White, transition_duration); + FadeColour(joinedColour ?? Color4.White, transition_duration); + } + else + { + joinedCheckmark.FadeTo(0f, transition_duration); + topic.FadeTo(1f, transition_duration); + topic.FadeColour(topicColour ?? Color4.White, transition_duration); + FadeColour(Color4.White, transition_duration); + } } } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 60fabdf187..4fe705e0e0 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -17,12 +17,12 @@ namespace osu.Game.Overlays.Chat public readonly FillFlowContainer<ChannelListItem> ChannelFlow; - public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children.OfType<ChannelListItem>(); - public string[] FilterTerms => new[] { Header }; - public bool MatchingCurrentFilter - { + public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children.OfType<ChannelListItem>(); + public string[] FilterTerms => new[] { Header }; + public bool MatchingCurrentFilter + { set - { + { FadeTo(value ? 1f : 0f, 100); } } @@ -38,7 +38,6 @@ namespace osu.Game.Overlays.Chat set { ChannelFlow.Children = value.Select(c => new ChannelListItem { Channel = c }); } } - public ChannelSection() { RelativeSizeAxes = Axes.X; From d632435a344d2a5cb05b89329f27d521ef51d51d Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 03:51:09 -0300 Subject: [PATCH 14/61] Make ChannelListItems scale better --- osu.Game/Overlays/Chat/ChannelListItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index fe058e131a..5d40766bee 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Chat { private const float width_padding = 5; private const float channel_width = 150; - private const float topic_width = 380; private const float text_size = 15; private const float transition_duration = 100; @@ -104,7 +103,8 @@ namespace osu.Game.Overlays.Chat }, new Container { - Width = topic_width, + RelativeSizeAxes = Axes.X, + Width = 0.7f, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Left = width_padding }, Children = new[] From 4c551270e986afda61427a8faf6b72ee6c6c9bb4 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 03:56:10 -0300 Subject: [PATCH 15/61] Add OnRequestLeave --- osu.Game/Overlays/Chat/ChannelListItem.cs | 3 ++- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 5d40766bee..1232c0a132 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -37,6 +37,7 @@ namespace osu.Game.Overlays.Chat } public Action<Channel> OnRequestJoin; + public Action<Channel> OnRequestLeave; private Channel channel; public Channel Channel @@ -60,7 +61,7 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Action = () => { if (!Channel.Joined) OnRequestJoin?.Invoke(Channel); }; + Action = () => { (Channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); }; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 9b010e1794..ed01789712 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Chat private readonly SearchContainer<ChannelSection> sectionsFlow; public Action<Channel> OnRequestJoin; + public Action<Channel> OnRequestLeave; public IEnumerable<ChannelSection> Sections { @@ -41,6 +42,7 @@ namespace osu.Game.Overlays.Chat foreach (ChannelListItem c in s.ChannelFlow.Children) { c.OnRequestJoin = channel => { OnRequestJoin?.Invoke(channel); }; + c.OnRequestLeave = channel => { OnRequestLeave?.Invoke(channel); }; } } } From ae96ef08f707fae6703fbc8feee0ce4222f17fe0 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 04:02:04 -0300 Subject: [PATCH 16/61] Tab character --- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 1232c0a132..23dba69c90 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string[] FilterTerms => new[] { Channel.Name }; public bool MatchingCurrentFilter { - set + set { FadeTo(value ? 1f : 0f, 100); } From 38d0138978001a452727ee0d0ede8cdc5982e712 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 26 May 2017 04:11:45 -0300 Subject: [PATCH 17/61] CI fixes --- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 4fe705e0e0..e5fce2667e 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Chat public readonly FillFlowContainer<ChannelListItem> ChannelFlow; - public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children.OfType<ChannelListItem>(); + public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; public string[] FilterTerms => new[] { Header }; public bool MatchingCurrentFilter { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 193b18dd12..04bab211ab 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -245,7 +245,7 @@ namespace osu.Game.Overlays addChannel(channels.Find(c => c.Name == @"#osu")); addChannel(channels.Find(c => c.Name == @"#lobby")); - channelSelection.OnRequestJoin = channel => addChannel(channel); + channelSelection.OnRequestJoin = addChannel; channelSelection.Sections = new[] { new ChannelSection From b632e7f1ad8950344aa7e3a35e7c7cd81e919de5 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 27 May 2017 17:35:42 -0300 Subject: [PATCH 18/61] Accept Channel in ctor and remove Channel property --- osu.Game/Overlays/Chat/ChannelListItem.cs | 32 ++++++++--------------- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 23dba69c90..8b0c3778c3 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -21,13 +21,12 @@ namespace osu.Game.Overlays.Chat private const float transition_duration = 100; private readonly OsuSpriteText topic; - private readonly OsuSpriteText name; private readonly TextAwesome joinedCheckmark; private Color4? joinedColour; private Color4? topicColour; - public string[] FilterTerms => new[] { Channel.Name }; + public string[] FilterTerms => new[] { channel.Name }; public bool MatchingCurrentFilter { set @@ -40,28 +39,15 @@ namespace osu.Game.Overlays.Chat public Action<Channel> OnRequestLeave; private Channel channel; - public Channel Channel - { - get { return channel; } - set - { - if (value == channel) return; - if (channel != null) channel.Joined.ValueChanged -= updateColour; - channel = value; - name.Text = Channel.ToString(); - topic.Text = Channel.Topic; - channel.Joined.ValueChanged += updateColour; - updateColour(Channel.Joined); - } - } - - public ChannelListItem() + public ChannelListItem(Channel channel) { + this.channel = channel; + RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Action = () => { (Channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); }; + Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; Children = new Drawable[] { @@ -94,8 +80,9 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Y, Children = new[] { - name = new OsuSpriteText + new OsuSpriteText { + Text = channel.ToString(), TextSize = text_size, Font = @"Exo2.0-Bold", Shadow = false, @@ -112,6 +99,7 @@ namespace osu.Game.Overlays.Chat { topic = new OsuSpriteText { + Text = channel.Topic, TextSize = text_size, Font = @"Exo2.0-SemiBold", Shadow = false, @@ -146,6 +134,8 @@ namespace osu.Game.Overlays.Chat }, }, }; + + channel.Joined.ValueChanged += updateColour; } [BackgroundDependencyLoader] @@ -154,7 +144,7 @@ namespace osu.Game.Overlays.Chat topicColour = colours.Gray9; joinedColour = colours.Blue; - updateColour(Channel.Joined); + updateColour(channel.Joined); } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index e5fce2667e..c0391c7113 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Chat public IEnumerable<Channel> Channels { - set { ChannelFlow.Children = value.Select(c => new ChannelListItem { Channel = c }); } + set { ChannelFlow.Children = value.Select(c => new ChannelListItem(c)); } } public ChannelSection() From 754fe956f9b264db7e4179293af518f68ba9ec35 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 27 May 2017 17:40:20 -0300 Subject: [PATCH 19/61] Make ChannelSection headers uppercase in the setter --- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index c0391c7113..0fe6019ed6 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value; } + set { header.Text = value.ToUpper(); } } public IEnumerable<Channel> Channels diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 04bab211ab..a1e43068ea 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -250,7 +250,7 @@ namespace osu.Game.Overlays { new ChannelSection { - Header = @"ALL CHANNELS", + Header = "All Channels", Channels = channels, }, }; From b88c07f1a02208566729ea39372af84debd0f300 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Sat, 27 May 2017 17:49:57 -0300 Subject: [PATCH 20/61] Make channel readonly --- osu.Game/Overlays/Chat/ChannelListItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 8b0c3778c3..156939fff1 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Chat private const float text_size = 15; private const float transition_duration = 100; + private readonly Channel channel; + private readonly OsuSpriteText topic; private readonly TextAwesome joinedCheckmark; @@ -38,8 +40,6 @@ namespace osu.Game.Overlays.Chat public Action<Channel> OnRequestJoin; public Action<Channel> OnRequestLeave; - private Channel channel; - public ChannelListItem(Channel channel) { this.channel = channel; From 50e50ce67ee4a408ef3dadb2519ee4f0f3c21fb5 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 20:33:28 -0300 Subject: [PATCH 21/61] Update with framework changes --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index ed01789712..c6524d5418 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { search.HoldFocus = true; - Schedule(() => search.TriggerFocus()); + Schedule(() => search.TriggerOnFocus()); FadeIn(100, EasingTypes.OutQuint); MoveToY(0, 800, EasingTypes.OutQuint); From 745e2e5e188c9b880fc1e4ef73262ba8efefe42a Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 21:23:03 -0300 Subject: [PATCH 22/61] Make the channel selection overlay hide/resize with chat --- osu.Game/Overlays/ChatOverlay.cs | 127 ++++++++++++++++++------------- 1 file changed, 74 insertions(+), 53 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 6d8ae36369..304350b57f 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent { private const float textbox_height = 60; + private const float channel_selection_min_height = 0.3f; private ScheduledDelegate messageRequest; @@ -48,6 +49,7 @@ namespace osu.Game.Overlays private readonly ChatTabControl channelTabs; + private readonly Container chatContainer; private readonly Box chatBackground; private readonly Box tabBackground; @@ -55,13 +57,12 @@ namespace osu.Game.Overlays private readonly ChannelSelectionOverlay channelSelection; - protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || channelSelection.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.Contains(screenSpacePos); public ChatOverlay() { RelativeSizeAxes = Axes.Both; RelativePositionAxes = Axes.Both; - Size = new Vector2(1, DEFAULT_HEIGHT); Anchor = Anchor.BottomLeft; Origin = Anchor.BottomLeft; @@ -71,78 +72,96 @@ namespace osu.Game.Overlays { channelSelection = new ChannelSelectionOverlay //todo: temporary placement { - Origin = Anchor.BottomLeft, - Height = 400, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Height = 1f - DEFAULT_HEIGHT, State = Visibility.Visible, }, - new Container + chatContainer = new Container { - Name = @"chat area", + Name = @"chat container", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = TAB_AREA_HEIGHT }, - Children = new Drawable[] + Height = DEFAULT_HEIGHT, + Children = new[] { - chatBackground = new Box + new Container { + Name = @"chat area", RelativeSizeAxes = Axes.Both, - }, - currentChannelContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding + Padding = new MarginPadding { Top = TAB_AREA_HEIGHT }, + Children = new Drawable[] { - Bottom = textbox_height + padding - }, + chatBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + currentChannelContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding + { + Bottom = textbox_height + padding + }, + }, + new Container + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = textbox_height, + Padding = new MarginPadding + { + Top = padding * 2, + Bottom = padding * 2, + Left = ChatLine.LEFT_PADDING + padding * 2, + Right = padding * 2, + }, + Children = new Drawable[] + { + inputTextBox = new FocusedTextBox + { + RelativeSizeAxes = Axes.Both, + Height = 1, + PlaceholderText = "type your message", + Exit = () => State = Visibility.Hidden, + OnCommit = postMessage, + HoldFocus = true, + } + } + } + } }, new Container { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Name = @"tabs area", RelativeSizeAxes = Axes.X, - Height = textbox_height, - Padding = new MarginPadding - { - Top = padding * 2, - Bottom = padding * 2, - Left = ChatLine.LEFT_PADDING + padding * 2, - Right = padding * 2, - }, + Height = TAB_AREA_HEIGHT, Children = new Drawable[] { - inputTextBox = new FocusedTextBox + tabBackground = new Box { RelativeSizeAxes = Axes.Both, - Height = 1, - PlaceholderText = "type your message", - Exit = () => State = Visibility.Hidden, - OnCommit = postMessage, - HoldFocus = true, - } + Colour = Color4.Black, + }, + channelTabs = new ChatTabControl + { + RelativeSizeAxes = Axes.Both, + }, } - } - } - }, - new Container - { - Name = @"tabs area", - RelativeSizeAxes = Axes.X, - Height = TAB_AREA_HEIGHT, - Children = new Drawable[] - { - tabBackground = new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, }, - channelTabs = new ChatTabControl - { - RelativeSizeAxes = Axes.Both, - }, - } + }, }, }; channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; + channelSelection.StateChanged += (overlay, state) => + { + if (state == Visibility.Visible && 1f - chatHeight.Value < channel_selection_min_height) + chatHeight.Value = 1f - channel_selection_min_height; + }; } private double startDragChatHeight; @@ -211,7 +230,9 @@ namespace osu.Game.Overlays chatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight); chatHeight.ValueChanged += h => { - Height = (float)h; + chatContainer.Height = (float)h; + channelSelection.Height = 1f - (float)h; + if (channelSelection.Height < channel_selection_min_height) channelSelection.Hide(); tabBackground.FadeTo(Height == 1 ? 1 : 0.8f, 200); }; chatHeight.TriggerChange(); From d29bf58817be2c5ee2fbc31f24131469f509d5b4 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 21:50:15 -0300 Subject: [PATCH 23/61] Show scroll dragger --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index c6524d5418..c755e6fe3e 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -80,7 +80,6 @@ namespace osu.Game.Overlays.Chat new ScrollContainer { RelativeSizeAxes = Axes.Both, - ScrollDraggerVisible = false, Children = new[] { sectionsFlow = new SearchContainer<ChannelSection> From d8e86da78c1007ec58c83bbfee7d4e56d10b0372 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 22:00:15 -0300 Subject: [PATCH 24/61] Better scroll dragger position --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index c755e6fe3e..ab23f010cb 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Chat new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = 85 }, + Padding = new MarginPadding { Top = 85, Right = WIDTH_PADDING }, Children = new[] { new ScrollContainer @@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Chat LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, Spacing = new Vector2(0f, 20f), - Padding = new MarginPadding { Top = 20, Bottom = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, + Padding = new MarginPadding { Vertical = 20, Left = WIDTH_PADDING }, }, }, }, From 2ba86cffa6f5f0480d5ba025cf42f253838e4afc Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 22:04:53 -0300 Subject: [PATCH 25/61] Channel list item hover effect --- osu.Game/Overlays/Chat/ChannelListItem.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 156939fff1..ede80074d5 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -7,6 +7,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -22,11 +23,13 @@ namespace osu.Game.Overlays.Chat private readonly Channel channel; + private readonly OsuSpriteText name; private readonly OsuSpriteText topic; private readonly TextAwesome joinedCheckmark; private Color4? joinedColour; private Color4? topicColour; + private Color4 hoverColour; public string[] FilterTerms => new[] { channel.Name }; public bool MatchingCurrentFilter @@ -80,7 +83,7 @@ namespace osu.Game.Overlays.Chat AutoSizeAxes = Axes.Y, Children = new[] { - new OsuSpriteText + name = new OsuSpriteText { Text = channel.ToString(), TextSize = text_size, @@ -143,10 +146,25 @@ namespace osu.Game.Overlays.Chat { topicColour = colours.Gray9; joinedColour = colours.Blue; + hoverColour = colours.Yellow; updateColour(channel.Joined); } + protected override bool OnHover(InputState state) + { + if (!channel.Joined.Value) + name.FadeColour(hoverColour, transition_duration); + + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (!channel.Joined.Value) + name.FadeColour(Color4.White, transition_duration); + } + protected override void Dispose(bool isDisposing) { if(channel != null) channel.Joined.ValueChanged -= updateColour; @@ -157,6 +175,7 @@ namespace osu.Game.Overlays.Chat { if (joined) { + name.FadeColour(Color4.White, transition_duration); joinedCheckmark.FadeTo(1f, transition_duration); topic.FadeTo(0.8f, transition_duration); topic.FadeColour(Color4.White, transition_duration); From 96efa5a2403606ba2f268193d2aa1d41628e0a8a Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 22:10:07 -0300 Subject: [PATCH 26/61] Hook up to channel selector tab item --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 831cccf2d8..447946b863 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -76,7 +76,6 @@ namespace osu.Game.Overlays Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Height = 1f - DEFAULT_HEIGHT, - State = Visibility.Visible, }, chatContainer = new Container { @@ -157,6 +156,7 @@ namespace osu.Game.Overlays }; channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; + channelTabs.ChannelSelectorActive.ValueChanged += (value) => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden; channelSelection.StateChanged += (overlay, state) => { if (state == Visibility.Visible && 1f - chatHeight.Value < channel_selection_min_height) From 2edbf64d697de95734b147c88b4d05ca8857e7db Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Mon, 29 May 2017 22:22:14 -0300 Subject: [PATCH 27/61] Redundant parentheses --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 447946b863..8b4b3d2704 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays }; channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel; - channelTabs.ChannelSelectorActive.ValueChanged += (value) => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden; + channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden; channelSelection.StateChanged += (overlay, state) => { if (state == Visibility.Visible && 1f - chatHeight.Value < channel_selection_min_height) From d9704301742b3fbd92461d0ce47308174b429734 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Wed, 31 May 2017 22:08:25 -0300 Subject: [PATCH 28/61] Fix the channel selector not appearing if the chat is scaled up too tall then back down --- osu.Game/Overlays/ChatOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8b4b3d2704..b94489c421 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -232,7 +232,11 @@ namespace osu.Game.Overlays { chatContainer.Height = (float)h; channelSelection.Height = 1f - (float)h; - if (channelSelection.Height < channel_selection_min_height) channelSelection.Hide(); + if (channelSelection.Height < channel_selection_min_height) + channelSelection.Hide(); + else if (channelSelection.State == Visibility.Hidden && channelTabs.ChannelSelectorActive.Value) + channelSelection.Show(); + tabBackground.FadeTo(Height == 1 ? 1 : 0.8f, 200); }; chatHeight.TriggerChange(); From 6176f1d275acd855afd1b181a6ab3e18f756063c Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Wed, 31 May 2017 22:29:52 -0300 Subject: [PATCH 29/61] Make the transition when chat is too tall and opening the channel selector smoother --- osu.Game/Overlays/ChatOverlay.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index b94489c421..23827a7f1d 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { - channelSelection = new ChannelSelectionOverlay //todo: temporary placement + channelSelection = new ChannelSelectionOverlay { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, @@ -160,7 +160,12 @@ namespace osu.Game.Overlays channelSelection.StateChanged += (overlay, state) => { if (state == Visibility.Visible && 1f - chatHeight.Value < channel_selection_min_height) + { + chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, EasingTypes.OutQuint); + channelSelection.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); + channelSelection.Show(); chatHeight.Value = 1f - channel_selection_min_height; + } }; } From 52d524a65e1d24eafc7397fe3cb673912fe7dd69 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Wed, 31 May 2017 22:39:03 -0300 Subject: [PATCH 30/61] Update with framework changes --- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- osu.Game/Overlays/Chat/ChannelSection.cs | 2 +- .../Overlays/Chat/ChannelSelectionOverlay.cs | 20 +++++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index ede80074d5..825f0ae980 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Chat private Color4 hoverColour; public string[] FilterTerms => new[] { channel.Name }; - public bool MatchingCurrentFilter + public bool MatchingFilter { set { diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 0fe6019ed6..f12ec53605 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Chat public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; public string[] FilterTerms => new[] { Header }; - public bool MatchingCurrentFilter + public bool MatchingFilter { set { diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index ab23f010cb..872543bdd9 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -10,6 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -18,7 +19,7 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelSelectionOverlay : OverlayContainer + public class ChannelSelectionOverlay : FocusedOverlayContainer { public static readonly float WIDTH_PADDING = 170; @@ -146,21 +147,28 @@ namespace osu.Game.Overlays.Chat headerBg.Colour = colours.Gray2.Opacity(0.75f); } + protected override void OnFocus(InputState state) + { + InputManager.ChangeFocus(search); + base.OnFocus(state); + } + protected override void PopIn() { - search.HoldFocus = true; - Schedule(() => search.TriggerOnFocus()); - FadeIn(100, EasingTypes.OutQuint); MoveToY(0, 800, EasingTypes.OutQuint); + + search.HoldFocus = true; + base.PopIn(); } protected override void PopOut() { - search.HoldFocus = false; - FadeOut(500, EasingTypes.InQuint); MoveToY(DrawHeight, 500, EasingTypes.In); + + search.HoldFocus = false; + base.PopOut(); } private class HeaderSearchTextBox : SearchTextBox From 32f98ca62b09e1be982bfd243047d44e38ed68d6 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Wed, 31 May 2017 22:42:53 -0300 Subject: [PATCH 31/61] Don't autohide the channel list if the chat is too tall --- osu.Game/Overlays/ChatOverlay.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e4f04c49d6..9b97f7e1b3 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -241,11 +241,6 @@ namespace osu.Game.Overlays { chatContainer.Height = (float)h; channelSelection.Height = 1f - (float)h; - if (channelSelection.Height < channel_selection_min_height) - channelSelection.Hide(); - else if (channelSelection.State == Visibility.Hidden && channelTabs.ChannelSelectorActive.Value) - channelSelection.Show(); - tabBackground.FadeTo(Height == 1 ? 1 : 0.8f, 200); }; chatHeight.TriggerChange(); From c2d1a44de5946ed1f0749010a064224f78cea7fd Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 05:17:45 -0300 Subject: [PATCH 32/61] Fix channel selection not getting focus --- osu.Game/Overlays/ChatOverlay.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 9b97f7e1b3..e8081c965a 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -159,12 +159,20 @@ namespace osu.Game.Overlays channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden; channelSelection.StateChanged += (overlay, state) => { - if (state == Visibility.Visible && 1f - chatHeight.Value < channel_selection_min_height) + if (state == Visibility.Visible) { - chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, EasingTypes.OutQuint); - channelSelection.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); - channelSelection.Show(); - chatHeight.Value = 1f - channel_selection_min_height; + inputTextBox.HoldFocus = false; + if (1f - chatHeight.Value < channel_selection_min_height) + { + chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, EasingTypes.OutQuint); + channelSelection.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); + channelSelection.Show(); + chatHeight.Value = 1f - channel_selection_min_height; + } + } + else + { + inputTextBox.HoldFocus = true; } }; } From d728c87cca39a492449dd85df117e8b012f77316 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 05:26:01 -0300 Subject: [PATCH 33/61] Fix janky opening transition when resizing the chat and reopening the channel list --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 872543bdd9..780cad575f 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -155,6 +155,8 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { + MoveToY(DrawHeight); + FadeIn(100, EasingTypes.OutQuint); MoveToY(0, 800, EasingTypes.OutQuint); From a707d63647baded46e81eb4dded9f008b70bde51 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 05:41:21 -0300 Subject: [PATCH 34/61] Fix visual errors if spamming close/open on channel list --- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 780cad575f..5e76468fde 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Chat protected override void PopIn() { - MoveToY(DrawHeight); + if (Alpha == 0) MoveToY(DrawHeight); FadeIn(100, EasingTypes.OutQuint); MoveToY(0, 800, EasingTypes.OutQuint); From fad5b4ca9d4c33acddca01c613971e5e7cc6225a Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 06:10:26 -0300 Subject: [PATCH 35/61] Speed up animations --- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 825f0ae980..1a2d74b060 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -154,7 +154,7 @@ namespace osu.Game.Overlays.Chat protected override bool OnHover(InputState state) { if (!channel.Joined.Value) - name.FadeColour(hoverColour, transition_duration); + name.FadeColour(hoverColour, 50, EasingTypes.OutQuint); return base.OnHover(state); } diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 5e76468fde..cd736a5fe9 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -23,6 +23,8 @@ namespace osu.Game.Overlays.Chat { public static readonly float WIDTH_PADDING = 170; + private const float transition_duration = 500; + private readonly Box bg; private readonly Triangles triangles; private readonly Box headerBg; @@ -157,8 +159,8 @@ namespace osu.Game.Overlays.Chat { if (Alpha == 0) MoveToY(DrawHeight); - FadeIn(100, EasingTypes.OutQuint); - MoveToY(0, 800, EasingTypes.OutQuint); + FadeIn(transition_duration, EasingTypes.OutQuint); + MoveToY(0, transition_duration, EasingTypes.OutQuint); search.HoldFocus = true; base.PopIn(); @@ -166,8 +168,8 @@ namespace osu.Game.Overlays.Chat protected override void PopOut() { - FadeOut(500, EasingTypes.InQuint); - MoveToY(DrawHeight, 500, EasingTypes.In); + FadeOut(transition_duration, EasingTypes.InSine); + MoveToY(DrawHeight, transition_duration, EasingTypes.InSine); search.HoldFocus = false; base.PopOut(); From ecb0c2f68f47c2a1fbaa7c0ccc5ce18935448ed6 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 07:55:01 -0300 Subject: [PATCH 36/61] Cleanup ChannelListItem Joined binding --- osu.Game/Overlays/Chat/ChannelListItem.cs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 1a2d74b060..9aa11cdd4f 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -5,6 +5,7 @@ using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -23,12 +24,13 @@ namespace osu.Game.Overlays.Chat private readonly Channel channel; + private readonly Bindable<bool> joinedBind = new Bindable<bool>(); private readonly OsuSpriteText name; private readonly OsuSpriteText topic; private readonly TextAwesome joinedCheckmark; - private Color4? joinedColour; - private Color4? topicColour; + private Color4 joinedColour; + private Color4 topicColour; private Color4 hoverColour; public string[] FilterTerms => new[] { channel.Name }; @@ -137,8 +139,6 @@ namespace osu.Game.Overlays.Chat }, }, }; - - channel.Joined.ValueChanged += updateColour; } [BackgroundDependencyLoader] @@ -148,7 +148,8 @@ namespace osu.Game.Overlays.Chat joinedColour = colours.Blue; hoverColour = colours.Yellow; - updateColour(channel.Joined); + joinedBind.ValueChanged += updateColour; + joinedBind.BindTo(channel.Joined); } protected override bool OnHover(InputState state) @@ -165,12 +166,6 @@ namespace osu.Game.Overlays.Chat name.FadeColour(Color4.White, transition_duration); } - protected override void Dispose(bool isDisposing) - { - if(channel != null) channel.Joined.ValueChanged -= updateColour; - base.Dispose(isDisposing); - } - private void updateColour(bool joined) { if (joined) @@ -179,13 +174,13 @@ namespace osu.Game.Overlays.Chat joinedCheckmark.FadeTo(1f, transition_duration); topic.FadeTo(0.8f, transition_duration); topic.FadeColour(Color4.White, transition_duration); - FadeColour(joinedColour ?? Color4.White, transition_duration); + FadeColour(joinedColour, transition_duration); } else { joinedCheckmark.FadeTo(0f, transition_duration); topic.FadeTo(1f, transition_duration); - topic.FadeColour(topicColour ?? Color4.White, transition_duration); + topic.FadeColour(topicColour, transition_duration); FadeColour(Color4.White, transition_duration); } } From 24b3ec7787bb94b6b0346af45503cd10148ff439 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 08:16:53 -0300 Subject: [PATCH 37/61] Fix tab background not fading --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e8081c965a..df02b903bf 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -249,7 +249,7 @@ namespace osu.Game.Overlays { chatContainer.Height = (float)h; channelSelection.Height = 1f - (float)h; - tabBackground.FadeTo(Height == 1 ? 1 : 0.8f, 200); + tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200); }; chatHeight.TriggerChange(); From 697fab9248188e55795d037253175c4cdddee41d Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 20:22:09 -0300 Subject: [PATCH 38/61] Reselect the chosen tab when closing the channel list --- osu.Game/Overlays/Chat/ChatTabControl.cs | 11 ++++++++++- osu.Game/Overlays/ChatOverlay.cs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index a281cff7db..87222f03f9 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -23,9 +23,13 @@ namespace osu.Game.Overlays.Chat protected override TabItem<Channel> CreateTabItem(Channel value) => new ChannelTabItem(value); private const float shear_width = 10; + private readonly Channel addChannel = new Channel { Name = "+" }; public readonly Bindable<bool> ChannelSelectorActive = new Bindable<bool>(); + private Channel lastTab; + public Channel LastTab => lastTab; + public ChatTabControl() { TabContainer.Margin = new MarginPadding { Left = 50 }; @@ -41,7 +45,12 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding(10), }); - AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, ChannelSelectorActive)); + AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(addChannel, ChannelSelectorActive)); + + Current.ValueChanged += tab => + { + if (tab != addChannel) lastTab = tab; + }; } private class ChannelTabItem : TabItem<Channel> diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index df02b903bf..62ede00bb6 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -173,6 +173,7 @@ namespace osu.Game.Overlays else { inputTextBox.HoldFocus = true; + channelTabs.Current.Value = channelTabs.LastTab; } }; } From 62ada0afcb214e68e1b35b31df38cce30cb26d00 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Thu, 1 Jun 2017 20:46:18 -0300 Subject: [PATCH 39/61] Make the add tab item unselectable and toggle the channel list --- osu.Game/Overlays/Chat/ChatTabControl.cs | 17 ++++------------- osu.Game/Overlays/ChatOverlay.cs | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 87222f03f9..ba36fce33e 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -23,13 +23,9 @@ namespace osu.Game.Overlays.Chat protected override TabItem<Channel> CreateTabItem(Channel value) => new ChannelTabItem(value); private const float shear_width = 10; - private readonly Channel addChannel = new Channel { Name = "+" }; public readonly Bindable<bool> ChannelSelectorActive = new Bindable<bool>(); - private Channel lastTab; - public Channel LastTab => lastTab; - public ChatTabControl() { TabContainer.Margin = new MarginPadding { Left = 50 }; @@ -45,12 +41,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding(10), }); - AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(addChannel, ChannelSelectorActive)); - - Current.ValueChanged += tab => - { - if (tab != addChannel) lastTab = tab; - }; + AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, ChannelSelectorActive)); } private class ChannelTabItem : TabItem<Channel> @@ -216,11 +207,11 @@ namespace osu.Game.Overlays.Chat { public override bool Active { - get { return base.Active; } + get { return false; } set { - activeBindable.Value = value; - base.Active = value; + activeBindable.Value = !activeBindable.Value; + base.Active = false; } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 62ede00bb6..df02b903bf 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -173,7 +173,6 @@ namespace osu.Game.Overlays else { inputTextBox.HoldFocus = true; - channelTabs.Current.Value = channelTabs.LastTab; } }; } From 90dabe01f4150aa1949f609bec800efa8d3c8df2 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 2 Jun 2017 01:00:09 -0300 Subject: [PATCH 40/61] Fix the channel list appearing behind the tab bar --- osu.Game/Overlays/ChatOverlay.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index df02b903bf..e7d77b8408 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -55,6 +55,7 @@ namespace osu.Game.Overlays private Bindable<double> chatHeight; + private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.Contains(screenSpacePos); @@ -70,12 +71,18 @@ namespace osu.Game.Overlays Children = new Drawable[] { - channelSelection = new ChannelSelectionOverlay + channelSelectionContainer = new Container { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Height = 1f - DEFAULT_HEIGHT, + Masking = true, + Children = new[] + { + channelSelection = new ChannelSelectionOverlay + { + RelativeSizeAxes = Axes.Both, + }, + }, }, chatContainer = new Container { @@ -165,7 +172,7 @@ namespace osu.Game.Overlays if (1f - chatHeight.Value < channel_selection_min_height) { chatContainer.ResizeHeightTo(1f - channel_selection_min_height, 800, EasingTypes.OutQuint); - channelSelection.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); + channelSelectionContainer.ResizeHeightTo(channel_selection_min_height, 800, EasingTypes.OutQuint); channelSelection.Show(); chatHeight.Value = 1f - channel_selection_min_height; } @@ -248,7 +255,7 @@ namespace osu.Game.Overlays chatHeight.ValueChanged += h => { chatContainer.Height = (float)h; - channelSelection.Height = 1f - (float)h; + channelSelectionContainer.Height = 1f - (float)h; tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200); }; chatHeight.TriggerChange(); From 1fa70167c2061b5c61f591e971e790e6478bd81f Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 2 Jun 2017 01:35:36 -0300 Subject: [PATCH 41/61] Fix channel list occasioanlly taking clicks when not open --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e7d77b8408..ecb8d316c6 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || (channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos)); public ChatOverlay() { From d81ff9cbc2345c0cd3279018a6620ec609dced6a Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 2 Jun 2017 01:41:55 -0300 Subject: [PATCH 42/61] Add visual states for ChannelSelectorTabItem --- osu.Game/Overlays/Chat/ChatTabControl.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index ba36fce33e..13d90a1089 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -211,6 +211,7 @@ namespace osu.Game.Overlays.Chat set { activeBindable.Value = !activeBindable.Value; + selectorUpdateState(); base.Active = false; } } @@ -235,6 +236,26 @@ namespace osu.Game.Overlays.Chat backgroundInactive = colour.Gray2; backgroundActive = colour.Gray3; } + + protected override void LoadComplete() + { + base.LoadComplete(); + + selectorUpdateState(); + } + + protected override void OnHoverLost(InputState state) + { + selectorUpdateState(); + } + + private void selectorUpdateState() + { + if (activeBindable.Value) + fadeActive(); + else + fadeInactive(); + } } } } From c13e807d82510a9c5bbc38f95aa7df99e0c11ea2 Mon Sep 17 00:00:00 2001 From: DrabWeb <sethunity@gmail.com> Date: Fri, 2 Jun 2017 01:48:43 -0300 Subject: [PATCH 43/61] Redundant parenthesis --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index ecb8d316c6..d969ec5579 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || (channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos)); + protected override bool InternalContains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); public ChatOverlay() { From edead2ad3a12f92a261581642eeabdbb5f734c76 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Fri, 2 Jun 2017 20:24:18 +0900 Subject: [PATCH 44/61] Add settings for toggling raw input and adjusting sensitivity --- .../Settings/Sections/Input/MouseSettings.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 9cf5c42319..320ddae460 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -14,9 +14,24 @@ namespace osu.Game.Overlays.Settings.Sections.Input { protected override string Header => "Mouse"; + private readonly BindableBool rawInputToggle = new BindableBool(); + private Bindable<string> activeInputHandlers; + [BackgroundDependencyLoader] private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) { + activeInputHandlers = config.GetBindable<string>(FrameworkSetting.ActiveInputHandlers); + rawInputToggle.Value = activeInputHandlers.Value.Contains("Raw"); + rawInputToggle.ValueChanged += enabled => + { + const string raw_mouse_handler = @"OpenTKRawMouseHandler"; + const string standard_mouse_handler = @"OpenTKMouseHandler"; + + activeInputHandlers.Value = enabled ? + activeInputHandlers.Value.Replace(standard_mouse_handler, raw_mouse_handler) : + activeInputHandlers.Value.Replace(raw_mouse_handler, standard_mouse_handler); + }; + Children = new Drawable[] { new SettingsEnumDropdown<ConfineMouseMode> @@ -34,6 +49,16 @@ namespace osu.Game.Overlays.Settings.Sections.Input LabelText = "Disable mouse buttons during gameplay", Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons) }, + new SettingsCheckbox + { + LabelText = "Raw Input", + Bindable = rawInputToggle + }, + new SettingsSlider<double, SensitivitySlider> + { + LabelText = "Cursor Sensitivity", + Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity) + } }; } @@ -42,4 +67,4 @@ namespace osu.Game.Overlays.Settings.Sections.Input public override string TooltipText => Current.Value.ToString(@"0.##x"); } } -} +} \ No newline at end of file From 01243a6e75c1aae26e18c0c1d0c266a119f1759f Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 11:58:01 +0900 Subject: [PATCH 45/61] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index c76d8b811b..94f73e822b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c76d8b811b93d0c0862f342ebbab70a461006e13 +Subproject commit 94f73e822bd6e04d8aeeddc07479db4684d2eccb From ff0888449f63282366062a18eb512a0730d5d769 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 12:13:15 +0900 Subject: [PATCH 46/61] Disable ability to adjust sensitivity when raw input is disabled --- .../Settings/Sections/Input/MouseSettings.cs | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 320ddae460..4a9c13b1a6 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -16,27 +16,29 @@ namespace osu.Game.Overlays.Settings.Sections.Input private readonly BindableBool rawInputToggle = new BindableBool(); private Bindable<string> activeInputHandlers; + private SettingsSlider<double, SensitivitySlider> sensitivity; [BackgroundDependencyLoader] private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) { activeInputHandlers = config.GetBindable<string>(FrameworkSetting.ActiveInputHandlers); rawInputToggle.Value = activeInputHandlers.Value.Contains("Raw"); - rawInputToggle.ValueChanged += enabled => - { - const string raw_mouse_handler = @"OpenTKRawMouseHandler"; - const string standard_mouse_handler = @"OpenTKMouseHandler"; - - activeInputHandlers.Value = enabled ? - activeInputHandlers.Value.Replace(standard_mouse_handler, raw_mouse_handler) : - activeInputHandlers.Value.Replace(raw_mouse_handler, standard_mouse_handler); - }; Children = new Drawable[] { + new SettingsCheckbox + { + LabelText = "Raw Input", + Bindable = rawInputToggle + }, + sensitivity = new SettingsSlider<double, SensitivitySlider> + { + LabelText = "Cursor Sensitivity", + Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity) + }, new SettingsEnumDropdown<ConfineMouseMode> { - LabelText = "Confine mouse cursor", + LabelText = "Confine mouse cursor to window", Bindable = config.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode), }, new SettingsCheckbox @@ -49,22 +51,27 @@ namespace osu.Game.Overlays.Settings.Sections.Input LabelText = "Disable mouse buttons during gameplay", Bindable = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons) }, - new SettingsCheckbox - { - LabelText = "Raw Input", - Bindable = rawInputToggle - }, - new SettingsSlider<double, SensitivitySlider> - { - LabelText = "Cursor Sensitivity", - Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity) - } }; + + rawInputToggle.ValueChanged += enabled => + { + // this is temporary until we support per-handler settings. + const string raw_mouse_handler = @"OpenTKRawMouseHandler"; + const string standard_mouse_handler = @"OpenTKMouseHandler"; + + activeInputHandlers.Value = enabled ? + activeInputHandlers.Value.Replace(standard_mouse_handler, raw_mouse_handler) : + activeInputHandlers.Value.Replace(raw_mouse_handler, standard_mouse_handler); + + sensitivity.Bindable.Disabled = !enabled; + }; + + rawInputToggle.TriggerChange(); } private class SensitivitySlider : OsuSliderBar<double> { - public override string TooltipText => Current.Value.ToString(@"0.##x"); + public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); } } } \ No newline at end of file From ae7388e68fab5010236da38704b175f0ba97d4bd Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 13:24:54 +0900 Subject: [PATCH 47/61] Don't update sensitivity when dragging slider --- .../Settings/Sections/Input/MouseSettings.cs | 58 ++++++++++++++++++- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 4a9c13b1a6..b4d877e7a6 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input private readonly BindableBool rawInputToggle = new BindableBool(); private Bindable<string> activeInputHandlers; - private SettingsSlider<double, SensitivitySlider> sensitivity; + private SensitivitySetting sensitivity; [BackgroundDependencyLoader] private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input LabelText = "Raw Input", Bindable = rawInputToggle }, - sensitivity = new SettingsSlider<double, SensitivitySlider> + sensitivity = new SensitivitySetting { LabelText = "Cursor Sensitivity", Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity) @@ -69,8 +69,62 @@ namespace osu.Game.Overlays.Settings.Sections.Input rawInputToggle.TriggerChange(); } + private class SensitivitySetting : SettingsSlider<double, SensitivitySlider> + { + public override Bindable<double> Bindable + { + get { return ((SensitivitySlider)Control).Sensitivity; } + + set + { + BindableDouble doubleValue = (BindableDouble)value; + + // create a second layer of bindable so we can only handle state changes when not being dragged. + ((SensitivitySlider)Control).Sensitivity = doubleValue; + + // this bindable will still act as the "interactive" bindable displayed during a drag. + base.Bindable = new BindableDouble(doubleValue.Value) + { + MinValue = doubleValue.MinValue, + MaxValue = doubleValue.MaxValue + }; + + // one-way binding to update the sliderbar with changes from external actions. + doubleValue.DisabledChanged += disabled => base.Bindable.Disabled = disabled; + doubleValue.ValueChanged += newValue => base.Bindable.Value = newValue; + } + } + } + private class SensitivitySlider : OsuSliderBar<double> { + public Bindable<double> Sensitivity; + + public SensitivitySlider() + { + Current.ValueChanged += newValue => + { + if (!isDragging && Sensitivity != null) + Sensitivity.Value = newValue; + }; + } + + private bool isDragging; + + protected override bool OnDragStart(InputState state) + { + isDragging = true; + return base.OnDragStart(state); + } + + protected override bool OnDragEnd(InputState state) + { + isDragging = false; + Current.TriggerChange(); + + return base.OnDragEnd(state); + } + public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 7cddefb755..14b67dd6df 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Settings // hold a reference to the provided bindable so we don't have to in every settings section. private Bindable<T> bindable; - public Bindable<T> Bindable + public virtual Bindable<T> Bindable { get { From 61289dceade1dd15baa031a350bd2224b1419f38 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 13:38:37 +0900 Subject: [PATCH 48/61] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 94f73e822b..925bbe42ba 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 94f73e822bd6e04d8aeeddc07479db4684d2eccb +Subproject commit 925bbe42bab95078b9d33189205b5b1b76bf8e01 From 5568df1aee9fc495ea81cdb95b66fe42151706ea Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 17:15:04 +0900 Subject: [PATCH 49/61] Remove StandardHUDOverlay This class hierarchy was originally when we had different HUDs for rulesets, but this is no longer the case. Skins will be able to build off the base (new) HUDOverlay without issue, so there is no real need for the abstract class for now. We can add it back if a need for it arises; for the moment I'd like to avoid as many Standard* classes as possible. --- osu.Game/Screens/Play/HUDOverlay.cs | 113 ++++++++++++++++---- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/StandardHUDOverlay.cs | 105 ------------------ osu.Game/osu.Game.csproj | 1 - 4 files changed, 95 insertions(+), 126 deletions(-) delete mode 100644 osu.Game/Screens/Play/StandardHUDOverlay.cs diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 616b28fa99..3248495b61 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -7,21 +7,24 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play.HUD; +using OpenTK; using OpenTK.Input; namespace osu.Game.Screens.Play { - public abstract class HUDOverlay : Container + public class HUDOverlay : Container { private const int duration = 100; private readonly Container content; + public readonly KeyCounterCollection KeyCounter; public readonly RollingCounter<int> ComboCounter; public readonly ScoreCounter ScoreCounter; @@ -35,16 +38,7 @@ namespace osu.Game.Screens.Play private static bool hasShownNotificationOnce; - protected abstract KeyCounterCollection CreateKeyCounter(); - protected abstract RollingCounter<int> CreateComboCounter(); - protected abstract RollingCounter<double> CreateAccuracyCounter(); - protected abstract ScoreCounter CreateScoreCounter(); - protected abstract HealthDisplay CreateHealthDisplay(); - protected abstract SongProgress CreateProgress(); - protected abstract ModDisplay CreateModsContainer(); - //protected abstract ReplaySettingsOverlay CreateReplaySettingsOverlay(); - - protected HUDOverlay() + public HUDOverlay() { RelativeSizeAxes = Axes.Both; @@ -67,7 +61,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuConfigManager config, NotificationManager notificationManager) + private void load(OsuConfigManager config, NotificationManager notificationManager, OsuColour colours) { showHud = config.GetBindable<bool>(OsuSetting.ShowInterface); showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); @@ -82,14 +76,18 @@ namespace osu.Game.Screens.Play Text = @"The score overlay is currently disabled. You can toggle this by pressing Shift+Tab." }); } - } - public virtual void BindProcessor(ScoreProcessor processor) - { - ScoreCounter?.Current.BindTo(processor.TotalScore); - AccuracyCounter?.Current.BindTo(processor.Accuracy); - ComboCounter?.Current.BindTo(processor.Combo); - HealthDisplay?.Current.BindTo(processor.Health); + // todo: the stuff below should probably not be in this base implementation, but in each individual class. + ComboCounter.AccentColour = colours.BlueLighter; + AccuracyCounter.AccentColour = colours.BlueLighter; + ScoreCounter.AccentColour = colours.BlueLighter; + + var shd = HealthDisplay as StandardHealthDisplay; + if (shd != null) + { + shd.AccentColour = colours.BlueLighter; + shd.GlowColour = colours.BlueDarker; + } } public virtual void BindHitRenderer(HitRenderer hitRenderer) @@ -122,5 +120,82 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } + + protected virtual RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopRight, + Position = new Vector2(0, 35), + TextSize = 20, + Margin = new MarginPadding { Right = 140 }, + }; + + protected virtual RollingCounter<int> CreateComboCounter() => new SimpleComboCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft, + Position = new Vector2(0, 35), + Margin = new MarginPadding { Left = 140 }, + TextSize = 20, + }; + + protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay + { + Size = new Vector2(1, 5), + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = 20 } + }; + + protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + { + IsCounting = true, + FadeTime = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding(10), + Y = -TwoLayerButton.SIZE_RETRACTED.Y, + }; + + protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 40, + Position = new Vector2(0, 30), + }; + + protected virtual SongProgress CreateProgress() => new SongProgress + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + + protected virtual ModDisplay CreateModsContainer() => new ModDisplay + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Top = 20, Right = 10 }, + }; + + //protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay + //{ + // Anchor = Anchor.TopRight, + // Origin = Anchor.TopRight, + // Margin = new MarginPadding { Top = 100, Right = 10 }, + //}; + + public virtual void BindProcessor(ScoreProcessor processor) + { + ScoreCounter?.Current.BindTo(processor.TotalScore); + AccuracyCounter?.Current.BindTo(processor.Accuracy); + ComboCounter?.Current.BindTo(processor.Combo); + HealthDisplay?.Current.BindTo(processor.Health); + + var shd = HealthDisplay as StandardHealthDisplay; + if (shd != null) + processor.NewJudgement += shd.Flash; + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 707d026e2b..d4b8445ed9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play HitRenderer, } }, - hudOverlay = new StandardHUDOverlay + hudOverlay = new HUDOverlay { Anchor = Anchor.Centre, Origin = Anchor.Centre diff --git a/osu.Game/Screens/Play/StandardHUDOverlay.cs b/osu.Game/Screens/Play/StandardHUDOverlay.cs deleted file mode 100644 index 50add4a19b..0000000000 --- a/osu.Game/Screens/Play/StandardHUDOverlay.cs +++ /dev/null @@ -1,105 +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.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Scoring; -using osu.Game.Screens.Play.HUD; -using OpenTK; - -namespace osu.Game.Screens.Play -{ - public class StandardHUDOverlay : HUDOverlay - { - protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopRight, - Position = new Vector2(0, 35), - TextSize = 20, - Margin = new MarginPadding { Right = 140 }, - }; - - protected override RollingCounter<int> CreateComboCounter() => new SimpleComboCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopLeft, - Position = new Vector2(0, 35), - Margin = new MarginPadding { Left = 140 }, - TextSize = 20, - }; - - protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay - { - Size = new Vector2(1, 5), - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = 20 } - }; - - protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection - { - IsCounting = true, - FadeTime = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding(10), - Y = -TwoLayerButton.SIZE_RETRACTED.Y, - }; - - protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 40, - Position = new Vector2(0, 30), - }; - - protected override SongProgress CreateProgress() => new SongProgress - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - }; - - protected override ModDisplay CreateModsContainer() => new ModDisplay - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - 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) - { - ComboCounter.AccentColour = colours.BlueLighter; - AccuracyCounter.AccentColour = colours.BlueLighter; - ScoreCounter.AccentColour = colours.BlueLighter; - - var shd = HealthDisplay as StandardHealthDisplay; - if (shd != null) - { - shd.AccentColour = colours.BlueLighter; - shd.GlowColour = colours.BlueDarker; - } - } - - public override void BindProcessor(ScoreProcessor processor) - { - base.BindProcessor(processor); - - var shd = HealthDisplay as StandardHealthDisplay; - if (shd != null) - processor.NewJudgement += shd.Flash; - } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 25504f44d7..e6dd7ba1c4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -253,7 +253,6 @@ <Compile Include="Screens\Play\SongProgressInfo.cs" /> <Compile Include="Screens\Play\HUD\ModDisplay.cs" /> <Compile Include="Screens\Play\SquareGraph.cs" /> - <Compile Include="Screens\Play\StandardHUDOverlay.cs" /> <Compile Include="Screens\Ranking\ResultsPage.cs" /> <Compile Include="Screens\Ranking\ResultsPageRanking.cs" /> <Compile Include="Screens\Ranking\ResultsPageScore.cs" /> From 16fcfc473d79efbc0008ada0d35ea8510db1729b Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 18:04:40 +0900 Subject: [PATCH 50/61] Fix toggle not toggling on pressing escape Also add comment about hacky implementation of toggle tab. --- osu.Game/Overlays/Chat/ChatTabControl.cs | 7 ++++++- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 13d90a1089..111e2dc4ad 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -210,8 +210,10 @@ namespace osu.Game.Overlays.Chat get { return false; } set { + // we basically never want this tab to become active. + // this allows us to become a "toggle" tab. + // is a bit hacky, to say the least. activeBindable.Value = !activeBindable.Value; - selectorUpdateState(); base.Active = false; } } @@ -221,6 +223,9 @@ namespace osu.Game.Overlays.Chat public ChannelSelectorTabItem(Channel value, Bindable<bool> active) : base(value) { activeBindable = active; + activeBindable.ValueChanged += v => selectorUpdateState(); + + Depth = float.MaxValue; Width = 45; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8d79f470f5..7430ab8923 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -166,6 +166,8 @@ namespace osu.Game.Overlays channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden; channelSelection.StateChanged += (overlay, state) => { + channelTabs.ChannelSelectorActive.Value = state == Visibility.Visible; + if (state == Visibility.Visible) { inputTextBox.HoldFocus = false; From a7c7618aa08bbdb7093c48328fed59d09c5a9e56 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 19:24:34 +0900 Subject: [PATCH 51/61] Update resources --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 9f46a456dc..a5199500cc 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 9f46a456dc3a56dcbff09671a3f588b16a464106 +Subproject commit a5199500cc3ba96101fd858e0f78f36e538697b1 From e92c1210d12eb689691fad34014aceb52194d007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net> Date: Mon, 5 Jun 2017 12:59:29 +0200 Subject: [PATCH 52/61] Make osu tooltips move smoothly --- osu-framework | 2 +- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index c76d8b811b..925bbe42ba 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c76d8b811b93d0c0862f342ebbab70a461006e13 +Subproject commit 925bbe42bab95078b9d33189205b5b1b76bf8e01 diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 46addf5ac2..3df735b725 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -1,6 +1,7 @@ // 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; @@ -24,6 +25,7 @@ namespace osu.Game.Graphics.Cursor { private readonly Box background; private readonly OsuSpriteText text; + private bool firstMovement = true; public override string TooltipText { @@ -88,6 +90,19 @@ namespace osu.Game.Graphics.Cursor using (BeginDelayedSequence(150)) FadeOut(500, EasingTypes.OutQuint); } + + public override void Move(Vector2 pos) + { + if (firstMovement) + { + Position = pos; + firstMovement = false; + } + else + { + MoveTo(pos, 200, EasingTypes.OutQuint); + } + } } } } From b4b3ba0787f15bf6d7df870e7c2791defe50bea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net> Date: Mon, 5 Jun 2017 13:07:38 +0200 Subject: [PATCH 53/61] Fix incorrect initial movement of tooltips --- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 3df735b725..bce0279465 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -83,6 +83,7 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { FadeIn(500, EasingTypes.OutQuint); + firstMovement = true; } protected override void PopOut() From 09e075e3fb0a4d84febc571df40e4131a2f5bdbd Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 20:22:39 +0900 Subject: [PATCH 54/61] Allow adjusting mouse sensitivity at 0.01 increments --- osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index b4d877e7a6..311fa072c6 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -102,6 +102,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input public SensitivitySlider() { + KeyboardStep = 0.01f; + Current.ValueChanged += newValue => { if (!isDragging && Sensitivity != null) From c85a0223b0d4ffc5290b99040f644c39ece11b16 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 20:52:46 +0900 Subject: [PATCH 55/61] Only instantly move tooltip is we are not visible --- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index bce0279465..815d820a47 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Graphics.Cursor { private readonly Box background; private readonly OsuSpriteText text; - private bool firstMovement = true; + private bool instantMovement = true; public override string TooltipText { @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.Cursor if (value == text.Text) return; text.Text = value; - if (Alpha > 0) + if (IsPresent) { AutoSizeDuration = 250; background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint); @@ -82,8 +82,8 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { + instantMovement |= !IsPresent; FadeIn(500, EasingTypes.OutQuint); - firstMovement = true; } protected override void PopOut() @@ -94,10 +94,10 @@ namespace osu.Game.Graphics.Cursor public override void Move(Vector2 pos) { - if (firstMovement) + if (instantMovement) { Position = pos; - firstMovement = false; + instantMovement = false; } else { From d9106c4e304da129f881072d8eea9566ca5222bf Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 21:58:13 +0900 Subject: [PATCH 56/61] Temporarily disable inspection --- osu.Game/Overlays/Chat/ChatTabControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 111e2dc4ad..23ddff9381 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -208,6 +208,7 @@ namespace osu.Game.Overlays.Chat public override bool Active { get { return false; } + // ReSharper disable once ValueParameterNotUsed set { // we basically never want this tab to become active. From 6b7e18a1e36de8c3dae809bb6415b08226a455d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Mon, 5 Jun 2017 23:12:39 +0900 Subject: [PATCH 57/61] Fix not being able to change channels when channel select dialog is up --- osu.Game/Overlays/ChatOverlay.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 7430ab8923..2e6f143e74 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -324,9 +324,7 @@ namespace osu.Game.Overlays set { - if (currentChannel == value) return; - - if (channelTabs.ChannelSelectorActive) return; + if (currentChannel == value || value == null) return; currentChannel = value; From fac16bdebd3c4bfc01afc1a03a60775807420da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net> Date: Mon, 5 Jun 2017 18:07:28 +0200 Subject: [PATCH 58/61] Do not release focus of the chat text box when sending a message --- osu-framework | 2 +- osu.Game/Overlays/ChatOverlay.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 925bbe42ba..4e82d99cbe 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 925bbe42bab95078b9d33189205b5b1b76bf8e01 +Subproject commit 4e82d99cbe1c9e60ca99beff91c7dbe84fee7897 diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 2e6f143e74..c32199f881 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -134,6 +134,7 @@ namespace osu.Game.Overlays PlaceholderText = "type your message", Exit = () => State = Visibility.Hidden, OnCommit = postMessage, + ReleaseFocusOnCommit = false, HoldFocus = true, } } From 141c53c50624fbf830dff0e4c5ab71eb8760f96d Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Tue, 6 Jun 2017 13:54:16 +0900 Subject: [PATCH 59/61] Update resource again (fixes filesize increase) --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index a5199500cc..b348c1e540 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit a5199500cc3ba96101fd858e0f78f36e538697b1 +Subproject commit b348c1e540edbb3325a8da9bca452c9dce2938d6 From e7271951872a0bb5d005c0fe6510e46ae3863e7f Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Tue, 6 Jun 2017 22:06:43 +0900 Subject: [PATCH 60/61] Treat inspectcode warnings as errors (CI) There are many instances we accidentally merge pull requests with outstanding warnings, as the fact warnings exists is not made obvious. This forces all `inspectcode` warnings to an error level. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cc6dfb9c88..b26a895788 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,4 +20,4 @@ build: verbosity: minimal after_build: - cmd: inspectcode /o="inspectcodereport.xml" /caches-home="inspectcode" osu.sln - - cmd: NVika parsereport "inspectcodereport.xml" \ No newline at end of file + - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file From 5f537780cf061019ee650cadadf4fde66667164b Mon Sep 17 00:00:00 2001 From: Dean Herbert <pe@ppy.sh> Date: Wed, 7 Jun 2017 15:32:50 +0900 Subject: [PATCH 61/61] Bring framework up-to-date --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs | 4 ++-- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs | 2 +- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 4 ++-- osu.Game/Overlays/Music/PlaylistItem.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu-framework b/osu-framework index 4e82d99cbe..3ad1dd52ae 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4e82d99cbe1c9e60ca99beff91c7dbe84fee7897 +Subproject commit 3ad1dd52ae511b816fb928f70ef811ec605c5c18 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs index 3113b63db1..c66b0b4db4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests { Name = "Timing section", RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, 10000), + RelativeChildSize = new Vector2(1, 10000), Children = new[] { new DrawableNote(new Note { StartTime = 5000 }) { AccentColour = Color4.Red }, @@ -62,7 +62,7 @@ namespace osu.Desktop.VisualTests.Tests { Name = "Timing section", RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, 10000), + RelativeChildSize = new Vector2(1, 10000), Children = new[] { new DrawableHoldNote(new HoldNote diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 5d7f3314cd..1d751b0293 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables tickContainer = new Container<DrawableHoldNoteTick> { RelativeSizeAxes = Axes.Both, - RelativeCoordinateSpace = new Vector2(1, (float)HitObject.Duration) + RelativeChildSize = new Vector2(1, (float)HitObject.Duration) }, head = new DrawableHeadNote(this, key) { diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index 0a8bc2d44a..2619ce150c 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.Timing // Adjust our height to account for the speed changes Height = (float)(1000 / timingChange.BeatLength / timingChange.SpeedMultiplier); - RelativeCoordinateSpace = new Vector2(1, (float)parent.TimeSpan); + RelativeChildSize = new Vector2(1, (float)parent.TimeSpan); // Scroll the content content.Y = (float)(timingChange.Time - Time.Current); @@ -146,7 +146,7 @@ namespace osu.Game.Rulesets.Mania.Timing float height = Children.Select(child => child.Y + child.Height).Max(); Height = height; - RelativeCoordinateSpace = new Vector2(1, height); + RelativeChildSize = new Vector2(1, height); base.InvalidateFromChild(invalidation); } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 0618f96cac..789e45adfc 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Music private Color4 artistColour; private TextAwesome handle; - private Paragraph text; + private TextFlowContainer text; private IEnumerable<SpriteText> titleSprites; private UnicodeBindableString titleBind; private UnicodeBindableString artistBind; @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Music Margin = new MarginPadding { Left = 5 }, Padding = new MarginPadding { Top = 2 }, }, - text = new Paragraph + text = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y,