New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Channel selection overlay #861
Merged
Merged
Changes from 21 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
31890a1
Initial layout, channels items
DrabWeb 6a8d745
Use Channels in ChannelListItems, ChannelSection, fix ChannelListItem…
DrabWeb 3cc5100
Add settings button, background triangles, proper displaying of Channels
DrabWeb 7eba619
Move Joined to Channel
DrabWeb 47dfc0d
Added transition
DrabWeb 2e1d01a
Added searching
DrabWeb 4a166c1
Make ChannelSelectionOverlay a FocusedOverlayContainer
DrabWeb a60d1ef
Basic channel joining (ignore layout in ChatOverlay, temporary)
DrabWeb 51bc3df
Padding below channel list, remove text shadows, fix search box focusing
DrabWeb 62897d3
Remove SettingsButton(old and outdated design), fix channel list scro…
DrabWeb 64016f9
Merge https://github.com/ppy/osu into channel-selection
DrabWeb fb0b54e
Remove merge error
DrabWeb d29ebb1
Cleanup
DrabWeb 21e900d
Transition code cleanup
DrabWeb d632435
Make ChannelListItems scale better
DrabWeb 4c55127
Add OnRequestLeave
DrabWeb ae96ef0
Tab character
DrabWeb 38d0138
CI fixes
DrabWeb b632e7f
Accept Channel in ctor and remove Channel property
DrabWeb 754fe95
Make ChannelSection headers uppercase in the setter
DrabWeb b88c07f
Make channel readonly
DrabWeb 21a8071
Merge https://github.com/ppy/osu into channel-selection
DrabWeb 50e50ce
Update with framework changes
DrabWeb 745e2e5
Make the channel selection overlay hide/resize with chat
DrabWeb d29bf58
Show scroll dragger
DrabWeb d8e86da
Better scroll dragger position
DrabWeb 2ba86cf
Channel list item hover effect
DrabWeb b9292b6
Merge https://github.com/ppy/osu into channel-selection
DrabWeb 96efa5a
Hook up to channel selector tab item
DrabWeb 2edbf64
Redundant parentheses
DrabWeb d970430
Fix the channel selector not appearing if the chat is scaled up too t…
DrabWeb 6176f1d
Make the transition when chat is too tall and opening the channel sel…
DrabWeb e7bf1e0
Merge https://github.com/ppy/osu into channel-selection
DrabWeb 52d524a
Update with framework changes
DrabWeb 32f98ca
Don't autohide the channel list if the chat is too tall
DrabWeb c2d1a44
Fix channel selection not getting focus
DrabWeb d728c87
Fix janky opening transition when resizing the chat and reopening the…
DrabWeb a707d63
Fix visual errors if spamming close/open on channel list
DrabWeb fad5b4c
Speed up animations
DrabWeb ecb0c2f
Cleanup ChannelListItem Joined binding
DrabWeb 24b3ec7
Fix tab background not fading
DrabWeb 697fab9
Reselect the chosen tab when closing the channel list
DrabWeb 62ada0a
Make the add tab item unselectable and toggle the channel list
DrabWeb 90dabe0
Fix the channel list appearing behind the tab bar
DrabWeb 1fa7016
Fix channel list occasioanlly taking clicks when not open
DrabWeb d81ff9c
Add visual states for ChannelSelectorTabItem
DrabWeb c13e807
Redundant parenthesis
DrabWeb 778865b
Merge remote-tracking branch 'upstream/master' into channel-selection
peppy 16fcfc4
Fix toggle not toggling on pressing escape
peppy 57aad13
Merge branch 'master' into channel-selection
peppy d9106c4
Temporarily disable inspection
peppy 6b7e18a
Fix not being able to change channels when channel select dialog is up
peppy File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
// 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; | ||
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, IFilterable | ||
{ | ||
private const float width_padding = 5; | ||
private const float channel_width = 150; | ||
private const float text_size = 15; | ||
private const float transition_duration = 100; | ||
|
||
private readonly Channel channel; | ||
|
||
private readonly OsuSpriteText topic; | ||
private readonly TextAwesome joinedCheckmark; | ||
|
||
private Color4? joinedColour; | ||
private Color4? topicColour; | ||
|
||
public string[] FilterTerms => new[] { channel.Name }; | ||
public bool MatchingCurrentFilter | ||
{ | ||
set | ||
{ | ||
FadeTo(value ? 1f : 0f, 100); | ||
} | ||
} | ||
|
||
public Action<Channel> OnRequestJoin; | ||
public Action<Channel> OnRequestLeave; | ||
|
||
public ChannelListItem(Channel channel) | ||
{ | ||
this.channel = channel; | ||
|
||
RelativeSizeAxes = Axes.X; | ||
AutoSizeAxes = Axes.Y; | ||
|
||
Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; | ||
|
||
Children = new Drawable[] | ||
{ | ||
new FillFlowContainer | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Direction = FillDirection.Horizontal, | ||
Children = new Drawable[] | ||
{ | ||
new Container | ||
{ | ||
Children = new[] | ||
{ | ||
joinedCheckmark = new TextAwesome | ||
{ | ||
Anchor = Anchor.TopRight, | ||
Origin = Anchor.TopRight, | ||
Icon = FontAwesome.fa_check_circle, | ||
TextSize = text_size, | ||
Shadow = false, | ||
Margin = new MarginPadding { Right = 10f }, | ||
Alpha = 0f, | ||
}, | ||
}, | ||
}, | ||
new Container | ||
{ | ||
Width = channel_width, | ||
AutoSizeAxes = Axes.Y, | ||
Children = new[] | ||
{ | ||
new OsuSpriteText | ||
{ | ||
Text = channel.ToString(), | ||
TextSize = text_size, | ||
Font = @"Exo2.0-Bold", | ||
Shadow = false, | ||
}, | ||
}, | ||
}, | ||
new Container | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
Width = 0.7f, | ||
AutoSizeAxes = Axes.Y, | ||
Margin = new MarginPadding { Left = width_padding }, | ||
Children = new[] | ||
{ | ||
topic = new OsuSpriteText | ||
{ | ||
Text = channel.Topic, | ||
TextSize = text_size, | ||
Font = @"Exo2.0-SemiBold", | ||
Shadow = false, | ||
Alpha = 0.8f, | ||
}, | ||
}, | ||
}, | ||
new FillFlowContainer | ||
{ | ||
AutoSizeAxes = Axes.Both, | ||
Direction = FillDirection.Horizontal, | ||
Margin = new MarginPadding { Left = width_padding }, | ||
Spacing = new Vector2(3f, 0f), | ||
Children = new Drawable[] | ||
{ | ||
new TextAwesome | ||
{ | ||
Icon = FontAwesome.fa_user, | ||
TextSize = text_size - 2, | ||
Shadow = false, | ||
Margin = new MarginPadding { Top = 1 }, | ||
}, | ||
new OsuSpriteText | ||
{ | ||
Text = @"0", | ||
TextSize = text_size, | ||
Font = @"Exo2.0-SemiBold", | ||
Shadow = false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
channel.Joined.ValueChanged += updateColour; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuColour colours) | ||
{ | ||
topicColour = colours.Gray9; | ||
joinedColour = colours.Blue; | ||
|
||
updateColour(channel.Joined); | ||
} | ||
|
||
protected override void Dispose(bool isDisposing) | ||
{ | ||
if(channel != null) channel.Joined.ValueChanged -= updateColour; | ||
This comment was marked as off-topic.
Sorry, something went wrong. |
||
base.Dispose(isDisposing); | ||
} | ||
|
||
private void updateColour(bool joined) | ||
{ | ||
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// 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, IHasFilterableChildren | ||
{ | ||
private readonly OsuSpriteText header; | ||
|
||
public readonly FillFlowContainer<ChannelListItem> ChannelFlow; | ||
|
||
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children; | ||
public string[] FilterTerms => new[] { Header }; | ||
public bool MatchingCurrentFilter | ||
{ | ||
set | ||
{ | ||
FadeTo(value ? 1f : 0f, 100); | ||
} | ||
} | ||
|
||
public string Header | ||
{ | ||
get { return header.Text; } | ||
set { header.Text = value.ToUpper(); } | ||
} | ||
|
||
public IEnumerable<Channel> Channels | ||
{ | ||
set { ChannelFlow.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", | ||
}, | ||
ChannelFlow = new FillFlowContainer<ChannelListItem> | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Margin = new MarginPadding { Top = 25 }, | ||
Spacing = new Vector2(0f, 5f), | ||
}, | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.