protected override void SendDeltaChanges(IEnumerable <SocketEndpoint> endpoints, ChangeType changeType) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeType); if (HasFlag(changeType, ChangeType.Enabled)) { message.Write(previousEnabled); } if (HasFlag(changeType, ChangeType.Properties)) { message.Write((byte)previousProperties.renderMode); message.Write(previousProperties.sortingLayerID); message.Write(previousProperties.sortingOrder); message.Write(previousProperties.overrideSorting); } message.Flush(); StateSynchronizationSceneManager.Instance.Send(endpoints, memoryStream.ToArray()); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, byte changeFlags) { byte changeFlagsWithoutMaterialProperty = (byte)(changeFlags & ~ChangeType.MaterialProperty); if (changeFlags != ChangeType.MaterialProperty) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write(changeFlagsWithoutMaterialProperty); WriteRenderer(message, changeFlagsWithoutMaterialProperty); message.Flush(); var data = memoryStream.ToArray(); StateSynchronizationSceneManager.Instance.Send(connections, ref data); } } if (HasFlag(changeFlags, ChangeType.MaterialProperty)) { MaterialsBroadcaster.SendMaterialPropertyChanges(connections, Renderer, TransformBroadcaster.PerformanceParameters, message => { ComponentBroadcasterService.WriteHeader(message, this); message.Write(ChangeType.MaterialProperty); }, ShouldSynchronizeMaterialProperty); } }
protected override void SendDeltaChanges(IEnumerable <SocketEndpoint> endpoints, byte changeFlags) { foreach (SocketEndpoint endpoint in endpoints) { PerConnectionInstantiationState state; if (perConnectionInstantiationState.TryGetValue(endpoint, out state)) { if (state.sendInstantiationRequest) { state.sendInstantiationRequest = false; using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)ChangeType.CreateObserverObject); WriteInstantiationRequestParameters(message); message.Flush(); endpoint.Send(memoryStream.ToArray()); } } if (state.sendTransformHierarchyBinding) { state.sendTransformHierarchyBinding = false; SendTransformHierarchyBinding(endpoint); } } } }
protected override void SendDeltaChanges(IEnumerable <SocketEndpoint> endpoints, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(previousProperties.enabled); message.Write((byte)previousProperties.type); message.Write(previousProperties.bounceIntensity); message.Write(previousProperties.color); message.Write(previousProperties.colorTemperature); AssetService.Instance.TrySerializeTexture(message, previousProperties.cookie); message.Write(previousProperties.cookieSize); message.Write(previousProperties.cullingMask); message.Write(previousProperties.intensity); message.Write(previousProperties.range); message.Write(previousProperties.shadowBias); message.Write(previousProperties.shadowCustomResolution); message.Write(previousProperties.shadowNearPlane); message.Write(previousProperties.shadowNormalBias); message.Write((byte)previousProperties.shadows); message.Write(previousProperties.spotAngle); } message.Flush(); StateSynchronizationSceneManager.Instance.Send(endpoints, memoryStream.ToArray()); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeType) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeType); if (HasFlag(changeType, ChangeType.Enabled)) { message.Write(previousEnabled); } if (HasFlag(changeType, ChangeType.Properties)) { message.Write((byte)previousProperties.renderMode); message.Write(previousProperties.sortingLayerID); message.Write(previousProperties.sortingOrder); message.Write(previousProperties.overrideSorting); } message.Flush(); memoryStream.TryGetBuffer(out var buffer); StateSynchronizationSceneManager.Instance.Send(connections, buffer.Array, buffer.Offset, buffer.Count); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, byte changeFlags) { foreach (INetworkConnection connection in connections) { PerConnectionInstantiationState state; if (perConnectionInstantiationState.TryGetValue(connection, out state)) { if (state.sendInstantiationRequest) { state.sendInstantiationRequest = false; using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)ChangeType.CreateObserverObject); WriteInstantiationRequestParameters(message); message.Flush(); var data = memoryStream.ToArray(); connection.Send(ref data); } } if (state.sendTransformHierarchyBinding) { state.sendTransformHierarchyBinding = false; SendTransformHierarchyBinding(connection); } } } }
protected override void SendDeltaChanges(IEnumerable <SocketEndpoint> endpoints, TextMeshProBroadcasterChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); WriteText(changeFlags, message); message.Flush(); StateSynchronizationSceneManager.Instance.Send(endpoints, memoryStream.ToArray()); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, TextMeshProBroadcasterChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); WriteText(changeFlags, message); message.Flush(); StateSynchronizationSceneManager.Instance.Send(connections, memoryStream.GetBuffer(), 0, memoryStream.Position); } }
private void SendTransformHierarchyBinding(SocketEndpoint sendingEndpoint) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)ChangeType.BindTransformHierarchy); DynamicObject.GetComponent <TransformBroadcaster>().WriteChildHierarchyTree(message); message.Flush(); sendingEndpoint.Send(memoryStream.ToArray()); } }
private void SendTransformHierarchyBinding(INetworkConnection connection) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)ChangeType.BindTransformHierarchy); DynamicObject.GetComponent <TransformBroadcaster>().WriteChildHierarchyTree(message); message.Flush(); connection.Send(memoryStream.GetBuffer(), 0, memoryStream.Position); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { if (changeFlags != ChangeType.MaterialProperty) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)(changeFlags & ~ChangeType.MaterialProperty)); if (HasFlag(changeFlags, ChangeType.Data)) { message.Write(ImageService.Instance.GetSpriteId(imageComp.overrideSprite)); message.Write(ImageService.Instance.GetSpriteId(imageComp.sprite)); message.Write(imageComp.fillAmount); message.Write(imageComp.color); message.Write(imageComp.alphaHitTestMinimumThreshold); message.Write(imageComp.fillOrigin); message.Write(imageComp.fillClockwise); message.Write((byte)imageComp.fillMethod); message.Write(imageComp.fillCenter); message.Write(imageComp.preserveAspect); message.Write((byte)imageComp.type); message.Write(imageComp.enabled); } if (HasFlag(changeFlags, ChangeType.Materials)) { MaterialsBroadcaster.SendMaterials(message, null, ShouldSynchronizeMaterialProperty); } message.Flush(); var data = memoryStream.ToArray(); StateSynchronizationSceneManager.Instance.Send(connections, ref data); } } if (HasFlag(changeFlags, ChangeType.MaterialProperty)) { MaterialsBroadcaster.SendMaterialPropertyChanges(connections, null, TransformBroadcaster.PerformanceParameters, m => { ImageService.Instance.WriteHeader(m, this); m.Write((byte)ChangeType.MaterialProperty); }, ShouldSynchronizeMaterialProperty); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { if (changeFlags != ChangeType.MaterialProperty) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)(changeFlags & ~ChangeType.MaterialProperty)); if (HasFlag(changeFlags, ChangeType.Text)) { message.Write(textComp.text); } if (HasFlag(changeFlags, ChangeType.FontAndPlacement)) { message.Write((byte)textComp.alignment); message.Write(textComp.color); message.Write(textComp.fontSize); message.Write((byte)textComp.fontStyle); message.Write(textComp.lineSpacing); message.Write((byte)textComp.horizontalOverflow); message.Write((byte)textComp.verticalOverflow); message.Write(FontAssetId); } if (HasFlag(changeFlags, ChangeType.Materials)) { MaterialsBroadcaster.SendMaterials(message, null, ShouldSynchronizeMaterialProperty); } message.Flush(); var data = memoryStream.ToArray(); StateSynchronizationSceneManager.Instance.Send(connections, ref data); } } if (HasFlag(changeFlags, ChangeType.MaterialProperty)) { MaterialsBroadcaster.SendMaterialPropertyChanges(connections, null, TransformBroadcaster.PerformanceParameters, message => { TextService.Instance.WriteHeader(message, this); message.Write((byte)ChangeType.MaterialProperty); }, ShouldSynchronizeMaterialProperty); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(AudioClipAssetId); message.Write(AudioMixerGroupAssetId); message.Write(previousProperties.bypassEffects); message.Write(previousProperties.bypassListenerEffects); message.Write(previousProperties.bypassReverbZones); message.Write(previousProperties.dopplerLevel); message.Write(previousProperties.enabled); message.Write(previousProperties.ignoreListenerPause); message.Write(previousProperties.ignoreListenerVolume); message.Write(previousProperties.loop); message.Write(previousProperties.maxDistance); message.Write(previousProperties.minDistance); message.Write(previousProperties.mute); message.Write(previousProperties.panStereo); message.Write(previousProperties.pitch); message.Write(previousProperties.priority); message.Write(previousProperties.reverbZoneMix); message.Write((byte)previousProperties.rolloffMode); message.Write(previousProperties.spatialBlend); message.Write(previousProperties.spatialize); message.Write(previousProperties.spatializePostEffects); message.Write(previousProperties.spread); message.Write((byte)previousProperties.velocityUpdateMode); } if (HasFlag(changeFlags, ChangeType.Volume)) { message.Write(previousVolume); } message.Flush(); memoryStream.TryGetBuffer(out var buffer); StateSynchronizationSceneManager.Instance.Send(connections, buffer.Array, buffer.Offset, buffer.Count); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(previousEnabled); } message.Flush(); var data = memoryStream.ToArray(); StateSynchronizationSceneManager.Instance.Send(connections, ref data); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(previousProperties.isMainCamera); message.Write(previousProperties.cullingMask); } message.Flush(); StateSynchronizationSceneManager.Instance.Send(connections, memoryStream.GetBuffer(), 0, memoryStream.Position); } }
protected override void SendDeltaChanges(IEnumerable <SocketEndpoint> endpoints, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(previousValues.enabled); message.Write(previousValues.showMaskGraphic); } message.Flush(); StateSynchronizationSceneManager.Instance.Send(endpoints, memoryStream.ToArray()); } }
protected override void SendDeltaChanges(IEnumerable <INetworkConnection> connections, ChangeType changeFlags) { using (MemoryStream memoryStream = new MemoryStream()) using (BinaryWriter message = new BinaryWriter(memoryStream)) { ComponentBroadcasterService.WriteHeader(message, this); message.Write((byte)changeFlags); if (HasFlag(changeFlags, ChangeType.Properties)) { message.Write(previousValues.alpha); message.Write(previousValues.ignoreParentGroups); } message.Flush(); memoryStream.TryGetBuffer(out var buffer); StateSynchronizationSceneManager.Instance.Send(connections, buffer.Array, buffer.Offset, buffer.Count); } }