fix cnc chrome yaml issues

This commit is contained in:
Chris Forbes
2012-03-16 18:39:01 +13:00
parent 062c49dac3
commit 3e0f52db1a
9 changed files with 31 additions and 74 deletions

View File

@@ -24,8 +24,9 @@ namespace OpenRA.Widgets
public string Font = ChromeMetrics.Get<string>("ButtonFont");
public string ClickSound = null;
public string ClickDisabledSound = null;
public bool Disabled = false;
public Func<string> GetText;
public Func<bool> IsDisabled = () => false;
public Func<bool> IsDisabled;
public Action<MouseInput> OnMouseDown = _ => {};
public Action<MouseInput> OnMouseUp = _ => {};
@@ -39,6 +40,7 @@ namespace OpenRA.Widgets
GetText = () => { return Text; };
OnMouseUp = _ => OnClick();
OnKeyPress = _ => OnClick();
IsDisabled = () => Disabled;
}
protected ButtonWidget(ButtonWidget widget)
@@ -50,6 +52,8 @@ namespace OpenRA.Widgets
VisualHeight = widget.VisualHeight;
GetText = widget.GetText;
OnMouseDown = widget.OnMouseDown;
Disabled = widget.Disabled;
IsDisabled = widget.IsDisabled;
OnMouseUp = mi => OnClick();
OnKeyPress = _ => OnClick();

View File

