private void _Apportion(ClientToServerOpCode code, byte[] args) { switch (code) { case ClientToServerOpCode.Ping: OnPingEvent?.Invoke(); break; case ClientToServerOpCode.CallMethod: { var pkg = args.ToPackageData <PackageCallMethod>(_Serializer); OnCallMethodEvent?.Invoke(pkg.EntityId, pkg.MethodId, pkg.ReturnId, pkg.MethodParams); } break; case ClientToServerOpCode.Release: { var pkg = args.ToPackageData <PackageRelease>(_Serializer); OnReleaseEvent?.Invoke(pkg.EntityId); } break; default: throw new ArgumentOutOfRangeException(nameof(code), code, null); } }
void IGhostRequest.Request(ClientToServerOpCode code, byte[] args) { _Sends.Enqueue( new RequestPackage() { Data = args, Code = code }); }
void IGhostRequest.Request(ClientToServerOpCode code, byte[] args) { lock (_Requests) { _Requests.Enqueue( new RequestPackage { Code = code, Data = args }); } }
void IGhostRequest.Request(ClientToServerOpCode code, byte[] args) { lock(_Requests) { _Requests.Enqueue( new RequestPackage { Code = code, Data = args }); } }
void IGhostRequest.Request(ClientToServerOpCode code, byte[] args) { lock (OnlineStage._LockRequest) { _Sends.Enqueue( new RequestPackage() { Data = args, Code = code }); OnlineStage.RequestQueueCount++; } }
private void _Apportion(ClientToServerOpCode code, byte[] args) { if(ClientToServerOpCode.Ping == code) { if(PingEvent != null) { PingEvent(); } } else if(ClientToServerOpCode.CallMethod == code) { /*var EntityId = new Guid(args[0]); var MethodName = Encoding.Default.GetString(args[1]); byte[] par = null; var ReturnId = Guid.Empty; if(args.TryGetValue(2, out par)) { ReturnId = new Guid(par); } var MethodParams = (from p in args where p.Key >= 3 orderby p.Key select p.Value).ToArray();*/ var data = args.ToPackageData<PackageCallMethod>(); if (CallMethodEvent != null) { CallMethodEvent(data.EntityId, data.MethodName, data.ReturnId, data.MethodParams); } } else if(ClientToServerOpCode.Release == code) { var data = args.ToPackageData<PackageRelease>(); //var EntityId = new Guid(args[0]); ReleaseEvent(data.EntityId); } }
private void _Apportion(ClientToServerOpCode code, byte[] args) { if (ClientToServerOpCode.Ping == code) { if (PingEvent != null) { PingEvent(); } } else if (ClientToServerOpCode.CallMethod == code) { /*var EntityId = new Guid(args[0]); * * var MethodId = Encoding.Default.GetString(args[1]); * * byte[] par = null; * var ReturnId = Guid.Empty; * if(args.TryGetValue(2, out par)) * { * ReturnId = new Guid(par); * } * * var MethodParams = (from p in args * where p.Key >= 3 * orderby p.Key * select p.Value).ToArray();*/ var data = args.ToPackageData <PackageCallMethod>(_Serializer); if (CallMethodEvent != null) { CallMethodEvent(data.EntityId, data.MethodId, data.ReturnId, data.MethodParams); } } else if (ClientToServerOpCode.Release == code) { var data = args.ToPackageData <PackageRelease>(_Serializer); //var EntityId = new Guid(args[0]); ReleaseEvent(data.EntityId); } }
void IGhostRequest.Request(ClientToServerOpCode code, byte[] args) { lock(OnlineStage._LockRequest) { _Sends.Enqueue( new RequestPackage() { Data = args, Code = code }); OnlineStage.RequestQueueCount++; } }