diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 6beac6f5cf..d502966a0b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -190,6 +190,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic { "getSpawnOccupants", (Func>)(() => spawnOccupants) }, { "getDisabledSpawnPoints", (Func>)(() => orderManager.LobbyInfo.DisabledSpawnPoints) }, { "showUnoccupiedSpawnpoints", true }, + { "mapUpdatesEnabled", true }, + { + "onMapUpdate", (Action)(uid => + { + orderManager.IssueOrder(Order.Command("map " + uid)); + Game.Settings.Server.Map = uid; + Game.Settings.Save(); + }) + }, }); mapContainer.IsVisible = () => panel != PanelType.Servers; @@ -242,7 +251,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { { "initialMap", modData.MapCache.PickLastModifiedMap(MapVisibility.Lobby) ?? map.Uid }, { "initialTab", MapClassification.System }, - { "onExit", Game.IsHost ? UpdateSelectedMap : modData.MapCache.UpdateMaps }, + { "onExit", modData.MapCache.UpdateMaps }, { "onSelect", Game.IsHost ? onSelect : null }, { "filter", MapVisibility.Lobby }, }); @@ -419,7 +428,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic orderManager.IssueOrder(Order.Command("startgame")); } else - UpdateSelectedMap(); + modData.MapCache.UpdateMaps(); } var startGameButton = lobby.GetOrNull("START_GAME_BUTTON"); @@ -904,20 +913,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic onStart(); } - - void UpdateSelectedMap() - { - if (modData.MapCache[map.Uid].Status == MapStatus.Available) - return; - - var uid = modData.MapCache.GetUpdatedMap(map.Uid); - if (uid != null) - { - orderManager.IssueOrder(Order.Command("map " + uid)); - Game.Settings.Server.Map = uid; - Game.Settings.Save(); - } - } } public class LobbyFaction diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs index 24ca91f421..7476dedf3f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/MapPreviewLogic.cs @@ -38,226 +38,261 @@ namespace OpenRA.Mods.Common.Widgets.Logic const string CreatedBy = "label-created-by"; readonly int blinkTickLength = 10; - bool installHighlighted; + readonly Dictionary previewWidgets = new(); + readonly Func<(MapPreview Map, Session.MapStatus Status)> getMap; + + enum PreviewStatus { Unknown, Playable, Incompatible, Validating, DownloadAvailable, Searching, Downloading, DownloadError, Unavailable, UpdateAvailable, UpdateDownloadAvailable } + PreviewStatus currentStatus; + bool blink; int blinkTick; + readonly ButtonWidget retryButton; + bool mapUpdateAvailable = false; [ObjectCreator.UseCtor] internal MapPreviewLogic(Widget widget, ModData modData, OrderManager orderManager, Func<(MapPreview Map, Session.MapStatus Status)> getMap, Action onMouseDown, Func> getSpawnOccupants, - Func> getDisabledSpawnPoints, bool showUnoccupiedSpawnpoints) + bool mapUpdatesEnabled, Action onMapUpdate, Func> getDisabledSpawnPoints, bool showUnoccupiedSpawnpoints) { + this.getMap = getMap; + + Widget SetupMapPreview(Widget parent) + { + var preview = parent.Get("MAP_PREVIEW"); + preview.Preview = () => getMap().Map; + preview.OnMouseDown = mi => onMouseDown(preview, getMap().Map, mi); + preview.SpawnOccupants = getSpawnOccupants; + preview.DisabledSpawnPoints = getDisabledSpawnPoints; + preview.ShowUnoccupiedSpawnpoints = showUnoccupiedSpawnpoints; + + var titleLabel = parent.Get("MAP_TITLE"); + titleLabel.IsVisible = () => getMap().Map != MapCache.UnknownMap; + var font = Game.Renderer.Fonts[titleLabel.Font]; + var titleCache = new CachedTransform(str => + { + var truncatedText = WidgetUtils.TruncateText(str, titleLabel.Bounds.Width, font); + + if (str != truncatedText) + titleLabel.GetTooltipText = () => str; + else + titleLabel.GetTooltipText = null; + + return truncatedText; + }); + + titleLabel.GetText = () => titleCache.Update(getMap().Map.Title); + + return parent; + } + + var authorCache = new CachedTransform( + text => TranslationProvider.GetString(CreatedBy, Translation.Arguments("author", text))); + + Widget SetupAuthorAndMapType(Widget parent) + { + var typeLabel = parent.Get("MAP_TYPE"); + var typeCache = new CachedTransform( + m => m.Categories.FirstOrDefault() ?? ""); + + typeLabel.GetText = () => typeCache.Update(getMap().Map); + + var authorLabel = parent.Get("MAP_AUTHOR"); + var font = Game.Renderer.Fonts[authorLabel.Font]; + var truncateCache = new CachedTransform( + m => WidgetUtils.TruncateText(authorCache.Update(m.Author), authorLabel.Bounds.Width, font)); + + authorLabel.GetText = () => truncateCache.Update(getMap().Map); + + return parent; + } + var mapRepository = modData.Manifest.Get().MapRepository; - var available = widget.GetOrNull("MAP_AVAILABLE"); - if (available != null) + Widget SetUpInstallButton(Widget parent) { - available.IsVisible = () => + var button = parent.Get("MAP_INSTALL"); + button.IsHighlighted = () => blink; + button.OnClick = () => { - var (map, serverStatus) = getMap(); - var isPlayable = (serverStatus & Session.MapStatus.Playable) == Session.MapStatus.Playable; - return map.Status == MapStatus.Available && isPlayable; - }; - - SetupWidgets(available, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints); - } - - var invalid = widget.GetOrNull("MAP_INVALID"); - if (invalid != null) - { - invalid.IsVisible = () => - { - var (map, serverStatus) = getMap(); - return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Incompatible) != 0; - }; - - SetupWidgets(invalid, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints); - } - - var validating = widget.GetOrNull("MAP_VALIDATING"); - if (validating != null) - { - validating.IsVisible = () => - { - var (map, serverStatus) = getMap(); - return map.Status == MapStatus.Available && (serverStatus & Session.MapStatus.Validating) != 0; - }; - - SetupWidgets(validating, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints); - } - - var download = widget.GetOrNull("MAP_DOWNLOADABLE"); - if (download != null) - { - download.IsVisible = () => getMap().Map.Status == MapStatus.DownloadAvailable; - - SetupWidgets(download, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints); - - var install = download.GetOrNull("MAP_INSTALL"); - if (install != null) - { - install.OnClick = () => + getMap().Map.Install(mapRepository, () => { - getMap().Map.Install(mapRepository, () => - { - if (orderManager != null) - Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"))); - }); - }; + if (orderManager != null) + Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"))); + }); + }; - install.IsHighlighted = () => installHighlighted; - } + return parent; } - var progress = widget.GetOrNull("MAP_PROGRESS"); - if (progress != null) + var updateButton = widget.Get("MAP_UPDATE"); + updateButton.IsHighlighted = () => blink; + updateButton.OnClick = () => { - progress.IsVisible = () => + var uid = getMap().Map.Uid; + var newUid = modData.MapCache.GetUpdatedMap(uid); + if (newUid != null && newUid != uid) + onMapUpdate(newUid); + }; + + Widget SetUpDownloadProgress(Widget parent) + { + var progressbar = parent.Get("MAP_PROGRESSBAR"); + progressbar.IsIndeterminate = () => getMap().Map.DownloadPercentage == 0; + progressbar.GetPercentage = () => getMap().Map.DownloadPercentage; + + var downloadingLabel = parent.Get("MAP_STATUS_DOWNLOADING"); + downloadingLabel.GetText = () => { var (map, _) = getMap(); - return map.Status != MapStatus.Available && map.Status != MapStatus.DownloadAvailable; + if (map.DownloadBytes == 0) + return TranslationProvider.GetString(Connecting); + + // Server does not provide the total file length. + if (map.DownloadPercentage == 0) + return TranslationProvider.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024)); + + return TranslationProvider.GetString(DownloadingPercentage, Translation.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage)); }; - SetupWidgets(progress, getMap, onMouseDown, getSpawnOccupants, getDisabledSpawnPoints, showUnoccupiedSpawnpoints); - - var statusSearching = progress.GetOrNull("MAP_STATUS_SEARCHING"); - if (statusSearching != null) - { - statusSearching.IsVisible = () => - { - var (map, _) = getMap(); - return map.Status == MapStatus.Searching; - }; - } - - var statusUnavailable = progress.GetOrNull("MAP_STATUS_UNAVAILABLE"); - if (statusUnavailable != null) - { - statusUnavailable.IsVisible = () => - { - var (map, _) = getMap(); - return map.Status == MapStatus.Unavailable && map != MapCache.UnknownMap; - }; - } - - var statusError = progress.GetOrNull("MAP_STATUS_ERROR"); - if (statusError != null) - statusError.IsVisible = () => getMap().Map.Status == MapStatus.DownloadError; - - var statusDownloading = progress.GetOrNull("MAP_STATUS_DOWNLOADING"); - if (statusDownloading != null) - { - statusDownloading.IsVisible = () => getMap().Map.Status == MapStatus.Downloading; - - statusDownloading.GetText = () => - { - var (map, _) = getMap(); - if (map.DownloadBytes == 0) - return TranslationProvider.GetString(Connecting); - - // Server does not provide the total file length - if (map.DownloadPercentage == 0) - TranslationProvider.GetString(Downloading, Translation.Arguments("size", map.DownloadBytes / 1024)); - - return TranslationProvider.GetString(DownloadingPercentage, Translation.Arguments("size", map.DownloadBytes / 1024, "progress", map.DownloadPercentage)); - }; - } - - var retry = progress.GetOrNull("MAP_RETRY"); - if (retry != null) - { - retry.IsVisible = () => - { - var (map, _) = getMap(); - return (map.Status == MapStatus.DownloadError || map.Status == MapStatus.Unavailable) && map != MapCache.UnknownMap; - }; - - retry.OnClick = () => - { - modData.MapCache.UpdateMaps(); - var (map, _) = getMap(); - if (map.Status == MapStatus.DownloadError) - { - map.Install(mapRepository, () => - { - if (orderManager != null) - Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"))); - }); - } - else if (map.Status == MapStatus.Unavailable) - modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid }); - }; - - retry.GetText = () => getMap().Map.Status == MapStatus.DownloadError - ? TranslationProvider.GetString(RetryInstall) - : TranslationProvider.GetString(RetrySearch); - } - - var progressbar = progress.GetOrNull("MAP_PROGRESSBAR"); - if (progressbar != null) - { - progressbar.IsIndeterminate = () => getMap().Map.DownloadPercentage == 0; - progressbar.GetPercentage = () => getMap().Map.DownloadPercentage; - progressbar.IsVisible = () => getMap().Map.Status == MapStatus.Downloading; - } + return parent; } + + retryButton = widget.Get("MAP_RETRY"); + retryButton.OnClick = () => + { + retryTriggered = true; + var (map, _) = getMap(); + + var uid = modData.MapCache.GetUpdatedMap(map.Uid); + mapUpdateAvailable = mapUpdatesEnabled && uid != null && map.Uid != uid; + + if (map.Status == MapStatus.DownloadError) + { + map.Install(mapRepository, () => + { + if (orderManager != null) + Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"))); + }); + } + else if (map.Status == MapStatus.Unavailable) + modData.MapCache.QueryRemoteMapDetails(mapRepository, new[] { map.Uid }); + }; + + var retryInstall = TranslationProvider.GetString(RetryInstall); + var retrySearch = TranslationProvider.GetString(RetrySearch); + retryButton.GetText = () => getMap().Map.Status == MapStatus.DownloadError ? retryInstall : retrySearch; + + var previewLarge = SetupMapPreview(widget.Get("MAP_LARGE")); + var previewSmall = SetupMapPreview(widget.Get("MAP_SMALL")); + + // Widgets to be made visible. + previewWidgets[PreviewStatus.Unknown] = new Widget[] { previewLarge }; + previewWidgets[PreviewStatus.Playable] = new Widget[] { previewLarge, SetupAuthorAndMapType(widget.Get("MAP_AVAILABLE")) }; + previewWidgets[PreviewStatus.Incompatible] = new Widget[] { previewLarge, widget.Get("MAP_INCOMPATIBLE") }; + previewWidgets[PreviewStatus.Validating] = new Widget[] { previewSmall, widget.Get("MAP_VALIDATING") }; + previewWidgets[PreviewStatus.UpdateAvailable] = new Widget[] { previewSmall, widget.Get("MAP_UPDATE_AVAILABLE"), updateButton }; + previewWidgets[PreviewStatus.DownloadAvailable] = new Widget[] { previewSmall, SetUpInstallButton(SetupAuthorAndMapType(widget.Get("MAP_DOWNLOAD_AVAILABLE"))) }; + previewWidgets[PreviewStatus.UpdateDownloadAvailable] = new Widget[] { previewSmall, SetUpInstallButton(widget.Get("MAP_UPDATE_DOWNLOAD_AVAILABLE")), updateButton }; + previewWidgets[PreviewStatus.Searching] = new Widget[] { previewSmall, widget.Get("MAP_SEARCHING") }; + previewWidgets[PreviewStatus.Downloading] = new Widget[] { previewSmall, SetUpDownloadProgress(widget.Get("MAP_DOWNLOADING")) }; + previewWidgets[PreviewStatus.Unavailable] = new Widget[] { previewSmall, widget.Get("MAP_UNAVAILABLE"), retryButton }; + previewWidgets[PreviewStatus.DownloadError] = new Widget[] { previewSmall, widget.Get("MAP_ERROR"), retryButton }; + + // Hide all widgets. + foreach (var preview in previewWidgets) + foreach (var p in preview.Value) + p.IsVisible = () => false; } + Widget[] visibleWidgets = Array.Empty(); + + void UpdateVisibility() + { + foreach (var widget in visibleWidgets) + widget.IsVisible = () => false; + + visibleWidgets = previewWidgets[currentStatus]; + foreach (var widget in visibleWidgets) + widget.IsVisible = () => true; + } + + bool retryTriggered = false; + public override void Tick() { if (++blinkTick >= blinkTickLength) { - installHighlighted ^= true; + blink ^= true; blinkTick = 0; } - } - static void SetupWidgets(Widget parent, - Func<(MapPreview Map, Session.MapStatus Status)> getMap, - Action onMouseDown, - Func> getSpawnOccupants, - Func> getDisabledSpawnPoints, - bool showUnoccupiedSpawnpoints) - { - var preview = parent.Get("MAP_PREVIEW"); - preview.Preview = () => getMap().Map; - preview.OnMouseDown = mi => onMouseDown(preview, getMap().Map, mi); - preview.SpawnOccupants = getSpawnOccupants; - preview.DisabledSpawnPoints = getDisabledSpawnPoints; - preview.ShowUnoccupiedSpawnpoints = showUnoccupiedSpawnpoints; + var (map, serverStatus) = getMap(); - var titleLabel = parent.GetOrNull("MAP_TITLE"); - if (titleLabel != null) + // Combine Session.MapStatus and MapStatus into PreviewStatus. + PreviewStatus? status = null; + if (map == MapCache.UnknownMap) + status = PreviewStatus.Unknown; + else { - titleLabel.IsVisible = () => getMap().Map != MapCache.UnknownMap; - var font = Game.Renderer.Fonts[titleLabel.Font]; - var title = new CachedTransform(m => + switch (map.Status) { - var truncated = WidgetUtils.TruncateText(m.Title, titleLabel.Bounds.Width, font); + case MapStatus.Available: + if (serverStatus.HasFlag(Session.MapStatus.Playable)) + status = PreviewStatus.Playable; + else if (serverStatus.HasFlag(Session.MapStatus.Incompatible)) + status = PreviewStatus.Incompatible; + else if (serverStatus.HasFlag(Session.MapStatus.Validating)) + status = PreviewStatus.Validating; + else + return; + break; + case MapStatus.DownloadAvailable: + if (mapUpdateAvailable) + status = PreviewStatus.UpdateDownloadAvailable; + else + status = PreviewStatus.DownloadAvailable; + break; + case MapStatus.Searching: + status = PreviewStatus.Searching; + break; + case MapStatus.Unavailable: + if (mapUpdateAvailable) + status = PreviewStatus.UpdateAvailable; + else + status = PreviewStatus.Unavailable; + break; + case MapStatus.DownloadError: + status = PreviewStatus.DownloadError; + break; + case MapStatus.Downloading: + status = PreviewStatus.Downloading; + break; + } + } - if (m.Title != truncated) - titleLabel.GetTooltipText = () => m.Title; + // Trigger only on status change. + if (status != null && status != currentStatus) + { + // When a map becomes invalid, make sure the `Retry` button is triggered. + if (status == PreviewStatus.Unavailable || status == PreviewStatus.UpdateAvailable) + { + if (retryTriggered) + retryTriggered = false; else - titleLabel.GetTooltipText = null; + { + retryButton.OnClick(); + if (map.Status == MapStatus.Searching) + status = PreviewStatus.Searching; + else if (mapUpdateAvailable) + status = PreviewStatus.UpdateAvailable; + else + status = PreviewStatus.Unavailable; + } + } + else if (status != PreviewStatus.Searching) + retryTriggered = false; - return truncated; - }); - titleLabel.GetText = () => title.Update(getMap().Map); - } - - var typeLabel = parent.GetOrNull("MAP_TYPE"); - if (typeLabel != null) - { - var type = new CachedTransform(m => m.Categories.FirstOrDefault() ?? ""); - typeLabel.GetText = () => type.Update(getMap().Map); - } - - var authorLabel = parent.GetOrNull("MAP_AUTHOR"); - if (authorLabel != null) - { - var font = Game.Renderer.Fonts[authorLabel.Font]; - var author = new CachedTransform( - m => WidgetUtils.TruncateText(TranslationProvider.GetString(CreatedBy, Translation.Arguments("author", m.Author)), authorLabel.Bounds.Width, font)); - authorLabel.GetText = () => author.Update(getMap().Map); + currentStatus = status.Value; + UpdateVisibility(); } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs index 8233ff8841..75babf34a8 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ReplayBrowserLogic.cs @@ -176,6 +176,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic { "getSpawnOccupants", (Func>)(() => spawnOccupants.Update(selectedReplay)) }, { "getDisabledSpawnPoints", (Func>)(() => disabledSpawnPoints.Update(selectedReplay)) }, { "showUnoccupiedSpawnpoints", false }, + { "mapUpdatesEnabled", false }, + { "onMapUpdate", (Action)(_ => { }) }, }); var replayDuration = new CachedTransform(r => diff --git a/mods/cnc/chrome/lobby-mappreview.yaml b/mods/cnc/chrome/lobby-mappreview.yaml index 2d3d129960..2f6f14fb02 100644 --- a/mods/cnc/chrome/lobby-mappreview.yaml +++ b/mods/cnc/chrome/lobby-mappreview.yaml @@ -3,7 +3,7 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Container@MAP_AVAILABLE: + Container@MAP_LARGE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: @@ -26,6 +26,33 @@ Container@MAP_PREVIEW: Align: Center TooltipContainer: TOOLTIP_CONTAINER TooltipTemplate: SIMPLE_TOOLTIP + Container@MAP_SMALL: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + Background@MAP_BG: + Width: PARENT_RIGHT + Height: 142 + Background: panel-gray + Children: + MapPreview@MAP_PREVIEW: + X: 1 + Y: 1 + Width: PARENT_RIGHT - 2 + Height: PARENT_BOTTOM - 2 + TooltipContainer: TOOLTIP_CONTAINER + LabelWithTooltip@MAP_TITLE: + Y: 143 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + Container@MAP_AVAILABLE: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: Label@MAP_TYPE: Y: 188 Width: PARENT_RIGHT @@ -39,29 +66,10 @@ Container@MAP_PREVIEW: Height: 25 Font: Tiny Align: Center - Container@MAP_INVALID: + Container@MAP_INCOMPATIBLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 174 - Background: panel-gray - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 173 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_STATUS_A: Y: 188 Width: PARENT_RIGHT @@ -81,25 +89,6 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 158 - Background: panel-gray - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 159 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_STATUS_VALIDATING: Y: 174 Width: PARENT_RIGHT @@ -108,34 +97,15 @@ Container@MAP_PREVIEW: Align: Center Text: Validating... IgnoreMouseOver: true - ProgressBar@MAP_PROGRESSBAR: + ProgressBar@MAP_VALIDATING_BAR: Y: 194 Width: PARENT_RIGHT Height: 25 Indeterminate: True - Container@MAP_DOWNLOADABLE: + Container@MAP_DOWNLOAD_AVAILABLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 142 - Background: panel-gray - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 143 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_TYPE: Y: 158 Width: PARENT_RIGHT @@ -154,61 +124,56 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: 25 Text: Install Map - Container@MAP_PROGRESS: + Button@MAP_UPDATE: + Y: 195 + Width: PARENT_RIGHT + Height: 25 + Text: Update Map + Container@MAP_UPDATE_DOWNLOAD_AVAILABLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 142 - Background: panel-gray - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 143 + Button@MAP_INSTALL: + Y: 166 Width: PARENT_RIGHT Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP - Label@MAP_STATUS_SEARCHING: + Text: Install Map + Label@MAP_SEARCHING: + Y: 158 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: Searching OpenRA Resource Center... + IgnoreMouseOver: true + Container@MAP_UNAVAILABLE: + Width: PARENT_RIGHT + Children: + Label@a: Y: 158 Width: PARENT_RIGHT Height: 25 Font: Tiny Align: Center - Text: Searching OpenRA Resource Center... - IgnoreMouseOver: true - Container@MAP_STATUS_UNAVAILABLE: - Width: PARENT_RIGHT - Children: - Label@a: - Y: 158 - Width: PARENT_RIGHT - Height: 25 - Font: Tiny - Align: Center - Text: This map was not found on the - Label@b: - Y: 171 - Width: PARENT_RIGHT - Height: 25 - Font: Tiny - Align: Center - Text: OpenRA Resource Center - Label@MAP_STATUS_ERROR: - Y: 158 + Text: This map was not found on the + Label@b: + Y: 171 Width: PARENT_RIGHT Height: 25 Font: Tiny Align: Center - Text: An error occurred during installation + Text: OpenRA Resource Center + Label@MAP_ERROR: + Y: 158 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: An error occurred during installation + Container@MAP_DOWNLOADING: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: Label@MAP_STATUS_DOWNLOADING: Y: 158 Width: PARENT_RIGHT @@ -220,7 +185,24 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: 25 Indeterminate: True - Button@MAP_RETRY: - Y: 194 + Button@MAP_RETRY: + Y: 194 + Width: PARENT_RIGHT + Height: 25 + Container@MAP_UPDATE_AVAILABLE: + Width: PARENT_RIGHT + Children: + Label@a: + Y: 158 Width: PARENT_RIGHT Height: 25 + Font: Tiny + Align: Center + Text: A new version of the map + Label@b: + Y: 171 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: was found on your computer diff --git a/mods/common/chrome/lobby-mappreview.yaml b/mods/common/chrome/lobby-mappreview.yaml index 5be5d09eba..7fc448ebe2 100644 --- a/mods/common/chrome/lobby-mappreview.yaml +++ b/mods/common/chrome/lobby-mappreview.yaml @@ -3,7 +3,7 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Container@MAP_AVAILABLE: + Container@MAP_LARGE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: @@ -26,6 +26,33 @@ Container@MAP_PREVIEW: Align: Center TooltipContainer: TOOLTIP_CONTAINER TooltipTemplate: SIMPLE_TOOLTIP + Container@MAP_SMALL: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: + Background@MAP_BG: + Width: PARENT_RIGHT + Height: 142 + Background: dialog3 + Children: + MapPreview@MAP_PREVIEW: + X: 1 + Y: 1 + Width: PARENT_RIGHT - 2 + Height: PARENT_BOTTOM - 2 + TooltipContainer: TOOLTIP_CONTAINER + LabelWithTooltip@MAP_TITLE: + Y: 143 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Align: Center + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: SIMPLE_TOOLTIP + Container@MAP_AVAILABLE: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: Label@MAP_TYPE: Y: 188 Width: PARENT_RIGHT @@ -39,29 +66,10 @@ Container@MAP_PREVIEW: Height: 25 Font: Tiny Align: Center - Container@MAP_INVALID: + Container@MAP_INCOMPATIBLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 174 - Background: dialog3 - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 173 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_STATUS_A: Y: 188 Width: PARENT_RIGHT @@ -81,25 +89,6 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 158 - Background: dialog3 - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 159 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_STATUS_VALIDATING: Y: 174 Width: PARENT_RIGHT @@ -108,34 +97,15 @@ Container@MAP_PREVIEW: Align: Center Text: Validating... IgnoreMouseOver: true - ProgressBar@MAP_PROGRESSBAR: + ProgressBar@MAP_VALIDATING_BAR: Y: 194 Width: PARENT_RIGHT Height: 25 Indeterminate: True - Container@MAP_DOWNLOADABLE: + Container@MAP_DOWNLOAD_AVAILABLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 142 - Background: dialog3 - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 143 - Width: PARENT_RIGHT - Height: 25 - Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP Label@MAP_TYPE: Y: 158 Width: PARENT_RIGHT @@ -155,61 +125,58 @@ Container@MAP_PREVIEW: Height: 25 Font: Bold Text: Install Map - Container@MAP_PROGRESS: + Button@MAP_UPDATE: + Y: 195 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Text: Update Map + Container@MAP_UPDATE_DOWNLOAD_AVAILABLE: Width: PARENT_RIGHT Height: PARENT_BOTTOM Children: - Background@MAP_BG: - Width: PARENT_RIGHT - Height: 142 - Background: dialog3 - Children: - MapPreview@MAP_PREVIEW: - X: 1 - Y: 1 - Width: PARENT_RIGHT - 2 - Height: PARENT_BOTTOM - 2 - TooltipContainer: TOOLTIP_CONTAINER - LabelWithTooltip@MAP_TITLE: - Y: 143 + Button@MAP_INSTALL: + Y: 166 Width: PARENT_RIGHT Height: 25 Font: Bold - Align: Center - TooltipContainer: TOOLTIP_CONTAINER - TooltipTemplate: SIMPLE_TOOLTIP - Label@MAP_STATUS_SEARCHING: + Text: Install Map + Label@MAP_SEARCHING: + Y: 158 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: Searching OpenRA Resource Center... + IgnoreMouseOver: true + Container@MAP_UNAVAILABLE: + Width: PARENT_RIGHT + Children: + Label@a: Y: 158 Width: PARENT_RIGHT Height: 25 Font: Tiny Align: Center - Text: Searching OpenRA Resource Center... - IgnoreMouseOver: true - Container@MAP_STATUS_UNAVAILABLE: - Width: PARENT_RIGHT - Children: - Label@a: - Y: 158 - Width: PARENT_RIGHT - Height: 25 - Font: Tiny - Align: Center - Text: This map was not found on the - Label@b: - Y: 171 - Width: PARENT_RIGHT - Height: 25 - Font: Tiny - Align: Center - Text: OpenRA Resource Center - Label@MAP_STATUS_ERROR: - Y: 158 + Text: This map was not found on the + Label@b: + Y: 171 Width: PARENT_RIGHT Height: 25 Font: Tiny Align: Center - Text: An error occurred during installation + Text: OpenRA Resource Center + Label@MAP_ERROR: + Y: 158 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: An error occurred during installation + Container@MAP_DOWNLOADING: + Width: PARENT_RIGHT + Height: PARENT_BOTTOM + Children: Label@MAP_STATUS_DOWNLOADING: Y: 158 Width: PARENT_RIGHT @@ -221,8 +188,25 @@ Container@MAP_PREVIEW: Width: PARENT_RIGHT Height: 25 Indeterminate: True - Button@MAP_RETRY: - Y: 194 + Button@MAP_RETRY: + Y: 194 + Width: PARENT_RIGHT + Height: 25 + Font: Bold + Container@MAP_UPDATE_AVAILABLE: + Width: PARENT_RIGHT + Children: + Label@a: + Y: 158 Width: PARENT_RIGHT Height: 25 - Font: Bold + Font: Tiny + Align: Center + Text: A new version of the map + Label@b: + Y: 171 + Width: PARENT_RIGHT + Height: 25 + Font: Tiny + Align: Center + Text: was found on your computer