220 lines
7.8 KiB
C#
220 lines
7.8 KiB
C#
// using System;
|
|
// using System.Collections.Generic;
|
|
// using System.Linq;
|
|
// using BlueWater.Items;
|
|
// using BlueWater.Tycoons;
|
|
// using Sirenix.OdinInspector;
|
|
// using UnityEngine;
|
|
// using UnityEngine.Serialization;
|
|
//
|
|
// namespace BlueWater.Uis
|
|
// {
|
|
// public class DailyFoodMenuUi : MonoBehaviour
|
|
// {
|
|
// [Title("프리팹 생성 위치")]
|
|
// [SerializeField, Required]
|
|
// private Transform _soupFoodSlotLocation;
|
|
//
|
|
// [FormerlySerializedAs("_fryingPanFoodSlotLocation")]
|
|
// [SerializeField, Required]
|
|
// private Transform _grillFoodSlotLocation;
|
|
//
|
|
// [SerializeField, Required]
|
|
// private Transform _skewerFoodSlotLocation;
|
|
//
|
|
// [SerializeField, Required]
|
|
// private Transform _dessertFoodSlotLocation;
|
|
//
|
|
// [Title("프리팹")]
|
|
// [SerializeField, Required]
|
|
// private TycoonItemSlotUi _dailyFoodSlotUi;
|
|
//
|
|
// [Title("실시간 데이터")]
|
|
// [SerializeField]
|
|
// private List<TycoonItemSlotUi> _soupFoodSlotUis = new(3);
|
|
//
|
|
// [FormerlySerializedAs("_fryingPanFoodSlotUis")]
|
|
// [SerializeField]
|
|
// private List<TycoonItemSlotUi> _grillFoodSlotUis = new(3);
|
|
//
|
|
// [SerializeField]
|
|
// private List<TycoonItemSlotUi> _skewerFoodSlotUis = new(3);
|
|
//
|
|
// [SerializeField]
|
|
// private List<TycoonItemSlotUi> _dessertPanFoodSlotUis = new(3);
|
|
//
|
|
// [field: SerializeField]
|
|
// public List<TycoonItemSlotUi> DailyFoodSlotUis { get; private set; } = new(12);
|
|
//
|
|
// [SerializeField]
|
|
// private List<Pot> _pots = new(3);
|
|
//
|
|
// [SerializeField]
|
|
// private List<Grill> _grills = new(3);
|
|
//
|
|
// [SerializeField]
|
|
// private List<Skewer> _skewers = new(3);
|
|
//
|
|
// private CookUi _cookUi;
|
|
//
|
|
// private void Start()
|
|
// {
|
|
// Initialize();
|
|
// }
|
|
//
|
|
// private void Initialize()
|
|
// {
|
|
// _cookUi = TycoonUiManager.Instance.TycoonManagementUi.CookMenuUi.CookUi;
|
|
//
|
|
// foreach (var element in _grillFoodSlotUis)
|
|
// {
|
|
// element.AddButtonClickListener(() => RemoveDailyFood(element));
|
|
// }
|
|
//
|
|
// foreach (var element in _soupFoodSlotUis)
|
|
// {
|
|
// element.AddButtonClickListener(() => RemoveDailyFood(element));
|
|
// }
|
|
//
|
|
// foreach (var element in _skewerFoodSlotUis)
|
|
// {
|
|
// element.AddButtonClickListener(() => RemoveDailyFood(element));
|
|
// }
|
|
//
|
|
// foreach (var element in _dessertPanFoodSlotUis)
|
|
// {
|
|
// element.AddButtonClickListener(() => RemoveDailyFood(element));
|
|
// }
|
|
// }
|
|
//
|
|
// private void RemoveDailyFood(TycoonItemSlotUi tycoonItemSlotUi)
|
|
// {
|
|
// tycoonItemSlotUi.SetFoodData(null);
|
|
// DailyFoodSlotUis.Remove(tycoonItemSlotUi);
|
|
// _cookUi.CheckCookable();
|
|
// }
|
|
//
|
|
// public bool IsEmptyDailyFoodMenu(FoodData selectedFoodData)
|
|
// {
|
|
// var selectedTypeItemSlotUis = GetDailyFoodType(selectedFoodData.Type);
|
|
//
|
|
// foreach (var element in selectedTypeItemSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData == null || string.IsNullOrEmpty(element.FoodData.Idx))
|
|
// {
|
|
// return true;
|
|
// }
|
|
// }
|
|
//
|
|
// return false;
|
|
// }
|
|
//
|
|
// public void AddDailyFoodMenu(FoodData selectedFoodData)
|
|
// {
|
|
// var selectedTypeItemSlotUis = GetDailyFoodType(selectedFoodData.Type);
|
|
//
|
|
// foreach (var element in selectedTypeItemSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData == null || string.IsNullOrEmpty(element.FoodData.Idx))
|
|
// {
|
|
// element.SetFoodData(selectedFoodData);
|
|
// DailyFoodSlotUis.Add(element);
|
|
// return;
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// private List<TycoonItemSlotUi> GetDailyFoodType(FoodType foodType)
|
|
// {
|
|
// switch (foodType)
|
|
// {
|
|
// case FoodType.None:
|
|
// Debug.LogError($"FoodType이 None입니다.");
|
|
// return null;
|
|
// case FoodType.Skewer:
|
|
// return _skewerFoodSlotUis;
|
|
// case FoodType.Soup:
|
|
// return _soupFoodSlotUis;
|
|
// case FoodType.Grill:
|
|
// return _grillFoodSlotUis;
|
|
// case FoodType.Dessert:
|
|
// return _dessertPanFoodSlotUis;
|
|
// default:
|
|
// throw new ArgumentOutOfRangeException(nameof(foodType), foodType, null);
|
|
// }
|
|
// }
|
|
//
|
|
// public bool CanOpen()
|
|
// {
|
|
// return _grillFoodSlotUis.Any(slot => slot.FoodData != null && !string.IsNullOrEmpty(slot.FoodData.Idx)) ||
|
|
// _soupFoodSlotUis.Any(slot => slot.FoodData != null && !string.IsNullOrEmpty(slot.FoodData.Idx)) ||
|
|
// _skewerFoodSlotUis.Any(slot => slot.FoodData != null && !string.IsNullOrEmpty(slot.FoodData.Idx)) ||
|
|
// _dessertPanFoodSlotUis.Any(slot => slot.FoodData != null && !string.IsNullOrEmpty(slot.FoodData.Idx));
|
|
// }
|
|
//
|
|
// public TycoonItemSlotUi InitializeGrill(Grill grill)
|
|
// {
|
|
// _grills.Add(grill);
|
|
// var index = _grills.Count - 1;
|
|
// _grillFoodSlotUis[index].SetIsLocked(false);
|
|
// _grillFoodSlotUis[index].SetFoodData(null);
|
|
// return _grillFoodSlotUis[index];
|
|
// }
|
|
//
|
|
// public TycoonItemSlotUi InitializePot(Pot pot)
|
|
// {
|
|
// _pots.Add(pot);
|
|
// var index = _pots.Count - 1;
|
|
// _soupFoodSlotUis[index].SetIsLocked(false);
|
|
// _soupFoodSlotUis[index].SetFoodData(null);
|
|
// return _soupFoodSlotUis[index];
|
|
// }
|
|
//
|
|
//
|
|
// public TycoonItemSlotUi InitializeSkewer(Skewer skewer)
|
|
// {
|
|
// _skewers.Add(skewer);
|
|
// var index = _skewers.Count - 1;
|
|
// _skewerFoodSlotUis[index].SetIsLocked(false);
|
|
// _skewerFoodSlotUis[index].SetFoodData(null);
|
|
// return _skewerFoodSlotUis[index];
|
|
// }
|
|
//
|
|
// public void TycoonClosed()
|
|
// {
|
|
// DailyFoodSlotUis.Clear();
|
|
//
|
|
// foreach (var element in _grillFoodSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData is not null)
|
|
// {
|
|
// element.SetFoodData(null);
|
|
// }
|
|
// }
|
|
//
|
|
// foreach (var element in _soupFoodSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData is not null)
|
|
// {
|
|
// element.SetFoodData(null);
|
|
// }
|
|
// }
|
|
//
|
|
// foreach (var element in _skewerFoodSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData is not null)
|
|
// {
|
|
// element.SetFoodData(null);
|
|
// }
|
|
// }
|
|
//
|
|
// foreach (var element in _dessertPanFoodSlotUis)
|
|
// {
|
|
// if (!element.GetIsLocked() && element.FoodData is not null)
|
|
// {
|
|
// element.SetFoodData(null);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// } |