1
0
Fork 0
This repository has been archived on 2019-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Galactic_Colors_Control/Galactic Colors Control Common/Protocol/EventData.cs

37 lines
1.0 KiB
C#

namespace Galactic_Colors_Control_Common.Protocol
{
public enum EventTypes { ChatMessage, ServerJoin, ServerLeave, ServerKick, PartyJoin, PartyLeave, PartyKick }
public class EventData : Data
{
public EventTypes type;
public string[] data;
public EventData(EventTypes p1, string[] p2 = null)
{
type = p1;
data = p2;
}
public EventData(ref byte[] bytes)
{
type = (EventTypes)Binary.ToInt(ref bytes);
data = Binary.ToStringArray(ref bytes);
}
public override byte[] ToBytes()
{
return Binary.AddBytes(Binary.FromInt((int)DataType.Event), Binary.FromInt((int)type), Binary.FromStringArray(data));
}
public override string ToSmallString()
{
return type.ToString() + "|" + Common.ArrayToString(data);
}
public override string ToLongString()
{
return "Event : " + ToSmallString();
}
}
}