43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using System;
|
|
using Code.Calendar.Constants;
|
|
using Code.Calendar.DataStructures;
|
|
using Code.Infrastructure.UI;
|
|
using PrimeTween;
|
|
using Reflex.Attributes;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Code.Calendar.Panels
|
|
{
|
|
public class PlantAddPanel : UIPanel
|
|
{
|
|
[Inject] private IPlantService _plantService;
|
|
[SerializeField] private TMP_InputField plantName;
|
|
[SerializeField] private Image image;
|
|
|
|
public void TryGetIcon()
|
|
{
|
|
|
|
}
|
|
public void TryAddPlant()
|
|
{
|
|
Plant newPlant = new()
|
|
{
|
|
Name = plantName.text,
|
|
IconPath = null
|
|
};
|
|
_plantService.AddPlant(newPlant);
|
|
}
|
|
|
|
public override void Open(Action callback = null)
|
|
{
|
|
Tween.Alpha(image, 1f, 1f).OnComplete(target: this, _ => callback?.Invoke());
|
|
}
|
|
|
|
public override void Close(Action callback = null)
|
|
{
|
|
Tween.Alpha(image, 0f, 1f).OnComplete(target: this, _ => callback?.Invoke());
|
|
}
|
|
}
|
|
} |