Add Visualization chat commands

This commit is contained in:
rob-v
2017-05-21 09:17:31 +02:00
committed by Oliver Brakmann
parent 8403adba37
commit d4e9e0e069
18 changed files with 145 additions and 71 deletions

View File

@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public DebugMenuLogic(Widget widget, World world)
{
var devTrait = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
var debugVis = world.WorldActor.TraitOrDefault<DebugVisualizations>();
var visibilityCheckbox = widget.GetOrNull<CheckboxWidget>("DISABLE_VISIBILITY_CHECKS");
if (visibilityCheckbox != null)
@@ -63,15 +64,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var showCombatCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_COMBATOVERLAY");
if (showCombatCheckbox != null)
{
showCombatCheckbox.IsChecked = () => devTrait.ShowCombatGeometry;
showCombatCheckbox.OnClick = () => devTrait.ShowCombatGeometry ^= true;
showCombatCheckbox.Disabled = debugVis == null;
showCombatCheckbox.IsChecked = () => debugVis != null && debugVis.CombatGeometry;
showCombatCheckbox.OnClick = () => debugVis.CombatGeometry ^= true;
}
var showGeometryCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_GEOMETRY");
if (showGeometryCheckbox != null)
{
showGeometryCheckbox.IsChecked = () => devTrait.ShowDebugGeometry;
showGeometryCheckbox.OnClick = () => devTrait.ShowDebugGeometry ^= true;
showGeometryCheckbox.Disabled = debugVis == null;
showGeometryCheckbox.IsChecked = () => debugVis != null && debugVis.RenderGeometry;
showGeometryCheckbox.OnClick = () => debugVis.RenderGeometry ^= true;
}
var terrainGeometryTrait = world.WorldActor.Trait<TerrainGeometryOverlay>();
@@ -85,8 +88,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var showDepthPreviewCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_DEPTH_PREVIEW");
if (showDepthPreviewCheckbox != null)
{
showDepthPreviewCheckbox.IsChecked = () => devTrait.ShowDepthPreview;
showDepthPreviewCheckbox.OnClick = () => devTrait.ShowDepthPreview ^= true;
showDepthPreviewCheckbox.Disabled = debugVis == null;
showDepthPreviewCheckbox.IsChecked = () => debugVis != null && debugVis.DepthBuffer;
showDepthPreviewCheckbox.OnClick = () => debugVis.DepthBuffer ^= true;
}
var allTechCheckbox = widget.GetOrNull<CheckboxWidget>("ENABLE_TECH");
@@ -123,8 +127,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var showActorTagsCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_ACTOR_TAGS");
if (showActorTagsCheckbox != null)
{
showActorTagsCheckbox.IsChecked = () => devTrait.ShowActorTags;
showActorTagsCheckbox.OnClick = () => devTrait.ShowActorTags ^= true;
showActorTagsCheckbox.Disabled = debugVis == null;
showActorTagsCheckbox.IsChecked = () => debugVis != null && debugVis.ActorTags;
showActorTagsCheckbox.OnClick = () => debugVis.ActorTags ^= true;
}
var showCustomTerrainCheckbox = widget.GetOrNull<CheckboxWidget>("SHOW_CUSTOMTERRAIN_OVERLAY");