so 네이밍 변경
This commit is contained in:
parent
98354a30a1
commit
94b361f069
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
namespace DDD
|
namespace DDD
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(fileName = "TodayMenuDataSo", menuName = "GameState/TodayMenuDataSo")]
|
[CreateAssetMenu(fileName = "RestaurantManagementSo", menuName = "GameState/RestaurantManagementSo")]
|
||||||
public class TodayMenuDataSo : GameFlowTask
|
public class RestaurantManagementSo : GameFlowTask
|
||||||
{
|
{
|
||||||
[ReadOnly, SerializeField] private List<string> _foodRecipeIds = new();
|
[ReadOnly, SerializeField] private List<string> _foodRecipeIds = new();
|
||||||
[ReadOnly, SerializeField] private List<string> _drinkRecipeIds = new();
|
[ReadOnly, SerializeField] private List<string> _drinkRecipeIds = new();
|
@ -9,7 +9,7 @@ public class InventoryView : MonoBehaviour, IEventHandler<InventoryChangedEvent>
|
|||||||
[SerializeField] private Transform _slotParent;
|
[SerializeField] private Transform _slotParent;
|
||||||
[SerializeField] private GameObject _slotPrefab;
|
[SerializeField] private GameObject _slotPrefab;
|
||||||
|
|
||||||
private TodayMenuDataSo _todayMenuDataSo;
|
private RestaurantManagementSo _restaurantManagementSo;
|
||||||
private InventoryCategoryType _currenInventoryCategoryType = InventoryCategoryType.None;
|
private InventoryCategoryType _currenInventoryCategoryType = InventoryCategoryType.None;
|
||||||
|
|
||||||
private readonly Dictionary<string, IInventorySlotUi> _slotLookup = new();
|
private readonly Dictionary<string, IInventorySlotUi> _slotLookup = new();
|
||||||
@ -31,8 +31,8 @@ private void OnDisable()
|
|||||||
|
|
||||||
public async Task Initialize()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
_todayMenuDataSo = await AssetManager.LoadAsset<TodayMenuDataSo>(DataConstants.TodayMenuDataSo);
|
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
Debug.Assert(_todayMenuDataSo != null, "_todayMenuDataSo != null");
|
Debug.Assert(_restaurantManagementSo != null, "_todayMenuDataSo != null");
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public void UpdateCategoryView(InventoryCategoryType category)
|
|||||||
var model = slot.Model;
|
var model = slot.Model;
|
||||||
|
|
||||||
// 1. 오늘의 메뉴에 등록된 경우 필터링
|
// 1. 오늘의 메뉴에 등록된 경우 필터링
|
||||||
bool isRegisteredTodayMenu = model.ItemType == ItemType.Recipe && _todayMenuDataSo.IsContainTodayMenu(id);
|
bool isRegisteredTodayMenu = model.ItemType == ItemType.Recipe && _restaurantManagementSo.IsContainTodayMenu(id);
|
||||||
|
|
||||||
// 2. 현재 선택된 카테고리에 맞는지 필터링
|
// 2. 현재 선택된 카테고리에 맞는지 필터링
|
||||||
bool matchCategory = MatchesCategory(model, _currenInventoryCategoryType);
|
bool matchCategory = MatchesCategory(model, _currenInventoryCategoryType);
|
||||||
|
@ -14,7 +14,7 @@ public enum TodayMenuEventType
|
|||||||
public class TodayMenuInteractor : MonoBehaviour, IInteractableUi
|
public class TodayMenuInteractor : MonoBehaviour, IInteractableUi
|
||||||
{
|
{
|
||||||
private IInventorySlotUi _inventorySlotUi;
|
private IInventorySlotUi _inventorySlotUi;
|
||||||
private TodayMenuDataSo _todayMenuDataSo;
|
private RestaurantManagementSo _restaurantManagementSo;
|
||||||
private TaskCompletionSource<bool> _isInitialized = new();
|
private TaskCompletionSource<bool> _isInitialized = new();
|
||||||
private TodayMenuEventType _todayMenuEventType = TodayMenuEventType.None;
|
private TodayMenuEventType _todayMenuEventType = TodayMenuEventType.None;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public async void Initialize(TodayMenuEventType todayMenuEventType)
|
|||||||
{
|
{
|
||||||
_todayMenuEventType = todayMenuEventType;
|
_todayMenuEventType = todayMenuEventType;
|
||||||
|
|
||||||
_todayMenuDataSo = await AssetManager.LoadAsset<TodayMenuDataSo>(DataConstants.TodayMenuDataSo);
|
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
_isInitialized.SetResult(true);
|
_isInitialized.SetResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,12 +62,12 @@ private void OnAdded()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_todayMenuDataSo.TryAddTodayMenu(_inventorySlotUi);
|
_restaurantManagementSo.TryAddTodayMenu(_inventorySlotUi);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRemoved()
|
private void OnRemoved()
|
||||||
{
|
{
|
||||||
_todayMenuDataSo.TryRemoveTodayMenu(_inventorySlotUi);
|
_restaurantManagementSo.TryRemoveTodayMenu(_inventorySlotUi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,23 +13,23 @@ public class TodayMenuView : MonoBehaviour, IEventHandler<TodayMenuAddedEvent>,
|
|||||||
private List<IInventorySlotUi> _foodSlots;
|
private List<IInventorySlotUi> _foodSlots;
|
||||||
private List<IInventorySlotUi> _drinkSlots;
|
private List<IInventorySlotUi> _drinkSlots;
|
||||||
|
|
||||||
private TodayMenuDataSo _todayMenuDataSo;
|
private RestaurantManagementSo _restaurantManagementSo;
|
||||||
|
|
||||||
private async void Start()
|
private async void Start()
|
||||||
{
|
{
|
||||||
EventBus.Register<TodayMenuAddedEvent>(this);
|
EventBus.Register<TodayMenuAddedEvent>(this);
|
||||||
EventBus.Register<TodayMenuRemovedEvent>(this);
|
EventBus.Register<TodayMenuRemovedEvent>(this);
|
||||||
|
|
||||||
_todayMenuDataSo = await AssetManager.LoadAsset<TodayMenuDataSo>(DataConstants.TodayMenuDataSo);
|
_restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
|
|
||||||
foreach (Transform child in _todayFoodContent)
|
foreach (Transform child in _todayFoodContent)
|
||||||
{
|
{
|
||||||
Destroy(child.gameObject);
|
Destroy(child.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxFoodCount = _todayMenuDataSo.MaxFoodCount;
|
int maxFoodCount = _restaurantManagementSo.MaxFoodCount;
|
||||||
_foodSlots = new List<IInventorySlotUi>(maxFoodCount);
|
_foodSlots = new List<IInventorySlotUi>(maxFoodCount);
|
||||||
for (int i = 0; i < _todayMenuDataSo.MaxFoodCount; i++)
|
for (int i = 0; i < _restaurantManagementSo.MaxFoodCount; i++)
|
||||||
{
|
{
|
||||||
var go = Instantiate(_slotPrefab, _todayFoodContent);
|
var go = Instantiate(_slotPrefab, _todayFoodContent);
|
||||||
var slot = go.GetComponent<IInventorySlotUi>();
|
var slot = go.GetComponent<IInventorySlotUi>();
|
||||||
@ -45,9 +45,9 @@ private async void Start()
|
|||||||
Destroy(child.gameObject);
|
Destroy(child.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxDrinkCount = _todayMenuDataSo.MaxDrinkCount;
|
int maxDrinkCount = _restaurantManagementSo.MaxDrinkCount;
|
||||||
_drinkSlots = new List<IInventorySlotUi>(maxDrinkCount);
|
_drinkSlots = new List<IInventorySlotUi>(maxDrinkCount);
|
||||||
for (int i = 0; i < _todayMenuDataSo.MaxDrinkCount; i++)
|
for (int i = 0; i < _restaurantManagementSo.MaxDrinkCount; i++)
|
||||||
{
|
{
|
||||||
var go = Instantiate(_slotPrefab, _todayDrinkContent);
|
var go = Instantiate(_slotPrefab, _todayDrinkContent);
|
||||||
var slot = go.GetComponent<IInventorySlotUi>();
|
var slot = go.GetComponent<IInventorySlotUi>();
|
||||||
@ -81,9 +81,9 @@ private void UpdateView()
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _foodSlots.Count; i++)
|
for (int i = 0; i < _foodSlots.Count; i++)
|
||||||
{
|
{
|
||||||
if (i < _todayMenuDataSo.FoodRecipeIds.Count)
|
if (i < _restaurantManagementSo.FoodRecipeIds.Count)
|
||||||
{
|
{
|
||||||
string recipeId = _todayMenuDataSo.FoodRecipeIds[i];
|
string recipeId = _restaurantManagementSo.FoodRecipeIds[i];
|
||||||
var model = ItemViewModelFactory.CreateByRecipeId(recipeId);
|
var model = ItemViewModelFactory.CreateByRecipeId(recipeId);
|
||||||
|
|
||||||
_foodSlots[i].Initialize(model);
|
_foodSlots[i].Initialize(model);
|
||||||
@ -97,9 +97,9 @@ private void UpdateView()
|
|||||||
|
|
||||||
for (int i = 0; i < _drinkSlots.Count; i++)
|
for (int i = 0; i < _drinkSlots.Count; i++)
|
||||||
{
|
{
|
||||||
if (i < _todayMenuDataSo.DrinkRecipeIds.Count)
|
if (i < _restaurantManagementSo.DrinkRecipeIds.Count)
|
||||||
{
|
{
|
||||||
string recipeId = _todayMenuDataSo.DrinkRecipeIds[i];
|
string recipeId = _restaurantManagementSo.DrinkRecipeIds[i];
|
||||||
var model = ItemViewModelFactory.CreateByRecipeId(recipeId);
|
var model = ItemViewModelFactory.CreateByRecipeId(recipeId);
|
||||||
|
|
||||||
_drinkSlots[i].Initialize(model);
|
_drinkSlots[i].Initialize(model);
|
||||||
|
@ -62,10 +62,10 @@ public async Task OnReadyNewFlow(GameFlowState newFlowState)
|
|||||||
{
|
{
|
||||||
CreateRestaurantPlayerSo createRestaurantPlayerSoJob = await AssetManager.LoadAsset<CreateRestaurantPlayerSo>(CreateRestaurantPlayerSo);
|
CreateRestaurantPlayerSo createRestaurantPlayerSoJob = await AssetManager.LoadAsset<CreateRestaurantPlayerSo>(CreateRestaurantPlayerSo);
|
||||||
CreateEnvironmentSo createEnvironmentSoJob = await AssetManager.LoadAsset<CreateEnvironmentSo>(CreateEnvironmentSo);
|
CreateEnvironmentSo createEnvironmentSoJob = await AssetManager.LoadAsset<CreateEnvironmentSo>(CreateEnvironmentSo);
|
||||||
TodayMenuDataSo todayMenuDataSo = await AssetManager.LoadAsset<TodayMenuDataSo>(DataConstants.TodayMenuDataSo);
|
RestaurantManagementSo restaurantManagementSo = await AssetManager.LoadAsset<RestaurantManagementSo>(DataConstants.RestaurantManagementSo);
|
||||||
var playerHandle = createRestaurantPlayerSoJob.OnReadyNewFlow(newFlowState);
|
var playerHandle = createRestaurantPlayerSoJob.OnReadyNewFlow(newFlowState);
|
||||||
var propHandle = createEnvironmentSoJob.OnReadyNewFlow(newFlowState);
|
var propHandle = createEnvironmentSoJob.OnReadyNewFlow(newFlowState);
|
||||||
var todayMenuHandle = todayMenuDataSo.OnReadyNewFlow(newFlowState);
|
var todayMenuHandle = restaurantManagementSo.OnReadyNewFlow(newFlowState);
|
||||||
// Combine handles and return it
|
// Combine handles and return it
|
||||||
InputManager.Instance.SwitchCurrentActionMap(InputActionMaps.Restaurant);
|
InputManager.Instance.SwitchCurrentActionMap(InputActionMaps.Restaurant);
|
||||||
await Task.WhenAll(playerHandle, propHandle, todayMenuHandle);
|
await Task.WhenAll(playerHandle, propHandle, todayMenuHandle);
|
||||||
|
@ -19,7 +19,7 @@ public static class DataConstants
|
|||||||
public const string EnvironmentDataSo = "EnvironmentDataSo";
|
public const string EnvironmentDataSo = "EnvironmentDataSo";
|
||||||
public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo";
|
public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo";
|
||||||
public const string UiInputBindingSo = "UiInputBindingSo";
|
public const string UiInputBindingSo = "UiInputBindingSo";
|
||||||
public const string TodayMenuDataSo = "TodayMenuDataSo";
|
public const string RestaurantManagementSo = "RestaurantManagementSo";
|
||||||
|
|
||||||
public const string AtlasLabel = "Atlas";
|
public const string AtlasLabel = "Atlas";
|
||||||
public const string BasePropSpriteMaterial = "BasePropSpriteMaterial";
|
public const string BasePropSpriteMaterial = "BasePropSpriteMaterial";
|
||||||
|
Loading…
Reference in New Issue
Block a user