settings menu w/ working debug options
This commit is contained in:
@@ -50,6 +50,65 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SettingsMenuDelegate : WidgetDelegate
|
||||||
|
{
|
||||||
|
public override bool GetState(Widget w)
|
||||||
|
{
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_UNITDEBUG")
|
||||||
|
return Game.Settings.UnitDebug;
|
||||||
|
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_PATHDEBUG")
|
||||||
|
return Game.Settings.PathDebug;
|
||||||
|
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_INDEXDEBUG")
|
||||||
|
return Game.Settings.IndexDebug;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool OnMouseDown(Widget w, MouseInput mi)
|
||||||
|
{
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_UNITDEBUG")
|
||||||
|
{
|
||||||
|
Game.Settings.UnitDebug = !Game.Settings.UnitDebug;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_PATHDEBUG")
|
||||||
|
{
|
||||||
|
Game.Settings.PathDebug = !Game.Settings.PathDebug;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w.Id == "SETTINGS_CHECKBOX_INDEXDEBUG")
|
||||||
|
{
|
||||||
|
Game.Settings.IndexDebug = !Game.Settings.IndexDebug;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool OnMouseUp(Widget w, MouseInput mi)
|
||||||
|
{
|
||||||
|
if (w.Id == "MAINMENU_BUTTON_SETTINGS")
|
||||||
|
{
|
||||||
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
|
||||||
|
Game.chrome.rootWidget.GetWidget("SETTINGS_BG").Visible = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w.Id == "SETTINGS_BUTTON_OK")
|
||||||
|
{
|
||||||
|
Game.chrome.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
|
||||||
|
Game.chrome.rootWidget.GetWidget("SETTINGS_BG").Visible = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class CreateServerMenuDelegate : WidgetDelegate
|
public class CreateServerMenuDelegate : WidgetDelegate
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -432,8 +432,6 @@ namespace OpenRA
|
|||||||
// Load the default mod to access required files
|
// Load the default mod to access required files
|
||||||
Game.LoadModPackages(new Manifest(Game.LobbyInfo.GlobalSettings.Mods));
|
Game.LoadModPackages(new Manifest(Game.LobbyInfo.GlobalSettings.Mods));
|
||||||
|
|
||||||
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
|
||||||
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
|
||||||
Renderer.SheetSize = Game.Settings.SheetSize;
|
Renderer.SheetSize = Game.Settings.SheetSize;
|
||||||
|
|
||||||
bool windowed = !Game.Settings.Fullscreen;
|
bool windowed = !Game.Settings.Fullscreen;
|
||||||
|
|||||||
@@ -23,10 +23,11 @@ namespace OpenRA.GameRules
|
|||||||
public class UserSettings
|
public class UserSettings
|
||||||
{
|
{
|
||||||
// Debug settings
|
// Debug settings
|
||||||
public readonly bool UnitDebug = false;
|
public bool UnitDebug = false;
|
||||||
public readonly bool PathDebug = false;
|
public bool PathDebug = false;
|
||||||
public readonly bool PerfGraph = true;
|
public bool PerfGraph = true;
|
||||||
public readonly bool PerfText = true;
|
public bool PerfText = true;
|
||||||
|
public bool IndexDebug = false;
|
||||||
|
|
||||||
// Window settings
|
// Window settings
|
||||||
public readonly int Width = 0;
|
public readonly int Width = 0;
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ namespace OpenRA.Graphics
|
|||||||
internal readonly Renderer renderer;
|
internal readonly Renderer renderer;
|
||||||
internal readonly HardwarePalette palette;
|
internal readonly HardwarePalette palette;
|
||||||
|
|
||||||
public static bool ShowUnitPaths = false;
|
|
||||||
public static bool ShowBinDebug = false;
|
|
||||||
|
|
||||||
internal WorldRenderer(World world, Renderer renderer)
|
internal WorldRenderer(World world, Renderer renderer)
|
||||||
{
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@@ -154,8 +151,8 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
renderer.Device.DisableScissor();
|
renderer.Device.DisableScissor();
|
||||||
|
|
||||||
if (ShowBinDebug)
|
if (Game.Settings.IndexDebug)
|
||||||
DrawBins( bounds );
|
DrawBins(bounds);
|
||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
}
|
}
|
||||||
@@ -240,7 +237,7 @@ namespace OpenRA.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShowUnitPaths)
|
if (Game.Settings.PathDebug)
|
||||||
{
|
{
|
||||||
var mobile = selectedUnit.traits.GetOrDefault<Mobile>();
|
var mobile = selectedUnit.traits.GetOrDefault<Mobile>();
|
||||||
if (mobile != null)
|
if (mobile != null)
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ namespace OpenRA
|
|||||||
SpriteRenderer spriteRenderer;
|
SpriteRenderer spriteRenderer;
|
||||||
Sprite buildOk, buildBlocked, unitDebug;
|
Sprite buildOk, buildBlocked, unitDebug;
|
||||||
|
|
||||||
public static bool ShowUnitDebug = false;
|
|
||||||
|
|
||||||
public UiOverlay(SpriteRenderer spriteRenderer)
|
public UiOverlay(SpriteRenderer spriteRenderer)
|
||||||
{
|
{
|
||||||
this.spriteRenderer = spriteRenderer;
|
this.spriteRenderer = spriteRenderer;
|
||||||
@@ -56,7 +54,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Draw( World world )
|
public void Draw( World world )
|
||||||
{
|
{
|
||||||
if (ShowUnitDebug)
|
if (Game.Settings.UnitDebug)
|
||||||
for (var j = 0; j < world.Map.MapSize; j++)
|
for (var j = 0; j < world.Map.MapSize; j++)
|
||||||
for (var i = 0; i < world.Map.MapSize; i++)
|
for (var i = 0; i < world.Map.MapSize; i++)
|
||||||
if (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(new int2(i, j)).Any())
|
if (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(new int2(i, j)).Any())
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Container:
|
|||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:250
|
Width:250
|
||||||
Height:200
|
Height:250
|
||||||
Children:
|
Children:
|
||||||
Label@MAINMENU_LABEL_TITLE:
|
Label@MAINMENU_LABEL_TITLE:
|
||||||
Id:MAINMENU_LABEL_TITLE
|
Id:MAINMENU_LABEL_TITLE
|
||||||
@@ -31,10 +31,18 @@ Container:
|
|||||||
Height:25
|
Height:25
|
||||||
Text:Create Game
|
Text:Create Game
|
||||||
Delegate:CreateServerMenuDelegate
|
Delegate:CreateServerMenuDelegate
|
||||||
|
Button@MAINMENU_BUTTON_SETTINGS:
|
||||||
|
Id:MAINMENU_BUTTON_SETTINGS
|
||||||
|
X:45
|
||||||
|
Y:150
|
||||||
|
Width:160
|
||||||
|
Height:25
|
||||||
|
Text:Settings
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Button@MAINMENU_BUTTON_QUIT:
|
Button@MAINMENU_BUTTON_QUIT:
|
||||||
Id:MAINMENU_BUTTON_QUIT
|
Id:MAINMENU_BUTTON_QUIT
|
||||||
X:45
|
X:45
|
||||||
Y:150
|
Y:190
|
||||||
Width:160
|
Width:160
|
||||||
Height:25
|
Height:25
|
||||||
Text:Quit
|
Text:Quit
|
||||||
@@ -85,6 +93,72 @@ Container:
|
|||||||
Height:25
|
Height:25
|
||||||
Text:Cancel
|
Text:Cancel
|
||||||
Delegate:CreateServerMenuDelegate
|
Delegate:CreateServerMenuDelegate
|
||||||
|
Background@SETTINGS_BG:
|
||||||
|
Id:SETTINGS_BG
|
||||||
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
Y:(WINDOW_BOTTOM- HEIGHT)/2
|
||||||
|
Width: 450
|
||||||
|
Height: 300
|
||||||
|
Visible: false
|
||||||
|
Children:
|
||||||
|
Label@SETTINGS_LABEL_TITLE:
|
||||||
|
Id:SETTINGS_LABEL_TITLE
|
||||||
|
X:0
|
||||||
|
Y:20
|
||||||
|
Width:450
|
||||||
|
Height:25
|
||||||
|
Text:Settings
|
||||||
|
Align:Center
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_UNITDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_UNITDEBUG
|
||||||
|
X:100
|
||||||
|
Y:60
|
||||||
|
Width:20
|
||||||
|
Height:20
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
|
Label@SETTINGS_LABEL_UNITDEBUG:
|
||||||
|
Id:SETTINGS_LABEL_UNITDEBUG
|
||||||
|
X:135
|
||||||
|
Y:60
|
||||||
|
Width:300
|
||||||
|
Height:25
|
||||||
|
Text:Show Occupied Cells
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_PATHDEBUG
|
||||||
|
X:100
|
||||||
|
Y:90
|
||||||
|
Width:20
|
||||||
|
Height:20
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
|
Label@SETTINGS_LABEL_PATHDEBUG:
|
||||||
|
Id:SETTINGS_LABEL_PATHDEBUG
|
||||||
|
X:135
|
||||||
|
Y:90
|
||||||
|
Width:300
|
||||||
|
Height:25
|
||||||
|
Text:Show Unit Paths
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_INDEXDEBUG
|
||||||
|
X:100
|
||||||
|
Y:120
|
||||||
|
Width:20
|
||||||
|
Height:20
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
|
Label@SETTINGS_LABEL_INDEXDEBUG:
|
||||||
|
Id:SETTINGS_LABEL_INDEXDEBUG
|
||||||
|
X:135
|
||||||
|
Y:120
|
||||||
|
Width:300
|
||||||
|
Height:25
|
||||||
|
Text:Show Spatial Index Debug
|
||||||
|
Button@SETTINGS_BUTTON_OK:
|
||||||
|
Id:SETTINGS_BUTTON_OK
|
||||||
|
X:PARENT_RIGHT - 180
|
||||||
|
Y:PARENT_BOTTOM - 45
|
||||||
|
Width:160
|
||||||
|
Height:25
|
||||||
|
Text:OK
|
||||||
|
Delegate:SettingsMenuDelegate
|
||||||
Background@JOINSERVER_BG:
|
Background@JOINSERVER_BG:
|
||||||
Id:JOINSERVER_BG
|
Id:JOINSERVER_BG
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
|||||||
Reference in New Issue
Block a user