using System.Text; using System.Collections; using System; public class ChatData { public ChatData(string content) { _content = content; if (ChatCenter.s_VoiceRegex.IsMatch(_content)) { _content = ChatCenter.s_VoiceRegex.Replace(_content, string.Empty); } richText = new StringBuilder(); richText.Length = 0; createTime = DateTime.Now; } private string _content = string.Empty; public string content { get { if (richText.Length > 0) { return richText.ToString(); } return _content; } protected set { _content = value; } } public ChatInfoType type { get; protected set; } public DateTime createTime { get; set; } private ChatInfoType m_DetailType = ChatInfoType.World; public ChatInfoType detailType { get { return m_DetailType; } set { m_DetailType = value; } } public StringBuilder richText; public ArrayList infoList = new ArrayList(); } public class ChatUeseData : ChatData { public ChatUeseData(string _content, int player, string name, string extra) : base(_content) { this.player = player; this.name = name; extra = UIHelper.ServerStringTrim(extra); this.extra = extra; this.job = 1; IsSound = false; var extraLength = extra.Length; if (extraLength > 1) { vipLv = int.Parse(extra.Substring(0, 2)); } if (extraLength > 2) { isGm = byte.Parse(extra.Substring(2, 1)) == 1; } if (extraLength > 3) { job = byte.Parse(extra.Substring(3, 1)); } if (extraLength > 4) { bubbleId = int.Parse(extra.Substring(4, extraLength > 5 ? 2 : 1)); } if (extraLength > 12) { serverGroupId = int.Parse(extra.Substring(6, 7)); } if (extraLength > 16) { level = int.Parse(extra.Substring(13, 4)); } // if (ChatCenter.s_VoiceRegex.IsMatch(_content)) // { // var _match = ChatCenter.s_VoiceRegex.Match(_content); // soundTick = long.Parse(_match.Groups[1].Value); // soundLength = byte.Parse(_match.Groups[2].Value)/10.0f; // IsSound = true; // } string[] parts = extra.Split('|'); face = (parts.Length > 4 && int.TryParse(parts[4], out var result1)) ? result1 : 0; facePic = (parts.Length > 5 && int.TryParse(parts[5], out var result2)) ? result2 : 0; } public int player { get; protected set; } public string name { get; protected set; } public string extra { get; protected set; } public int vipLv { get; protected set; } public bool isGm { get; protected set; } public int job { get; protected set; } public int bubbleId { get; protected set; } public long soundTick { get; private set; } public bool IsSound { get; private set; } public float soundLength { get; private set; } public int serverGroupId { get; private set; } public int level { get; private set; } public int face { get; private set; } public int facePic { get; private set; } } public class ChatSystemData : ChatData { public ChatSystemData(string content) : base(content) { type = ChatInfoType.System; } } // 喇叭暂时不要了 // public class ChatTrumpetData : ChatUeseData // { // public ChatTrumpetData(string content, int player, string name, string extra, byte speakType, string accId) : base(content, player, name, extra) // { // this.speakType = speakType; // this.accId = accId; // // type = ChatInfoType.Trumpet; // } // public byte speakType { get; protected set; } // public string accId { get; protected set; } // } public class ChatWorldData : ChatUeseData { public ChatWorldData(string content, int player, string name, string extra) : base(content, player, name, extra) { type = ChatInfoType.World; } } public class ChatAreaData : ChatUeseData { public ChatAreaData(string content, int player, string name, string extra) : base(content, player, name, extra) { type = ChatInfoType.Area; } } public class ChatCrossServerData : ChatUeseData { public ChatCrossServerData(string content, int player, string name, string extra) : base(content, player, name, extra) { type = ChatInfoType.CrossServer; } } public class ChatFactionData : ChatUeseData { public ChatFactionData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.default1) : base(content, player, name, extra) { type = ChatInfoType.default1; this.detailType = detailType; } } public class ChatTeamData : ChatUeseData { public ChatTeamData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Team) : base(content, player, name, extra) { type = ChatInfoType.Team; this.detailType = detailType; } } public class ChatFamilyData : ChatUeseData { public ChatFamilyData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Fairy) : base(content, player, name, extra) { type = ChatInfoType.Fairy; this.detailType = detailType; } } public class ChatInviteData : ChatUeseData { public ChatInviteData(string content, int player, string name, string extra) : base(content, player, name, extra) { type = ChatInfoType.Invite; } } public class ChatFriendData : ChatUeseData { public ChatFriendData(string content, int player, string name, string extra, string toName, byte talkType, uint toPlayer) : base(content, player, name, extra) { type = ChatInfoType.Friend; this.toName = toName; this.talkType = talkType; this.toPlayer = (int)toPlayer; } public string toName { get; protected set; } public byte talkType { get; protected set; } public int toPlayer { get; protected set; } }