using System.Collections.Generic;
using CSNetwork.GPDataType;
namespace BrewMonster.UI
{
///
/// Code gốc bên C++
/// Class này làm về UI nên trong C# được chia ra
/// trong ChatInputHandler và ChatPanelUI
///
public static class DlgChat
{
private static readonly Dictionary ChannelColors = new Dictionary
{
{ ChatChannel.GP_CHAT_LOCAL, "FFFFFF" },
{ ChatChannel.GP_CHAT_FARCRY, "FFE400" },
{ ChatChannel.GP_CHAT_TEAM, "00FF00" },
{ ChatChannel.GP_CHAT_FACTION, "00FFFC" },
{ ChatChannel.GP_CHAT_WHISPER, "0065FE" },
{ ChatChannel.GP_CHAT_DAMAGE, "C0C0C0" },
{ ChatChannel.GP_CHAT_FIGHT, "FF7E00" },
{ ChatChannel.GP_CHAT_TRADE, "FF742E" },
{ ChatChannel.GP_CHAT_SYSTEM, "BED293" },
{ ChatChannel.GP_CHAT_BROADCAST, "FF3600" },
{ ChatChannel.GP_CHAT_MISC, "9AA6FF" },
{ ChatChannel.GP_CHAT_INSTANCE, "EC0D3C" },
{ ChatChannel.GP_CHAT_SUPERFARCRY, "ff9b3e" },
{ ChatChannel.GP_CHAT_BATTLE, "FFFFFF" },
{ ChatChannel.GP_CHAT_COUNTRY, "FFFFFF" }
};
public const string NPC_COLOR = "C8FF64";
public const string KING_COLOR = "8A2BE2";
///
/// Formats a message with TextMeshPro color tags based on the channel.
///
public static string FormatMessage(string message, ChatChannel channel)
{
if (string.IsNullOrEmpty(message)) return string.Empty;
if (ChannelColors.TryGetValue(channel, out string hexColor))
return $"{message}";
return message;
}
///
/// Formats a message with a specific hex color tag.
///
public static string FormatWithColor(string text, string hexColor)
{
if (string.IsNullOrEmpty(text)) return string.Empty;
return $"{text}";
}
///
/// Returns the hex color string for a given channel.
/// Mirrors CDlgChat::GetChatColor in C++.
/// idPlayer is reserved for future per-player coloring (e.g. friend highlight).
///
public static string GetChatColor(ChatChannel channel, int idPlayer = -1)
{
if (ChannelColors.TryGetValue(channel, out string hexColor))
return hexColor;
return "FFFFFF";
}
///
/// Returns a channel icon/image prefix string.
/// Currently returns empty — placeholder for future TMP sprite implementation.
/// Mirrors GetChatChannelImage() in C++.
///
public static string GetChatChannelImage(ChatChannel channel)
{
// TODO: return TMP sprite tag per channel when assets are ready
// e.g. return $"";
return string.Empty;
}
}
}