diff --git a/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs index b81ff087a7..4f4e217a62 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs @@ -49,7 +49,8 @@ namespace OpenRA.Mods.Common.Widgets if (TooltipContainer == null) return; - tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", GetTooltipText } }); + if (GetTooltipText != null) + tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", GetTooltipText } }); } public override void MouseExited() diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs index de6ced17fe..68b1a180d5 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs @@ -62,14 +62,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic status.GetText = statusText; } - var percentage = widget.GetOrNull("GAME_TIMER_PERCENTAGE"); - if (percentage != null) + var timerTooltip = timer as LabelWithTooltipWidget; + if (timerTooltip != null) { var connection = orderManager.Connection as ReplayConnection; if (connection != null && connection.TickCount != 0) - percentage.GetText = () => "({0}%)".F(orderManager.NetFrameNumber * 100 / connection.TickCount); - else if (timer != null) - timer.Bounds.Width += percentage.Bounds.Width; + timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount); + else + timerTooltip.GetTooltipText = null; } } } diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 8b09519a1e..8b0d861e32 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -10,25 +10,14 @@ Container@INGAME_ROOT: Children: LogicTicker@DISCONNECT_WATCHER: Logic: DisconnectWatcherLogic - Container@GAME_TIMER_BLOCK: - Logic: GameTimerLogic - X: WINDOW_RIGHT/2 - WIDTH - Width: 100 - Height: 55 - Children: - Label@GAME_TIMER: - Width: PARENT_RIGHT - Height: 30 - Align: Center - Font: Title - Contrast: true - Label@GAME_TIMER_STATUS: - Y: 35 - Width: PARENT_RIGHT - Height: 15 - Align: Center - Font: Bold - Contrast: true + Label@MISSION_TEXT: + X: WINDOW_RIGHT/2 - 256 + Y: 22 + Width: 512 + Height: 25 + Font: Bold + Align: Center + Contrast: true StrategicProgress@STRATEGIC_PROGRESS: X: WINDOW_RIGHT/2 Y: 40 @@ -43,17 +32,30 @@ Container@INGAME_ROOT: WorldCommand: Width: WINDOW_RIGHT Height: WINDOW_BOTTOM + Container@GAME_TIMER_BLOCK: + Logic: GameTimerLogic + X: WINDOW_RIGHT/2 - WIDTH + Width: 100 + Height: 55 + Children: + LabelWithTooltip@GAME_TIMER: + Width: PARENT_RIGHT + Height: 30 + Align: Center + Font: Title + Contrast: true + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + Label@GAME_TIMER_STATUS: + Y: 35 + Width: PARENT_RIGHT + Height: 15 + Align: Center + Font: Bold + Contrast: true Container@PLAYER_ROOT: Container@MENU_ROOT: TooltipContainer@TOOLTIP_CONTAINER: - Label@MISSION_TEXT: - X: WINDOW_RIGHT/2 - 256 - Y: 22 - Width: 512 - Height: 25 - Font: Bold - Align: Center - Contrast: true Container@PERF_WIDGETS: Logic: PerfDebugLogic diff --git a/mods/d2k/chrome/ingame-observer.yaml b/mods/d2k/chrome/ingame-observer.yaml index 4ba34bfe37..c57c1140f4 100644 --- a/mods/d2k/chrome/ingame-observer.yaml +++ b/mods/d2k/chrome/ingame-observer.yaml @@ -24,12 +24,14 @@ Container@OBSERVER_WIDGETS: Width: 100 Height: 55 Children: - Label@GAME_TIMER: + LabelWithTooltip@GAME_TIMER: Width: PARENT_RIGHT Height: 30 Align: Center Font: Title Contrast: true + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP Label@GAME_TIMER_STATUS: Y: 32 Width: PARENT_RIGHT diff --git a/mods/ra/chrome/ingame-observer.yaml b/mods/ra/chrome/ingame-observer.yaml index 390c5a10bf..96a12da0b6 100644 --- a/mods/ra/chrome/ingame-observer.yaml +++ b/mods/ra/chrome/ingame-observer.yaml @@ -21,19 +21,14 @@ Container@OBSERVER_WIDGETS: Height: 22 Background: sidebar-button-observer Children: - Label@GAME_TIMER: + LabelWithTooltip@GAME_TIMER: Y: 0-1 - Width: PARENT_RIGHT - 30 + Width: PARENT_RIGHT Height: PARENT_BOTTOM Align: Center Font: TinyBold - Label@GAME_TIMER_PERCENTAGE: - X: PARENT_RIGHT - 40 - Y: 0-1 - Width: 30 - Height: PARENT_BOTTOM - Align: Right - Font: TinyBold + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP Container@TOP_BUTTONS: Logic: MenuButtonsChromeLogic X: 9 diff --git a/mods/ra/chrome/ingame.yaml b/mods/ra/chrome/ingame.yaml index a21b9fe428..aabe1f17ca 100644 --- a/mods/ra/chrome/ingame.yaml +++ b/mods/ra/chrome/ingame.yaml @@ -10,6 +10,14 @@ Container@INGAME_ROOT: Children: LogicTicker@DISCONNECT_WATCHER: Logic: DisconnectWatcherLogic + Label@MISSION_TEXT: + X: WINDOW_RIGHT/2 - 256 + Y: 22 + Width: 512 + Height: 25 + Font: Bold + Align: Center + Contrast: true WorldInteractionController@INTERACTION_CONTROLLER: Width: WINDOW_RIGHT Height: WINDOW_BOTTOM @@ -27,11 +35,3 @@ Container@INGAME_ROOT: Container@PERF_ROOT: Container@MENU_ROOT: TooltipContainer@TOOLTIP_CONTAINER: - Label@MISSION_TEXT: - X: WINDOW_RIGHT/2 - 256 - Y: 22 - Width: 512 - Height: 25 - Font: Bold - Align: Center - Contrast: true