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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ Container@SETTINGS_PANEL:
Font:Bold Font:Bold
Text:Debug Text:Debug
Align:Center Align:Center
Checkbox@PERFINFO_CHECKBOX: Checkbox@PERFTEXT_CHECKBOX:
X:15 X:15
Y:120 Y:120
Width:300 Width:300
@@ -98,7 +98,7 @@ Container@SETTINGS_PANEL:
Height:25 Height:25
Font:Regular Font:Regular
Text:Windowed Text:Windowed
Container@WINDOWRES: Container@WINDOW_RESOLUTION:
X:595 X:595
Y:40 Y:40
Children: Children:
@@ -109,7 +109,7 @@ Container@SETTINGS_PANEL:
Height:25 Height:25
Width:25 Width:25
Align:Center Align:Center
TextField@SCREEN_WIDTH: TextField@WINDOW_WIDTH:
X:25 X:25
Width:45 Width:45
Height:25 Height:25
@@ -122,7 +122,7 @@ Container@SETTINGS_PANEL:
Height:25 Height:25
Width:15 Width:15
Align:Center Align:Center
TextField@SCREEN_HEIGHT: TextField@WINDOW_HEIGHT:
X:85 X:85
Width:45 Width:45
Height:25 Height:25
@@ -245,21 +245,6 @@ Container@SETTINGS_PANEL:
Height:25 Height:25
Font:Regular Font:Regular
Text:Enabled 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: Label@KEYBOARD_TITLE:
X:375 X:375
Y:20 Y:20
@@ -274,27 +259,6 @@ Container@SETTINGS_PANEL:
Height:20 Height:20
Font:Regular Font:Regular
Text:Shift-Enter Toggles Team Chat 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: Button@GENERAL_BUTTON:
Y:249 Y:249
Width:140 Width:140
@@ -306,7 +270,7 @@ Container@SETTINGS_PANEL:
Width:140 Width:140
Height:35 Height:35
Text:Input Text:Input
Button@SAVE_BUTTON: Button@BACK_BUTTON:
Key:escape Key:escape
X:600 X:600
Y:249 Y:249

View File

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