fixes, improvements. firebase
This commit is contained in:
@@ -151,7 +151,7 @@ namespace Darkmatter.Features.Artbook
|
||||
{
|
||||
if (!entry.HasValue || entry.Value.Thumbnail == null) return;
|
||||
var ct = _cts?.Token ?? CancellationToken.None;
|
||||
await _gallery.SaveImageAsync(entry.Value.Thumbnail, entry.Value.Id, ct);
|
||||
await _gallery.SaveImageAsync(entry.Value.Thumbnail, entry.Value.Name, ct);
|
||||
}
|
||||
|
||||
private void HandleLeftEditClicked() => OpenForEdit(GetLeftEntry());
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Darkmatter.Core.Contracts.Features.Capture;
|
||||
using Darkmatter.Core.Contracts.Features.DrawingCatalog;
|
||||
using Darkmatter.Core.Contracts.Features.GameplayFlow;
|
||||
using Darkmatter.Core.Contracts.Features.Progression;
|
||||
using Darkmatter.Core.Contracts.Services.Capture;
|
||||
using Darkmatter.Core.Contracts.Services.Gallery;
|
||||
using Darkmatter.Core.Data.Signals.Features.Capture;
|
||||
@@ -18,19 +19,25 @@ namespace Darkmatter.Features.Capture
|
||||
private readonly IGameplaySceneRefs _refs;
|
||||
private readonly IEventBus _bus;
|
||||
private readonly CaptureConfig _config;
|
||||
private readonly IProgressionSystem _progression;
|
||||
private readonly IDrawingTemplateCatalog _catalog;
|
||||
|
||||
public CaptureSystem(
|
||||
ICaptureService captureService,
|
||||
IGalleryService galleryService,
|
||||
IGameplaySceneRefs refs,
|
||||
IEventBus bus,
|
||||
CaptureConfig config)
|
||||
CaptureConfig config,
|
||||
IProgressionSystem progression,
|
||||
IDrawingTemplateCatalog catalog)
|
||||
{
|
||||
_captureService = captureService;
|
||||
_galleryService = galleryService;
|
||||
_refs = refs;
|
||||
_bus = bus;
|
||||
_config = config;
|
||||
_progression = progression;
|
||||
_catalog = catalog;
|
||||
}
|
||||
|
||||
public async UniTask<byte[]> CapturePngAsync(bool saveToGallery = false, CancellationToken ct = default)
|
||||
@@ -44,9 +51,9 @@ namespace Darkmatter.Features.Capture
|
||||
{
|
||||
if (tex.LoadImage(png))
|
||||
{
|
||||
var fileName = await BuildFileNameAsync();
|
||||
_bus.Publish(new GallerySaveStartedSignal());
|
||||
await _galleryService.SaveImageAsync(tex,
|
||||
$"colorbook_{DateTime.UtcNow:yyyyMMdd_HHmmss}.png", ct);
|
||||
await _galleryService.SaveImageAsync(tex, fileName, ct);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@@ -57,5 +64,20 @@ namespace Darkmatter.Features.Capture
|
||||
}
|
||||
return png;
|
||||
}
|
||||
|
||||
private async UniTask<string> BuildFileNameAsync()
|
||||
{
|
||||
var id = _progression.LastOpenedTemplateId;
|
||||
if (string.IsNullOrEmpty(id)) return null;
|
||||
try
|
||||
{
|
||||
var template = await _catalog.LoadAsync(id);
|
||||
return template?.DisplayName;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Darkmatter.Core;
|
||||
using Darkmatter.Core.Contracts.Features.DrawingCatalog;
|
||||
using Darkmatter.Core.Contracts.Features.Progression;
|
||||
using Darkmatter.Core.Data.Signals.Features.Drawing;
|
||||
using Darkmatter.Libs.Observer;
|
||||
using ZLinq;
|
||||
|
||||
namespace Darkmatter.Features.DrawingCatalog.Systems;
|
||||
|
||||
@@ -15,7 +12,6 @@ public sealed class DrawingCatalogController : IDrawingCatalogController
|
||||
{
|
||||
private readonly IDrawingTemplateCatalog _catalog;
|
||||
private readonly IEventBus _bus;
|
||||
private readonly IProgressionSystem _progression;
|
||||
|
||||
private readonly List<string> _visible = new();
|
||||
public IReadOnlyList<string> VisibleIds => _visible;
|
||||
@@ -23,11 +19,9 @@ public sealed class DrawingCatalogController : IDrawingCatalogController
|
||||
|
||||
public DrawingCatalogController(
|
||||
IDrawingTemplateCatalog catalog,
|
||||
IProgressionSystem progression,
|
||||
IEventBus bus)
|
||||
{
|
||||
_catalog = catalog;
|
||||
_progression = progression;
|
||||
_bus = bus;
|
||||
}
|
||||
|
||||
@@ -45,13 +39,8 @@ public sealed class DrawingCatalogController : IDrawingCatalogController
|
||||
private void Refresh()
|
||||
{
|
||||
_visible.Clear();
|
||||
var all = _catalog.AllTemplateIds;
|
||||
foreach (var id in all)
|
||||
if (!_progression.CompletedTemplateIds.AsValueEnumerable().Contains(id))
|
||||
_visible.Add(id);
|
||||
foreach (var id in all)
|
||||
if (_progression.CompletedTemplateIds.AsValueEnumerable().Contains(id))
|
||||
_visible.Add(id);
|
||||
_visible.AddRange(_catalog.AllTemplateIds);
|
||||
_visible.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
ListChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user