public static void Send(int toChannel, int gID, int uID, SProto msg) { if (instance == null) { return; } instance._Send(toChannel, gID, uID, msg); }
private static void ValueToBuffer(ByteBuffer buf, ValueType vt, object v) { if (vt == ValueType.BOOL) { bool tv = (bool)v; if (tv) { buf.WriteByte(1); } else { buf.WriteByte(0); } } else if (vt == ValueType.BYTE) { buf.WriteByte((byte)v); } else if (vt == ValueType.DOUBLE) { buf.WriteDouble((double)v); } else if (vt == ValueType.FLOAT) { buf.WriteFloat((float)v); } else if (vt == ValueType.INT32) { buf.WriteInt((int)v); } else if (vt == ValueType.INT64) { buf.WriteLong((long)v); } else if (vt == ValueType.STRING) { byte[] arr = System.Text.Encoding.UTF8.GetBytes((string)v); buf.WriteInt(arr.Length); buf.WriteBytes(arr); } else if (vt == ValueType.ENUM) { buf.WriteInt((int)v); } else if (vt == ValueType.MESSAGE) { SProto sp = (SProto)v; sp.PackMessage(buf); } else { throw new Exception("sproto parse value error->" + vt); } }
public static int SendMsg(int channel, int toChannel, int gID, int uID, SProto msg) { CThreadContext context = GetCThreadContext(channel); if (context == null) { return(-1); } context.AddMsg(toChannel, gID, uID, msg); return(0); }
internal void AddMsg(int toChannel, int gID, int uID, SProto msg) { ProtoMsg pm = new ProtoMsg(); pm.gID = gID; pm.uID = uID; pm.msg = msg; pm.toChannel = toChannel; lock (lockobj) { msgs.Add(pm); } }
private void _Send(int toChannel, int gID, int uID, SProto msg) { LuaCThread.SendMsg(channel, toChannel, gID, uID, msg); }
public Repeated(SProto sp) : base(sp) { CheckValueType(typeof(T)); }
public Optional(SProto sp) : base(sp) { CheckValueType(typeof(T)); }
public RepeatedMessage(SProto sp) : base(sp) { }
public OptionalMessage(SProto sp) : base(sp) { }
public PropertyBase(SProto sp) { sp.REG(this); }