Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -313,6 +313,7 @@ deselectgroup = Ctrl ; Modifier to deselect units when clicking group icon, instead of selecting rotate.cw = RightBracket ; Rotate building placement preview clockwise rotate.ccw = LeftBracket ; Rotate building placement preview anticlockwise +showbuildingsshortcuts.toggle = Space ; Toggle buildings shortcut visibility [hotkey.session.gui] toggle = "Alt+G" ; Toggle visibility of session GUI @@ -334,6 +335,32 @@ 7 = "M" ; add seventh unit type to queue 8 = Comma ; add eighth unit type to queue +[hotkey.session.building] ; > BUILDING SELECTION +1 = "Space+Q" ; select 1st building type, first row +2 = "Space+W" ; select 2nd building type, first row +3 = "Space+E" ; select 3rd building type, first row +4 = "Space+R" ; select 4th building type, first row +5 = "Space+T" ; select 5th building type, first row +6 = "Space+Y" ; select 6th building type, first row +7 = "Space+U" ; select 7th building type, first row +8 = "Space+I" ; select 8th building type, first row +9 = "Space+A" ; select 9th building type, second row +10 = "Space+S" ; select 10th building type, second row +11 = "Space+D" ; select 11th building type, second row +12 = "Space+F" ; select 12th building type, second row +13 = "Space+G" ; select 13th building type, second row +14 = "Space+H" ; select 14th building type, second row +15 = "Space+J" ; select 15th building type, second row +16 = "Space+K" ; select 16th building type, third row +17 = "Space+Z" ; select 17th building type, third row +18 = "Space+X" ; select 18th building type, third row +19 = "Space+C" ; select 19th building type, third row +20 = "Space+V" ; select 20th building type, third row +21 = "Space+B" ; select 21st building type, third row +22 = "Space+N" ; select 22nd building type, third row +23 = "Space+M" ; select 23rd building type, third row +24 = "Space+Comma" ; select 24th building type, third row + [hotkey.session.timewarp] fastforward = Space ; If timewarp mode enabled, speed up the game rewind = Backspace ; If timewarp mode enabled, go back to earlier point in the game Index: binaries/data/mods/public/gui/session/hotkeys/building.xml =================================================================== --- binaries/data/mods/public/gui/session/hotkeys/building.xml +++ binaries/data/mods/public/gui/session/hotkeys/building.xml @@ -0,0 +1,101 @@ + + + + + + selectBuildingByPosition(0); + + + + selectBuildingByPosition(1); + + + + selectBuildingByPosition(2); + + + + selectBuildingByPosition(3); + + + + selectBuildingByPosition(4); + + + + selectBuildingByPosition(5); + + + + selectBuildingByPosition(6); + + + + selectBuildingByPosition(7); + + + + selectBuildingByPosition(8); + + + + selectBuildingByPosition(9); + + + + selectBuildingByPosition(10); + + + + selectBuildingByPosition(11); + + + + selectBuildingByPosition(12); + + + + selectBuildingByPosition(13); + + + + selectBuildingByPosition(14); + + + + selectBuildingByPosition(15); + + + + selectBuildingByPosition(16); + + + + selectBuildingByPosition(17); + + + + selectBuildingByPosition(18); + + + + selectBuildingByPosition(19); + + + + selectBuildingByPosition(20); + + + + selectBuildingByPosition(21); + + + + selectBuildingByPosition(22); + + + + selectBuildingByPosition(23); + + + Index: binaries/data/mods/public/gui/session/hotkeys/misc.xml =================================================================== --- binaries/data/mods/public/gui/session/hotkeys/misc.xml +++ binaries/data/mods/public/gui/session/hotkeys/misc.xml @@ -92,6 +92,11 @@ updateSelectionDetails(); + + hideBuildingsShortcuts(false); + hideBuildingsShortcuts(true); + + updateSelectionDetails(); Index: binaries/data/mods/public/gui/session/input.js =================================================================== --- binaries/data/mods/public/gui/session/input.js +++ binaries/data/mods/public/gui/session/input.js @@ -1388,6 +1388,44 @@ return; } +// Select a building from the construction panel given the current unit selected +function selectBuildingByPosition(position) +{ + let playerState = GetSimState().players[Engine.GetPlayerID()]; + let selection = g_Selection.toList(); + + if (!playerState || !selection.length || Engine.GetGUIObjectByName("unitConstructionPanel").hidden) + return; + + let unitConstructionButton = Engine.GetGUIObjectByName("unitConstructionButton["+position+"]"); + + if( unitConstructionButton.hidden || !unitConstructionButton.enabled || !unitConstructionButton.onPress) + return; + + unitConstructionButton.onPress(); + return; +} + +// Set construction panel hotkeys visibility +function hideBuildingsShortcuts(hidden) +{ + if( hideBuildingsShortcuts.hidden === undefined) + hideBuildingsShortcuts.hidden = !hidden; + + if( hideBuildingsShortcuts.hidden === hidden ) + return; + + let i = 0; + let unitConstructionShortcutKeyContainer; + while( (unitConstructionShortcutKeyContainer = Engine.GetGUIObjectByName("unitConstructionShortcutKeyContainer[" + i + "]") ) !== undefined) + { + unitConstructionShortcutKeyContainer.hidden = hidden; + ++i; + } + + hideBuildingsShortcuts.hidden = hidden; +} + // Called by GUI when user clicks training button function addTrainingToQueue(selection, trainEntType, playerState) { Index: binaries/data/mods/public/gui/session/selection_panels.js =================================================================== --- binaries/data/mods/public/gui/session/selection_panels.js +++ binaries/data/mods/public/gui/session/selection_panels.js @@ -275,6 +275,14 @@ data.icon.sprite = modifier + "stretched:session/portraits/" + template.icon; setPanelObjectPosition(data.button, data.i + getNumberOfRightPanelButtons(), data.rowLength); + + let mapNunitConstructionShortcutKey = Engine.GetGUIObjectByName("mapNunitConstructionShortcutKey[" + data.i + "]"); + if( !mapNunitConstructionShortcutKey.caption ) + { + let key = Engine.ConfigDB_GetValue("user", "hotkey." + "session.building." + (data.i + 1) ); + mapNunitConstructionShortcutKey.caption = key.indexOf("+") == -1 ? key : key.split("+").slice(-1)[0]; + } + return true; } }; Index: binaries/data/mods/public/gui/session/selection_panels_right/construction_panel.xml =================================================================== --- binaries/data/mods/public/gui/session/selection_panels_right/construction_panel.xml +++ binaries/data/mods/public/gui/session/selection_panels_right/construction_panel.xml @@ -1,12 +1,14 @@ - + + - -