Remove Developer Settings from Settings > Debug. Adjust Widget layout in DeveloperMode. In preparation for DeveloperMode trait.

This commit is contained in:
alzeih
2010-07-24 17:35:38 +12:00
parent d8d731b321
commit 2d916e60d9
6 changed files with 69 additions and 101 deletions

View File

@@ -29,10 +29,6 @@ namespace OpenRA.Widgets.Delegates
public class DeveloperModeDelegate : IWidgetDelegate
{
float oldBuildSpeed = 0;
bool slowed = false;
public DeveloperModeDelegate ()
{
var devmodeBG = Widget.RootWidget.GetWidget("INGAME_ROOT").GetWidget("DEVELOPERMODE_BG");
@@ -77,26 +73,28 @@ namespace OpenRA.Widgets.Delegates
return true;
};
devmodeBG.GetWidget<ButtonWidget>("SETTINGS_GIVE_CASH").OnMouseUp = mi =>
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_GIVE_CASH").Checked =
() => true;
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_GIVE_CASH").OnMouseDown = mi =>
{
Game.world.AddFrameEndTask(w =>
{
Game.world.LocalPlayer.PlayerActor.traits.Get<PlayerResources>().GiveCash(5000);
});
TriggerCheatingMessage();
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;
TriggerCheatingMessage();
return true;
};
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_BUILD_SPEED").Checked =
() => {return slowed;};
() => true;
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHARGE_TIME").OnMouseDown = mi =>
{
return true;
};
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHARGE_TIME").Checked =
() => true;
devModeButton.IsVisible = () => { return Game.Settings.DeveloperMode; };
}

View File

