mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Accept Channel in ctor and remove Channel property
This commit is contained in:
parent
38d0138978
commit
b632e7f1ad
@ -21,13 +21,12 @@ namespace osu.Game.Overlays.Chat
|
|||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
|
|
||||||
private readonly OsuSpriteText topic;
|
private readonly OsuSpriteText topic;
|
||||||
private readonly OsuSpriteText name;
|
|
||||||
private readonly TextAwesome joinedCheckmark;
|
private readonly TextAwesome joinedCheckmark;
|
||||||
|
|
||||||
private Color4? joinedColour;
|
private Color4? joinedColour;
|
||||||
private Color4? topicColour;
|
private Color4? topicColour;
|
||||||
|
|
||||||
public string[] FilterTerms => new[] { Channel.Name };
|
public string[] FilterTerms => new[] { channel.Name };
|
||||||
public bool MatchingCurrentFilter
|
public bool MatchingCurrentFilter
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -40,28 +39,15 @@ namespace osu.Game.Overlays.Chat
|
|||||||
public Action<Channel> OnRequestLeave;
|
public Action<Channel> OnRequestLeave;
|
||||||
|
|
||||||
private Channel channel;
|
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();
|
public ChannelListItem(Channel channel)
|
||||||
topic.Text = Channel.Topic;
|
|
||||||
channel.Joined.ValueChanged += updateColour;
|
|
||||||
updateColour(Channel.Joined);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChannelListItem()
|
|
||||||
{
|
{
|
||||||
|
this.channel = channel;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Action = () => { (Channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(Channel); };
|
Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); };
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -94,8 +80,9 @@ namespace osu.Game.Overlays.Chat
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
name = new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
Text = channel.ToString(),
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Shadow = false,
|
Shadow = false,
|
||||||
@ -112,6 +99,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
topic = new OsuSpriteText
|
topic = new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
Text = channel.Topic,
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Font = @"Exo2.0-SemiBold",
|
Font = @"Exo2.0-SemiBold",
|
||||||
Shadow = false,
|
Shadow = false,
|
||||||
@ -146,6 +134,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
channel.Joined.ValueChanged += updateColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -154,7 +144,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
topicColour = colours.Gray9;
|
topicColour = colours.Gray9;
|
||||||
joinedColour = colours.Blue;
|
joinedColour = colours.Blue;
|
||||||
|
|
||||||
updateColour(Channel.Joined);
|
updateColour(channel.Joined);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
public IEnumerable<Channel> Channels
|
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()
|
public ChannelSection()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user