using System.Text;
|
using System.Collections;
|
using System.Text.RegularExpressions;
|
using UnityEngine;
|
using Snxxz.UI;
|
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;
|
}
|
}
|
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 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 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; }
|
}
|