merged RA/CncPerfDebugLogic
separate text and graph, fixes #3491 small repositions to fit with other widgets
This commit is contained in:
@@ -97,7 +97,6 @@
|
|||||||
<Compile Include="Widgets\Logic\CncInstallFromCDLogic.cs" />
|
<Compile Include="Widgets\Logic\CncInstallFromCDLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncInstallLogic.cs" />
|
<Compile Include="Widgets\Logic\CncInstallLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncMenuLogic.cs" />
|
<Compile Include="Widgets\Logic\CncMenuLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\CncPerfDebugLogic.cs" />
|
|
||||||
<Compile Include="Widgets\Logic\CncSettingsLogic.cs" />
|
<Compile Include="Widgets\Logic\CncSettingsLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\ProductionTooltipLogic.cs" />
|
<Compile Include="Widgets\Logic\ProductionTooltipLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\SupportPowerTooltipLogic.cs" />
|
<Compile Include="Widgets\Logic\SupportPowerTooltipLogic.cs" />
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2011 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 OpenRA.Support;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|
||||||
{
|
|
||||||
public class CncPerfDebugLogic
|
|
||||||
{
|
|
||||||
[ObjectCreator.UseCtor]
|
|
||||||
public CncPerfDebugLogic(Widget widget)
|
|
||||||
{
|
|
||||||
// Performance info
|
|
||||||
var perfRoot = widget.Get("PERFORMANCE_INFO");
|
|
||||||
perfRoot.IsVisible = () => Game.Settings.Debug.PerfGraph;
|
|
||||||
var text = perfRoot.Get<LabelWidget>("PERF_TEXT");
|
|
||||||
text.IsVisible = () => Game.Settings.Debug.PerfText;
|
|
||||||
text.GetText = () =>
|
|
||||||
"Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F(
|
|
||||||
Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
|
|
||||||
Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
|
|
||||||
PerfHistory.items["batches"].LastValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,7 +25,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
rootMenu = widget;
|
rootMenu = widget;
|
||||||
rootMenu.IsVisible = () => Menu == MenuType.Main;
|
rootMenu.IsVisible = () => Menu == MenuType.Main;
|
||||||
|
|
||||||
Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Ui.Root, "PERF_BG" );
|
|
||||||
var versionLabel = Ui.Root.GetOrNull<LabelWidget>("VERSION_LABEL");
|
var versionLabel = Ui.Root.GetOrNull<LabelWidget>("VERSION_LABEL");
|
||||||
if (versionLabel != null)
|
if (versionLabel != null)
|
||||||
versionLabel.GetText = WidgetUtils.ActiveModVersion;
|
versionLabel.GetText = WidgetUtils.ActiveModVersion;
|
||||||
|
|||||||
@@ -15,21 +15,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class PerfDebugLogic
|
public class PerfDebugLogic
|
||||||
{
|
{
|
||||||
public PerfDebugLogic()
|
[ObjectCreator.UseCtor]
|
||||||
|
public PerfDebugLogic(Widget widget)
|
||||||
{
|
{
|
||||||
var r = Ui.Root;
|
var perfGraph = widget.Get("GRAPH_BG");
|
||||||
var perfRoot = r.Get("PERF_BG");
|
perfGraph.IsVisible = () => Game.Settings.Debug.PerfGraph;
|
||||||
perfRoot.IsVisible = () => perfRoot.Visible && Game.Settings.Debug.PerfGraph;
|
|
||||||
|
|
||||||
// Perf text
|
var perfText = widget.Get<LabelWidget>("PERF_TEXT");
|
||||||
var perfText = perfRoot.Get<LabelWidget>("TEXT");
|
|
||||||
perfText.IsVisible = () => Game.Settings.Debug.PerfText;
|
perfText.IsVisible = () => Game.Settings.Debug.PerfText;
|
||||||
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
|
perfText.GetText = () =>
|
||||||
Game.RenderFrame,
|
"Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F(
|
||||||
Game.NetFrameNumber,
|
Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
|
||||||
PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
|
Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
|
||||||
PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
|
|
||||||
Game.LocalTick,
|
|
||||||
PerfHistory.items["batches"].LastValue);
|
PerfHistory.items["batches"].LastValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,27 @@ Container@INGAME_ROOT:
|
|||||||
Height: 30
|
Height: 30
|
||||||
UseContrast: yes
|
UseContrast: yes
|
||||||
Container@PERFORMANCE_INFO:
|
Container@PERFORMANCE_INFO:
|
||||||
Logic:CncPerfDebugLogic
|
Logic:PerfDebugLogic
|
||||||
Children:
|
Children:
|
||||||
Label@PERF_TEXT:
|
Label@PERF_TEXT:
|
||||||
X:85
|
X:WINDOW_RIGHT - 200
|
||||||
Y:10
|
Y:WINDOW_BOTTOM - 70
|
||||||
Width:170
|
Width:170
|
||||||
Height:40
|
Height:40
|
||||||
Contrast:true
|
Contrast:true
|
||||||
PerfGraph@GRAPH:
|
VAlign:Top
|
||||||
|
Background@GRAPH_BG:
|
||||||
X:10
|
X:10
|
||||||
Y:WINDOW_BOTTOM-HEIGHT-10
|
Y:WINDOW_BOTTOM-HEIGHT-10
|
||||||
Width:200
|
Width:220
|
||||||
Height:200
|
Height:220
|
||||||
|
Background:panel-black
|
||||||
|
Children:
|
||||||
|
PerfGraph@GRAPH:
|
||||||
|
X:10
|
||||||
|
Y:10
|
||||||
|
Width:200
|
||||||
|
Height:200
|
||||||
WorldInteractionController@INTERACTION_CONTROLLER:
|
WorldInteractionController@INTERACTION_CONTROLLER:
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ Container@MENU_BACKGROUND:
|
|||||||
Height:35
|
Height:35
|
||||||
Text:Back
|
Text:Back
|
||||||
Container@PERFORMANCE_INFO:
|
Container@PERFORMANCE_INFO:
|
||||||
Logic:CncPerfDebugLogic
|
Logic:PerfDebugLogic
|
||||||
Children:
|
Children:
|
||||||
Label@PERF_TEXT:
|
Label@PERF_TEXT:
|
||||||
X:40
|
X:40
|
||||||
|
|||||||
@@ -36,25 +36,28 @@ Container@INGAME_ROOT:
|
|||||||
Text:Options (ESC)
|
Text:Options (ESC)
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Key: escape
|
Key: escape
|
||||||
Background@PERF_BG:
|
Container@PERFORMANCE_INFO:
|
||||||
ClickThrough:true
|
|
||||||
Background:dialog4
|
|
||||||
Logic:PerfDebugLogic
|
Logic:PerfDebugLogic
|
||||||
X:10
|
|
||||||
Y:WINDOW_BOTTOM - 250
|
|
||||||
Width: 210
|
|
||||||
Height: 250
|
|
||||||
Children:
|
Children:
|
||||||
PerfGraph@GRAPH:
|
Label@PERF_TEXT:
|
||||||
X:5
|
X:WINDOW_RIGHT - 200
|
||||||
Y:5
|
Y:WINDOW_BOTTOM - 70
|
||||||
Width:200
|
|
||||||
Height:200
|
|
||||||
Label@TEXT:
|
|
||||||
X:20
|
|
||||||
Y:205
|
|
||||||
Width:170
|
Width:170
|
||||||
Height:40
|
Height:40
|
||||||
|
Contrast:true
|
||||||
|
Background@GRAPH_BG:
|
||||||
|
ClickThrough:true
|
||||||
|
Background:dialog4
|
||||||
|
X:30
|
||||||
|
Y:WINDOW_BOTTOM - 240
|
||||||
|
Width:210
|
||||||
|
Height:210
|
||||||
|
Children:
|
||||||
|
PerfGraph@GRAPH:
|
||||||
|
X:5
|
||||||
|
Y:5
|
||||||
|
Width:200
|
||||||
|
Height:200
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
|
|
||||||
Container@PLAYER_WIDGETS:
|
Container@PLAYER_WIDGETS:
|
||||||
|
|||||||
@@ -104,22 +104,25 @@ Container@MAINMENU:
|
|||||||
Height:35
|
Height:35
|
||||||
Text:Quit
|
Text:Quit
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Background@PERF_BG:
|
Container@PERFORMANCE_INFO:
|
||||||
ClickThrough:true
|
Logic:PerfDebugLogic
|
||||||
Background:dialog4
|
Children:
|
||||||
Logic:PerfDebugLogic
|
Label@PERF_TEXT:
|
||||||
X:10
|
X:30
|
||||||
Y:WINDOW_BOTTOM - 250
|
Y:WINDOW_BOTTOM - 70
|
||||||
Width: 210
|
Width:170
|
||||||
Height: 250
|
Height:40
|
||||||
Children:
|
Contrast:true
|
||||||
PerfGraph@GRAPH:
|
Background@GRAPH_BG:
|
||||||
X:5
|
ClickThrough:true
|
||||||
Y:5
|
Background:dialog4
|
||||||
Width:200
|
X:WINDOW_RIGHT - 240
|
||||||
Height:200
|
Y:WINDOW_BOTTOM - 240
|
||||||
Label@TEXT:
|
Width:210
|
||||||
X:20
|
Height:210
|
||||||
Y:205
|
Children:
|
||||||
Width:170
|
PerfGraph@GRAPH:
|
||||||
Height:40
|
X:5
|
||||||
|
Y:5
|
||||||
|
Width:200
|
||||||
|
Height:200
|
||||||
Reference in New Issue
Block a user