@@ -22,15 +22,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
var panel = widget.GetWidget("CONQUEST_OBJECTIVES");
panel.GetWidget<LabelWidget>("TITLE").GetText = () => "Conquest: " + world.Map.Title;
var objectiveCheckbox = panel.GetWidget<CheckboxWidget>("OBJECTIVE_CHECKBOX");
objectiveCheckbox.IsDisabled = () => true;
var statusLabel = panel.GetWidget<LabelWidget>("STATUS_LABEL");
var statusLabel = panel.GetWidget<LabelWidget>("STATUS");
statusLabel.IsVisible = () => world.LocalPlayer != null;
if (world.LocalPlayer != null)
{
var lp = world.LocalPlayer;
var objectiveCheckbox = panel.GetWidget<CheckboxWidget>("1");
objectiveCheckbox.IsChecked = () => lp.WinState != WinState.Undefined;
objectiveCheckbox.GetCheckType = () => lp.WinState == WinState.Won ?
"checked" : "crossed";

View File

@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
BindOrderButton<RepairOrderGenerator>(world, sidebarRoot, "REPAIR_BUTTON", "repair");
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
sidebarRoot.GetWidget<LabelWidget>("CASH_DISPLAY").GetText = () =>
sidebarRoot.GetWidget<LabelWidget>("CASH").GetText = () =>
"${0}".F(playerResources.DisplayCash + playerResources.DisplayOre);
queueTabs = playerWidgets.GetWidget<ProductionTabsWidget>("PRODUCTION_TABS");

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
{
// Performance info
var perfRoot = widget.GetWidget("PERFORMANCE_INFO");
perfRoot.GetWidget("PERF_GRAPH").IsVisible = () => Game.Settings.Debug.PerfGraph;
perfRoot.IsVisible = () => Game.Settings.Debug.PerfGraph;
var text = perfRoot.GetWidget<LabelWidget>("PERF_TEXT");
text.IsVisible = () => Game.Settings.Debug.PerfText;
text.GetText = () =>

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
playerPalettePreview = world.WorldActor.Trait<ColorPickerPaletteModifier>();
playerPalettePreview.Ramp = playerSettings.ColorRamp;
var colorDropdown = generalPane.GetWidget<DropDownButtonWidget>("COLOR_DROPDOWN");
var colorDropdown = generalPane.GetWidget<DropDownButtonWidget>("COLOR");
colorDropdown.OnMouseDown = _ => ShowColorPicker(colorDropdown, playerSettings);
colorDropdown.GetWidget<ColorBlockWidget>("COLORBLOCK").GetColor = () => playerSettings.ColorRamp.GetColor(0);

View File

@@ -41,7 +41,7 @@ Container@INGAME_ROOT:
Height:WINDOW_BOTTOM
TooltipContainer:TOOLTIP_CONTAINER
Container@PLAYER_ROOT:
TooltipContainer:
TooltipContainer@TOOLTIP_CONTAINER:
Container@OBSERVER_WIDGETS:
Children:
ToggleButton@OPTIONS_BUTTON:
@@ -73,7 +73,7 @@ Container@OBSERVER_WIDGETS:
Height:PARENT_BOTTOM-2
Container@PLAYER_WIDGETS:
Children:
LogicTicker:
LogicTicker@WIN_LOSS_WATCHER:
Button@CHEATS_BUTTON:
X:WINDOW_RIGHT-400
Y:5
@@ -106,7 +106,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:5
ImageCollection:order-icons
@@ -123,7 +123,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:5
ImageCollection:order-icons
@@ -139,7 +139,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:5
ImageCollection:order-icons
@@ -169,11 +169,6 @@ Container@PLAYER_WIDGETS:
Width:PARENT_RIGHT-2
Height:PARENT_BOTTOM-2
TooltipContainer:TOOLTIP_CONTAINER
# Label@POWERICON:
# X:4
# Y:180
# Text:P
# Font:Bold
Background@SILOBAR:
X:180
Y:5
@@ -187,11 +182,6 @@ Container@PLAYER_WIDGETS:
Width:PARENT_RIGHT-2
Height:PARENT_BOTTOM-2
TooltipContainer:TOOLTIP_CONTAINER
# Label@SILOICON:
# X:181
# Y:180
# Text:T
# Font:Bold
Label@CASH:
Y:170
Width:PARENT_RIGHT
@@ -213,7 +203,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:7
ImageCollection:production-icons
@@ -227,7 +217,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:7
ImageCollection:production-icons
@@ -241,7 +231,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:7
ImageCollection:production-icons
@@ -255,7 +245,7 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:7
ImageCollection:production-icons
@@ -269,11 +259,11 @@ Container@PLAYER_WIDGETS:
ClickSound:button.aud
ClickDisabledSound:scold2.aud
Children:
Image:
Image@ICON:
X:7
Y:7
ImageCollection:production-icons
ProductionTabs:
ProductionTabs@PRODUCTION_TABS:
PaletteWidget:PRODUCTION_PALETTE
ClickSound:button.aud
DisabledClickSound:scold2.aud
@@ -281,7 +271,7 @@ Container@PLAYER_WIDGETS:
Y:268
Width:194
Height:20
ProductionPalette:
ProductionPalette@PRODUCTION_PALETTE:
X:WINDOW_RIGHT - 204
Y:287
TabClick: button.aud

View File

@@ -37,6 +37,7 @@ Container@CONQUEST_OBJECTIVES:
Height:20
Font:Bold
Text:Crush all opposition!
Disabled: yes
Container@LABEL_CONTAINER:
X:17
Y:80

View File

@@ -56,7 +56,7 @@ Container@SETTINGS_PANEL:
Font:Bold
Text:Debug
Align:Center
Checkbox@PERFINFO_CHECKBOX:
Checkbox@PERFTEXT_CHECKBOX:
X:15
Y:120
Width:300
@@ -98,7 +98,7 @@ Container@SETTINGS_PANEL:
Height:25
Font:Regular
Text:Windowed
Container@WINDOWRES:
Container@WINDOW_RESOLUTION:
X:595
Y:40
Children:
@@ -109,7 +109,7 @@ Container@SETTINGS_PANEL:
Height:25
Width:25
Align:Center
TextField@SCREEN_WIDTH:
TextField@WINDOW_WIDTH:
X:25
Width:45
Height:25
@@ -122,7 +122,7 @@ Container@SETTINGS_PANEL:
Height:25
Width:15
Align:Center
TextField@SCREEN_HEIGHT:
TextField@WINDOW_HEIGHT:
X:85
Width:45
Height:25
@@ -245,21 +245,6 @@ Container@SETTINGS_PANEL:
Height:25
Font:Regular
Text:Enabled
# Label@MULTITOUCH_SCROLL_LABEL:
# X:15
# Y:210
# Width:160
# Height:20
# Font:Regular
# Text:Multitouch Scrolling:
# Align:Right
# DropDownButton@MULTITOUCH_SCROLL:
# X:180
# Y:210
# Width:100
# Height:25
# Font:Regular
# Text:Enabled
Label@KEYBOARD_TITLE:
X:375
Y:20
@@ -274,27 +259,6 @@ Container@SETTINGS_PANEL:
Height:20
Font:Regular
Text:Shift-Enter Toggles Team Chat
# Label@BINDING_LABEL:
# Font:Bold
# X:375
# Y:60
# Width:200
# Height:25
# Align:Center
# Text:Action
# Label@KEY_LABEL:
# Font:Bold
# X:640
# Y:60
# Width:30
# Height:25
# Align:Right
# Text:Key
# ScrollPanel@KEYBINDINGS:
# X:375
# Y:85
# Width:350
# Height:150
Button@GENERAL_BUTTON:
Y:249
Width:140
@@ -306,7 +270,7 @@ Container@SETTINGS_PANEL:
Width:140
Height:35
Text:Input
Button@SAVE_BUTTON:
Button@BACK_BUTTON:
Key:escape
X:600
Y:249

View File

@@ -31,7 +31,7 @@ Background@WORLD_TOOLTIP:
X:5
Height:23
Font:Bold
Image:
Image@FLAG:
X:5
Y:24
Width:32