mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 07:32:55 +08:00
Move Joined to Channel
This commit is contained in:
parent
3cc51006cc
commit
7eba619f80
@ -23,9 +23,9 @@ namespace osu.Game.Online.Chat
|
|||||||
[JsonProperty(@"channel_id")]
|
[JsonProperty(@"channel_id")]
|
||||||
public int 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";
|
public bool ReadOnly => Name != "#lazer";
|
||||||
|
|
||||||
|
@ -21,25 +21,28 @@ 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;
|
||||||
|
|
||||||
private bool joined;
|
private Channel channel;
|
||||||
public bool Joined
|
public Channel Channel
|
||||||
{
|
{
|
||||||
get { return joined; }
|
get { return channel; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == joined) return;
|
if (value == channel) return;
|
||||||
joined = value;
|
channel = value;
|
||||||
|
|
||||||
|
name.Text = Channel.ToString();
|
||||||
|
topic.Text = Channel.Topic;
|
||||||
updateColour();
|
updateColour();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChannelListItem(Channel channel)
|
public ChannelListItem()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
@ -74,9 +77,8 @@ namespace osu.Game.Overlays.Chat
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
name = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = channel.ToString(),
|
|
||||||
TextSize = text_size,
|
TextSize = text_size,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
@ -91,7 +93,6 @@ 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",
|
||||||
Alpha = 0.8f,
|
Alpha = 0.8f,
|
||||||
@ -136,10 +137,10 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private void updateColour()
|
private void updateColour()
|
||||||
{
|
{
|
||||||
joinedCheckmark.FadeTo(joined ? 1f : 0f, transition_duration);
|
joinedCheckmark.FadeTo(Channel.Joined ? 1f : 0f, transition_duration);
|
||||||
topic.FadeTo(joined ? 0.8f : 1f, transition_duration);
|
topic.FadeTo(Channel.Joined ? 0.8f : 1f, transition_duration);
|
||||||
topic.FadeColour(joined ? Color4.White : topicColour ?? Color4.White, transition_duration);
|
topic.FadeColour(Channel.Joined ? Color4.White : topicColour ?? Color4.White, transition_duration);
|
||||||
FadeColour(joined ? joinedColour ?? Color4.White : Color4.White, transition_duration);
|
FadeColour(Channel.Joined ? joinedColour ?? Color4.White : Color4.White, transition_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
items.Children = value.Select(c => new ChannelListItem(c));
|
items.Children = value.Select(c => new ChannelListItem { Channel = c });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user