From 1069b3a5910d3f2cc8e720ce93889c2634213e34 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 27 May 2020 02:33:22 +0200 Subject: [PATCH] Oh they connect if Sync() isn't used --- GCMC/CubePlacerEngine.cs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/GCMC/CubePlacerEngine.cs b/GCMC/CubePlacerEngine.cs index 6f19240..e01b69b 100644 --- a/GCMC/CubePlacerEngine.cs +++ b/GCMC/CubePlacerEngine.cs @@ -88,23 +88,16 @@ namespace GCMC Log.Output("Reading file..."); Blocks[] blocksArray = null; - //Console.WriteLine("Outside thread: " + Thread.CurrentThread.ManagedThreadId); - //Console.WriteLine("Outside context: " + SynchronizationContext.Current); await Task.Run(() => { - //Console.WriteLine("Inside thread: " + Thread.CurrentThread.Name); var fs = File.OpenText(name); _traceWriter.FileLength = ((FileStream) fs.BaseStream).Length; blocksArray = _serializer.Deserialize(new JsonTextReader(fs)); }); - //Console.WriteLine("After thread: " + Thread.CurrentThread.ManagedThreadId); Log.Output("Placing blocks..."); int i; - uint start = BlockIdentifiers.LatestBlockID + 1; - uint end = start; for (i = 0; i < blocksArray.Length; i++) { - //if (i % 5000 == 0) await AsyncUtils.WaitForSubmission(); var blocks = blocksArray[i]; if (!mapping.TryGetValue(blocks.Material, out var type)) { @@ -114,23 +107,9 @@ namespace GCMC if (type.Type == BlockIDs.Invalid) continue; - end = Block.PlaceNew(type.Type, (blocks.Start + blocks.End) / 10 * 3, color: type.Color.Color, + Block.PlaceNew(type.Type, (blocks.Start + blocks.End) / 10 * 3, color: type.Color.Color, darkness: type.Color.Darkness, scale: (blocks.End - blocks.Start + 1) * 3, - rotation: float3.zero).Id.entityID; - } - - await AsyncUtils.WaitForSubmission(); - var conns = entitiesDB.QueryEntities(CommonExclusiveGroups - .OWNED_BLOCKS_GROUP); - Log.Output("Start: " + start + " - End: " + end); - Log.Output("conn: " + conns[start].isIsolator + " " + conns[start].isProcessed + " " + - conns[start].areConnectionsAssigned + " " + conns[start].ID + " " + - conns[start].machineRigidBodyId); - for (uint j = start; j <= end; j++) - { - conns[j].isProcessed = false; - conns[j].areConnectionsAssigned = false; - conns[j].isIsolator = false; + rotation: float3.zero); } Log.Output(i + " blocks placed.");