Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show factory queue on rollover #3597

Merged
merged 22 commits into from Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions loc/CN/strings_db.lua
Expand Up @@ -7515,6 +7515,7 @@ OPTIONS_0242="总是显示自定义名称"
OPTIONS_0243="渲染敌方单位生命条"
OPTIONS_0244="在建造菜单中显示武器的详细信息"
OPTIONS_0245="更好的取消命令"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="为快捷键启用周期预览"
OPTIONS_0248="当它打开时,你可以预览快捷键的周期"
OPTIONS_0251="周期复位时间"
Expand Down
1 change: 1 addition & 0 deletions loc/CZ/strings_db.lua
Expand Up @@ -1383,6 +1383,7 @@ OPTIONS_0242="Always Render Custom Names"
OPTIONS_0243="Force Render Enemy Lifebars"
OPTIONS_0244="Show Armament Detail in Build Menu"
OPTIONS_0245="Improved Unit deselection"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
1 change: 1 addition & 0 deletions loc/DE/strings_db.lua
Expand Up @@ -1382,6 +1382,7 @@ OPTIONS_0242="Einheiten Namen immer anzeigen"
OPTIONS_0243="Gegnerische Lebensbalken erzwingen"
OPTIONS_0244="Zeige Bewaffnungsdetails im Bau Menü"
OPTIONS_0245="Erweiterte Einheiten Abwahl"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Ermögliche Wechsel für Hotbuild Vorschau"
OPTIONS_0248="Wenn eingeschaltet kann die Hotbuildvorschau durch mehrmaliges drücken der Hotbuildtaste gewechselt werden"
OPTIONS_0251="Rotations Rückstellzeit"
Expand Down
1 change: 1 addition & 0 deletions loc/ES/strings_db.lua
Expand Up @@ -1366,6 +1366,7 @@ OPTIONS_0242="Permitir Siempre Nombres Personalizados"
OPTIONS_0243="Forzar Aparición de Barras de Vida Enemigas"
OPTIONS_0244="Mostrar Detalles del Armamento en el Menú de Construcción"
OPTIONS_0245="Deselección de Unidades Mejorado"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Activa la Previsualización Cíclica de los Atajos de Construcción"
OPTIONS_0248="Cuando está activado, puedes pasar en ciclo la previsualización de los Atajos de Construcción"
OPTIONS_0251="Tiempo de Reinicio del Ciclo"
Expand Down
1 change: 1 addition & 0 deletions loc/FR/strings_db.lua
Expand Up @@ -7653,6 +7653,7 @@ OPTIONS_0243 = "Forcer l'affichage des barres de vie ennemies"
OPTIONS_0244 = "Détails dans les menus de construction"
tooltipui0692 = "Affiche des informations détaillées sur les capacités de l'unité dans le menu de construction"
OPTIONS_0245 = "Utiliser la dé-selection améliorée d'unité"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Afficher le menu des prédéfinis"
OPTIONS_0248="Active un menu qui permet de parcourir les prédéfinis avec la touche rapide associée"
OPTIONS_0251="Persistence du menu des prédef."
Expand Down
1 change: 1 addition & 0 deletions loc/IT/strings_db.lua
Expand Up @@ -7794,6 +7794,7 @@ OPTIONS_0243 = "Forzare la visualizzazione delle barre di vita delle unità nemi
OPTIONS_0244 = "Mostra i dettagli dell'armamento nel menu di costruzione"
tooltipui0692 = "Mostra informazioni dettagliate sulle armi delle unità dal menu di costruzione"
OPTIONS_0245 = "Migliora la desezione delle unità"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
1 change: 1 addition & 0 deletions loc/PL/strings_db.lua
Expand Up @@ -1383,6 +1383,7 @@ OPTIONS_0242="Always Render Custom Names"
OPTIONS_0243="Force Render Enemy Lifebars"
OPTIONS_0244="Show Armament Detail in Build Menu"
OPTIONS_0245="Improved Unit deselection"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
1 change: 1 addition & 0 deletions loc/RU/strings_db.lua
Expand Up @@ -8595,6 +8595,7 @@ OPTIONS_0242="Всегда показывать имена"
OPTIONS_0243="Показывать вражеские индикаторы жизни"
OPTIONS_0244="Показывать вооружение в строит-ом меню"
OPTIONS_0245="Улучшенный сброс выбранных юнитов"
OPTIONS_0246 = "Show Factory Queue on Hover"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4z0t can you make this a proper russian translation?

