Esempio n. 1
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     if (Instance != null)
     {
         Instance.Dispose();
     }
     Instance   = this;
     debug      = FastTrackOptions.Instance.AsyncPathProbe;
     jobManager = new AsyncJobManager();
 }
Esempio n. 2
0
            internal WorkerThread(AsyncJobManager parent, string name)
            {
                errors      = new List <Exception>(4);
                this.parent = parent ?? throw new ArgumentNullException(nameof(parent));
                var thread = new Thread(Run, 131072)
                {
                    // Klei uses AboveNormal
                    Priority = ThreadPriority.Normal, Name = name
                };

                Util.ApplyInvariantCultureToThread(thread);
                thread.Start();
            }
Esempio n. 3
0
 /// <summary>
 /// Destroys the singleton instance.
 /// </summary>
 internal static void DestroyInstance()
 {
     Instance?.Dispose();
     Instance = null;
 }
Esempio n. 4
0
        internal static void OnEndGame()
        {
            var options = FastTrackOptions.Instance;

#if DEBUG
            Metrics.FastTrackProfiler.End();
#endif
            ConduitPatches.ConduitFlowVisualizerRenderer.Cleanup();
            if (options.CachePaths)
            {
                PathPatches.PathCacher.Cleanup();
            }
            if (options.UnstackLights)
            {
                VisualPatches.LightBufferManager.Cleanup();
            }
            if (options.ReduceTileUpdates)
            {
                VisualPatches.PropertyTextureUpdater.DestroyInstance();
            }
            if (options.ConduitOpts)
            {
                ConduitPatches.BackgroundConduitUpdater.DestroyInstance();
            }
            if (options.ParallelInventory)
            {
                UIPatches.BackgroundInventoryUpdater.DestroyInstance();
            }
            if (options.MeshRendererOptions != FastTrackOptions.MeshRendererSettings.None)
            {
                VisualPatches.TerrainMeshRenderer.DestroyInstance();
                ConduitPatches.ConduitFlowMeshPatches.CleanupAll();
                VisualPatches.GroundRendererDataPatches.CleanupAll();
            }
            if (options.MeshRendererOptions == FastTrackOptions.MeshRendererSettings.All)
            {
                VisualPatches.TileMeshRenderer.DestroyInstance();
            }
            if (options.FastReachability)
            {
                SensorPatches.FastGroupProber.Cleanup();
                GamePatches.FastCellChangeMonitor.FastInstance.Cleanup();
            }
            if (options.MiscOpts)
            {
                GamePatches.GeyserConfigurator_FindType_Patch.Cleanup();
            }
            if (options.PickupOpts)
            {
                GamePatches.SolidTransferArmUpdater.DestroyInstance();
                PathPatches.DeferAnimQueueTrigger.DestroyInstance();
            }
            if (options.AsyncPathProbe)
            {
                PathPatches.PathProbeJobManager.DestroyInstance();
            }
            GamePatches.AchievementPatches.DestroyInstance();
            PathPatches.AsyncBrainGroupUpdater.DestroyInstance();
            if (options.AllocOpts)
            {
                UIPatches.DescriptorAllocPatches.Cleanup();
            }
            if (options.SideScreenOpts)
            {
                UIPatches.AdditionalDetailsPanelWrapper.Cleanup();
                UIPatches.DetailsPanelWrapper.Cleanup();
                UIPatches.VitalsPanelWrapper.Cleanup();
            }
            if (options.BackgroundRoomRebuild)
            {
                GamePatches.BackgroundRoomProber.DestroyInstance();
            }
            AsyncJobManager.DestroyInstance();
            if (options.CustomStringFormat)
            {
                UIPatches.FormatStringPatches.DumpStringFormatterCaches();
            }
            GameRunning = false;
        }