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(DataConstants.RestaurantManagementSo); } 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.HideCount(); ui.HideMark(); ui.SetButtonInteractable(false); return; } ui.SetIcon(model.ItemSprite); ui.HideCount(); ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 ui.SetButtonInteractable(true); } public async Task GetAnimatorController() { return await AssetManager.LoadAsset(AnimatorControllerKey); } } }