settings menu w/ working debug options
This commit is contained in:
@@ -50,6 +50,65 @@ namespace OpenRA.Widgets.Delegates
|
||||
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
|
||||
{
|
||||
|
||||
@@ -432,8 +432,6 @@ namespace OpenRA
|
||||
// Load the default mod to access required files
|
||||
Game.LoadModPackages(new Manifest(Game.LobbyInfo.GlobalSettings.Mods));
|
||||
|
||||
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
||||
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
||||
Renderer.SheetSize = Game.Settings.SheetSize;
|
||||
|
||||
bool windowed = !Game.Settings.Fullscreen;
|
||||
|
||||
@@ -23,10 +23,11 @@ namespace OpenRA.GameRules
|
||||
public class UserSettings
|
||||
{
|
||||
// Debug settings
|
||||
public readonly bool UnitDebug = false;
|
||||
public readonly bool PathDebug = false;
|
||||
public readonly bool PerfGraph = true;
|
||||
public readonly bool PerfText = true;
|
||||
public bool UnitDebug = false;
|
||||
public bool PathDebug = false;
|
||||
public bool PerfGraph = true;
|
||||
public bool PerfText = true;
|
||||
public bool IndexDebug = false;
|
||||
|
||||
// Window settings
|
||||
public readonly int Width = 0;
|
||||
|
||||
@@ -36,9 +36,6 @@ namespace OpenRA.Graphics
|
||||
internal readonly Renderer renderer;
|
||||
internal readonly HardwarePalette palette;
|
||||
|
||||
public static bool ShowUnitPaths = false;
|
||||
public static bool ShowBinDebug = false;
|
||||
|
||||
internal WorldRenderer(World world, Renderer renderer)
|
||||
{
|
||||
this.world = world;
|
||||
@@ -154,8 +151,8 @@ namespace OpenRA.Graphics
|
||||
|
||||
renderer.Device.DisableScissor();
|
||||
|
||||
if (ShowBinDebug)
|
||||
DrawBins( bounds );
|
||||
if (Game.Settings.IndexDebug)
|
||||
DrawBins(bounds);
|
||||
|
||||
lineRenderer.Flush();
|
||||
}
|
||||
@@ -240,7 +237,7 @@ namespace OpenRA.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
if (ShowUnitPaths)
|
||||
if (Game.Settings.PathDebug)
|
||||
{
|
||||
var mobile = selectedUnit.traits.GetOrDefault<Mobile>();
|
||||
if (mobile != null)
|
||||
|
||||
@@ -32,8 +32,6 @@ namespace OpenRA
|
||||
SpriteRenderer spriteRenderer;
|
||||
Sprite buildOk, buildBlocked, unitDebug;
|
||||
|
||||
public static bool ShowUnitDebug = false;
|
||||
|
||||
public UiOverlay(SpriteRenderer spriteRenderer)
|
||||
{
|
||||
this.spriteRenderer = spriteRenderer;
|
||||
@@ -56,7 +54,7 @@ namespace OpenRA
|
||||
|
||||
public void Draw( World world )
|
||||
{
|
||||
if (ShowUnitDebug)
|
||||
if (Game.Settings.UnitDebug)
|
||||
for (var j = 0; j < world.Map.MapSize; j++)
|
||||
for (var i = 0; i < world.Map.MapSize; i++)
|
||||
if (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(new int2(i, j)).Any())
|
||||
|
||||
Reference in New Issue
Block a user