Move map installed check to LobbyLogic.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
e5ffed2a4f
commit
246a1b9fec
@@ -535,7 +535,7 @@ namespace OpenRA
|
|||||||
innerData = newData;
|
innerData = newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Install(string mapRepositoryUrl, Action onSuccess)
|
public void Install(string mapRepositoryUrl)
|
||||||
{
|
{
|
||||||
if ((Status != MapStatus.DownloadError && Status != MapStatus.DownloadAvailable) || !Game.Settings.Game.AllowDownloading)
|
if ((Status != MapStatus.DownloadError && Status != MapStatus.DownloadAvailable) || !Game.Settings.Game.AllowDownloading)
|
||||||
return;
|
return;
|
||||||
@@ -592,10 +592,7 @@ namespace OpenRA
|
|||||||
if (p == null)
|
if (p == null)
|
||||||
innerData.Status = MapStatus.DownloadError;
|
innerData.Status = MapStatus.DownloadError;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
UpdateFromMapWithoutOwningPackage(p, mapInstallPackage, MapClassification.User, GridType);
|
UpdateFromMapWithoutOwningPackage(p, mapInstallPackage, MapClassification.User, GridType);
|
||||||
Game.RunAfterTick(onSuccess);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
bool teamChat;
|
bool teamChat;
|
||||||
bool updateDiscordStatus = true;
|
bool updateDiscordStatus = true;
|
||||||
bool resetOptionsButtonEnabled;
|
bool resetOptionsButtonEnabled;
|
||||||
|
bool mapAvailable;
|
||||||
Dictionary<int, SpawnOccupant> spawnOccupants = [];
|
Dictionary<int, SpawnOccupant> spawnOccupants = [];
|
||||||
|
|
||||||
readonly string chatLineSound;
|
readonly string chatLineSound;
|
||||||
@@ -589,6 +590,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
|
// Map may have been installed or generated in the background
|
||||||
|
if (!mapAvailable && map.Status == MapStatus.Available)
|
||||||
|
{
|
||||||
|
mapAvailable = true;
|
||||||
|
orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"));
|
||||||
|
}
|
||||||
|
|
||||||
if (panel == PanelType.Options && OptionsTabDisabled())
|
if (panel == PanelType.Options && OptionsTabDisabled())
|
||||||
panel = PanelType.Players;
|
panel = PanelType.Players;
|
||||||
|
|
||||||
@@ -650,7 +658,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
map = modData.MapCache[uid];
|
map = modData.MapCache[uid];
|
||||||
|
|
||||||
// Tell the server that we have the map
|
// Tell the server that we have the map
|
||||||
if (map.Status == MapStatus.Available)
|
mapAvailable = map.Status == MapStatus.Available;
|
||||||
|
if (mapAvailable)
|
||||||
orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"));
|
orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}"));
|
||||||
|
|
||||||
// We don't have the map
|
// We don't have the map
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
bool mapUpdateAvailable = false;
|
bool mapUpdateAvailable = false;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
internal MapPreviewLogic(Widget widget, ModData modData, OrderManager orderManager, Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
internal MapPreviewLogic(Widget widget, ModData modData, Func<(MapPreview Map, Session.MapStatus Status)> getMap,
|
||||||
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown, Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
Action<MapPreviewWidget, MapPreview, MouseInput> onMouseDown, Func<Dictionary<int, SpawnOccupant>> getSpawnOccupants,
|
||||||
bool mapUpdatesEnabled, Action<string> onMapUpdate, Func<HashSet<int>> getDisabledSpawnPoints, bool showUnoccupiedSpawnpoints)
|
bool mapUpdatesEnabled, Action<string> onMapUpdate, Func<HashSet<int>> getDisabledSpawnPoints, bool showUnoccupiedSpawnpoints)
|
||||||
{
|
{
|
||||||
@@ -132,15 +132,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
var button = parent.Get<ButtonWidget>("MAP_INSTALL");
|
var button = parent.Get<ButtonWidget>("MAP_INSTALL");
|
||||||
button.IsHighlighted = () => blink;
|
button.IsHighlighted = () => blink;
|
||||||
button.OnClick = () =>
|
button.OnClick = () => getMap().Map.Install(mapRepository);
|
||||||
{
|
|
||||||
getMap().Map.Install(mapRepository, () =>
|
|
||||||
{
|
|
||||||
if (orderManager != null)
|
|
||||||
Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}")));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,13 +179,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
mapUpdateAvailable = mapUpdatesEnabled && uid != null && map.Uid != uid;
|
mapUpdateAvailable = mapUpdatesEnabled && uid != null && map.Uid != uid;
|
||||||
|
|
||||||
if (map.Status == MapStatus.DownloadError)
|
if (map.Status == MapStatus.DownloadError)
|
||||||
{
|
map.Install(mapRepository);
|
||||||
map.Install(mapRepository, () =>
|
|
||||||
{
|
|
||||||
if (orderManager != null)
|
|
||||||
Game.RunAfterTick(() => orderManager.IssueOrder(Order.Command($"state {Session.ClientState.NotReady}")));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (map.Status == MapStatus.Unavailable)
|
else if (map.Status == MapStatus.Unavailable)
|
||||||
modData.MapCache.QueryRemoteMapDetails(mapRepository, [map.Uid]);
|
modData.MapCache.QueryRemoteMapDetails(mapRepository, [map.Uid]);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user