Files
OpenRA/OpenRA.Game/TextNotification.cs
let5sne.win10 9cf6ebb986
Some checks failed
Continuous Integration / Linux (.NET 8.0) (push) Has been cancelled
Continuous Integration / Windows (.NET 8.0) (push) Has been cancelled
Initial commit: OpenRA game engine
Fork from OpenRA/OpenRA with one-click launch script (start-ra.cmd)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:46:54 +08:00

59 lines
1.8 KiB
C#

#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
using OpenRA.Primitives;
namespace OpenRA
{
public enum TextNotificationPool { System, Join, Leave, Chat, Mission, Feedback, Transients }
public class TextNotification : IEquatable<TextNotification>
{
public readonly TextNotificationPool Pool;
public readonly string Prefix;
public readonly int ClientId;
public readonly string Text;
public readonly Color? PrefixColor;
public readonly Color? TextColor;
public readonly DateTime Time;
public TextNotification(TextNotificationPool pool, int clientId, string prefix, string text, Color? prefixColor, Color? textColor)
{
Pool = pool;
ClientId = clientId;
Prefix = prefix;
Text = text;
PrefixColor = prefixColor;
TextColor = textColor;
Time = DateTime.Now;
}
public bool CanIncrementOnDuplicate()
{
return Pool == TextNotificationPool.Feedback || Pool == TextNotificationPool.System || Pool == TextNotificationPool.Transients;
}
public static bool operator ==(TextNotification me, TextNotification other) { return me.GetHashCode() == other.GetHashCode(); }
public static bool operator !=(TextNotification me, TextNotification other) { return !(me == other); }
public bool Equals(TextNotification other) { return other == this; }
public override bool Equals(object obj) { return obj is TextNotification notification && Equals(notification); }
public override int GetHashCode()
{
return HashCode.Combine(Prefix, Text, (int)Pool);
}
}
}