예제 #1
0
        void Awake()
        {
            if (!_loadingLevel)
            {
                LevelLoadedByCheat = false;
            }
            else
            {
                _loadingLevel = false;
            }

            _cheatBeep      = gameObject.AddComponent <AudioSource>();
            _cheatBeep.clip = Resources.Instance.CheatBeep;

            _cheatWatermark = new Utils.Label
            {
                positionDelegate = () => new Rect(0, UI.ScaleVertical(100), Screen.width, Screen.height - UI.ScaleVertical(100)),
                text             = "CHEATS ENABLED",
                fontSize         = 40,
                enableOutline    = true,
                outlineColor     = Color.black,
                style            = new GUIStyle
                {
                    fontStyle = FontStyle.Bold,
                    alignment = TextAnchor.UpperCenter
                }
            };

            if (ModLoader.Settings.FlashCheatWatermark)
            {
                _cheatWatermark.fontSize         = 60;
                _cheatWatermark.positionDelegate = () => new Rect(0, 0, Screen.width, Screen.height);
                _cheatWatermark.displayTime      = 2f;
                _cheatWatermark.text             = "CHEAT USED";
                _cheatWatermark.style.alignment  = TextAnchor.MiddleCenter;
            }

            _cheatWatermark.style.normal.textColor = Color.magenta;
        }
예제 #2
0
        void Awake()
        {
            var color = new Color(235 / 255f, 235 / 255f, 235 / 255f);

            var timerStyle = new GUIStyle
            {
                fontStyle = FontStyle.Bold
            };
            var timerFontSize = 20;

            _gameTimeLabel = new Utils.Label()
            {
                style            = timerStyle,
                fontSize         = timerFontSize,
                positionDelegate = () => new Rect(ScaleVertical(4), 0, Screen.width, Screen.height)
            };

            _realTimeLabel = new Utils.Label()
            {
                Enabled          = false,
                positionDelegate = () => new Rect(_gameTimeLabel.Position.xMin, _gameTimeLabel.Position.yMin + timerStyle.fontSize,
                                                  _gameTimeLabel.Position.width, _gameTimeLabel.Position.height),
                style    = timerStyle,
                fontSize = timerFontSize
            };

            _updateLabel = new Utils.Label()
            {
                positionDelegate = () => new Rect(ScaleVertical(4), Screen.height - _updateLabel.style.fontSize - ScaleVertical(4), Screen.width, Screen.height),
                fontSize         = 18,
                enableOutline    = true,
                outlineColor     = Color.black,
                style            = new GUIStyle
                {
                    fontStyle = FontStyle.Bold
                },
            };

            _debugLabel = new Utils.Label()
            {
                Enabled          = false,
                positionDelegate = () => new Rect(ScaleVertical(4), _updateLabel.Position.yMin - _debugLabel.style.fontSize * 5 - ScaleVertical(3),
                                                  Screen.width, Screen.height),
                fontSize      = 16,
                enableOutline = true,
                outlineColor  = Color.black,
                style         = new GUIStyle
                {
                    fontStyle = FontStyle.Bold
                }
            };

            _titleLabel = new Utils.Label()
            {
                style            = _gameTimeLabel.style,
                fontSize         = _gameTimeLabel.fontSize,
                enableOutline    = true,
                outlineColor     = Color.black,
                positionDelegate = _gameTimeLabel.positionDelegate,
                text             = $"Speedrun Timer v{ Utils.FormatVersion(Assembly.GetExecutingAssembly().GetName().Version)}"
#if DEBUG
                                   + " (debug)"
#elif PRE_RELEASE
                                   + " (pre-release)"
#elif EXPERIMENTAL
                                   + " (experimental)"
#endif
            };

            timerStyle.normal.textColor             = _debugLabel.style.normal.textColor
                                                    = _updateLabel.style.normal.textColor = color;

            ReadSettings();
            _titleLabel.Enabled = !_gameTimeLabel.Enabled;
        }