diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 0f59fdaec8..d4c7c49849 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -354,27 +354,32 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static void SetupProfileWidget(Widget parent, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) { - var visible = c != null && c.Bot == null; var profile = parent.GetOrNull("PROFILE"); if (profile != null) { - var imageName = (c != null && c.IsAdmin ? "admin-" : "player-") - + (c.Fingerprint != null ? "registered" : "anonymous"); + var imageName = c.IsBot ? "bot" : + c.IsAdmin ? "admin-" : + "player-"; + + if (!c.IsBot) + imageName += c.Fingerprint != null ? "registered" : "anonymous"; profile.GetImageName = () => imageName; - profile.IsVisible = () => visible; + profile.IsVisible = () => true; } var profileTooltip = parent.GetOrNull("PROFILE_TOOLTIP"); if (profileTooltip != null) { - if (c != null && c.Fingerprint != null) + if (c.Fingerprint != null) profileTooltip.Template = "REGISTERED_PLAYER_TOOLTIP"; - if (visible) - profileTooltip.Bind(orderManager, worldRenderer, c); + if (c.IsBot) + profileTooltip.Template = "BOT_TOOLTIP"; - profileTooltip.IsVisible = () => visible; + profileTooltip.Bind(orderManager, worldRenderer, c); + + profileTooltip.IsVisible = () => true; } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs index c2d21ee0be..e1486fc20b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs @@ -352,4 +352,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic } } } + + public class BotTooltipLogic : ChromeLogic + { + [TranslationReference("name")] + const string BotManagedBy = "label-bot-managed-by-tooltip"; + + [ObjectCreator.UseCtor] + public BotTooltipLogic(OrderManager orderManager, Widget widget, Session.Client client) + { + var nameLabel = widget.Get("NAME"); + var nameFont = Game.Renderer.Fonts[nameLabel.Font]; + var controller = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.Index == client.BotControllerClientIndex); + if (controller != null) + nameLabel.GetText = () => TranslationProvider.GetString(BotManagedBy, Translation.Arguments("name", controller.Name)); + + widget.Bounds.Width = nameFont.Measure(nameLabel.GetText()).X + 2 * nameLabel.Bounds.Left; + } + } } diff --git a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs index 8d96a0c9e3..457802b33b 100644 --- a/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MapPreviewWidget.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets public SpawnOccupant(Session.Client client) { Color = client.Color; - PlayerName = client.IsBot ? TranslationProvider.GetString(client.Name) : client.Name;; + PlayerName = client.IsBot ? TranslationProvider.GetString(client.Name) : client.Name; Team = client.Team; Faction = client.Faction; SpawnPoint = client.SpawnPoint; diff --git a/mods/cnc/chrome.yaml b/mods/cnc/chrome.yaml index f34cb22405..0cd6a4ca8e 100644 --- a/mods/cnc/chrome.yaml +++ b/mods/cnc/chrome.yaml @@ -408,6 +408,7 @@ lobby-bits: admin-anonymous: 802, 51, 16, 16 player-registered: 785, 51, 16, 16 player-anonymous: 819, 51, 16, 16 + bot: 938, 51, 16, 16 reload-icon: Inherits: ^Chrome diff --git a/mods/cnc/chrome/tooltips.yaml b/mods/cnc/chrome/tooltips.yaml index 9f8cb6f5d5..712b6c8c0f 100644 --- a/mods/cnc/chrome/tooltips.yaml +++ b/mods/cnc/chrome/tooltips.yaml @@ -412,6 +412,20 @@ Background@LATENCY_TOOLTIP: Height: 23 Font: Bold +Background@BOT_TOOLTIP: + Logic: BotTooltipLogic + Background: panel-black + Height: 30 + Width: 300 + Children: + Label@NAME: + X: 5 + Y: 2 + Text: label-bot-player-tooltip-name + Width: 290 + Height: 24 + Font: Bold + Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: panel-black diff --git a/mods/cnc/languages/chrome/en.ftl b/mods/cnc/languages/chrome/en.ftl index 308f096a38..15df182d41 100644 --- a/mods/cnc/languages/chrome/en.ftl +++ b/mods/cnc/languages/chrome/en.ftl @@ -696,5 +696,7 @@ button-settings-panel-reset = Reset ## tooltips.yaml label-latency-tooltip-prefix = Latency: label-anonymous-player-tooltip-name = Anonymous Player +label-bot-player-tooltip-name = Bot +label-bot-managed-by-tooltip = Bot managed by { $name } label-game-admin = Game Admin diff --git a/mods/cnc/uibits/chrome-2x.png b/mods/cnc/uibits/chrome-2x.png index 0fe4453566..0777295606 100644 Binary files a/mods/cnc/uibits/chrome-2x.png and b/mods/cnc/uibits/chrome-2x.png differ diff --git a/mods/cnc/uibits/chrome-3x.png b/mods/cnc/uibits/chrome-3x.png index 85d6663093..6c7c4d41a8 100644 Binary files a/mods/cnc/uibits/chrome-3x.png and b/mods/cnc/uibits/chrome-3x.png differ diff --git a/mods/cnc/uibits/chrome.png b/mods/cnc/uibits/chrome.png index d214306aaf..3574411bc8 100644 Binary files a/mods/cnc/uibits/chrome.png and b/mods/cnc/uibits/chrome.png differ diff --git a/mods/common/chrome/tooltips.yaml b/mods/common/chrome/tooltips.yaml index a1f4acafb9..b4287d6d01 100644 --- a/mods/common/chrome/tooltips.yaml +++ b/mods/common/chrome/tooltips.yaml @@ -130,6 +130,20 @@ Background@LATENCY_TOOLTIP: Height: 26 Font: Bold +Background@BOT_TOOLTIP: + Logic: BotTooltipLogic + Background: dialog4 + Height: 30 + Width: 300 + Children: + Label@NAME: + X: 7 + Y: 2 + Text: label-bot-player-tooltip-name + Width: 290 + Height: 24 + Font: Bold + Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: dialog4 diff --git a/mods/common/languages/chrome/en.ftl b/mods/common/languages/chrome/en.ftl index 4982043143..7640cf8427 100644 --- a/mods/common/languages/chrome/en.ftl +++ b/mods/common/languages/chrome/en.ftl @@ -522,6 +522,8 @@ button-settings-panel-reset = Reset ## tooltips.yaml label-latency-tooltip-prefix = Latency: label-anonymous-player-tooltip-name = Anonymous Player +label-bot-player-tooltip-name = Bot +label-bot-managed-by-tooltip = Bot managed by { $name } label-game-admin = Game Admin ## gamesave-loading.yaml diff --git a/mods/d2k/chrome.yaml b/mods/d2k/chrome.yaml index e79c37e56e..a6c3368174 100644 --- a/mods/d2k/chrome.yaml +++ b/mods/d2k/chrome.yaml @@ -269,6 +269,7 @@ lobby-bits: admin-anonymous: 34, 51, 16, 16 player-registered: 17, 51, 16, 16 player-anonymous: 51, 51, 16, 16 + bot: 170, 51, 16, 16 reload-icon: Inherits: ^Glyphs diff --git a/mods/d2k/chrome/tooltips.yaml b/mods/d2k/chrome/tooltips.yaml index a95744fbb1..cce7fbd6da 100644 --- a/mods/d2k/chrome/tooltips.yaml +++ b/mods/d2k/chrome/tooltips.yaml @@ -131,6 +131,20 @@ Background@LATENCY_TOOLTIP: Height: 23 Font: Bold +Background@BOT_TOOLTIP: + Logic: BotTooltipLogic + Background: dialog3 + Height: 30 + Width: 300 + Children: + Label@NAME: + X: 7 + Y: 3 + Text: label-bot-player-tooltip-name + Width: 290 + Height: 24 + Font: Bold + Background@ANONYMOUS_PLAYER_TOOLTIP: Logic: AnonymousProfileTooltipLogic Background: dialog3 diff --git a/mods/d2k/uibits/glyphs-2x.png b/mods/d2k/uibits/glyphs-2x.png index d97be349a4..c4863cb669 100644 Binary files a/mods/d2k/uibits/glyphs-2x.png and b/mods/d2k/uibits/glyphs-2x.png differ diff --git a/mods/d2k/uibits/glyphs-3x.png b/mods/d2k/uibits/glyphs-3x.png index c0a9e4e58c..a6f7b8d581 100644 Binary files a/mods/d2k/uibits/glyphs-3x.png and b/mods/d2k/uibits/glyphs-3x.png differ diff --git a/mods/d2k/uibits/glyphs.png b/mods/d2k/uibits/glyphs.png index 50f5d6da21..cc211c39ba 100644 Binary files a/mods/d2k/uibits/glyphs.png and b/mods/d2k/uibits/glyphs.png differ diff --git a/mods/ra/chrome.yaml b/mods/ra/chrome.yaml index b06c33ad5c..7af2062a8f 100644 --- a/mods/ra/chrome.yaml +++ b/mods/ra/chrome.yaml @@ -345,6 +345,7 @@ lobby-bits: spawn-unclaimed: 91, 119, 22, 22 spawn-disabled: 114, 119, 22, 22 admin: 170, 0, 6, 5 + bot: 170, 51, 16, 16 colorpicker: 68, 119, 22, 22 huepicker: 136, 0, 7, 15 kick: 153, 0, 11, 11 diff --git a/mods/ra/uibits/glyphs-2x.png b/mods/ra/uibits/glyphs-2x.png index a2dca700d3..d6df5b4ac3 100644 Binary files a/mods/ra/uibits/glyphs-2x.png and b/mods/ra/uibits/glyphs-2x.png differ diff --git a/mods/ra/uibits/glyphs-3x.png b/mods/ra/uibits/glyphs-3x.png index d25e876c53..2ac8405440 100644 Binary files a/mods/ra/uibits/glyphs-3x.png and b/mods/ra/uibits/glyphs-3x.png differ diff --git a/mods/ra/uibits/glyphs.png b/mods/ra/uibits/glyphs.png index e789470c1b..7d1112f0d4 100644 Binary files a/mods/ra/uibits/glyphs.png and b/mods/ra/uibits/glyphs.png differ diff --git a/mods/ts/chrome.yaml b/mods/ts/chrome.yaml index d77022fe19..378e028852 100644 --- a/mods/ts/chrome.yaml +++ b/mods/ts/chrome.yaml @@ -489,6 +489,7 @@ lobby-bits: admin-anonymous: 34, 51, 16, 16 player-registered: 17, 51, 16, 16 player-anonymous: 51, 51, 16, 16 + bot: 170, 51, 16, 16 reload-icon: Inherits: ^Glyphs diff --git a/mods/ts/uibits/glyphs-2x.png b/mods/ts/uibits/glyphs-2x.png index b9449041f9..7bffe03f4e 100644 Binary files a/mods/ts/uibits/glyphs-2x.png and b/mods/ts/uibits/glyphs-2x.png differ diff --git a/mods/ts/uibits/glyphs-3x.png b/mods/ts/uibits/glyphs-3x.png index 3259d0a0f5..ea226259cb 100644 Binary files a/mods/ts/uibits/glyphs-3x.png and b/mods/ts/uibits/glyphs-3x.png differ diff --git a/mods/ts/uibits/glyphs.png b/mods/ts/uibits/glyphs.png index da4fc915f1..432cdb80d1 100644 Binary files a/mods/ts/uibits/glyphs.png and b/mods/ts/uibits/glyphs.png differ