OPTIONS_0247="Включить зацикленность предварительного просмотра для Hotbuild"
OPTIONS_0248="Когда включено, вы можете зациклить предварительной просмотр Hotbuild"
OPTIONS_0251="Время сброса цикла"
Expand Down
1 change: 1 addition & 0 deletions loc/TW/strings_db.lua
Expand Up @@ -7516,6 +7516,7 @@ OPTIONS_0242="Always Render Custom Names"
OPTIONS_0243="Force Render Enemy Lifebars"
OPTIONS_0244="Show Armament Detail in Build Menu"
OPTIONS_0245="Improved Unit deselection"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
1 change: 1 addition & 0 deletions loc/TZM/strings_db.lua
Expand Up @@ -7779,6 +7779,7 @@ OPTIONS_0243 = "Force Render Enemy Lifebars"
OPTIONS_0244 = "Show Armament Detail in Build Umuɣ"
tooltipui0692 = "Shows detailed information about the weapons a unit has from the build menu"
OPTIONS_0245 = "Improved Unit deselection"
OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
2 changes: 1 addition & 1 deletion loc/US/strings_db.lua
Expand Up @@ -7489,7 +7489,7 @@ OPTIONS_0242 = "Always Render Custom Names"
OPTIONS_0243 = "Force Render Enemy Lifebars"
OPTIONS_0244 = "Show Armament Detail in Build Menu"
OPTIONS_0245 = "Improved Unit deselection"

OPTIONS_0246 = "Show Factory Queue on Hover"
OPTIONS_0247="Enable Cycle Preview for Hotbuild"
OPTIONS_0248="When on, you can cycle the Hotbuild preview"
OPTIONS_0251="Cycle reset time"
Expand Down
1 change: 1 addition & 0 deletions lua/keymap/hotbuild.lua
Expand Up @@ -566,6 +566,7 @@ function buildActionUnit(name, modifier)

if maxPos == 1 then
IssueBlueprintCommand("UNITCOMMAND_BuildFactory", unit, count)
Construction.RefreshUI()
else
factoryHotkey(unit, count)
end
Expand Down
15 changes: 15 additions & 0 deletions lua/options/options.lua
Expand Up @@ -540,6 +540,19 @@ options = {
},
},

{
title = "<LOC OPTIONS_0246>Show Factory Queue on Hover",
key = 'gui_queue_on_hover',
type = 'toggle',
default = 1,
custom = {
states = {
{text = "<LOC _Off>", key = false },
{text = "<LOC _On>", key = true },
},
},
},

{
title = "<LOC OPTIONS_0232>Middle Click Avatars",
key = 'gui_idle_engineer_avatars',
Expand Down Expand Up @@ -604,6 +617,8 @@ options = {
},
},



