public bool Send(ProtocolBase protocol, MsgDistribution.Delegate cb) { string cbName = protocol.GetName(); Debug.Log(cbName); return(Send(protocol, cbName, cb)); }
/// <summary> /// 发送数据给服务器 /// </summary> public void SendMessage(string data, string cbName, MsgDistribution.Delegate cb) { ByteBuffer buffer = new ByteBuffer(); buffer.WriteString(data); byte[] msg = WriteMessage(buffer.ToBytes()); SendMessage(msg, cbName, cb); }
public bool Send(ProtocolBase protocolBase, string cbName, MsgDistribution.Delegate cb) { if (_status != Status.Connected) { return(false); } msgDist.AddOnceListener(cbName, cb); return(Send(protocolBase)); }
public bool Send(ProtocolBase protocol, MsgDistribution.Delegate cb, string name) { if (status != Status.Connected) { return(false); } msgDistribution.AddOnceListener(name, cb); return(Send(protocol)); }
public bool Send(GameMessage message, Protocol msgType, MsgDistribution.Delegate cb) { if (status != Status.Connected) { return(false); } msgDist.AddOnceListener(msgType, cb); return(Send(message)); }
// 发送消息的同时绑定回调函数,并指定key名 public bool Send(string name, string body, string cbName, MsgDistribution.Delegate cb) { if (!Send(name, body)) { return(false); } msgDist.AddOnceListener(cbName, cb); return(true); }
public bool Send(ProtocolBase protocol, string cbName, MsgDistribution.Delegate cb) //消息监听,可指定协议 { if (status != Status.connected) { return(false); } msgDist.AddOnceListener(cbName, cb); return(Send(protocol)); }
bool Send(ProtocolBase protocol, string cbName, MsgDistribution.Delegate cb) { bool ret = Send(protocol); if (ret) { msgDist.AddOnceListener(cbName, cb); } return(ret); }
/// <summary> /// 发送数据 /// </summary> /// <param name="data"></param> public void SendMessage(byte[] data, string cbName, MsgDistribution.Delegate cb) { if (status == Status.None) { return; } try { msgDist.AddOnceListener(cbName, cb); socket.Send(data); } catch { msgDist.DelOnceListener(cbName, cb); status = Status.None; socket.Shutdown(SocketShutdown.Both); socket.Close(); } }
public bool Send(ProtocolBase protocol, MsgDistribution.Delegate cb) { string name = protocol.GetName(); return(Send(protocol, cb, name)); }
public bool Send(GameMessage message, MsgDistribution.Delegate cb) { Protocol msgType = (Protocol)message.type[0]; return(Send(message, msgType, cb)); }
public bool Send(ProtocolBase protocol, string cbName, MsgDistribution.Delegate cb) { msgDist.AddOnceListener(cbName, cb); return(Send(protocol)); }
// 发送消息的同时绑定回调函数,使用Msg+name作为key名 public bool Send(string name, string body, MsgDistribution.Delegate cb) { string cbName = "Msg" + name; return(Send(name, body, cbName, cb)); }
public bool Send(ProtocolBase protocol, MsgDistribution.Delegate cb) //消息监听 { string cbName = protocol.GetName(); return(Send(protocol, cbName, cb)); }
public bool Send(string protoName, MsgDistribution.Delegate cb) { return(Send(new ProtocolBytes(protoName), cb)); }