ComponentUpdateDeserialize(global::System.UInt32 componentId, global::System.UIntPtr userData, global::Improbable.Worker.CInterop.SchemaComponentUpdate source, out global::System.UIntPtr handleOut) { handleOut = global::System.UIntPtr.Zero; try { var data = new Update(); var fieldsToClear = new global::System.Collections.Generic.HashSet <uint>(); var fieldsToClearCount = source.GetClearedFieldCount(); for (uint i = 0; i < fieldsToClearCount; ++i) { fieldsToClear.Add(source.IndexClearedField(i)); } var fields = source.GetFields(); if (fields.GetObjectCount(1) > 0) { global::Improbable.WorkerRequirementSet field; { field = global::Improbable.WorkerRequirementSet_Internal.Read(fields.GetObject(1)); } data.readAcl.Set(field); } if (fields.GetObjectCount(2) > 0 || fieldsToClear.Contains(2)) { global::Improbable.Collections.Map <uint, global::Improbable.WorkerRequirementSet> field; { var _count = fields.GetObjectCount(2); field = new global::Improbable.Collections.Map <uint, global::Improbable.WorkerRequirementSet>((int)_count); for (uint _i = 0; _i < _count; ++_i) { var _pair = fields.IndexObject(2, _i); field.Add(_pair.GetUint32(1), global::Improbable.WorkerRequirementSet_Internal.Read(_pair.GetObject(2))); } } data.componentWriteAcl.Set(field); } var handle = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc(); *handle = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data); handleOut = (global::System.UIntPtr)handle; } catch (global::System.Exception e) { global::Improbable.Worker.ClientError.LogClientException(e); return(false); } return(true); }
ClientDeserialize(global::System.UInt32 componentId, void *userData, global::System.Byte handleType, global::Improbable.Worker.Internal.Pbio.Object *root, global::Improbable.Worker.Internal.ComponentProtocol.ClientHandle **handleOut) { *handleOut = null; try { *handleOut = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc(); if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Update) { var data = new Update(); var fieldsToClear = new global::System.Collections.Generic.HashSet <uint>(); var fieldsToClearCount = global::Improbable.Worker.Internal.Pbio.GetUint32Count(root, /* fields to clear */ 1); for (uint i = 0; i < fieldsToClearCount; ++i) { fieldsToClear.Add(global::Improbable.Worker.Internal.Pbio.IndexUint32(root, /* fields to clear */ 1, i)); } var stateObject = global::Improbable.Worker.Internal.Pbio.GetObject( global::Improbable.Worker.Internal.Pbio.GetObject(root, /* entity_state */ 2), 58); if (global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 1) > 0 || fieldsToClear.Contains(1)) { global::Improbable.Collections.Map <uint, global::Improbable.ComponentInterest> field; { var _count = global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 1); field = new global::Improbable.Collections.Map <uint, global::Improbable.ComponentInterest>((int)_count); for (uint _i = 0; _i < _count; ++_i) { var _pair = global::Improbable.Worker.Internal.Pbio.IndexObject(stateObject, 1, _i); field.Add(global::Improbable.Worker.Internal.Pbio.GetUint32(_pair, 1), global::Improbable.ComponentInterest_Internal.Read(global::Improbable.Worker.Internal.Pbio.GetObject(_pair, 2))); } } data.componentInterest.Set(field); } **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data); } else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Snapshot) { var data = new Data(global::Improbable.InterestData_Internal.Read( global::Improbable.Worker.Internal.Pbio.GetObject(root, 58))); **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data); } else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Request) { var data = new global::Improbable.Worker.Internal.GenericCommandObject(); **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data); return(0); } else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Response) { var data = new global::Improbable.Worker.Internal.GenericCommandObject(); **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data); return(0); } } catch (global::System.Exception e) { global::Improbable.Worker.ClientError.LogClientException(e); return(0); } return(1); }