Unify the perf info visibility
This commit is contained in:
@@ -25,8 +25,7 @@ namespace OpenRA.GameRules
|
||||
// Debug settings
|
||||
public bool UnitDebug = false;
|
||||
public bool PathDebug = false;
|
||||
public bool PerfGraph = true;
|
||||
public bool PerfText = true;
|
||||
public bool PerfDebug = true;
|
||||
public bool IndexDebug = false;
|
||||
|
||||
// Window settings
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Widgets
|
||||
public readonly string Background = "dialog";
|
||||
public override void Draw(World world)
|
||||
{
|
||||
if (!Visible)
|
||||
if (!IsVisible())
|
||||
{
|
||||
base.Draw(world);
|
||||
return;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override void Draw(World world)
|
||||
{
|
||||
if (!Visible)
|
||||
if (!IsVisible())
|
||||
{
|
||||
base.Draw(world);
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override void Draw(World world)
|
||||
{
|
||||
if (!Visible)
|
||||
if (!IsVisible())
|
||||
{
|
||||
base.Draw(world);
|
||||
return;
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace OpenRA.Widgets.Delegates
|
||||
{
|
||||
var r = Chrome.rootWidget;
|
||||
var perfRoot = r.GetWidget("PERF_BG");
|
||||
perfRoot.IsVisible = () => {return (perfRoot.Visible && Game.Settings.PerfDebug);};
|
||||
|
||||
// Perf text
|
||||
var perfText = perfRoot.GetWidget<LabelWidget>("TEXT");
|
||||
@@ -40,11 +41,6 @@ namespace OpenRA.Widgets.Delegates
|
||||
PerfHistory.items["tick_time"].LastValue,
|
||||
Game.LocalTick);
|
||||
};
|
||||
perfText.IsVisible = () => {return (perfText.Visible && Game.Settings.PerfText);};
|
||||
|
||||
// Perf graph
|
||||
var perfGraph = perfRoot.GetWidget("GRAPH");
|
||||
perfGraph.IsVisible = () => {return (perfGraph.Visible && Game.Settings.PerfGraph);};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,19 +30,12 @@ namespace OpenRA.Widgets.Delegates
|
||||
return true;
|
||||
};
|
||||
|
||||
r.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_PERFGRAPH").Checked = () => {return Game.Settings.PerfGraph;};
|
||||
r.GetWidget("SETTINGS_CHECKBOX_PERFGRAPH").OnMouseDown = mi => {
|
||||
Game.Settings.PerfGraph = !Game.Settings.PerfGraph;
|
||||
r.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_PERFDEBUG").Checked = () => {return Game.Settings.PerfDebug;};
|
||||
r.GetWidget("SETTINGS_CHECKBOX_PERFDEBUG").OnMouseDown = mi => {
|
||||
Game.Settings.PerfDebug = !Game.Settings.PerfDebug;
|
||||
return true;
|
||||
};
|
||||
|
||||
r.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_PERFTEXT").Checked = () => {return Game.Settings.PerfText;};
|
||||
r.GetWidget("SETTINGS_CHECKBOX_PERFTEXT").OnMouseDown = mi => {
|
||||
Game.Settings.PerfText = !Game.Settings.PerfText;
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Menu Buttons
|
||||
r.GetWidget("MAINMENU_BUTTON_SETTINGS").OnMouseUp = mi => {
|
||||
r.ShowMenu("SETTINGS_BG");
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Widgets
|
||||
public virtual bool HandleInput(MouseInput mi)
|
||||
{
|
||||
// Are we able to handle this event?
|
||||
if (!Visible || !GetEventBounds().Contains(mi.Location.X,mi.Location.Y))
|
||||
if (!IsVisible() || !GetEventBounds().Contains(mi.Location.X,mi.Location.Y))
|
||||
return false;
|
||||
|
||||
// Can any of our children handle this?
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public virtual void Draw(World world)
|
||||
{
|
||||
if (Visible)
|
||||
if (IsVisible())
|
||||
foreach (var child in Children)
|
||||
child.Draw(world);
|
||||
}
|
||||
|
||||
@@ -121,20 +121,13 @@ Container:
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Spatial Index Debug
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFGRAPH:
|
||||
Id:SETTINGS_CHECKBOX_PERFGRAPH
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFDEBUG:
|
||||
Id:SETTINGS_CHECKBOX_PERFDEBUG
|
||||
X:100
|
||||
Y:150
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Performance Graph
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFTEXT:
|
||||
Id:SETTINGS_CHECKBOX_PERFTEXT
|
||||
X:100
|
||||
Y:180
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Performance Text
|
||||
Text:Show Performance Information
|
||||
Button@SETTINGS_BUTTON_OK:
|
||||
Id:SETTINGS_BUTTON_OK
|
||||
X:PARENT_RIGHT - 180
|
||||
@@ -306,7 +299,6 @@ Container:
|
||||
Y:WINDOW_BOTTOM - 250
|
||||
Width: 210
|
||||
Height: 250
|
||||
Visible: true
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
ClickThrough:true
|
||||
|
||||
@@ -121,20 +121,13 @@ Container:
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Spatial Index Debug
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFGRAPH:
|
||||
Id:SETTINGS_CHECKBOX_PERFGRAPH
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFDEBUG:
|
||||
Id:SETTINGS_CHECKBOX_PERFDEBUG
|
||||
X:100
|
||||
Y:150
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Performance Graph
|
||||
Checkbox@SETTINGS_CHECKBOX_PERFTEXT:
|
||||
Id:SETTINGS_CHECKBOX_PERFTEXT
|
||||
X:100
|
||||
Y:180
|
||||
Width:300
|
||||
Height:20
|
||||
Text:Show Performance Text
|
||||
Text:Show Performance Information
|
||||
Button@SETTINGS_BUTTON_OK:
|
||||
Id:SETTINGS_BUTTON_OK
|
||||
X:PARENT_RIGHT - 180
|
||||
@@ -306,7 +299,6 @@ Container:
|
||||
Y:WINDOW_BOTTOM - 250
|
||||
Width: 210
|
||||
Height: 250
|
||||
Visible: true
|
||||
Children:
|
||||
PerfGraph@GRAPH:
|
||||
ClickThrough:true
|
||||
|
||||
Reference in New Issue
Block a user