示例#1
0
        void OnGUI()
        {
            if (!_gameTimeLabel.Enabled && Time.realtimeSinceStartup < 10)
            {
                _titleLabel.OnGUI();
            }

            if (_gameTimeLabel.Enabled)
            {
                var livesplitConnected = SpeedrunTimer.Instance.LiveSplitConnected;
                var gtSuffix           = livesplitConnected ? "•" : "";
                _gameTimeLabel.OnGUI(Utils.FormatTime(SpeedrunTimer.Instance.GameTime, 3) + gtSuffix);
                _realTimeLabel.OnGUI(Utils.FormatTime(SpeedrunTimer.Instance.RealTime, 3));
            }

            if (_debugLabel.Enabled)
            {
                var pos = _player?.transform?.position ?? null;
                var currentCheckpoint = Globals.levelsManager.GetCurrentCheckPoint();

                var isRunning              = SpeedrunTimer.Instance.IsRunning;
                var gtPaused               = SpeedrunTimer.Instance.IsGameTimePaused;
                var livesplitSyncEnabled   = SpeedrunTimer.Instance.LiveSplitSyncEnabled;
                var liveplitSyncConnecting = SpeedrunTimer.Instance.LiveSplitConnecting;

                var playerX = pos.HasValue ? PadPosition(pos.Value.x) : "??";
                var playerY = pos.HasValue ? PadPosition(pos.Value.y) : "??";

                var beat = DebugBeatListener.LastBeatId >= 0
                                        ? (DebugBeatListener.LastBeatId + 1).ToString().PadLeft(2, '0')
                                        : "-";
                var beatDbgStr = $"{beat}/16";

                _debugLabel.OnGUI(
                    $"Checkpoint: {currentCheckpoint + 1} | Beat: {beatDbgStr} | Pos: ({playerX}, {playerY})\n"
                    + $"Frame: {Time.renderedFrameCount} | IsRunning: {isRunning} | IsGameTimePaused: {gtPaused} | LiveSplitSyncEnabled: {livesplitSyncEnabled}, TryingToConnect: {liveplitSyncConnecting}\n"
                    + $"Level {Application.loadedLevel} \"{Application.loadedLevelName}\" | Unity: {Application.unityVersion} | Legacy: {ModLoader.IsLegacyVersion}"
                    );
            }

            string releaseType = "";

#if DEBUG
            releaseType = " (debug)";
#elif PRE_RELEASE
            releaseType = " (pre-release)";
#elif EXPERIMENTAL
            releaseType = " (experimental)";
#endif
            if (Updater.NeedUpdate)
            {
                _updateLabel.OnGUI($"A new Speedrun Timer version is available (v{Assembly.GetExecutingAssembly().GetName().Version}{releaseType} -> v{Updater.LatestVersion})");
            }
#if DEBUG || PRE_RELEASE || EXPERIMENTAL
            else
            {
                _updateLabel.OnGUI($"Unstable build v{Assembly.GetExecutingAssembly().GetName().Version}{releaseType}");
            }
#endif
        }
示例#2
0
        void OnGUI()
        {
            if (!Enabled)
            {
                return;
            }

            _cheatWatermark.OnGUI();
        }