mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
init: add project
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02b00825f490449690f1efdc31ede4e4
|
||||
timeCreated: 1771176950
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace _Project.Develop.Runtime.UI.Common
|
||||
{
|
||||
public class IconTextListView : ElementsListView<IconTextView>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf2c40f7b2744ebeb706010ab50a1a3d
|
||||
timeCreated: 1771176950
|
||||
17
Assets/_Project/Develop/Runtime/UI/Common/IconTextView.cs
Normal file
17
Assets/_Project/Develop/Runtime/UI/Common/IconTextView.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 066c31a029034b4399c6e94b9b71e2bf
|
||||
timeCreated: 1771176950
|
||||
Reference in New Issue
Block a user