mirror of
https://github.com/ppy/osu
synced 2025-01-31 18:32:14 +00:00
Merge pull request #776 from peppy/fix-duplicate-messages
Revert "Use generic IComparable for message."
This commit is contained in:
commit
12716d2ab4
@ -23,7 +23,7 @@ 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>(Comparer<Message>.Default);
|
public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id));
|
||||||
|
|
||||||
//internal bool Joined;
|
//internal bool Joined;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Online.Chat
|
namespace osu.Game.Online.Chat
|
||||||
{
|
{
|
||||||
public class Message : IComparable<Message>
|
public class Message
|
||||||
{
|
{
|
||||||
[JsonProperty(@"message_id")]
|
[JsonProperty(@"message_id")]
|
||||||
public readonly long Id;
|
public readonly long Id;
|
||||||
@ -42,7 +42,17 @@ namespace osu.Game.Online.Chat
|
|||||||
Id = id;
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(Message other) => Id.CompareTo(other.Id);
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
var objMessage = obj as Message;
|
||||||
|
|
||||||
|
return Id == objMessage?.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Id.GetHashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TargetType
|
public enum TargetType
|
||||||
|
Loading…
Reference in New Issue
Block a user