private Request _TryGetRequest(RequestPackage package) { if (package.Code == ClientToServerOpCode.Ping) { _Push(ServerToClientOpCode.Ping, new byte[0]); return(null); } else if (package.Code == ClientToServerOpCode.CallMethod) { PackageCallMethod data = package.Data.ToPackageData <PackageCallMethod>(_Serialize); return(_ToRequest(data.EntityId, data.MethodId, data.ReturnId, data.MethodParams)); } else if (package.Code == ClientToServerOpCode.Release) { PackageRelease data = package.Data.ToPackageData <PackageRelease>(_Serialize); _SoulProvider.Unbind(data.EntityId); return(null); } else if (package.Code == ClientToServerOpCode.UpdateProperty) { PackageSetPropertyDone data = package.Data.ToPackageData <PackageSetPropertyDone>(_Serialize); _SoulProvider.SetPropertyDone(data.EntityId, data.Property); } else if (package.Code == ClientToServerOpCode.AddEvent) { PackageAddEvent data = package.Data.ToPackageData <PackageAddEvent>(_Serialize); _SoulProvider.AddEvent(data.Entity, data.Event, data.Handler); } else if (package.Code == ClientToServerOpCode.RemoveEvent) { PackageRemoveEvent data = package.Data.ToPackageData <PackageRemoveEvent>(_Serialize); _SoulProvider.RemoveEvent(data.Entity, data.Event, data.Handler); } else if (ClientToServerOpCode.AddNotifierSupply == package.Code) { PackageNotifierEvent data = package.Data.ToPackageData <PackageNotifierEvent>(_Serialize); _SoulProvider.AddNotifierSupply(data.Entity, data.Property, data.Passage); } else if (ClientToServerOpCode.RemoveNotifierSupply == package.Code) { PackageNotifierEvent data = package.Data.ToPackageData <PackageNotifierEvent>(_Serialize); _SoulProvider.RemoveNotifierSupply(data.Entity, data.Property, data.Passage); } else if (ClientToServerOpCode.AddNotifierUnsupply == package.Code) { PackageNotifierEvent data = package.Data.ToPackageData <PackageNotifierEvent>(_Serialize); _SoulProvider.AddNotifierUnsupply(data.Entity, data.Property, data.Passage); } else if (ClientToServerOpCode.RemoveNotifierUnsupply == package.Code) { PackageNotifierEvent data = package.Data.ToPackageData <PackageNotifierEvent>(_Serialize); _SoulProvider.RemoveNotifierUnsupply(data.Entity, data.Property, data.Passage); } return(null); }
private void _InternalRequest(RequestPackage package) { if (package.Code == ClientToServerOpCode.Ping) { _Push(ServerToClientOpCode.Ping, new byte[0]); } else if (package.Code == ClientToServerOpCode.Release) { PackageRelease data = package.Data.ToPackageData <PackageRelease>(_Serialize); _SoulProvider.Unbind(data.EntityId); } else if (package.Code == ClientToServerOpCode.UpdateProperty) { PackageSetPropertyDone data = package.Data.ToPackageData <PackageSetPropertyDone>(_Serialize); _SoulProvider.SetPropertyDone(data.EntityId, data.Property); } else { _ExternalRequests.Enqueue(package); } }