@@ -132,30 +132,6 @@ namespace OpenRA.Widgets.Delegates
return true;
};
var unitdebug = debug.GetWidget<CheckboxWidget>("UNITDEBUG_CHECKBOX");
unitdebug.Checked = () => {return Game.Settings.UnitDebug;};
unitdebug.OnMouseDown = mi =>
{
Game.Settings.UnitDebug ^= true;
return true;
};
var pathdebug = debug.GetWidget<CheckboxWidget>("PATHDEBUG_CHECKBOX");
pathdebug.Checked = () => {return Game.Settings.PathDebug;};
pathdebug.OnMouseDown = mi =>
{
Game.Settings.PathDebug ^= true;
return true;
};
var indexdebug = debug.GetWidget<CheckboxWidget>("INDEXDEBUG_CHECKBOX");
indexdebug.Checked = () => {return Game.Settings.IndexDebug;};
indexdebug.OnMouseDown = mi =>
{
Game.Settings.IndexDebug ^= true;
return true;
};
var timedebug = debug.GetWidget<CheckboxWidget>("GAMETIME_CHECKBOX");
timedebug.Checked = () => {return Game.Settings.ShowGameTimer;};
timedebug.OnMouseDown = mi =>
@@ -164,6 +140,14 @@ namespace OpenRA.Widgets.Delegates
return true;
};
var devmode = debug.GetWidget<CheckboxWidget>("DEV_MODE_ENABLED");
devmode.Checked = () => Game.Settings.DeveloperMode;
devmode.OnMouseDown = mi =>
{
Game.Settings.DeveloperMode ^= true;
return true;
};
bg.GetWidget("BUTTON_CLOSE").OnMouseUp = mi => {
Game.Settings.Save();
Widget.RootWidget.CloseWindow();

View File

@@ -203,7 +203,7 @@ Container@ROOT:
Delegate:DeveloperModeDelegate
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:300
Width:350
Height:300
Visible:false
Children:
@@ -220,45 +220,52 @@ Container@ROOT:
X:30
Y:50
Height:20
Width:20
Width:PARENT_RIGHT - 30
Text:Disable Shroud
Checkbox@SETTINGS_CHECKBOX_UNITDEBUG:
Id:SETTINGS_CHECKBOX_UNITDEBUG
X:30
Y:80
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Occupied Cells
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
Id:SETTINGS_CHECKBOX_PATHDEBUG
X:30
Y:110
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Unit Paths
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
Id:SETTINGS_CHECKBOX_INDEXDEBUG
X:30
Y:140
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Spatial Index Debug
Label@LABEL_MP_WARNING
Id:LABEL_MP_WARNING
X:30
Y:180
Text:May cause errors under multiplayer:
Button@SETTINGS_GIVE_CASH
Text:Must be identical for all multiplayer players:
Checkbox@SETTINGS_GIVE_CASH
Id:SETTINGS_GIVE_CASH
X:30
Y:200
Width:150
Width:PARENT_RIGHT - 30
Height:20
Text: Give Cash
Checkbox@SETTINGS_BUILD_SPEED
Id:SETTINGS_BUILD_SPEED
X:30
Y:230
Width:20
Width:PARENT_RIGHT - 30
Height:20
Text:Instant Build Speed
Checkbox@SETTINGS_CHARGE_TIME
Id:SETTINGS_CHARGE_TIME
X:30
Y:260
Width:PARENT_RIGHT - 30
Height:20
Text:Instant Charge Time (Special Powers)

View File

@@ -193,31 +193,17 @@ Container@ROOT:
Width:300
Height:20
Text:Collect Sync Reports
Checkbox@UNITDEBUG_CHECKBOX:
Id:UNITDEBUG_CHECKBOX
Checkbox@GAMETIME_CHECKBOX:
Id:GAMETIME_CHECKBOX
X:0
Y:60
Width:300
Height:20
Text:Show Occupied Cells
Checkbox@PATHDEBUG_CHECKBOX:
Id:PATHDEBUG_CHECKBOX
Text:Show Game Time Counter
Checkbox:DEV_MODE_ENABLED
Id:DEV_MODE_ENABLED
X:0
Y:90
Width:300
Height:20
Text:Show Unit Paths
Checkbox@INDEXDEBUG_CHECKBOX:
Id:INDEXDEBUG_CHECKBOX
X:0
Y:120
Width:300
Height:20
Text:Show Spatial Index Debug
Checkbox@GAMETIME_CHECKBOX:
Id:GAMETIME_CHECKBOX
X:0
Y:150
Width:300
Height:20
Text:Show Game Time Counter
Text:Enable Developer Mode

View File

@@ -212,7 +212,7 @@ Container@ROOT:
Delegate:DeveloperModeDelegate
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:300
Width:350
Height:300
Visible:false
Children:
@@ -229,45 +229,52 @@ Container@ROOT:
X:30
Y:50
Height:20
Width:20
Width:PARENT_RIGHT - 30
Text:Disable Shroud
Checkbox@SETTINGS_CHECKBOX_UNITDEBUG:
Id:SETTINGS_CHECKBOX_UNITDEBUG
X:30
Y:80
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Occupied Cells
Checkbox@SETTINGS_CHECKBOX_PATHDEBUG:
Id:SETTINGS_CHECKBOX_PATHDEBUG
X:30
Y:110
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Unit Paths
Checkbox@SETTINGS_CHECKBOX_INDEXDEBUG:
Id:SETTINGS_CHECKBOX_INDEXDEBUG
X:30
Y:140
Width:300
Width:PARENT_RIGHT - 30
Height:20
Text:Show Spatial Index Debug
Label@LABEL_MP_WARNING
Id:LABEL_MP_WARNING
X:30
Y:180
Text:May cause errors under multiplayer:
Button@SETTINGS_GIVE_CASH
Text:Must be identical for all multiplayer players:
Checkbox@SETTINGS_GIVE_CASH
Id:SETTINGS_GIVE_CASH
X:30
Y:200
Width:150
Width:PARENT_RIGHT - 30
Height:20
Text: Give Cash
Checkbox@SETTINGS_BUILD_SPEED
Id:SETTINGS_BUILD_SPEED
X:30
Y:230
Width:20
Width:PARENT_RIGHT - 30
Height:20
Text:Instant Build Speed
Checkbox@SETTINGS_CHARGE_TIME
Id:SETTINGS_CHARGE_TIME
X:30
Y:260
Width:PARENT_RIGHT - 30
Height:20
Text:Instant Charge Time (Special Powers)

View File

@@ -193,31 +193,17 @@ Container@ROOT:
Width:300
Height:20
Text:Collect Sync Reports
Checkbox@UNITDEBUG_CHECKBOX:
Id:UNITDEBUG_CHECKBOX
Checkbox@GAMETIME_CHECKBOX:
Id:GAMETIME_CHECKBOX
X:0
Y:60
Width:300
Height:20
Text:Show Occupied Cells
Checkbox@PATHDEBUG_CHECKBOX:
Id:PATHDEBUG_CHECKBOX
Text:Show Game Time Counter
Checkbox:DEV_MODE_ENABLED
Id:DEV_MODE_ENABLED
X:0
Y:90
Width:300
Height:20
Text:Show Unit Paths
Checkbox@INDEXDEBUG_CHECKBOX:
Id:INDEXDEBUG_CHECKBOX
X:0
Y:120
Width:300
Height:20
Text:Show Spatial Index Debug
Checkbox@GAMETIME_CHECKBOX:
Id:GAMETIME_CHECKBOX
X:0
Y:150
Width:300
Height:20
Text:Show Game Time Counter
Text:Enable Developer Mode