using System.Threading.Tasks; using UnityEngine; namespace DDD { public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy { private readonly RecipeType _recipeType; private RestaurantManagementSo _restaurantManagementSo; public string AnimatorControllerKey => "TodayMenuSlotUi"; public TodayMenuSlotUiStrategy(RecipeType recipeType) { _recipeType = recipeType; } public async Task Setup(ItemSlotUi ui, ItemViewModel model) { _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.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); return; } string markSpriteKey = null; if (_restaurantManagementSo.IsCookwareMatched(ui.Model.Id)) { markSpriteKey = SpriteConstants.CheckYesSpriteKey; } else { markSpriteKey = SpriteConstants.CheckNoSpriteKey; } ui.SetIcon(model.ItemSprite); ui.HideCountText(); ui.ShowMark(DataManager.Instance.GetSprite(markSpriteKey)); ui.SetButtonInteractable(true); } public async Task GetAnimatorController() { return await AssetManager.LoadAsset(AnimatorControllerKey); } } }