Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into change_to_R3
Browse files Browse the repository at this point in the history
# Conflicts:
#	Assets/TORISOUP/NicoliveClient/version.txt
  • Loading branch information
TORISOUP committed Feb 19, 2024
2 parents 99ee131 + de9d7fa commit 21a0b71
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions Assets/TORISOUP/NicoliveClient/Plugins/Comment/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public struct Chat : IEquatable<Chat>
/// <value></value>
public int Score { get; private set; }

/// <summary>
/// コメント投稿者の名前
/// </summary>
public string Name { get; private set; }

public Chat(string thread,
long vpos,
long date,
Expand All @@ -73,7 +78,8 @@ public Chat(string thread,
string content,
int no,
int roomId,
int score) : this()
int score,
string name)
{
Thread = thread;
Vpos = vpos;
Expand All @@ -86,29 +92,15 @@ public Chat(string thread,
No = no;
RoomId = roomId;
Score = score;
}

/// <summary>
/// プレミアム会員であるか
/// </summary>
public bool IsPremium
{
get { return (Premium & 1) != 0; }
}

/// <summary>
/// 運営コメント または /から始まる特殊なメッセージであるか
/// </summary>
public bool IsStaff
{
get { return (Premium & 2) != 0; }
Name = name;
}

public bool Equals(Chat other)
{
return Thread == other.Thread && Vpos == other.Vpos && Date == other.Date && Mail == other.Mail &&
UserId == other.UserId && Premium == other.Premium && Anonymity == other.Anonymity &&
Content == other.Content && No == other.No && RoomId == other.RoomId && Score == other.Score;
Content == other.Content && No == other.No && RoomId == other.RoomId && Score == other.Score &&
Name == other.Name;
}

public override bool Equals(object obj)
Expand All @@ -130,8 +122,15 @@ public override int GetHashCode()
hashCode.Add(No);
hashCode.Add(RoomId);
hashCode.Add(Score);
hashCode.Add(Name);
return hashCode.ToHashCode();
}

public override string ToString()
{
return
$"{nameof(Thread)}: {Thread}, {nameof(Vpos)}: {Vpos}, {nameof(Date)}: {Date}, {nameof(Mail)}: {Mail}, {nameof(UserId)}: {UserId}, {nameof(Premium)}: {Premium}, {nameof(Anonymity)}: {Anonymity}, {nameof(Content)}: {Content}, {nameof(No)}: {No}, {nameof(RoomId)}: {RoomId}, {nameof(Score)}: {Score}, {nameof(Name)}: {Name}";
}
}

[Serializable]
Expand All @@ -147,6 +146,7 @@ internal struct ChatDto : IEquatable<ChatDto>
public string content;
public int no;
public int score;
public string name;

public bool IsSuccess()
{
Expand All @@ -166,15 +166,16 @@ public Chat ToChat(int roomId)
content,
no,
roomId,
score
score,
name
);
}

public bool Equals(ChatDto other)
{
return thread == other.thread && vpos == other.vpos && date == other.date && mail == other.mail &&
user_id == other.user_id && premium == other.premium && anonymity == other.anonymity &&
content == other.content && no == other.no && score == other.score;
content == other.content && no == other.no && score == other.score && name == other.name;
}

public override bool Equals(object obj)
Expand All @@ -195,6 +196,7 @@ public override int GetHashCode()
hashCode.Add(content);
hashCode.Add(no);
hashCode.Add(score);
hashCode.Add(name);
return hashCode.ToHashCode();
}
}
Expand Down

0 comments on commit 21a0b71

Please sign in to comment.