{
title = "<LOC OPTIONS_0238>Seperate Idle Builders",
key = 'gui_seperate_idle_builders',
Expand Down
2 changes: 1 addition & 1 deletion lua/ui/dialogs/options.lua
Expand Up @@ -3,7 +3,7 @@
--* Author: Chris Blackwell
--* Summary: Manages the options dialog
--*
--* Copyright 2006 Gas Powered Games, Inc. All rights reserved.
--* Copyright 2006 Gas Powered Games, Inc. All rights reserved.
--*****************************************************************************

local UIUtil = import('/lua/ui/uiutil.lua')
Expand Down
3 changes: 3 additions & 0 deletions lua/ui/game/construction.lua
Expand Up @@ -1130,6 +1130,7 @@ function OnRolloverHandler(button, state)
count = 5
end
IncreaseBuildCountInQueue(item.position, count)
RefreshUI()
end
if self.dragMarker then
self.dragMarker:Destroy()
Expand Down Expand Up @@ -1552,9 +1553,11 @@ function OnClickHandler(button, modifiers)

if modifiers.Left then
IncreaseBuildCountInQueue(item.position, count)

elseif modifiers.Right then
DecreaseBuildCountInQueue(item.position, count)
end
RefreshUI()
end
end

Expand Down
58 changes: 58 additions & 0 deletions lua/ui/game/unitview.lua
Expand Up @@ -21,6 +21,8 @@ local options = Prefs.GetFromCurrentProfile('options')
local GetUnitRolloverInfo = import("/lua/keymap/selectedinfo.lua").GetUnitRolloverInfo
local unitViewLayout = import(UIUtil.GetLayoutFilename('unitview'))
local unitviewDetail = import('/lua/ui/game/unitviewDetail.lua')
local Grid = import('/lua/maui/grid.lua').Grid
local Construction = import('/lua/ui/game/construction.lua')

local selectedUnit = nil
local updateThread = nil
Expand All @@ -30,6 +32,8 @@ controls = import('/lua/ui/controls.lua').Get()
-- shared between sim and ui
local OverchargeShared = import('/lua/shared/overcharge.lua')

local UpdateWindowShowQueueOfUnit = (categories.SHOWQUEUE * categories.STRUCTURE) + categories.FACTORY

function OverchargeCanKill()
if unitHP[1] and unitHP.blueprintId then
local selected = GetSelectedUnits()
Expand Down Expand Up @@ -254,6 +258,48 @@ local statFuncs = {
end,
}


function CreateQueueGrid(parent)
if controls.queueGrid then
controls.queueGrid:Hide()
return
end
controls.queueGrid = Grid(parent, 44, 44)
controls.queueGrid:DisableHitTest()
LayoutHelpers.SetHeight(controls.queueGrid, 50)
LayoutHelpers.AnchorToTop(controls.queueGrid, parent)
LayoutHelpers.AtLeftIn(controls.queueGrid, parent)
LayoutHelpers.AtRightIn(controls.queueGrid, parent)
controls.queueGrid:AppendRows(1, true)
controls.queueGrid:AppendCols(controls.queueGrid._visible["Horz"]())
controls.queueGrid.UpdateQueue = function (self, queue)
for id, item in self._items[1] do
if queue[id] then
item:Show()
item.icon:SetTexture( UIUtil.UIFile('/icons/units/' .. queue[id].id .. '_icon.dds', true))
item.text:SetText(tostring(queue[id].count))
else
item:Hide()
end
end
end
local function CreateGridUnitIcon(parent)
local item = Bitmap(parent, UIUtil.SkinnableFile('/game/avatar-factory-panel/avatar-s-e-f_bmp.dds'))
item.icon = Bitmap(item)
LayoutHelpers.DepthOverParent(item.icon, item)
LayoutHelpers.FillParentFixedBorder(item.icon, item, 6)

item.text = UIUtil.CreateText(item, "", 16, 'Arial Black', true)
LayoutHelpers.DepthOverParent(item.text, item.icon)
LayoutHelpers.AtRightBottomIn(item.text, item, 4, 4)
return item
end
for id = 1, controls.queueGrid._lines["Horz"] do
controls.queueGrid:SetItem(CreateGridUnitIcon(controls.queueGrid),id,1)
end
controls.queueGrid:Hide()
end

function UpdateWindow(info)
if info.blueprintId == 'unknown' then
controls.name:SetText(LOC('<LOC rollover_0000>Unknown Unit'))
Expand Down Expand Up @@ -476,6 +522,18 @@ function UpdateWindow(info)
if info.userUnit then
unitQueue = info.userUnit:GetCommandQueue()
end


-- # Build queue upon hovering of unit

if options.gui_queue_on_hover then
if EntityCategoryContains(UpdateWindowShowQueueOfUnit, info.userUnit) then
CreateQueueGrid(controls.bg)
controls.queueGrid:Show()
controls.queueGrid:UpdateQueue(SetCurrentFactoryForQueueDisplay(info.userUnit) or {})
end
end

if info.focus then
if DiskGetFileInfo(UIUtil.UIFile('/icons/units/' .. info.focus.blueprintId .. '_icon.dds', true)) then
controls.actionIcon:SetTexture(UIUtil.UIFile('/icons/units/' .. info.focus.blueprintId .. '_icon.dds', true))
Expand Down