2023-02-16 23:54:23 +00:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Pal.Client.Configuration;
|
2023-02-16 09:25:33 +00:00
|
|
|
|
using Pal.Client.DependencyInjection;
|
2023-02-17 18:12:44 +00:00
|
|
|
|
using Pal.Client.Rendering;
|
2023-02-16 09:25:33 +00:00
|
|
|
|
|
|
|
|
|
namespace Pal.Client.Scheduled
|
2022-12-22 00:01:09 +00:00
|
|
|
|
{
|
2023-02-15 22:17:19 +00:00
|
|
|
|
internal sealed class QueuedConfigUpdate : IQueueOnFrameworkThread
|
2022-12-22 00:01:09 +00:00
|
|
|
|
{
|
2023-02-16 09:25:33 +00:00
|
|
|
|
internal sealed class Handler : IQueueOnFrameworkThread.Handler<QueuedConfigUpdate>
|
|
|
|
|
{
|
|
|
|
|
private readonly IPalacePalConfiguration _configuration;
|
|
|
|
|
private readonly FloorService _floorService;
|
|
|
|
|
private readonly TerritoryState _territoryState;
|
2023-02-17 18:12:44 +00:00
|
|
|
|
private readonly RenderAdapter _renderAdapter;
|
2023-02-16 09:25:33 +00:00
|
|
|
|
|
2023-02-17 18:12:44 +00:00
|
|
|
|
public Handler(
|
|
|
|
|
ILogger<Handler> logger,
|
|
|
|
|
IPalacePalConfiguration configuration,
|
|
|
|
|
FloorService floorService,
|
|
|
|
|
TerritoryState territoryState,
|
|
|
|
|
RenderAdapter renderAdapter)
|
2023-02-16 23:54:23 +00:00
|
|
|
|
: base(logger)
|
2023-02-16 09:25:33 +00:00
|
|
|
|
{
|
|
|
|
|
_configuration = configuration;
|
|
|
|
|
_floorService = floorService;
|
|
|
|
|
_territoryState = territoryState;
|
2023-02-17 18:12:44 +00:00
|
|
|
|
_renderAdapter = renderAdapter;
|
2023-02-16 09:25:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Run(QueuedConfigUpdate queued, ref bool recreateLayout, ref bool saveMarkers)
|
|
|
|
|
{
|
|
|
|
|
if (_configuration.Mode == EMode.Offline)
|
|
|
|
|
{
|
|
|
|
|
LocalState.UpdateAll();
|
|
|
|
|
_floorService.FloorMarkers.Clear();
|
|
|
|
|
_floorService.EphemeralMarkers.Clear();
|
|
|
|
|
_territoryState.LastTerritory = 0;
|
|
|
|
|
|
|
|
|
|
recreateLayout = true;
|
|
|
|
|
saveMarkers = true;
|
|
|
|
|
}
|
2023-02-17 18:12:44 +00:00
|
|
|
|
|
|
|
|
|
_renderAdapter.ConfigUpdated();
|
2023-02-16 09:25:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-22 00:01:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|