add chrome + plumbing for BuildAnywhere devhack

This commit is contained in:
Chris Forbes
2011-03-07 20:20:44 +13:00
parent 7cf07f5765
commit 14a2b68b7d
4 changed files with 38 additions and 13 deletions

View File

@@ -21,6 +21,7 @@ namespace OpenRA.Traits
public bool PathDebug = false;
public bool UnitInfluenceDebug = false;
public bool UnlimitedPower;
public bool BuildAnywhere;
public object Create (ActorInitializer init) { return new DeveloperMode(this); }
}
@@ -35,16 +36,18 @@ namespace OpenRA.Traits
[Sync] public bool PathDebug;
[Sync] public bool UnitInfluenceDebug;
[Sync] public bool UnlimitedPower;
[Sync] public bool BuildAnywhere;
public DeveloperMode(DeveloperModeInfo info)
{
Info = info;
FastBuild = Info.FastBuild;
FastCharge = Info.FastCharge;
DisableShroud = Info.DisableShroud;
PathDebug = Info.PathDebug;
FastBuild = info.FastBuild;
FastCharge = info.FastCharge;
DisableShroud = info.DisableShroud;
PathDebug = info.PathDebug;
UnitInfluenceDebug = info.UnitInfluenceDebug;
UnlimitedPower = info.UnlimitedPower;
BuildAnywhere = info.BuildAnywhere;
}
public void ResolveOrder (Actor self, Order order)
@@ -101,6 +104,11 @@ namespace OpenRA.Traits
UnlimitedPower ^= true;
break;
}
case "DevBuildAnywhere":
{
BuildAnywhere ^= true;
break;
}
default:
return;
}

View File

@@ -67,6 +67,9 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
devmodeBG.GetWidget<CheckboxWidget>("UNLIMITED_POWER").BindReadOnly(devTrait, "UnlimitedPower");
devmodeBG.GetWidget<CheckboxWidget>("UNLIMITED_POWER").OnChange += _ => Order(world, "DevUnlimitedPower");
devmodeBG.GetWidget<CheckboxWidget>("BUILD_ANYWHERE").BindReadOnly(devTrait, "BuildAnywhere");
devmodeBG.GetWidget<CheckboxWidget>("BUILD_ANYWHERE").OnChange += _ => Order(world, "DevBuildAnywhere");
devmodeBG.GetWidget<ButtonWidget>("GIVE_EXPLORATION").OnMouseUp = mi =>
{
world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));

View File

@@ -220,7 +220,7 @@ Container@INGAME_ROOT:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:350
Height:360
Height:370
Visible:false
Children:
Label@LABEL_TITLE:
@@ -287,10 +287,17 @@ Container@INGAME_ROOT:
Width:PARENT_RIGHT - 30
Height:20
Text:Unlimited Power
Checkbox@BUILD_ANYWHERE
Id:BUILD_ANYWHERE
X:30
Y:290
Width:PARENT_RIGHT - 30
Height:20
Text:Build Anywhere
Button@GIVE_EXPLORATION
Id:GIVE_EXPLORATION
X:30
Y:290
Y:320
Width:200
Height:20
Text: Give Exploration

View File

@@ -227,7 +227,7 @@ Container@INGAME_ROOT:
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:350
Height:360
Height:370
Visible:false
Children:
Label@LABEL_TITLE:
@@ -294,10 +294,17 @@ Container@INGAME_ROOT:
Width:PARENT_RIGHT - 30
Height:20
Text:Unlimited Power
Checkbox@BUILD_ANYWHERE
Id:BUILD_ANYWHERE
X:30
Y:290
Width:PARENT_RIGHT - 30
Height:20
Text:Build Anywhere
Button@GIVE_EXPLORATION
Id:GIVE_EXPLORATION
X:30
Y:290
Y:320
Width:200
Height:20
Text: Give Exploration