From 33da381892082b07400af4b66f50ae1fa0e1d94e Mon Sep 17 00:00:00 2001 From: joshuaptfan Date: Tue, 5 Nov 2019 10:48:49 -0800 Subject: [PATCH] Add hover info key combo hint --- .../mindustry/ui/fragments/PlacementFragment.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index 3c7d7b4cd0..d92cec1454 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -253,9 +253,21 @@ public class PlacementFragment extends Fragment{ lastGround = false; topTable.table(header -> { + String keyCombo = new String(); + if(!mobile){ + keyCombo = " [accent][" + Core.keybinds.get(blockSelect[currentCategory.ordinal()]).key.toString(); + Array blocks = getByCategory(currentCategory); + for(int i = 0; i < blocks.size; i++){ + if(blocks.get(i) == lastDisplay){ + keyCombo += (i < 10 ? "" : "," + Core.keybinds.get(blockSelect[(i + 1) / 10 - 1]).key.toString()) + "," + Core.keybinds.get(blockSelect[i % 10]).key.toString() + "]"; + break; + } + } + } + final String keyComboFinal = keyCombo; header.left(); header.add(new Image(lastDisplay.icon(Cicon.medium))).size(8 * 4); - header.labelWrap(() -> !unlocked(lastDisplay) ? Core.bundle.get("block.unknown") : lastDisplay.localizedName) + header.labelWrap(() -> !unlocked(lastDisplay) ? Core.bundle.get("block.unknown") : lastDisplay.localizedName + (mobile ? "" : keyComboFinal)) .left().width(190f).padLeft(5); header.add().growX(); if(unlocked(lastDisplay)){