Show replay percentage as a tooltip.
This commit is contained in:
@@ -49,6 +49,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (TooltipContainer == null)
|
if (TooltipContainer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (GetTooltipText != null)
|
||||||
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", GetTooltipText } });
|
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs() { { "getText", GetTooltipText } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
status.GetText = statusText;
|
status.GetText = statusText;
|
||||||
}
|
}
|
||||||
|
|
||||||
var percentage = widget.GetOrNull<LabelWidget>("GAME_TIMER_PERCENTAGE");
|
var timerTooltip = timer as LabelWithTooltipWidget;
|
||||||
if (percentage != null)
|
if (timerTooltip != null)
|
||||||
{
|
{
|
||||||
var connection = orderManager.Connection as ReplayConnection;
|
var connection = orderManager.Connection as ReplayConnection;
|
||||||
if (connection != null && connection.TickCount != 0)
|
if (connection != null && connection.TickCount != 0)
|
||||||
percentage.GetText = () => "({0}%)".F(orderManager.NetFrameNumber * 100 / connection.TickCount);
|
timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount);
|
||||||
else if (timer != null)
|
else
|
||||||
timer.Bounds.Width += percentage.Bounds.Width;
|
timerTooltip.GetTooltipText = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,24 +10,13 @@ Container@INGAME_ROOT:
|
|||||||
Children:
|
Children:
|
||||||
LogicTicker@DISCONNECT_WATCHER:
|
LogicTicker@DISCONNECT_WATCHER:
|
||||||
Logic: DisconnectWatcherLogic
|
Logic: DisconnectWatcherLogic
|
||||||
Container@GAME_TIMER_BLOCK:
|
Label@MISSION_TEXT:
|
||||||
Logic: GameTimerLogic
|
X: WINDOW_RIGHT/2 - 256
|
||||||
X: WINDOW_RIGHT/2 - WIDTH
|
Y: 22
|
||||||
Width: 100
|
Width: 512
|
||||||
Height: 55
|
Height: 25
|
||||||
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
|
Font: Bold
|
||||||
|
Align: Center
|
||||||
Contrast: true
|
Contrast: true
|
||||||
StrategicProgress@STRATEGIC_PROGRESS:
|
StrategicProgress@STRATEGIC_PROGRESS:
|
||||||
X: WINDOW_RIGHT/2
|
X: WINDOW_RIGHT/2
|
||||||
@@ -43,17 +32,30 @@ Container@INGAME_ROOT:
|
|||||||
WorldCommand:
|
WorldCommand:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
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@PLAYER_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
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:
|
Container@PERF_WIDGETS:
|
||||||
Logic: PerfDebugLogic
|
Logic: PerfDebugLogic
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Width: 100
|
Width: 100
|
||||||
Height: 55
|
Height: 55
|
||||||
Children:
|
Children:
|
||||||
Label@GAME_TIMER:
|
LabelWithTooltip@GAME_TIMER:
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 30
|
Height: 30
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Title
|
Font: Title
|
||||||
Contrast: true
|
Contrast: true
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@GAME_TIMER_STATUS:
|
Label@GAME_TIMER_STATUS:
|
||||||
Y: 32
|
Y: 32
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -21,19 +21,14 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Height: 22
|
Height: 22
|
||||||
Background: sidebar-button-observer
|
Background: sidebar-button-observer
|
||||||
Children:
|
Children:
|
||||||
Label@GAME_TIMER:
|
LabelWithTooltip@GAME_TIMER:
|
||||||
Y: 0-1
|
Y: 0-1
|
||||||
Width: PARENT_RIGHT - 30
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
Label@GAME_TIMER_PERCENTAGE:
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
X: PARENT_RIGHT - 40
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Y: 0-1
|
|
||||||
Width: 30
|
|
||||||
Height: PARENT_BOTTOM
|
|
||||||
Align: Right
|
|
||||||
Font: TinyBold
|
|
||||||
Container@TOP_BUTTONS:
|
Container@TOP_BUTTONS:
|
||||||
Logic: MenuButtonsChromeLogic
|
Logic: MenuButtonsChromeLogic
|
||||||
X: 9
|
X: 9
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ Container@INGAME_ROOT:
|
|||||||
Children:
|
Children:
|
||||||
LogicTicker@DISCONNECT_WATCHER:
|
LogicTicker@DISCONNECT_WATCHER:
|
||||||
Logic: DisconnectWatcherLogic
|
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:
|
WorldInteractionController@INTERACTION_CONTROLLER:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
@@ -27,11 +35,3 @@ Container@INGAME_ROOT:
|
|||||||
Container@PERF_ROOT:
|
Container@PERF_ROOT:
|
||||||
Container@MENU_ROOT:
|
Container@MENU_ROOT:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
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