init: add project

This commit is contained in:
Bragin Stepan
2026-02-18 23:02:28 +05:00
commit 4f01e66894
620 changed files with 52253 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f347709f80be4af28ebdfc850cd3c43a
timeCreated: 1771175621

View File

@@ -0,0 +1,27 @@
using System.Collections.Generic;
using _Project.Develop.Runtime.UI.Core;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Common
{
public class ElementsListView<TElement> : MonoBehaviour, IView where TElement : MonoBehaviour, IView
{
[SerializeField] private Transform _parent;
private List<TElement> _elements = new();
public IReadOnlyList<TElement> Elements => _elements;
public void Add(TElement element)
{
element.transform.SetParent(_parent);
_elements.Add(element);
}
public void Remove(TElement element)
{
element.transform.SetParent(null);
_elements.Remove(element);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 02b00825f490449690f1efdc31ede4e4
timeCreated: 1771176950

View File

@@ -0,0 +1,6 @@
namespace _Project.Develop.Runtime.UI.Common
{
public class IconTextListView : ElementsListView<IconTextView>
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cf2c40f7b2744ebeb706010ab50a1a3d
timeCreated: 1771176950

View File

@@ -0,0 +1,17 @@
using _Project.Develop.Runtime.UI.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Common
{
public class IconTextView : MonoBehaviour, IView
{
[SerializeField] private TMP_Text _text;
[SerializeField] private Image _icon;
public void SetText(string text) => _text.text = text;
public void SetIcon(Sprite icon) => _icon.sprite = icon;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 066c31a029034b4399c6e94b9b71e2bf
timeCreated: 1771176950

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f501394c294a43d0bf1232b97ebab77f
timeCreated: 1771175627

View File

@@ -0,0 +1,9 @@
using System;
using Assets._Project.Develop.Runtime.Infrastructure.DI;
namespace _Project.Develop.Runtime.UI.Core
{
public interface IPresenter : IInitializable, IDisposable
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a17e59c1efc943e58a2b04d44c05dbb0
timeCreated: 1771176342

View File

@@ -0,0 +1,11 @@
using DG.Tweening;
namespace _Project.Develop.Runtime.UI.Core
{
public interface IShowableView : IView
{
Tween Hide();
Tween Show();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9ab969c7e9ba4be7a812a8acfe2f67f2
timeCreated: 1771176390

View File

@@ -0,0 +1,9 @@
namespace _Project.Develop.Runtime.UI.Core
{
public interface ISubscribedPresenter : IPresenter
{
void Subscribe();
void Unsubscribe();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 24d2618113084abd80985f301bd7ba08
timeCreated: 1771254519

View File

@@ -0,0 +1,6 @@
namespace _Project.Develop.Runtime.UI.Core
{
public interface IView
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 15a89ddc28a94bcd9fda454a9aed023d
timeCreated: 1771176342

View File

@@ -0,0 +1,9 @@
namespace _Project.Develop.Runtime.UI.Core
{
public enum PopupAnimationTypes
{
None,
Expand,
Fade,
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7c220d1730874166b73b2577e1fbc87b
timeCreated: 1771176806

View File

@@ -0,0 +1,54 @@
using DG.Tweening;
using System;
using UnityEngine;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Core
{
public class PopupAnimationsCreator
{
public static Sequence CreateShowAnimation(
CanvasGroup body,
Image anticlicker,
PopupAnimationTypes animationType,
float anticlickerMaxAlpha)
{
switch (animationType)
{
case PopupAnimationTypes.None:
return DOTween.Sequence();
case PopupAnimationTypes.Expand:
return DOTween.Sequence()
.Append(anticlicker
.DOFade(anticlickerMaxAlpha, 0.2f)
.From(0))
.Join(body.transform
.DOScale(1, 0.5f)
.From(0)
.SetEase(Ease.OutBack));
case PopupAnimationTypes.Fade:
return DOTween.Sequence()
.Append(anticlicker
.DOFade(anticlickerMaxAlpha, 0.2f)
.From(0))
.Join(body
.DOFade(1, 0.3f)
.From(0));
default:
throw new ArgumentException(nameof(animationType));
}
}
public static Sequence CreateHideAnimation(
CanvasGroup body,
Image anticlicker,
PopupAnimationTypes animationType,
float anticlickerMaxAlpha)
{
return DOTween.Sequence();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ed279ea4e31b4eaeadae7447bf3bf1c1
timeCreated: 1771176390

View File

@@ -0,0 +1,91 @@
using DG.Tweening;
using System;
using System.Collections;
using Assets._Project.Develop.Runtime.Utilities.CoroutinesManagement;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Core
{
public abstract class PopupPresenterBase : IPresenter
{
public event Action<PopupPresenterBase> CloseRequest;
private readonly ICoroutinesPerformer _coroutinesPerformer;
private Coroutine _process;
protected PopupPresenterBase(ICoroutinesPerformer coroutinesPerformer)
{
_coroutinesPerformer = coroutinesPerformer;
}
protected abstract PopupViewBase PopupView { get; }
public virtual void Initialize()
{
}
public virtual void Dispose()
{
KillProcess();
PopupView.CloseRequest -= OnCloseRequest;
}
public void Show()
{
KillProcess();
_process = _coroutinesPerformer.StartPerform(ProcessShow());
}
public void Hide(Action callback = null)
{
KillProcess();
_process = _coroutinesPerformer.StartPerform(ProcessHide(callback));
}
protected virtual void OnPostShow() { }
protected virtual void OnPreShow()
{
PopupView.CloseRequest += OnCloseRequest;
}
protected virtual void OnPostHide() { }
protected virtual void OnPreHide()
{
PopupView.CloseRequest -= OnCloseRequest;
}
protected void OnCloseRequest() => CloseRequest?.Invoke(this);
private IEnumerator ProcessShow()
{
OnPreShow();
yield return PopupView.Show().WaitForCompletion();
OnPostShow();
}
private IEnumerator ProcessHide(Action callback)
{
OnPreHide();
yield return PopupView.Hide().WaitForCompletion();
OnPostHide();
callback?.Invoke();
}
private void KillProcess()
{
if (_process != null)
_coroutinesPerformer.StopPerform(_process);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f2bcb255ad1a4e33a7ba1b8fde4074ba
timeCreated: 1771176390

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using _Project.Develop.Runtime.UI.Features.LevelsMenuPopup;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Core
{
public abstract class PopupService : IDisposable
{
protected readonly ViewsFactory ViewsFactory;
private readonly ProjectPresentersFactory _presentersFactory;
private readonly Dictionary<PopupPresenterBase, PopupInfo> _presenterToInfo = new();
protected PopupService(
ViewsFactory viewsFactory,
ProjectPresentersFactory presentersFactory)
{
ViewsFactory = viewsFactory;
_presentersFactory = presentersFactory;
}
protected abstract Transform PopupLayer { get; }
public LevelsMenuPopupPresenter OpenLevelsMenuPopup()
{
LevelsMenuPopupView view = ViewsFactory.Create<LevelsMenuPopupView>(PopupLayer);
LevelsMenuPopupPresenter popup = _presentersFactory.CreateLevelsMenuPopupPresenter(view);
OnPopupCreated(popup, view);
return popup;
}
public void ClosePopup(PopupPresenterBase popup)
{
popup.CloseRequest -= ClosePopup;
popup.Hide(() =>
{
_presenterToInfo[popup].ClosedCallback?.Invoke();
DisposeFor(popup);
_presenterToInfo.Remove(popup);
});
}
public void Dispose()
{
foreach (PopupPresenterBase popup in _presenterToInfo.Keys)
{
popup.CloseRequest -= ClosePopup;
DisposeFor(popup);
}
_presenterToInfo.Clear();
}
protected void OnPopupCreated(
PopupPresenterBase popup,
PopupViewBase view,
Action closedCallback = null)
{
PopupInfo popupInfo = new PopupInfo(view, closedCallback);
_presenterToInfo.Add(popup, popupInfo);
popup.Initialize();
popup.Show();
popup.CloseRequest += ClosePopup;
}
private void DisposeFor(PopupPresenterBase popup)
{
popup.Dispose();
ViewsFactory.Release(_presenterToInfo[popup].View);
}
private class PopupInfo
{
public PopupInfo(PopupViewBase view, Action closedCallback)
{
View = view;
ClosedCallback = closedCallback;
}
public PopupViewBase View { get; }
public Action ClosedCallback { get; }
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d07420c6238f4b768b5236645c498ea6
timeCreated: 1771176390

View File

@@ -0,0 +1,84 @@
using System;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Core
{
public abstract class PopupViewBase : MonoBehaviour, IShowableView
{
public event Action CloseRequest;
[SerializeField] private CanvasGroup _mainGroup;
[SerializeField] private Image _anticlicker;
[SerializeField] private CanvasGroup _body;
[SerializeField] private PopupAnimationTypes _animationType;
private float _anticlickerDefaultAlpha;
private Tween _currentAnimation;
private void Awake()
{
_anticlickerDefaultAlpha = _anticlicker.color.a;
_mainGroup.alpha = 0;
}
public void OnCloseButtonClicked() => CloseRequest?.Invoke();
public Tween Show()
{
KillCurrentAnimation();
OnPreShow();
//тут анимация
_mainGroup.alpha = 1;
Sequence animation = PopupAnimationsCreator
.CreateShowAnimation(_body, _anticlicker, _animationType, _anticlickerDefaultAlpha);
ModifyShowAnimation(animation);
animation.OnComplete(OnPostShow);
return _currentAnimation = animation.SetUpdate(true).Play();
}
public Tween Hide()
{
KillCurrentAnimation();
OnPreHide();
Sequence animation = PopupAnimationsCreator
.CreateHideAnimation(_body, _anticlicker, _animationType, _anticlickerDefaultAlpha);
ModifyHideAnimation(animation);
animation.OnComplete(OnPostHide);
return _currentAnimation = animation.SetUpdate(true).Play();
}
protected virtual void ModifyShowAnimation(Sequence animation) { }
protected virtual void ModifyHideAnimation(Sequence animation) { }
protected virtual void OnPostShow() { }
protected virtual void OnPreShow() { }
protected virtual void OnPostHide() { }
protected virtual void OnPreHide() { }
private void OnDestroy() => KillCurrentAnimation();
private void KillCurrentAnimation()
{
if (_currentAnimation != null)
_currentAnimation.Kill();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3b5337111ada49188180124a87d5fba4
timeCreated: 1771176390

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using Assets._Project.Develop.Runtime.Utilities.AssetsManagement;
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
using UnityEngine;
using Object = UnityEngine.Object;
namespace _Project.Develop.Runtime.UI.Core
{
public class ViewsFactory
{
private readonly ResourcesAssetsLoader _resourcesAssetsLoader;
private readonly Dictionary<Type, string> _uiPaths = new (PathToResources.UIPaths);
public ViewsFactory(ResourcesAssetsLoader resourcesAssetsLoader)
{
_resourcesAssetsLoader = resourcesAssetsLoader;
}
public TView Create<TView>(Transform parent = null) where TView : MonoBehaviour, IView
{
if (_uiPaths.TryGetValue(typeof(TView), out string resourcePath) == false)
throw new KeyNotFoundException($"[ViewsFactory] Path for {typeof(TView)} not found");
GameObject prefab = _resourcesAssetsLoader.Load<GameObject>(resourcePath);
GameObject instance = Object.Instantiate(prefab, parent);
TView view = instance.GetComponent<TView>();
if (view == null)
throw new InvalidOperationException($"Not found {typeof(TView)} component on view instance");
return view;
}
public void Release<TView>(TView view) where TView : MonoBehaviour, IView
{
Object.Destroy(view.gameObject);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1ba849f2eb0e4d2e9df3e02e38cbd1e4
timeCreated: 1771175897

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4f0d7c06be804b8c8c2252a35abc178e
timeCreated: 1771175646

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b52c6eac56c54cdaba19b52e7c3e3ef1
timeCreated: 1771322162

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 91fa696b25444f7e9740c5c01edb6b2c
timeCreated: 1771322188

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8cbb0d7029e44b3e89d77dafd247facc
timeCreated: 1771254327

View File

@@ -0,0 +1,48 @@
using _Project.Develop.Runtime.UI.Core;
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
namespace _Project.Develop.Runtime.UI.Features.LevelsMenuPopup
{
public class LevelTilePresenter : ISubscribedPresenter
{
private readonly SceneSwitcherService _sceneSwitcherService;
private readonly LevelTileView _view;
public LevelTilePresenter(
SceneSwitcherService sceneSwitcherService,
LevelTileView view)
{
_sceneSwitcherService = sceneSwitcherService;
_view = view;
}
public LevelTileView View => _view;
public void Initialize()
{
// _view.SetLevel(_gameMode.ToString());
_view.SetActive();
}
public void Dispose()
{
_view.Clicked -= OnViewClicked;
}
public void Subscribe()
{
_view.Clicked += OnViewClicked;
}
public void Unsubscribe()
{
_view.Clicked -= OnViewClicked;
}
private void OnViewClicked()
{
// _gameRunner.Run(_gameMode);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: db8fa6c3e70e4981a03262ef8daaa925
timeCreated: 1771254366

View File

@@ -0,0 +1,65 @@
using DG.Tweening;
using System;
using _Project.Develop.Runtime.UI.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Features.LevelsMenuPopup
{
public class LevelTileView : MonoBehaviour, IShowableView
{
public event Action Clicked;
[SerializeField] private Image _background;
[SerializeField] private TMP_Text _levelNumberText;
[SerializeField] private Button _button;
[SerializeField] private Color _activeColor;
[SerializeField] private Color _completedColor;
[SerializeField] private Color _blockedColor;
private void OnEnable()
{
_button.onClick.AddListener(OnClick);
}
private void OnDisable()
{
_button.onClick.RemoveListener(OnClick);
}
public void SetLevel(string level) => _levelNumberText.text = level;
public void SetBlock() => _background.color = _blockedColor;
public void SetComplete() => _background.color = _completedColor;
public void SetActive() => _background.color = _activeColor;
public Tween Show()
{
transform.DOKill();
return transform
.DOScale(1, 0.1f)
.From(0)
.SetUpdate(true)
.Play();
}
public Tween Hide()
{
transform.DOKill();
return DOTween.Sequence();
}
private void OnDestroy()
{
transform.DOKill();
}
private void OnClick() => Clicked?.Invoke();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e5bff9d68670434684a58ae2d132ea9d
timeCreated: 1771254366

View File

@@ -0,0 +1,8 @@
using _Project.Develop.Runtime.UI.Common;
namespace _Project.Develop.Runtime.UI.Features.LevelsMenuPopup
{
public class LevelTilesListView : ElementsListView<LevelTileView>
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b70d87f107814fc18168ed2dc9d87357
timeCreated: 1771254366

View File

@@ -0,0 +1,87 @@
using System.Collections.Generic;
using _Project.Develop.Runtime.Configs.Gameplay.Levels;
using _Project.Develop.Runtime.UI.Core;
using Assets._Project.Develop.Runtime.Utilities.ConfigsManagement;
using Assets._Project.Develop.Runtime.Utilities.CoroutinesManagement;
namespace _Project.Develop.Runtime.UI.Features.LevelsMenuPopup
{
public class LevelsMenuPopupPresenter : PopupPresenterBase
{
private const string TitleName = "Levels";
private readonly ConfigsProviderService _configsProviderService;
private readonly ProjectPresentersFactory _presentersFactory;
private readonly ViewsFactory _viewsFactory;
private readonly LevelsMenuPopupView _view;
private readonly List<LevelTilePresenter> _levelTilePresenters = new();
public LevelsMenuPopupPresenter(
ICoroutinesPerformer coroutinesPerformer,
ConfigsProviderService configsProviderService,
ProjectPresentersFactory presentersFactory,
ViewsFactory viewsFactory,
LevelsMenuPopupView view) : base(coroutinesPerformer)
{
_configsProviderService = configsProviderService;
_presentersFactory = presentersFactory;
_viewsFactory = viewsFactory;
_view = view;
}
protected override PopupViewBase PopupView => _view;
public override void Initialize()
{
base.Initialize();
_view.SetTitle(TitleName);
LevelsListConfigSO levelsListConfig = _configsProviderService.GetConfig<LevelsListConfigSO>();
foreach (LevelConfigSO level in levelsListConfig.Levels)
{
LevelTileView levelTileView = _viewsFactory.Create<LevelTileView>();
_view.LevelTilesListView.Add(levelTileView);
LevelTilePresenter levelTilePresenter = _presentersFactory.CreateLevelTilePresenter(levelTileView);
levelTilePresenter.Initialize();
_levelTilePresenters.Add(levelTilePresenter);
}
}
public override void Dispose()
{
base.Dispose();
foreach (LevelTilePresenter levelTilePresenter in _levelTilePresenters)
{
_view.LevelTilesListView.Remove(levelTilePresenter.View);
_viewsFactory.Release(levelTilePresenter.View);
levelTilePresenter.Dispose();
}
_levelTilePresenters.Clear();
}
protected override void OnPreShow()
{
base.OnPreShow();
foreach (LevelTilePresenter levelTilePresenter in _levelTilePresenters)
levelTilePresenter.Subscribe();
}
protected override void OnPreHide()
{
base.OnPreHide();
foreach (LevelTilePresenter levelTilePresenter in _levelTilePresenters)
levelTilePresenter.Unsubscribe();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 67b599a9fa6947d8baed6cd4db4dfaca
timeCreated: 1771254366

View File

@@ -0,0 +1,28 @@
using _Project.Develop.Runtime.UI.Core;
using DG.Tweening;
using TMPro;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Features.LevelsMenuPopup
{
public class LevelsMenuPopupView : PopupViewBase
{
[SerializeField] private TMP_Text _title;
[SerializeField] private LevelTilesListView _levelTilesListView;
public LevelTilesListView LevelTilesListView => _levelTilesListView;
public void SetTitle(string title) => _title.text = title;
protected override void ModifyShowAnimation(Sequence animation)
{
base.ModifyShowAnimation(animation);
foreach (LevelTileView levelTileView in _levelTilesListView.Elements)
{
animation.Append(levelTileView.Show());
animation.AppendInterval(0.1f);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f8760059e45a42a5bac5cc657ffed36c
timeCreated: 1771254366

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5d22d0fc68a146ebb59f28768ea0e018
timeCreated: 1771177329

View File

@@ -0,0 +1,51 @@
using System;
using _Project.Develop.Runtime.Configs.Meta;
using _Project.Develop.Runtime.Logic.Meta.Features.Wallet;
using _Project.Develop.Runtime.UI.Common;
using _Project.Develop.Runtime.UI.Core;
using _Project.Develop.Runtime.Utils.ReactiveManagement;
namespace _Project.Develop.Runtime.UI.Features.Wallet
{
public class CurrencyPresenter : IPresenter
{
private readonly IReadOnlyVariable<int> _currency;
private readonly CurrencyTypes _currencyType;
private readonly CurrencyIconsConfigSO _currencyIconsConfig;
private readonly IconTextView _view;
private IDisposable _disposable;
public CurrencyPresenter(
IReadOnlyVariable<int> currency,
CurrencyTypes currencyType,
CurrencyIconsConfigSO currencyIconsConfig,
IconTextView view)
{
_currency = currency;
_currencyType = currencyType;
_currencyIconsConfig = currencyIconsConfig;
_view = view;
}
public IconTextView View => _view;
public void Initialize()
{
UpdateValue(_currency.Value);
_view.SetIcon(_currencyIconsConfig.GetSpriteFor(_currencyType));
_disposable = _currency.Subscribe(OnCurrencyChanged);
}
public void Dispose()
{
_disposable.Dispose();
}
private void OnCurrencyChanged(int arg1, int newValue) => UpdateValue(newValue);
private void UpdateValue(int value) => _view.SetText(value.ToString());
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 969e239137404e7e9d12b4b229fe7efb
timeCreated: 1771177336

View File

@@ -0,0 +1,62 @@
using Assets._Project.Develop.Runtime.Meta.Features.Wallet;
using System.Collections.Generic;
using _Project.Develop.Runtime.Logic.Meta.Features.Wallet;
using _Project.Develop.Runtime.UI.Common;
using _Project.Develop.Runtime.UI.Core;
namespace _Project.Develop.Runtime.UI.Features.Wallet
{
public class WalletPresenter : IPresenter
{
private readonly WalletService _walletService;
private readonly ProjectPresentersFactory _presentersFactory;
private readonly ViewsFactory _viewsFactory;
private readonly IconTextListView _view;
private readonly List<CurrencyPresenter> _currencyPresenters = new();
public WalletPresenter(
WalletService walletService,
ProjectPresentersFactory presentersFactory,
ViewsFactory viewsFactory,
IconTextListView view)
{
_walletService = walletService;
_presentersFactory = presentersFactory;
_viewsFactory = viewsFactory;
_view = view;
}
public void Initialize()
{
foreach (CurrencyTypes currencyType in _walletService.AvailableCurrencies)
{
IconTextView currencyView = _viewsFactory.Create<IconTextView>();
_view.Add(currencyView);
CurrencyPresenter currencyPresenter = _presentersFactory.CreateCurrencyPresenter(
currencyView,
_walletService.GetCurrency(currencyType),
currencyType);
currencyPresenter.Initialize();
_currencyPresenters.Add(currencyPresenter);
}
}
public void Dispose()
{
foreach (CurrencyPresenter currencyPresenter in _currencyPresenters)
{
_view.Remove(currencyPresenter.View);
_viewsFactory.Release(currencyPresenter.View);
currencyPresenter.Dispose();
}
_currencyPresenters.Clear();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b59b18c1bd074e5fa613924a9bd36a54
timeCreated: 1771177336

View File

@@ -0,0 +1,63 @@
using _Project.Develop.Runtime.Configs.Meta;
using _Project.Develop.Runtime.Logic.Meta.Features.Wallet;
using _Project.Develop.Runtime.UI.Common;
using _Project.Develop.Runtime.UI.Core;
using _Project.Develop.Runtime.UI.Features.LevelsMenuPopup;
using _Project.Develop.Runtime.UI.Features.Wallet;
using _Project.Develop.Runtime.Utils.ReactiveManagement;
using Assets._Project.Develop.Runtime.Infrastructure.DI;
using Assets._Project.Develop.Runtime.Meta.Features.Wallet;
using Assets._Project.Develop.Runtime.Utilities.ConfigsManagement;
using Assets._Project.Develop.Runtime.Utilities.CoroutinesManagement;
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
namespace _Project.Develop.Runtime.UI
{
public class ProjectPresentersFactory
{
private readonly DIContainer _container;
public ProjectPresentersFactory(DIContainer container)
{
_container = container;
}
public CurrencyPresenter CreateCurrencyPresenter(
IconTextView view,
IReadOnlyVariable<int> currency,
CurrencyTypes currencyType)
{
return new CurrencyPresenter(
currency,
currencyType,
_container.Resolve<ConfigsProviderService>().GetConfig<CurrencyIconsConfigSO>(),
view);
}
public WalletPresenter CreateWalletPresenter(IconTextListView view)
{
return new WalletPresenter(
_container.Resolve<WalletService>(),
this,
_container.Resolve<ViewsFactory>(),
view);
}
public LevelTilePresenter CreateLevelTilePresenter(LevelTileView view)
{
return new LevelTilePresenter(
_container.Resolve<SceneSwitcherService>(),
view);
}
public LevelsMenuPopupPresenter CreateLevelsMenuPopupPresenter(LevelsMenuPopupView view)
{
return new LevelsMenuPopupPresenter(
_container.Resolve<ICoroutinesPerformer>(),
_container.Resolve<ConfigsProviderService>(),
this,
_container.Resolve<ViewsFactory>(),
view);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e9d46aca25534516bc995c9a57610a69
timeCreated: 1771176845

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 28e2d01f86bd4105b3626f1f8ce99a47
timeCreated: 1771175653

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e9abb012cc084ddf8a6eb3c0ffcbe7ea
timeCreated: 1771175669

View File

@@ -0,0 +1,24 @@
using _Project.Develop.Runtime.UI.Core;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Screens.Gameplay
{
public class GameplayPopupService : PopupService
{
private readonly GameplayUIRoot _uiRoot;
private readonly GameplayPresentersFactory _gameplayPresentersFactory;
public GameplayPopupService(
ViewsFactory viewsFactory,
ProjectPresentersFactory presentersFactory,
GameplayUIRoot uiRoot,
GameplayPresentersFactory gameplayPresentersFactory)
: base(viewsFactory, presentersFactory)
{
_uiRoot = uiRoot;
_gameplayPresentersFactory = gameplayPresentersFactory;
}
protected override Transform PopupLayer => _uiRoot.PopupsLayer;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fdaa21e8b819445e837fefce1642703e
timeCreated: 1771178011

View File

@@ -0,0 +1,24 @@
using Assets._Project.Develop.Runtime.Infrastructure.DI;
using Assets._Project.Develop.Runtime.Meta.Features.Wallet;
namespace _Project.Develop.Runtime.UI.Screens.Gameplay
{
public class GameplayPresentersFactory
{
private readonly DIContainer _container;
public GameplayPresentersFactory(DIContainer container)
{
_container = container;
}
public GameplayScreenPresenter CreateGameplayScreenPresenter(GameplayScreenView view)
{
return new GameplayScreenPresenter(
view,
_container.Resolve<WalletService>(),
_container.Resolve<GameplayPresentersFactory>(),
_container.Resolve<ProjectPresentersFactory>());
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2bfe1c715c56498d815f1046bd37a70d
timeCreated: 1771178011

View File

@@ -0,0 +1,59 @@
using System.Collections.Generic;
using _Project.Develop.Runtime.Logic.Meta.Features.Wallet;
using _Project.Develop.Runtime.UI.Core;
using _Project.Develop.Runtime.UI.Features.Wallet;
using Assets._Project.Develop.Runtime.Meta.Features.Wallet;
namespace _Project.Develop.Runtime.UI.Screens.Gameplay
{
public class GameplayScreenPresenter : IPresenter
{
private readonly GameplayScreenView _screen;
private readonly WalletService _walletService;
private readonly GameplayPresentersFactory _gameplayPresentersFactory;
private readonly ProjectPresentersFactory _projectPresentersFactory;
private readonly List<IPresenter> _childPresenters = new();
public GameplayScreenPresenter(
GameplayScreenView screen,
WalletService walletService,
GameplayPresentersFactory gameplayPresentersFactory,
ProjectPresentersFactory projectPresentersFactory)
{
_screen = screen;
_walletService = walletService;
_gameplayPresentersFactory = gameplayPresentersFactory;
_projectPresentersFactory = projectPresentersFactory;
}
public void Initialize()
{
CreateCoins();
foreach (IPresenter presenter in _childPresenters)
presenter.Initialize();
}
private void CreateCoins()
{
CurrencyPresenter presenter = _projectPresentersFactory.CreateCurrencyPresenter(
_screen.CoinsView,
_walletService.GetCurrency(CurrencyTypes.Gold),
CurrencyTypes.Gold);
_childPresenters.Add(presenter);
}
public void Dispose()
{
foreach (IPresenter presenter in _childPresenters)
presenter.Dispose();
_childPresenters.Clear();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 51b3b1ae0ddd46c2b3ff9bc479e049ae
timeCreated: 1771178011

View File

@@ -0,0 +1,12 @@
using _Project.Develop.Runtime.UI.Common;
using _Project.Develop.Runtime.UI.Core;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Screens.Gameplay
{
public class GameplayScreenView : MonoBehaviour, IView
{
[field: SerializeField] public IconTextView CoinsView { get; private set; }
[field: SerializeField] public IconTextListView StatsView { get; private set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: eeaaaa56d8fa466ea3569279bcc1f591
timeCreated: 1771178011

View File

@@ -0,0 +1,13 @@
using UnityEngine;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Screens.Gameplay
{
public class GameplayUIRoot : MonoBehaviour
{
[field: SerializeField] public Transform HUDLayer { get; private set; }
[field: SerializeField] public Transform PopupsLayer { get; private set; }
[field: SerializeField] public Transform VFXUnderPopupsLayer { get; private set; }
[field: SerializeField] public Transform VFXOverPopupsLayer { get; private set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f61e203efd9e455ca1578edc51948477
timeCreated: 1771178011

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bbd8028d232a4654a3b8fd46280afc41
timeCreated: 1771175676

View File

@@ -0,0 +1,21 @@
using _Project.Develop.Runtime.UI.Core;
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Screens.MainMenu
{
public class MainMenuPopupService : PopupService
{
private readonly MainMenuUIRoot _uiRoot;
public MainMenuPopupService(
ViewsFactory viewsFactory,
ProjectPresentersFactory presentersFactory,
MainMenuUIRoot uiRoot)
: base(viewsFactory, presentersFactory)
{
_uiRoot = uiRoot;
}
protected override Transform PopupLayer => _uiRoot.PopupsLayer;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b8915fbd3a06462882defa0995a7f382
timeCreated: 1771177835

View File

@@ -0,0 +1,22 @@
using Assets._Project.Develop.Runtime.Infrastructure.DI;
namespace _Project.Develop.Runtime.UI.Screens.MainMenu
{
public class MainMenuPresentersFactory
{
private readonly DIContainer _container;
public MainMenuPresentersFactory(DIContainer container)
{
_container = container;
}
public MainMenuScreenPresenter CreateMainMenuScreen(MainMenuScreenView view)
{
return new MainMenuScreenPresenter(
view,
_container.Resolve<ProjectPresentersFactory>(),
_container.Resolve<MainMenuPopupService>());
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5db00ccae66241c39f8040ef76137734
timeCreated: 1771177835

View File

@@ -0,0 +1,57 @@
using System.Collections.Generic;
using _Project.Develop.Runtime.UI.Core;
using _Project.Develop.Runtime.UI.Features.Wallet;
namespace _Project.Develop.Runtime.UI.Screens.MainMenu
{
public class MainMenuScreenPresenter : IPresenter
{
private readonly MainMenuScreenView _screen;
private readonly ProjectPresentersFactory _projectPresentersFactory;
private readonly MainMenuPopupService _popupService;
private readonly List<IPresenter> _childPresenters = new();
public MainMenuScreenPresenter(
MainMenuScreenView screen,
ProjectPresentersFactory projectPresentersFactory,
MainMenuPopupService popupService)
{
_screen = screen;
_projectPresentersFactory = projectPresentersFactory;
_popupService = popupService;
}
public void Initialize()
{
_screen.OpenLevelsMenuButtonClicked += OnOpenLevelsMenuButtonClicked;
CreateWallet();
foreach (IPresenter presenter in _childPresenters)
presenter.Initialize();
}
public void Dispose()
{
_screen.OpenLevelsMenuButtonClicked -= OnOpenLevelsMenuButtonClicked;
foreach (IPresenter presenter in _childPresenters)
presenter.Dispose();
_childPresenters.Clear();
}
private void CreateWallet()
{
WalletPresenter walletPresenter = _projectPresentersFactory.CreateWalletPresenter(_screen.WalletView);
_childPresenters.Add(walletPresenter);
}
private void OnOpenLevelsMenuButtonClicked()
{
_popupService.OpenLevelsMenuPopup();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 95604473adb94e25b30a819cd13b7b48
timeCreated: 1771177835

View File

@@ -0,0 +1,35 @@
using System;
using _Project.Develop.Runtime.UI.Common;
using _Project.Develop.Runtime.UI.Core;
using UnityEngine;
using UnityEngine.UI;
namespace _Project.Develop.Runtime.UI.Screens.MainMenu
{
public class MainMenuScreenView : MonoBehaviour, IView
{
public event Action OpenLevelsMenuButtonClicked;
public event Action ResetStatsButtonClicked;
[field: SerializeField] public IconTextListView WalletView { get; private set; }
[field: SerializeField] public IconTextListView StatsView { get; private set; }
[SerializeField] private Button _openLevelsMenuButton;
[SerializeField] private Button _resetStatsButton;
private void OnEnable()
{
_openLevelsMenuButton.onClick.AddListener(OnOpenLevelsMenuButtonClicked);
_resetStatsButton.onClick.AddListener(OnResetStatsButtonClicked);
}
private void OnDisable()
{
_openLevelsMenuButton.onClick.RemoveListener(OnOpenLevelsMenuButtonClicked);
_resetStatsButton.onClick.RemoveListener(OnResetStatsButtonClicked);
}
private void OnOpenLevelsMenuButtonClicked() => OpenLevelsMenuButtonClicked?.Invoke();
private void OnResetStatsButtonClicked() => ResetStatsButtonClicked?.Invoke();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 75ddbca774384573879ac9aaa9f84738
timeCreated: 1771177835

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace _Project.Develop.Runtime.UI.Screens.MainMenu
{
public class MainMenuUIRoot : MonoBehaviour
{
[field: SerializeField] public Transform HUDLayer { get; private set; }
[field: SerializeField] public Transform PopupsLayer { get; private set; }
[field: SerializeField] public Transform VFXUnderPopupsLayer { get; private set; }
[field: SerializeField] public Transform VFXOverPopupsLayer { get; private set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 76e84f5cbfeb49d48f6c97834fc81f0e
timeCreated: 1771177835