artbook added to drawing
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Darkmatter.Core;
|
||||
using Darkmatter.Core.Data.Signals.Features.ShapeBuilder;
|
||||
using Darkmatter.Libs.Observer;
|
||||
using VContainer.Unity;
|
||||
@@ -22,11 +23,18 @@ namespace Darkmatter.Features.Coloring.UI
|
||||
{
|
||||
_view.HideInstant();
|
||||
_assembledSub = _bus.Subscribe<ShapeAssembledSignal>(_ => _view.Show());
|
||||
_view.OnArtbookClicked += HandleArtbookClicked;
|
||||
}
|
||||
|
||||
private void HandleArtbookClicked()
|
||||
{
|
||||
_bus.Publish(new OpenArtBookSignal());
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_assembledSub?.Dispose();
|
||||
_view.OnArtbookClicked -= HandleArtbookClicked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Darkmatter.Features.Coloring.UI
|
||||
{
|
||||
@@ -8,6 +10,7 @@ namespace Darkmatter.Features.Coloring.UI
|
||||
{
|
||||
[SerializeField] private RectTransform spawnRoot;
|
||||
[SerializeField] private RectTransform animatedRoot;
|
||||
[SerializeField] private Button artbookButton;
|
||||
[SerializeField] private float showDuration = 0.35f;
|
||||
[SerializeField] private float hideDuration = 0.25f;
|
||||
[SerializeField] private Vector2 hiddenOffset = new(1500f, 0f);
|
||||
@@ -17,9 +20,16 @@ namespace Darkmatter.Features.Coloring.UI
|
||||
private Sequence _activeSequence;
|
||||
private bool _refsReady;
|
||||
|
||||
public event Action OnArtbookClicked;
|
||||
public RectTransform SpawnRoot => spawnRoot;
|
||||
|
||||
private void Awake() => EnsureRefs();
|
||||
private void Awake()
|
||||
{
|
||||
EnsureRefs();
|
||||
if (artbookButton != null) artbookButton.onClick.AddListener(HandleArtbookClicked);
|
||||
}
|
||||
|
||||
private void HandleArtbookClicked() => OnArtbookClicked?.Invoke();
|
||||
|
||||
private void EnsureRefs()
|
||||
{
|
||||
@@ -80,5 +90,10 @@ namespace Darkmatter.Features.Coloring.UI
|
||||
{
|
||||
KillActive();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (artbookButton != null) artbookButton.onClick.RemoveListener(HandleArtbookClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Darkmatter.Core;
|
||||
using Darkmatter.Core.Data.Signals.Features.ShapeBuilder;
|
||||
using Darkmatter.Libs.Observer;
|
||||
using VContainer.Unity;
|
||||
@@ -24,12 +25,19 @@ namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
_view.HideInstant();
|
||||
_startedSub = _bus.Subscribe<ShapeBuilderStartedSignal>(_ => _view.Show());
|
||||
_assembledSub = _bus.Subscribe<ShapeAssembledSignal>(_ => _view.Hide());
|
||||
_view.OnArtbookClicked += HandleArtbookClicked;
|
||||
}
|
||||
|
||||
private void HandleArtbookClicked()
|
||||
{
|
||||
_bus.Publish(new OpenArtBookSignal());
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_startedSub?.Dispose();
|
||||
_assembledSub?.Dispose();
|
||||
_view.OnArtbookClicked -= HandleArtbookClicked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using Darkmatter.Features.ShapeBuilder.Systems;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
{
|
||||
@@ -8,6 +11,7 @@ namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
{
|
||||
[SerializeField] private RectTransform spawnRoot;
|
||||
[SerializeField] private RectTransform animatedRoot;
|
||||
[SerializeField] private Button artbookButton;
|
||||
[SerializeField] private float showDuration = 0.35f;
|
||||
[SerializeField] private float hideDuration = 0.25f;
|
||||
[SerializeField] private Vector2 hiddenOffset = new(1500f, 0f);
|
||||
@@ -15,6 +19,7 @@ namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
private CanvasGroup _canvasGroup;
|
||||
private Vector2 _shownAnchoredPos;
|
||||
private Sequence _activeSequence;
|
||||
public event Action OnArtbookClicked;
|
||||
|
||||
public RectTransform SpawnRoot => spawnRoot;
|
||||
public float SpawnWidth => spawnRoot.rect.width;
|
||||
@@ -24,6 +29,12 @@ namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
_canvasGroup = GetComponent<CanvasGroup>();
|
||||
if (animatedRoot == null) animatedRoot = (RectTransform)transform;
|
||||
_shownAnchoredPos = animatedRoot.anchoredPosition;
|
||||
artbookButton.onClick.AddListener(HandleArtbookClicked);
|
||||
}
|
||||
|
||||
private void HandleArtbookClicked()
|
||||
{
|
||||
OnArtbookClicked?.Invoke();
|
||||
}
|
||||
|
||||
public Sequence Show()
|
||||
@@ -73,5 +84,10 @@ namespace Darkmatter.Features.ShapeBuilder.UI
|
||||
{
|
||||
KillActive();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
artbookButton.onClick.RemoveListener(HandleArtbookClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user