少年修仙传客户端代码仓库
client_linchunjie
2018-08-27 d106f11e7f44c748f595da36e0cdfd54849649e6
System/Chat/ChatData.cs
@@ -1,177 +1,177 @@
using System.Text;
using System.Collections;
using System.Text.RegularExpressions;
using UnityEngine;
using Snxxz.UI;
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;
    }
    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; }
    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;
        this.extra = extra;
        this.job = 1;
        IsSound = false;
        if (extra.Length > 1)
        {
            vipLv = int.Parse(extra.Substring(0, 2));
        }
        if (extra.Length > 2)
        {
            isGm = byte.Parse(extra.Substring(2, 1)) == 1;
        }
        if (extra.Length > 3)
        {
            job = byte.Parse(extra.Substring(3, 1));
        }
        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 long soundTick { get; private set; }
    public bool IsSound { get; private set; }
    public float soundLength { 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 ChatTeamData : ChatUeseData
{
    public ChatTeamData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.World) : 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; }
using System.Text;
using System.Collections;
using System.Text.RegularExpressions;
using UnityEngine;
using Snxxz.UI;
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;
    }
    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; }
    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;
        this.extra = extra;
        this.job = 1;
        IsSound = false;
        if (extra.Length > 1)
        {
            vipLv = int.Parse(extra.Substring(0, 2));
        }
        if (extra.Length > 2)
        {
            isGm = byte.Parse(extra.Substring(2, 1)) == 1;
        }
        if (extra.Length > 3)
        {
            job = byte.Parse(extra.Substring(3, 1));
        }
        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 long soundTick { get; private set; }
    public bool IsSound { get; private set; }
    public float soundLength { 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 ChatTeamData : ChatUeseData
{
    public ChatTeamData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.World) : 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; }
}