ProjectDDD/Assets/_DDD/_Scripts/Restaurant/Ui/CookUi/AddedCookSlotUiStrategy.cs
2025-08-27 17:25:11 +09:00

49 lines
1.5 KiB
C#

using UnityEngine;
namespace DDD.Restaurant
{
public class AddedCookSlotUiStrategy : IItemSlotUiStrategy
{
private readonly RecipeType _recipeType;
public AddedCookSlotUiStrategy(RecipeType recipeType)
{
_recipeType = recipeType;
}
public void Setup(ItemSlotUi ui, ItemModel model)
{
if (model == null)
{
string emptySpriteKey = null;
if (_recipeType == RecipeType.FoodRecipe)
{
emptySpriteKey = SpriteConstants.EmptyFoodSpriteKey;
}
else if (_recipeType == RecipeType.DrinkRecipe)
{
emptySpriteKey = SpriteConstants.EmptyDrinkSpriteKey;
}
ui.SetIcon(DataManager.Instance.GetSprite(emptySpriteKey));
ui.HideCountText();
ui.HideMark();
ui.SetButtonInteractable(false);
ui.SetCommonButtonUsed(false);
return;
}
ui.SetIcon(model.ItemSprite);
ui.ShowCountText();
ui.HideMark();
ui.SetButtonInteractable(true);
ui.SetCommonButtonUsed(true);
}
public RuntimeAnimatorController GetAnimatorController()
{
return RestaurantData.Instance.ManagementData.InventorySlotUiAnimatorController;
}
}
}