ProjectDDD/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs
2025-07-30 03:18:16 +09:00

58 lines
2.0 KiB
C#

using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace DDD
{
public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy
{
private RestaurantManagementSo _restaurantManagementSo;
private readonly RecipeType _recipeType;
public string AnimatorControllerKey => "TodayMenuSlotUi";
public TodayMenuSlotUiStrategy(RecipeType recipeType)
{
_recipeType = recipeType;
}
public async Task Setup(ItemSlotUi ui, ItemViewModel model)
{
if (!_restaurantManagementSo)
{
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
}
if (model == null)
{
string emptySpriteKey = null;
if (_recipeType == RecipeType.FoodRecipe)
{
emptySpriteKey = SpriteConstants.EmptyFoodSpriteKey;
}
else if (_recipeType == RecipeType.DrinkRecipe)
{
emptySpriteKey = SpriteConstants.EmptyDrinkSpriteKey;
}
ui.SetBackgroundColor(_restaurantManagementSo.EmptyBackgroundColor);
ui.SetIcon(DataManager.Instance.GetSprite(emptySpriteKey));
ui.HideCount();
ui.HideMark();
ui.SetButtonInteractable(false);
return;
}
ui.SetBackgroundColor(_restaurantManagementSo.AddedBackgroundColor);
ui.SetIcon(model.ItemSprite);
ui.HideCount();
ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭
ui.SetButtonInteractable(true);
}
public async Task<RuntimeAnimatorController> GetAnimatorController()
{
return await AssetManager.LoadAsset<RuntimeAnimatorController>(AnimatorControllerKey);
}
}
}