????????????????????????????????д????????????????????????????鷳??????.??????EC??????????????????????????????linux??win???????е???????????.??????????????????mono??Щ???????????.??????????EC???????????????????????????????????????????????????.
??????????????????????????????????????Э?飬??EC??????????????Э?鸚?????????????????????????????????(EC?????????л??????????????protobuf??msgpack).
???????????
??????????????????????????????????????????????:
[MessageID(0x0001)]
[ProtoContract]
public class Login
{
[ProtoMember(1)]
public string Name { get; set; }
[ProtoMember(2)]
public string From { get; set; }
}
[MessageID(0x0003)]
[ProtoContract]
public class Signout
{
[ProtoMember(1)]
public string Name { get; set; }
[ProtoMember(2)]
public string From { get; set; }
}
[MessageID(0x0002)]
[ProtoContract]
public class Say
{
[ProtoMember(1)]
public string Content { get; set; }
[ProtoMember(3)]
public string From { get; set; }
[ProtoMember(2)]
public string Name { get; set; }
}
?????????
??????????????????EC???????????????????????????????????????飬????????д????????????????????????????.
[EC.Controller]
public class Program
{
static void Main(string[] args)
{
EC.ECServer.Open();
System.Threading.Thread.Sleep(-1);
}
public void OnLogin(EC.ISession session?? Chat.Login e)
{
session.Channel.Name = e.Name;
e.From = session.Channel.EndPoint.ToString();
foreach (Beetle.Express.IChannel other in session.Application.Server.GetOnlines())
{
if (other != session.Channel)
session.Application.Server.Send(e?? other);
}
}
public void OnSay(EC.ISession session?? Chat.Say e)
{
e.Name = session.Channel.Name;
e.From = session.Channel.EndPoint.ToString();
foreach (Beetle.Express.IChannel other in session.Application.Server.GetOnlines())
{
if (other != session.Channel)
session.Application.Server.Send(e?? other);
}
}
}