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\CncInstallLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\CncMenuLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\CncPerfDebugLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\CncSettingsLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ProductionTooltipLogic.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.IsVisible = () => Menu == MenuType.Main;
|
||||
|
||||
Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Ui.Root, "PERF_BG" );
|
||||
var versionLabel = Ui.Root.GetOrNull<LabelWidget>("VERSION_LABEL");
|
||||
if (versionLabel != null)
|
||||
versionLabel.GetText = WidgetUtils.ActiveModVersion;
|
||||
|
||||
@@ -15,21 +15,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public class PerfDebugLogic
|
||||
{
|
||||
public PerfDebugLogic()
|
||||
[ObjectCreator.UseCtor]
|
||||
public PerfDebugLogic(Widget widget)
|
||||
{
|
||||
var r = Ui.Root;
|
||||
var perfRoot = r.Get("PERF_BG");
|
||||
perfRoot.IsVisible = () => perfRoot.Visible && Game.Settings.Debug.PerfGraph;
|
||||
var perfGraph = widget.Get("GRAPH_BG");
|
||||
perfGraph.IsVisible = () => Game.Settings.Debug.PerfGraph;
|
||||
|
||||
// Perf text
|
||||
var perfText = perfRoot.Get<LabelWidget>("TEXT");
|
||||
var perfText = widget.Get<LabelWidget>("PERF_TEXT");
|
||||
perfText.IsVisible = () => Game.Settings.Debug.PerfText;
|
||||
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
|
||||
Game.RenderFrame,
|
||||
Game.NetFrameNumber,
|
||||
PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
|
||||
PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
|
||||
Game.LocalTick,
|
||||
perfText.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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,19 +23,27 @@ Container@INGAME_ROOT:
|
||||
Height: 30
|
||||
UseContrast: yes
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic:CncPerfDebugLogic
|
||||
Logic:PerfDebugLogic
|
||||
Children:
|
||||
Label@PERF_TEXT:
|
||||
X:85
|
||||
Y:10
|
||||
X:WINDOW_RIGHT - 200
|
||||
Y:WINDOW_BOTTOM - 70
|
||||
Width:170
|
||||
Height:40
|
||||
Contrast:true
|
||||
PerfGraph@GRAPH:
|
||||
VAlign:Top
|
||||
Background@GRAPH_BG:
|
||||
X:10
|
||||
Y:WINDOW_BOTTOM-HEIGHT-10
|
||||
Width:200
|
||||
Height:200
|
||||
Width:220
|
||||
Height:220
|
||||
Background:panel-black
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
X:10
|
||||
Y:10
|
||||
Width:200
|
||||
Height:200
|
||||
WorldInteractionController@INTERACTION_CONTROLLER:
|
||||
Width:WINDOW_RIGHT
|
||||
Height:WINDOW_BOTTOM
|
||||
|
||||
@@ -171,7 +171,7 @@ Container@MENU_BACKGROUND:
|
||||
Height:35
|
||||
Text:Back
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic:CncPerfDebugLogic
|
||||
Logic:PerfDebugLogic
|
||||
Children:
|
||||
Label@PERF_TEXT:
|
||||
X:40
|
||||
|
||||
@@ -36,25 +36,28 @@ Container@INGAME_ROOT:
|
||||
Text:Options (ESC)
|
||||
Font:Bold
|
||||
Key: escape
|
||||
Background@PERF_BG:
|
||||
ClickThrough:true
|
||||
Background:dialog4
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic:PerfDebugLogic
|
||||
X:10
|
||||
Y:WINDOW_BOTTOM - 250
|
||||
Width: 210
|
||||
Height: 250
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
X:5
|
||||
Y:5
|
||||
Width:200
|
||||
Height:200
|
||||
Label@TEXT:
|
||||
X:20
|
||||
Y:205
|
||||
Label@PERF_TEXT:
|
||||
X:WINDOW_RIGHT - 200
|
||||
Y:WINDOW_BOTTOM - 70
|
||||
Width:170
|
||||
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:
|
||||
|
||||
Container@PLAYER_WIDGETS:
|
||||
|
||||
@@ -104,22 +104,25 @@ Container@MAINMENU:
|
||||
Height:35
|
||||
Text:Quit
|
||||
Font:Bold
|
||||
Background@PERF_BG:
|
||||
ClickThrough:true
|
||||
Background:dialog4
|
||||
Logic:PerfDebugLogic
|
||||
X:10
|
||||
Y:WINDOW_BOTTOM - 250
|
||||
Width: 210
|
||||
Height: 250
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
X:5
|
||||
Y:5
|
||||
Width:200
|
||||
Height:200
|
||||
Label@TEXT:
|
||||
X:20
|
||||
Y:205
|
||||
Width:170
|
||||
Height:40
|
||||
Container@PERFORMANCE_INFO:
|
||||
Logic:PerfDebugLogic
|
||||
Children:
|
||||
Label@PERF_TEXT:
|
||||
X:30
|
||||
Y:WINDOW_BOTTOM - 70
|
||||
Width:170
|
||||
Height:40
|
||||
Contrast:true
|
||||
Background@GRAPH_BG:
|
||||
ClickThrough:true
|
||||
Background:dialog4
|
||||
X:WINDOW_RIGHT - 240
|
||||
Y:WINDOW_BOTTOM - 240
|
||||
Width:210
|
||||
Height:210
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
X:5
|
||||
Y:5
|
||||
Width:200
|
||||
Height:200
|
||||
Reference in New Issue
Block a user