public static void Initialise()
        {
            Logger.LogInfo($"Initialising Fast Loading Screen for BelowZero v{Assembly.GetExecutingAssembly().GetName().Version}...");
            var stopwatch = Stopwatch.StartNew();

            ApplyHarmonyPathches();

            stopwatch.Stop();
            Logger.LogInfo($"Initialised in {stopwatch.ElapsedMilliseconds}ms.");
        }
        private static void ApplyHarmonyPathches()
        {
            var stopwatch = Stopwatch.StartNew();

            var harmony = new Harmony("Fast Loading Screen");

            harmony.PatchAll(typeof(WaitScreenPatch));

            stopwatch.Stop();
            Logger.LogInfo($"Harmony patches applied in {stopwatch.ElapsedMilliseconds}ms.");
        }
        private static void ApplyHarmonyPatches()
        {
            var stopwatch = Stopwatch.StartNew();

            var harmony = new Harmony("SnapBuilder");

            harmony.PatchAll(typeof(BuilderPatch));
            harmony.PatchAll(typeof(PlaceToolPatch));

            stopwatch.Stop();
            Logger.LogInfo($"Harmony patches applied in {stopwatch.ElapsedMilliseconds}ms.");
        }
        public static void Initialise()
        {
            Logger.LogInfo($"Initialising SnapBuilder for {TargetGame} v{Assembly.GetExecutingAssembly().GetName().Version}...");
            var stopwatch = Stopwatch.StartNew();

            ApplyHarmonyPatches();
            Config.Initialise();
            Lang.Initialise();

            stopwatch.Stop();
            Logger.LogInfo($"Initialised in {stopwatch.ElapsedMilliseconds}ms.");
        }
コード例 #5
0
        private static IEnumerator End()
        {
            int frame = Time.frameCount;

            yield return(new WaitUntil(() => Time.frameCount > frame));

            yield return(new WaitWhile(() => WaitScreen.main.isShown));

            stopwatch.Stop();
            if (benchmarking)
            {
                benchmark = stopwatch.Elapsed.TotalSeconds;
                Logger.LogMessage($"Benchmark complete, loading completed in {benchmark:N2}s.");
            }
            else
            {
                Logger.LogInfo($"Loading completed in {stopwatch.Elapsed.TotalSeconds:N2}s, " +
                               $"resetting FPS cap and VSync per user preferences ({frameRate}, {vSyncCount})");
                Application.targetFrameRate = frameRate;
                QualitySettings.vSyncCount  = vSyncCount;

                if (benchmark >= 0)
                {
                    Logger.LogMessage($"Loading completed in {stopwatch.Elapsed.TotalSeconds:N2}s, vs. unboosted benchmark of {benchmark:N2}s.");
                    if (stopwatch.Elapsed.TotalSeconds < benchmark)
                    {
                        Logger.LogMessage($"Improvement of {benchmark - stopwatch.Elapsed.TotalSeconds:N2}s.");
                    }
                    else if (stopwatch.Elapsed.TotalSeconds > benchmark)
                    {
                        Logger.LogMessage($"Degradation of {stopwatch.Elapsed.TotalSeconds - benchmark:N2}s.");
                    }
                    else
                    {
                        Logger.LogMessage("No performance difference recorded.");
                    }
                }
            }
            stopwatch = null;
            end       = null;
        }
コード例 #6
0
        public static void ShowPrefix()
        {
            if (stopwatch is Stopwatch sw && sw.IsRunning)
            {
                return;
            }

            benchmarking = VirtualKey.GetKey(KeyCode.LeftControl);
            if (benchmarking)
            {
                Logger.LogMessage("Running benchmark without boosts for comparison, starting timer...");
            }
            else
            {
                Logger.LogInfo("Boosting loading times...");
                frameRate = Application.targetFrameRate;
                Application.targetFrameRate = -1;

                vSyncCount = QualitySettings.vSyncCount;
                QualitySettings.vSyncCount = 0;
            }
            stopwatch = Stopwatch.StartNew();
        }