private void DrawTime()
        {
            float yOffset = -0.023f;
            float scale   = 3f;

            string time = DateTimeManager.GetTimeString();

            // scale an offset
            if (Main.configClock.Show_Seconds || !Main.configClock.Military_Time_Format)
            {
                yOffset = 0.02f;
                scale   = 1.75f;
            }

            Helpers.DrawText(new Vector2(0.5f, 0.33f + yOffset), time, true, true, scale, 238, 201, 76, alpha, font);
        }
示例#2
0
        private void ClockScripts_Tick(object sender, EventArgs e)
        {
            if (Game.IsPaused || Game.IsLoading)
            {
                return;
            }

            bool   keyIsDown = Game.IsEnabledControlPressed(Control.CharacterWheel);
            string time      = DateTimeManager.GetTimeString();

            if (keyIsDown)
            {
                if (Main.configSettings.Show_Radar_OnKeyDown)
                {
                    Hud.IsRadarVisible = true;
                }
                _clockScroll += 1 * Game.LastFrameTime;
                if (_clockScroll > 0.02f)
                {
                    _clockScroll = 0.02f;
                }
            }
            else
            {
                _clockScroll -= 1 * Game.LastFrameTime;
                if (_clockScroll < -0.2f)
                {
                    _clockScroll = -0.2f;
                    if (Main.configSettings.Show_Radar_OnKeyDown)
                    {
                        Hud.IsRadarVisible = false;
                    }
                }
            }

            if (Main.configClock.Enable_Top_Clock)
            {
                Helpers.DrawText(new Vector2(0.5f, _clockScroll), time, true, true, 1.068f, 0, 0, 0, 200, Font.ChaletComprimeCologne);
                Helpers.DrawText(new Vector2(0.5f, _clockScroll), time, true, true, 1.066f, 240, 240, 240, 255, Font.ChaletComprimeCologne);
            }

            // Sync with machine
            if (DateTimeManager.CurrentClockMode == ClockMode.Sync)
            {
                DateTimeManager.Freeze(true);
                DateTimeManager.SetDate(DateTime.Now);
                DateTimeManager.SetTime(DateTime.Now.TimeOfDay);
            }
            // Vanilla game time
            else if (DateTimeManager.CurrentClockMode == ClockMode.Vanilla)
            {
                DateTimeManager.Freeze(false);
            }
            // Virtual game time
            else
            {
                DateTimeManager.Freeze(true);

                if (Game.GameTime > _timer)
                {
                    _timer = Game.GameTime + (int)Math.Round(1000 * DateTimeManager.CurrentTimerate);
                    DateTimeManager.AddSeconds(1);
                }
            }

            // Update Clock
            DateTimeManager.UpdateGameClock();
        }