From aa46d4962067596984c7038dbd88bb6d65ff9a2f Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 31 Aug 2023 12:08:35 +0100 Subject: [PATCH] reformat code --- Assets/Extra/SendChildrenToSpeckle.cs | 25 +- Assets/InteractionLogic.cs | 410 +++++++++--------- Assets/SpeckleExamples.cs | 222 +++++----- .../Components/SpeckleReceiverEditor.cs | 193 ++++++--- .../Editor/Components/SpeckleSendEditor.cs | 68 +-- .../Editor/Components/StreamManagerEditor.cs | 172 +++++--- .../Editor/NativeCache/AssetDBNativeCache.cs | 92 ++-- .../Selection/StreamSelectionEditor.cs | 139 +++--- .../Runtime/Components/Deprecated/Receiver.cs | 342 ++++++++------- .../Runtime/Components/Deprecated/Sender.cs | 261 +++++------ .../Components/Deprecated/StreamManager.cs | 23 +- .../Runtime/Components/ReceiveFromURL.cs | 71 +-- .../Components/RecursiveConverter.ToNative.cs | 177 +++++--- .../RecursiveConverter.ToSpeckle.cs | 39 +- .../Runtime/Components/SpeckleReceiver.cs | 315 +++++++++----- .../Runtime/Components/SpeckleSender.cs | 124 ++++-- .../Unity/ConverterUnity.BuiltElements.cs | 2 - .../Converter/Unity/ConverterUnity.Mesh.cs | 2 +- .../Unity/ConverterUnity.RenderMaterial.cs | 11 +- .../Converter/Unity/ConverterUnity.Units.cs | 10 +- .../Runtime/Converter/Unity/ConverterUnity.cs | 7 +- .../Runtime/Dispatcher.cs | 188 ++++---- .../Runtime/Factories/ConverterFactory.cs | 1 - .../NativeCache/AbstractNativeCache.cs | 30 +- .../NativeCache/AggregateNativeCache.cs | 16 +- .../Runtime/NativeCache/MemoryNativeCache.cs | 28 +- .../NativeCache/ResourcesNativeCache.cs | 20 +- .../Runtime/NativeCacheFactory.cs | 11 +- .../ObservableConcurrentDictionary.cs | 2 +- .../Runtime/Streams.cs | 56 +-- .../Runtime/Utils/CoreUtils.cs | 49 ++- .../Runtime/Utils/ObjectExtensions.cs | 8 +- .../Runtime/Utils/ShaderHelpers.cs | 11 +- .../Runtime/Utils/Utils.cs | 1 - .../Wrappers/Selection/AccountSelection.cs | 16 +- .../Wrappers/Selection/BranchSelection.cs | 21 +- .../Wrappers/Selection/CommitSelection.cs | 15 +- .../Wrappers/Selection/OptionSelection.cs | 27 +- .../Wrappers/Selection/StreamSelection.cs | 13 +- .../Runtime/Wrappers/SpeckleProperties.cs | 29 +- 40 files changed, 1851 insertions(+), 1396 deletions(-) diff --git a/Assets/Extra/SendChildrenToSpeckle.cs b/Assets/Extra/SendChildrenToSpeckle.cs index 47f17f1..4de0ebc 100644 --- a/Assets/Extra/SendChildrenToSpeckle.cs +++ b/Assets/Extra/SendChildrenToSpeckle.cs @@ -2,11 +2,8 @@ using System; using System.Collections.Concurrent; using System.Collections.Immutable; using System.Linq; -using System.Runtime.CompilerServices; using Speckle.ConnectorUnity; -using UnityEditor.Experimental; using UnityEngine; -using UnityEngine.Events; [RequireComponent(typeof(Sender)), ExecuteAlways] [Obsolete] @@ -23,7 +20,7 @@ public class SendChildrenToSpeckle : MonoBehaviour { sender = GetComponent(); } - + [ContextMenu(nameof(Send))] public void Send() { @@ -31,30 +28,32 @@ public class SendChildrenToSpeckle : MonoBehaviour .Where(t => t != this.transform) .Select(o => o.gameObject) .ToImmutableHashSet(); - + Debug.Log("starting send..."); - sender.Send(streamId, selected, null, branchName, createCommit, + sender.Send( + streamId, + selected, + null, + branchName, + createCommit, onErrorAction: OnError, onProgressAction: OnProgress, - onDataSentAction: OnSent); + onDataSentAction: OnSent + ); } private void OnSent(string objectId) { Debug.Log($"Data sent {objectId}", this); } - + private void OnError(string message, Exception e) { Debug.LogError($"Error while sending {message} \n {e}", this); - } + private void OnProgress(ConcurrentDictionary dict) { Debug.Log($"progress was made", this); } - - - - } diff --git a/Assets/InteractionLogic.cs b/Assets/InteractionLogic.cs index 5418810..b7b80ef 100644 --- a/Assets/InteractionLogic.cs +++ b/Assets/InteractionLogic.cs @@ -1,220 +1,244 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Speckle.Core.Api; -using Speckle.Core.Logging; using UnityEngine; using UnityEngine.UI; using Text = UnityEngine.UI.Text; namespace Speckle.ConnectorUnity -{ +{ [Obsolete] - public class InteractionLogic : MonoBehaviour - { - private Receiver receiver; - - public void InitReceiver(Stream stream, bool autoReceive) + public class InteractionLogic : MonoBehaviour { - gameObject.name = $"receiver-{stream.id}-{Guid.NewGuid().ToString()}"; - InitRemove(); + private Receiver _receiver; - receiver = gameObject.AddComponent(); - receiver.Stream = stream; - - var btn = gameObject.transform.Find("Btn").GetComponentInChildren