Overhaul ingame timer displays. Fixes #3062.
This commit is contained in:
@@ -73,7 +73,8 @@ namespace OpenRA
|
||||
public static int RenderFrame = 0;
|
||||
public static int NetFrameNumber { get { return orderManager.NetFrameNumber; } }
|
||||
public static int LocalTick { get { return orderManager.LocalFrameNumber; } }
|
||||
public const int NetTickScale = 3; // 120ms net tick for 40ms local tick
|
||||
public const int NetTickScale = 3; // 120ms net tick for 40ms local tick
|
||||
public const int Timestep = 40;
|
||||
|
||||
public static event Action<OrderManager> ConnectionStateChanged = _ => { };
|
||||
static ConnectionState lastConnectionState = ConnectionState.PreConnecting;
|
||||
@@ -224,6 +225,7 @@ namespace OpenRA
|
||||
|
||||
var map = modData.PrepareMap(mapUID);
|
||||
orderManager.world = new World(modData.Manifest, map, orderManager, isShellmap);
|
||||
orderManager.world.Timestep = Timestep;
|
||||
worldRenderer = new WorldRenderer(orderManager.world);
|
||||
orderManager.world.LoadComplete(worldRenderer);
|
||||
|
||||
|
||||
@@ -200,7 +200,6 @@
|
||||
<Compile Include="Widgets\ShpImageWidget.cs" />
|
||||
<Compile Include="Widgets\SliderWidget.cs" />
|
||||
<Compile Include="Widgets\TextFieldWidget.cs" />
|
||||
<Compile Include="Widgets\TimerWidget.cs" />
|
||||
<Compile Include="Widgets\VqaPlayerWidget.cs" />
|
||||
<Compile Include="Widgets\Widget.cs" />
|
||||
<Compile Include="Widgets\WidgetLoader.cs" />
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
public class TimerWidget : LabelWidget
|
||||
{
|
||||
public override void Draw()
|
||||
{
|
||||
var font = Game.Renderer.Fonts[Font];
|
||||
var rb = RenderBounds;
|
||||
var color = GetColor();
|
||||
var contrast = GetContrastColor();
|
||||
|
||||
var s = WidgetUtils.FormatTime(Game.LocalTick) + (Game.orderManager.world.Paused?" (paused)":"");
|
||||
var pos = new float2(rb.Left - font.Measure(s).X / 2, rb.Top);
|
||||
if (Contrast)
|
||||
font.DrawTextWithContrast(s, pos, color, contrast, 1);
|
||||
else
|
||||
font.DrawText(s, pos, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace OpenRA
|
||||
Queue<Action<World>> frameEndActions = new Queue<Action<World>>();
|
||||
|
||||
public int FrameNumber { get { return orderManager.LocalFrameNumber; } }
|
||||
public int Timestep;
|
||||
|
||||
internal readonly OrderManager orderManager;
|
||||
public Session LobbyInfo { get { return orderManager.LobbyInfo; } }
|
||||
@@ -190,6 +191,7 @@ namespace OpenRA
|
||||
public bool PredictedPaused { get; internal set; }
|
||||
public bool PauseStateLocked { get; set; }
|
||||
public bool IsShellmap = false;
|
||||
public int WorldTick { get; private set; }
|
||||
|
||||
public void SetPauseState(bool paused)
|
||||
{
|
||||
@@ -209,6 +211,8 @@ namespace OpenRA
|
||||
{
|
||||
if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
|
||||
{
|
||||
WorldTick++;
|
||||
|
||||
using (new PerfSample("tick_idle"))
|
||||
foreach (var ni in ActorsWithTrait<INotifyIdle>())
|
||||
if (ni.Actor.IsIdle)
|
||||
|
||||
Reference in New Issue
Block a user