Show replay percentage as a tooltip.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -62,14 +62,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
status.GetText = statusText;
|
||||
}
|
||||
|
||||
var percentage = widget.GetOrNull<LabelWidget>("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user