Developer Mode (pchote: amended)
This commit is contained in:
@@ -24,8 +24,9 @@ namespace OpenRA.GameRules
|
|||||||
public bool PathDebug = false;
|
public bool PathDebug = false;
|
||||||
public bool PerfDebug = false;
|
public bool PerfDebug = false;
|
||||||
public bool IndexDebug = false;
|
public bool IndexDebug = false;
|
||||||
public bool RecordSyncReports = true;
|
public bool RecordSyncReports = true;
|
||||||
public bool ShowGameTimer = true;
|
public bool ShowGameTimer = true;
|
||||||
|
public bool DeveloperMode = false;
|
||||||
|
|
||||||
// Window settings
|
// Window settings
|
||||||
public WindowMode WindowMode = WindowMode.PseudoFullscreen;
|
public WindowMode WindowMode = WindowMode.PseudoFullscreen;
|
||||||
|
|||||||
@@ -236,7 +236,8 @@
|
|||||||
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
|
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
|
||||||
<Name>OpenRA.FileFormats</Name>
|
<Name>OpenRA.FileFormats</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
<Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||||
<Visible>False</Visible>
|
<Visible>False</Visible>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA
|
|||||||
// brutal hack
|
// brutal hack
|
||||||
Application.CurrentCulture = CultureInfo.InvariantCulture;
|
Application.CurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
|
||||||
if (Debugger.IsAttached || args.Contains("--just-die"))
|
if (Debugger.IsAttached)
|
||||||
{
|
{
|
||||||
Run(args);
|
Run(args);
|
||||||
return;
|
return;
|
||||||
@@ -38,7 +38,8 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
Log.AddChannel("exception", "openra.exception.txt", true, false);
|
Log.AddChannel("exception", "openra.exception.txt", true, false);
|
||||||
Log.Write("exception", "{0}", e.ToString());
|
Log.Write("exception", "{0}", e.ToString());
|
||||||
Log.Upload(Game.GetGameId());
|
if (!Game.Settings.DeveloperMode || ( Game.Settings.DeveloperMode && Game.GetGameId() != 0) )
|
||||||
|
Log.Upload(Game.GetGameId());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
class ProductionQueueInfo : ITraitInfo
|
class ProductionQueueInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly float BuildSpeed = 0.4f;
|
public float BuildSpeed = 0.4f;
|
||||||
public readonly int LowPowerSlowdown = 3;
|
public readonly int LowPowerSlowdown = 3;
|
||||||
public object Create(ActorInitializer init) { return new ProductionQueue(init.self); }
|
public object Create(ActorInitializer init) { return new ProductionQueue(init.self); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Widgets
|
|||||||
var wasPressed = Depressed;
|
var wasPressed = Depressed;
|
||||||
return (LoseFocus(mi) && wasPressed);
|
return (LoseFocus(mi) && wasPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Down)
|
if (mi.Event == MouseInputEvent.Down)
|
||||||
Depressed = true;
|
Depressed = true;
|
||||||
else if (mi.Event == MouseInputEvent.Move && Focused)
|
else if (mi.Event == MouseInputEvent.Move && Focused)
|
||||||
|
|||||||
96
OpenRA.Game/Widgets/Delegates/DeveloperModeDelegate.cs
Normal file
96
OpenRA.Game/Widgets/Delegates/DeveloperModeDelegate.cs
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
|
* This file is part of OpenRA.
|
||||||
|
*
|
||||||
|
* OpenRA is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* OpenRA is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using OpenRA;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
|
||||||
|
namespace OpenRA.Widgets.Delegates
|
||||||
|
{
|
||||||
|
|
||||||
|
public class DeveloperModeDelegate : IWidgetDelegate
|
||||||
|
{
|
||||||
|
|
||||||
|
float oldBuildSpeed = 0;
|
||||||
|
bool slowed = false;
|
||||||
|
|
||||||
|
public DeveloperModeDelegate ()
|
||||||
|
{
|
||||||
|
var devmodeBG = Chrome.rootWidget.GetWidget("INGAME_ROOT").GetWidget("DEVELOPERMODE_BG");
|
||||||
|
var devModeButton = Chrome.rootWidget.GetWidget<ButtonWidget>("INGAME_DEVELOPERMODE_BUTTON");
|
||||||
|
|
||||||
|
devModeButton.OnMouseUp = mi =>
|
||||||
|
{
|
||||||
|
devmodeBG.Visible ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_SHROUD").Checked =
|
||||||
|
() => Game.world.LocalPlayer.Shroud.Disabled;
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_SHROUD").OnMouseDown = mi =>
|
||||||
|
{
|
||||||
|
Game.world.LocalPlayer.Shroud.Disabled ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_UNITDEBUG").Checked =
|
||||||
|
() => {return Game.Settings.UnitDebug;};
|
||||||
|
devmodeBG.GetWidget("SETTINGS_CHECKBOX_UNITDEBUG").OnMouseDown = mi => {
|
||||||
|
Game.Settings.UnitDebug ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_PATHDEBUG").Checked =
|
||||||
|
() => {return Game.Settings.PathDebug;};
|
||||||
|
devmodeBG.GetWidget("SETTINGS_CHECKBOX_PATHDEBUG").OnMouseDown = mi => {
|
||||||
|
Game.Settings.PathDebug ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHECKBOX_INDEXDEBUG").Checked =
|
||||||
|
() => {return Game.Settings.IndexDebug;};
|
||||||
|
devmodeBG.GetWidget("SETTINGS_CHECKBOX_INDEXDEBUG").OnMouseDown = mi => {
|
||||||
|
Game.Settings.IndexDebug ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
//danger will robinson
|
||||||
|
devmodeBG.GetWidget<ButtonWidget>("SETTINGS_GIVE_CASH").OnMouseUp = mi =>
|
||||||
|
{
|
||||||
|
Game.world.LocalPlayer.PlayerActor.traits.Get<PlayerResources>().GiveCash(5000);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_BUILD_SPEED").OnMouseDown = mi =>
|
||||||
|
{
|
||||||
|
oldBuildSpeed = (!slowed)? Game.world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().BuildSpeed : oldBuildSpeed;
|
||||||
|
Game.world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().BuildSpeed = (slowed)? oldBuildSpeed : 0;
|
||||||
|
slowed ^= true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_BUILD_SPEED").Checked =
|
||||||
|
() => {return slowed;};
|
||||||
|
|
||||||
|
devModeButton.IsVisible = () => { return Game.Settings.DeveloperMode; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
Chrome.rootWidget.GetWidget("INGAME_DIPLOMACY_BUTTON").OnMouseUp = mi =>
|
Chrome.rootWidget.GetWidget("INGAME_DIPLOMACY_BUTTON").OnMouseUp = mi =>
|
||||||
{
|
{
|
||||||
diplomacyBG.Visible = !diplomacyBG.Visible;
|
diplomacyBG.Visible = !diplomacyBG.Visible;
|
||||||
if (diplomacyBG.Visible)
|
if (diplomacyBG.IsVisible())
|
||||||
LayoutDialog(diplomacyBG);
|
LayoutDialog(diplomacyBG);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleInput(MouseInput mi)
|
public override bool HandleInput(MouseInput mi)
|
||||||
{
|
{
|
||||||
if (mi.Event == MouseInputEvent.Down)
|
if (mi.Event == MouseInputEvent.Down)
|
||||||
{
|
{
|
||||||
var action = buttons.Where(a => a.First.Contains(mi.Location.ToPoint()))
|
var action = buttons.Where(a => a.First.Contains(mi.Location.ToPoint()))
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Widgets
|
|||||||
public Rectangle GetEventBounds()
|
public Rectangle GetEventBounds()
|
||||||
{
|
{
|
||||||
return Children
|
return Children
|
||||||
.Where(c => c.Visible)
|
.Where(c => c.IsVisible())
|
||||||
.Select(c => c.GetEventBounds())
|
.Select(c => c.GetEventBounds())
|
||||||
.Aggregate(RenderBounds, Rectangle.Union);
|
.Aggregate(RenderBounds, Rectangle.Union);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,4 +233,9 @@ copy "$(TargetPath)" "$(SolutionDir)mods/ra/"
|
|||||||
cd "$(SolutionDir)"
|
cd "$(SolutionDir)"
|
||||||
ralint ra</PostBuildEvent>
|
ralint ra</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Widgets\" />
|
||||||
|
<Folder Include="Widgets\Delegates\" />
|
||||||
|
<Folder Include="Widgets\Delegates\" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -46,6 +46,15 @@ Container@ROOT:
|
|||||||
Bold:True
|
Bold:True
|
||||||
WorldTooltip@INGAME_WORLD_TOOLTIP:
|
WorldTooltip@INGAME_WORLD_TOOLTIP:
|
||||||
Id:INGAME_WORLD_TOOLTIP
|
Id:INGAME_WORLD_TOOLTIP
|
||||||
|
Button@INGAME_DEVELOPERMODE_BUTTON:
|
||||||
|
Id:INGAME_DEVELOPERMODE_BUTTON
|
||||||
|
X:324
|
||||||
|
Y:0
|
||||||
|
Width:160
|
||||||
|
Height:25
|
||||||
|
Text:Developer Mode
|
||||||
|
Visible:false
|
||||||
|
Bold:True
|
||||||
RadarBin@INGAME_RADAR_BIN:
|
RadarBin@INGAME_RADAR_BIN:
|
||||||
Id:INGAME_RADAR_BIN
|
Id:INGAME_RADAR_BIN
|
||||||
PowerBin@INGAME_POWER_BIN:
|
PowerBin@INGAME_POWER_BIN:
|
||||||
@@ -146,4 +155,68 @@ Container@ROOT:
|
|||||||
Y:WINDOW_BOTTOM - HEIGHT
|
Y:WINDOW_BOTTOM - HEIGHT
|
||||||
Width: 760
|
Width: 760
|
||||||
Height: 30
|
Height: 30
|
||||||
ClickThrough: True
|
ClickThrough: True
|
||||||
|
Background@DEVELOPERMODE_BG:
|
||||||
|
Id:DEVELOPERMODE_BG
|
||||||
|
Delegate:DeveloperModeDelegate
|
||||||
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
|
Width:450
|
||||||
|
Height:400
|
||||||
|
Visible:false
|
||||||
|
Children:
|
||||||
|
Label@LABEL_TITLE:
|
||||||
|
Id:LABEL_TITLE
|
||||||
|
X:(PARENT_RIGHT - WIDTH)/2
|
||||||
|
Y:20
|
||||||
|
Width:250
|
||||||
|
Height:25
|
||||||
|
Text:Developer Mode
|
||||||
|
Align:Center
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_SHROUD
|
||||||
|
Id:SETTINGS_CHECKBOX_SHROUD
|
||||||
|
X:100
|
||||||
|
Y:50
|
||||||
|
Height:20
|
||||||
|
Width:20
|
||||||
|
Text:Disable Shroud
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_UNITDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_UNITDEBUG
|
||||||
|
X:100
|
||||||
|
Y:80
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Occupied Cells
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_PATHDEBUG
|
||||||
|
X:100
|
||||||
|
Y:110
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Unit Paths
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_INDEXDEBUG
|
||||||
|
X:100
|
||||||
|
Y:140
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Spatial Index Debug
|
||||||
|
Label@LABEL_MP_WARNING
|
||||||
|
Id:LABEL_MP_WARNING
|
||||||
|
X:100
|
||||||
|
Y:170
|
||||||
|
Text:May cause errors under multiplayer:
|
||||||
|
Button@SETTINGS_GIVE_CASH
|
||||||
|
Id:SETTINGS_GIVE_CASH
|
||||||
|
X:100
|
||||||
|
Y:200
|
||||||
|
Width:150
|
||||||
|
Height:20
|
||||||
|
Text: Give Cash
|
||||||
|
Checkbox@SETTINGS_BUILD_SPEED
|
||||||
|
Id:SETTINGS_BUILD_SPEED
|
||||||
|
X:100
|
||||||
|
Y:230
|
||||||
|
Width:20
|
||||||
|
Height:20
|
||||||
|
Text:Instant Build Speed
|
||||||
@@ -43,6 +43,15 @@ Container@ROOT:
|
|||||||
Bold:True
|
Bold:True
|
||||||
WorldTooltip@INGAME_WORLD_TOOLTIP:
|
WorldTooltip@INGAME_WORLD_TOOLTIP:
|
||||||
Id:INGAME_WORLD_TOOLTIP
|
Id:INGAME_WORLD_TOOLTIP
|
||||||
|
Button@INGAME_DEVELOPERMODE_BUTTON:
|
||||||
|
Id:INGAME_DEVELOPERMODE_BUTTON
|
||||||
|
X:324
|
||||||
|
Y:0
|
||||||
|
Width:160
|
||||||
|
Height:25
|
||||||
|
Text:Developer Mode
|
||||||
|
Visible:false
|
||||||
|
Bold:True
|
||||||
RadarBin@INGAME_RADAR_BIN:
|
RadarBin@INGAME_RADAR_BIN:
|
||||||
Id:INGAME_RADAR_BIN
|
Id:INGAME_RADAR_BIN
|
||||||
PowerBin@INGAME_POWER_BIN:
|
PowerBin@INGAME_POWER_BIN:
|
||||||
@@ -143,4 +152,68 @@ Container@ROOT:
|
|||||||
Y:WINDOW_BOTTOM - HEIGHT
|
Y:WINDOW_BOTTOM - HEIGHT
|
||||||
Width: 760
|
Width: 760
|
||||||
Height: 30
|
Height: 30
|
||||||
ClickThrough: True
|
ClickThrough: True
|
||||||
|
Background@DEVELOPERMODE_BG:
|
||||||
|
Id:DEVELOPERMODE_BG
|
||||||
|
Delegate:DeveloperModeDelegate
|
||||||
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
|
Width:450
|
||||||
|
Height:400
|
||||||
|
Visible:false
|
||||||
|
Children:
|
||||||
|
Label@LABEL_TITLE:
|
||||||
|
Id:LABEL_TITLE
|
||||||
|
X:(PARENT_RIGHT - WIDTH)/2
|
||||||
|
Y:20
|
||||||
|
Width:250
|
||||||
|
Height:25
|
||||||
|
Text:Developer Mode
|
||||||
|
Align:Center
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_SHROUD
|
||||||
|
Id:SETTINGS_CHECKBOX_SHROUD
|
||||||
|
X:100
|
||||||
|
Y:50
|
||||||
|
Height:20
|
||||||
|
Width:20
|
||||||
|
Text:Disable Shroud
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_UNITDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_UNITDEBUG
|
||||||
|
X:100
|
||||||
|
Y:80
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Occupied Cells
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_PATHDEBUG
|
||||||
|
X:100
|
||||||
|
Y:110
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Unit Paths
|
||||||
|
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
|
||||||
|
Id:SETTINGS_CHECKBOX_INDEXDEBUG
|
||||||
|
X:100
|
||||||
|
Y:140
|
||||||
|
Width:300
|
||||||
|
Height:20
|
||||||
|
Text:Show Spatial Index Debug
|
||||||
|
Label@LABEL_MP_WARNING
|
||||||
|
Id:LABEL_MP_WARNING
|
||||||
|
X:100
|
||||||
|
Y:170
|
||||||
|
Text:May cause errors under multiplayer:
|
||||||
|
Button@SETTINGS_GIVE_CASH
|
||||||
|
Id:SETTINGS_GIVE_CASH
|
||||||
|
X:100
|
||||||
|
Y:200
|
||||||
|
Width:150
|
||||||
|
Height:20
|
||||||
|
Text: Give Cash
|
||||||
|
Checkbox@SETTINGS_BUILD_SPEED
|
||||||
|
Id:SETTINGS_BUILD_SPEED
|
||||||
|
X:100
|
||||||
|
Y:230
|
||||||
|
Width:20
|
||||||
|
Height:20
|
||||||
|
Text:Instant Build Speed
|
||||||
Reference in New Issue
Block a user