Merge remote-tracking branch 'origin/feature/Interaction_type_message' into develop

This commit is contained in:
NTG 2025-08-28 20:01:11 +09:00
commit 8a93361f3f
67 changed files with 3961 additions and 109 deletions

Binary file not shown.

View File

@ -426,7 +426,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3} m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_availableInteractions: 7 _availableInteractions: 15
_nearColliders: _nearColliders:
- {fileID: 0} - {fileID: 0}
- {fileID: 0} - {fileID: 0}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0d61dd18afc44b4409eecda0e90338ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 76176ff20d561274695e603b36895668
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d35e58996d347b94dbb6493239eaf92e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df2cf12efec018744b74b92e9764016a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7da88412aa69af04b98063c645ef6f99
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bbffb964311e7aa499a7c5e10191ed4a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,10 +8,10 @@ namespace DDD
{ {
public class DataManager : Singleton<DataManager>, IManager public class DataManager : Singleton<DataManager>, IManager
{ {
private readonly Dictionary<Type, ScriptableObject> _dataSoTable = new(); private Dictionary<Type, ScriptableObject> _dataAssetTable = new();
private Dictionary<string, Sprite> _spriteAtlas; private Dictionary<string, Sprite> _spriteAtlas;
private const string SoLabel = "GoogleSheetSo"; private const string AssetLabel = "GoogleSheetSo";
private const string Icon = "_icon"; private const string Icon = "_icon";
public void PreInit() public void PreInit()
@ -32,15 +32,15 @@ public void PostInit()
private async Task LoadAllGameDataSo() private async Task LoadAllGameDataSo()
{ {
var soList = await AssetManager.Instance.LoadAssetsByLabel<ScriptableObject>(SoLabel); var assets = await AssetManager.Instance.LoadAssetsByLabel<ScriptableObject>(AssetLabel);
_dataAssetTable = new Dictionary<Type, ScriptableObject>(assets.Count);
foreach (var so in soList) foreach (var asset in assets)
{ {
var type = so.GetType(); var type = asset.GetType();
_dataSoTable.TryAdd(type, so); _dataAssetTable.TryAdd(type, asset);
} }
Debug.Log($"[DataManager] {_dataSoTable.Count}개의 SO가 로드되었습니다."); Debug.Log($"[DataManager] {_dataAssetTable.Count}개의 DataAsset이 로드되었습니다.");
} }
private async Task LoadSpriteAtlas() private async Task LoadSpriteAtlas()
@ -68,14 +68,14 @@ private async Task LoadSpriteAtlas()
} }
} }
public T GetDataSo<T>() where T : ScriptableObject public T GetDataAsset<T>() where T : ScriptableObject
{ {
if (_dataSoTable.TryGetValue(typeof(T), out var so)) if (_dataAssetTable.TryGetValue(typeof(T), out var so))
{ {
return so as T; return so as T;
} }
Debug.LogError($"[DataManager] {typeof(T).Name} SO를 찾을 수 없습니다."); Debug.LogError($"[DataManager] {typeof(T).Name} 찾을 수 없습니다.");
return null; return null;
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace DDD namespace DDD
{ {
@ -28,11 +29,12 @@ public InteractionExecutionParameters(float holdTime = 0f)
[System.Serializable] [System.Serializable]
public struct InteractionDisplayParameters public struct InteractionDisplayParameters
{ {
[SerializeField] private string _messageKey; [field: SerializeField] public string DefaultMessageKey { get; private set; }
public string MessageKey => _messageKey; [field: SerializeField] public string ConditionalMessageKey { get; private set; }
public InteractionDisplayParameters(string messageKey = "") public InteractionDisplayParameters(string defaultMessageKey, string conditionalMessageKey = null)
{ {
_messageKey = messageKey; DefaultMessageKey = defaultMessageKey ?? string.Empty;
ConditionalMessageKey = conditionalMessageKey ?? DefaultMessageKey;
} }
} }

View File

@ -8,6 +8,7 @@ public interface IInteractionSubsystemObject
void InitializeSubsystem(); void InitializeSubsystem();
bool CanInteract(); bool CanInteract();
bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null); bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null);
string GetCurrentSubsystemTypeName();
} }
public interface IInteractionSubsystemObject<T> : IInteractionSubsystemObject where T : Enum public interface IInteractionSubsystemObject<T> : IInteractionSubsystemObject where T : Enum
{ {

View File

@ -48,7 +48,7 @@ public void PostInit()
private void InitializeItemData() private void InitializeItemData()
{ {
var itemDataSo = DataManager.Instance.GetDataSo<ItemDataAsset>(); var itemDataSo = DataManager.Instance.GetDataAsset<ItemDataAsset>();
Debug.Assert(itemDataSo != null, "itemDataSo != null"); Debug.Assert(itemDataSo != null, "itemDataSo != null");
_allItemDataLookup = itemDataSo.GetDataList() _allItemDataLookup = itemDataSo.GetDataList()

View File

@ -47,10 +47,10 @@ private void RemoveItem()
private IEnumerable<string> GetItemIds() private IEnumerable<string> GetItemIds()
{ {
if (!Application.isPlaying || DataManager.Instance?.GetDataSo<ItemDataAsset>() == null) if (!Application.isPlaying || DataManager.Instance?.GetDataAsset<ItemDataAsset>() == null)
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
return DataManager.Instance.GetDataSo<ItemDataAsset>().GetDataList() return DataManager.Instance.GetDataAsset<ItemDataAsset>().GetDataList()
.Select(data => data.Id) .Select(data => data.Id)
.Where(id => !string.IsNullOrEmpty(id)); .Where(id => !string.IsNullOrEmpty(id));
} }

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c2064d46b7e22ec46929f7efa150aa10
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b10bc2081be2cab46a268b145b132a10
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: da8fcc1f4658c38469681f2d9da7e72a
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
// <auto-generated> File: CookwareDataAsset.cs
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "InteractionDataAsset", menuName = "GoogleSheet/InteractionDataAsset")]
public class InteractionDataAsset : DataAsset<InteractionDataEntry>
{
public bool TryGetValueByTypeName(string interactionTypeName, string subsystemTypeName, out InteractionDataEntry interactionDataEntry)
{
var targetString = $"{interactionTypeName}.{subsystemTypeName}";
interactionDataEntry = _datas.FirstOrDefault(entry =>
string.Equals(entry.UnparsedInteractionType, targetString, StringComparison.Ordinal));
return interactionDataEntry != null;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a2a6159df6eba7442846f45c30f98c4f

View File

@ -0,0 +1,30 @@
// <auto-generated>
using System;
using UnityEngine;
namespace DDD
{
[Serializable]
public class InteractionDataEntry : IId
{
/// <summary>식별ID</summary>
[Tooltip("식별ID")]
[field: SerializeField]
public string Id { get; set; }
/// <summary>파싱 전 타입</summary>
[Tooltip("파싱 전 타입")]
[field: SerializeField]
public string UnparsedInteractionType;
/// <summary>상호작용 기본 현지화 키 값</summary>
[Tooltip("상호작용 기본 현지화 키 값")]
[field: SerializeField]
public string DefaultMessageKey;
/// <summary>상호작용 예외처리 현지화 키 값</summary>
[Tooltip("상호작용 예외처리 현지화 키 값")]
[field: SerializeField]
public string ConditionalMessageKey;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 91a858d70636bb9418edbee22449d147

View File

@ -987,7 +987,7 @@
"CookwareKey:string": "item_environment_cookware_001", "CookwareKey:string": "item_environment_cookware_001",
"CookTime:int": 10, "CookTime:int": 10,
"Price:int": 30, "Price:int": 30,
"IngredientKey1:string": "item_ingredient_005", "IngredientKey1:string": "item_ingredient_012",
"IngredientAmount1:string": 1, "IngredientAmount1:string": 1,
"IngredientKey2:string": "item_ingredient_006", "IngredientKey2:string": "item_ingredient_006",
"IngredientAmount2:string": 2, "IngredientAmount2:string": 2,
@ -1755,5 +1755,56 @@
"SpriteKey:string": "", "SpriteKey:string": "",
"Size:float": 1 "Size:float": 1
} }
],
"InteractionData": [
{
"Id": "식별ID",
"#설명": "설명",
"UnparsedInteractionType:string": "파싱 전 타입",
"DefaultMessageKey:string": "상호작용 기본 현지화 키 값",
"ConditionalMessageKey:string": "상호작용 예외처리 현지화 키 값"
},
{
"Id": "interaction_001",
"#설명": "준비단계 - 메뉴 ui 오픈",
"UnparsedInteractionType:string": "RestaurantManagement.OpenManagementUi",
"DefaultMessageKey:string": "interaction_001_default",
"ConditionalMessageKey:string": ""
},
{
"Id": "interaction_002",
"#설명": "준비단계 - 레스토랑 오픈",
"UnparsedInteractionType:string": "RestaurantManagement.RunRestaurant",
"DefaultMessageKey:string": "interaction_002_default",
"ConditionalMessageKey:string": "interaction_002_failure"
},
{
"Id": "interaction_003",
"#설명": "운영중 - 손님 주문 받기",
"UnparsedInteractionType:string": "RestaurantOrder.Order",
"DefaultMessageKey:string": "interaction_003_default",
"ConditionalMessageKey:string": ""
},
{
"Id": "interaction_004",
"#설명": "운영중 - 요리 서빙하기",
"UnparsedInteractionType:string": "RestaurantOrder.Serve",
"DefaultMessageKey:string": "interaction_004_default",
"ConditionalMessageKey:string": ""
},
{
"Id": "interaction_005",
"#설명": "운영중 - 테이블 치우기",
"UnparsedInteractionType:string": "RestaurantOrder.Dirty",
"DefaultMessageKey:string": "interaction_005_default",
"ConditionalMessageKey:string": ""
},
{
"Id": "interaction_006",
"#설명": "운영중 - 요리도구를 통해 요리 ui 오픈",
"UnparsedInteractionType:string": "RestaurantCook.OpenCookUi",
"DefaultMessageKey:string": "interaction_006_default",
"ConditionalMessageKey:string": ""
}
] ]
} }

View File

@ -155,9 +155,10 @@ protected override void OnInteractionCompleted()
private void BroadcastShowUi(IInteractable interactable, bool canInteract, float ratio) private void BroadcastShowUi(IInteractable interactable, bool canInteract, float ratio)
{ {
var displayParameters = interactable.GetDisplayParameters();
var evt = GameEvents.ShowInteractionUiEvent; var evt = GameEvents.ShowInteractionUiEvent;
evt.CanInteract = canInteract; evt.CanInteract = canInteract;
evt.TextKey = interactable.GetDisplayParameters().MessageKey; evt.TextKey = canInteract ? displayParameters.DefaultMessageKey : displayParameters.ConditionalMessageKey;
evt.HoldProgress = ratio; evt.HoldProgress = ratio;
EventBus.Broadcast(evt); EventBus.Broadcast(evt);
} }

View File

@ -31,7 +31,7 @@ public override Task OnExitCurrentFlow(GameFlowState exitingFlowState)
private void GenerateDummyEnvironmentProps() private void GenerateDummyEnvironmentProps()
{ {
// Make dummy placement data // Make dummy placement data
foreach (EnvironmentDataEntry prop in DataManager.Instance.GetDataSo<EnvironmentDataAsset>().GetDataList()) foreach (EnvironmentDataEntry prop in DataManager.Instance.GetDataAsset<EnvironmentDataAsset>().GetDataList())
{ {
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {

View File

@ -71,9 +71,9 @@ public override Task OnExitCurrentFlow(GameFlowState exitingFlowState)
private async Task StartSpawnLoopAsync(CancellationToken token) private async Task StartSpawnLoopAsync(CancellationToken token)
{ {
var currentGameLevel = GameState.Instance.LevelState.Level; var currentGameLevel = GameState.Instance.LevelState.Level;
_levelDataAsset ??= DataManager.Instance.GetDataSo<LevelDataAsset>(); _levelDataAsset ??= DataManager.Instance.GetDataAsset<LevelDataAsset>();
_customerDataAsset ??= DataManager.Instance.GetDataSo<CustomerDataAsset>(); _customerDataAsset ??= DataManager.Instance.GetDataAsset<CustomerDataAsset>();
_customerPoolDataAsset ??= DataManager.Instance.GetDataSo<CustomerPoolDataAsset>(); _customerPoolDataAsset ??= DataManager.Instance.GetDataAsset<CustomerPoolDataAsset>();
var currentLevelData = _levelDataAsset.GetDataList().FirstOrDefault(data => data.Level == currentGameLevel); var currentLevelData = _levelDataAsset.GetDataList().FirstOrDefault(data => data.Level == currentGameLevel);
Debug.Assert(currentLevelData != null, "currentLevelData is null"); Debug.Assert(currentLevelData != null, "currentLevelData is null");

View File

@ -40,6 +40,11 @@ public async Task Init()
public void PostInit() public void PostInit()
{ {
var allInteractables = GetRestaurantState().EnvironmentState.GetAllInteractables();
foreach (var interactable in allInteractables)
{
}
} }
private void CreateRestaurantState() private void CreateRestaurantState()

View File

@ -38,6 +38,11 @@ public virtual bool OnInteracted(IInteractor interactor, ScriptableObject payloa
return true; return true;
} }
public string GetCurrentSubsystemTypeName()
{
return _cookType.ToString();
}
public ScriptableObject GetPayload() public ScriptableObject GetPayload()
{ {
return null; return null;

View File

@ -6,13 +6,13 @@ namespace DDD
[Flags] [Flags]
public enum RestaurantManagementType : uint public enum RestaurantManagementType : uint
{ {
OpenRestaurantMenu = 0, OpenManagementUi = 0,
StartRestaurant = 1, RunRestaurant = 1,
} }
public class InteractionSubsystem_Management : MonoBehaviour, IInteractionSubsystemObject<RestaurantManagementType> public class InteractionSubsystem_Management : MonoBehaviour, IInteractionSubsystemObject<RestaurantManagementType>
{ {
[SerializeField] protected RestaurantManagementType _managementType = RestaurantManagementType.OpenRestaurantMenu; [SerializeField] protected RestaurantManagementType _managementType = RestaurantManagementType.OpenManagementUi;
public RestaurantManagementType GetInteractionSubsystemType() public RestaurantManagementType GetInteractionSubsystemType()
{ {
@ -39,6 +39,11 @@ public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = nu
return true; return true;
} }
public string GetCurrentSubsystemTypeName()
{
return _managementType.ToString();
}
public ScriptableObject GetPayload() public ScriptableObject GetPayload()
{ {
return null; return null;

View File

@ -47,6 +47,11 @@ public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = nu
return true; return true;
} }
public string GetCurrentSubsystemTypeName()
{
return _currentRestaurantMealType.ToString();
}
public ScriptableObject GetPayload() public ScriptableObject GetPayload()
{ {
return null; return null;

View File

@ -45,6 +45,11 @@ public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = nu
return true; return true;
} }
public string GetCurrentSubsystemTypeName()
{
return _currentRestaurantOrderType.ToString();
}
public ScriptableObject GetPayload() public ScriptableObject GetPayload()
{ {
return null; return null;

View File

@ -16,7 +16,7 @@ public class RestaurantEnvironment : MonoBehaviour
public void Initialize(RestaurantPropLocation location) public void Initialize(RestaurantPropLocation location)
{ {
EnvironmentDataEntry environmentDataEntry = DataManager.Instance.GetDataSo<EnvironmentDataAsset>().GetDataById(location.Id); EnvironmentDataEntry environmentDataEntry = DataManager.Instance.GetDataAsset<EnvironmentDataAsset>().GetDataById(location.Id);
_collider = GetComponent<Collider>(); _collider = GetComponent<Collider>();
_rootObject = transform.Find(CommonConstants.RootObject); _rootObject = transform.Find(CommonConstants.RootObject);

View File

@ -11,8 +11,9 @@ public static class RestaurantInteractionSubsystems
{ {
public static Dictionary<InteractionType, Type> TypeToSubsystem = new() public static Dictionary<InteractionType, Type> TypeToSubsystem = new()
{ {
{InteractionType.RestaurantOrder, typeof(InteractionSubsystem_Order)},
{InteractionType.RestaurantManagement, typeof(InteractionSubsystem_Management)}, {InteractionType.RestaurantManagement, typeof(InteractionSubsystem_Management)},
{InteractionType.RestaurantOrder, typeof(InteractionSubsystem_Order)},
{InteractionType.RestaurantCook, typeof(InteractionSubsystem_Cook)},
}; };
} }
@ -22,8 +23,8 @@ public class RestaurantInteractionComponent : MonoBehaviour, IInteractable, IInt
// Single interaction type // Single interaction type
[ValueDropdown("GetAllInteractionTypes")] [ValueDropdown("GetAllInteractionTypes")]
[SerializeField] protected InteractionType _interactionType = InteractionType.None; [SerializeField] protected InteractionType _interactionType = InteractionType.None;
[SerializeField] protected InteractionExecutionParameters _executionParameters = new InteractionExecutionParameters(1f); [SerializeField] protected InteractionExecutionParameters _executionParameters = new(1f);
[SerializeField] protected InteractionDisplayParameters _displayParameters = new InteractionDisplayParameters(""); [SerializeField] protected InteractionDisplayParameters _displayParameters;
[SerializeField] protected GameFlowState _interactionAvailableFlows; [SerializeField] protected GameFlowState _interactionAvailableFlows;
[SerializeField] private Transform[] _aiInteractionPoints; [SerializeField] private Transform[] _aiInteractionPoints;
[SerializeField] private bool autoInitialize = true; [SerializeField] private bool autoInitialize = true;
@ -141,6 +142,13 @@ public virtual InteractionExecutionParameters GetExecutionParameters()
public virtual InteractionDisplayParameters GetDisplayParameters() public virtual InteractionDisplayParameters GetDisplayParameters()
{ {
if (DataManager.Instance.GetDataAsset<InteractionDataAsset>().TryGetValueByTypeName(_interactionType.ToString(),
_subsystems[_interactionType].GetCurrentSubsystemTypeName(), out var interactionDataEntry) == false)
{
return new InteractionDisplayParameters();
}
_displayParameters = new InteractionDisplayParameters(interactionDataEntry.DefaultMessageKey, interactionDataEntry.ConditionalMessageKey);
return _displayParameters; return _displayParameters;
} }
@ -152,7 +160,7 @@ public float GetRequiredHoldTime()
public string GetInteractionMessageKey() public string GetInteractionMessageKey()
{ {
return _displayParameters.MessageKey; return _displayParameters.DefaultMessageKey;
} }
public Vector3[] GetInteractionPoints() public Vector3[] GetInteractionPoints()

View File

@ -8,8 +8,8 @@ public class RestaurantManagementSolver : RestaurantSubsystemSolver<RestaurantMa
private Dictionary<RestaurantManagementType, Type> _typeToManagementSolver = new() private Dictionary<RestaurantManagementType, Type> _typeToManagementSolver = new()
{ {
{ RestaurantManagementType.OpenRestaurantMenu, typeof(RestaurantManagementSolver_Menu) }, { RestaurantManagementType.OpenManagementUi, typeof(RestaurantManagementSolver_Menu) },
{ RestaurantManagementType.StartRestaurant, typeof(RestaurantManagementSolver_Start) }, { RestaurantManagementType.RunRestaurant, typeof(RestaurantManagementSolver_Start) },
}; };
protected override Dictionary<RestaurantManagementType, Type> GetSubsystemSolverTypeMappings() protected override Dictionary<RestaurantManagementType, Type> GetSubsystemSolverTypeMappings()
{ {

View File

@ -79,7 +79,7 @@ public bool TryAddTodayMenu(ItemModel model)
if (model.ItemType != ItemType.Recipe) return false; if (model.ItemType != ItemType.Recipe) return false;
if (DataManager.Instance.GetDataSo<RecipeDataAsset>().TryGetDataById(recipeId, out RecipeDataEntry recipeData) == false) return false; if (DataManager.Instance.GetDataAsset<RecipeDataAsset>().TryGetDataById(recipeId, out RecipeDataEntry recipeData) == false) return false;
bool added = false; bool added = false;
@ -87,7 +87,7 @@ public bool TryAddTodayMenu(ItemModel model)
{ {
if (_todayFoodRecipeIds.Count >= GetRestaurantManagementData().MaxFoodCount || _todayFoodRecipeIds.ContainsKey(recipeId)) return false; if (_todayFoodRecipeIds.Count >= GetRestaurantManagementData().MaxFoodCount || _todayFoodRecipeIds.ContainsKey(recipeId)) return false;
var foodData = DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(recipeData.RecipeResult); var foodData = DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(recipeData.RecipeResult);
var craftableCount = foodData.GetCraftableCount(); var craftableCount = foodData.GetCraftableCount();
foodData.ConsumeAllCraftableIngredients(); foodData.ConsumeAllCraftableIngredients();
@ -98,7 +98,7 @@ public bool TryAddTodayMenu(ItemModel model)
{ {
if (_todayDrinkRecipeIds.Count >= GetRestaurantManagementData().MaxDrinkCount || _todayDrinkRecipeIds.ContainsKey(recipeId)) return false; if (_todayDrinkRecipeIds.Count >= GetRestaurantManagementData().MaxDrinkCount || _todayDrinkRecipeIds.ContainsKey(recipeId)) return false;
var drinkData = DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(recipeData.RecipeResult); var drinkData = DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(recipeData.RecipeResult);
var craftableCount = drinkData.GetCraftableCount(); var craftableCount = drinkData.GetCraftableCount();
drinkData.ConsumeAllCraftableIngredients(); drinkData.ConsumeAllCraftableIngredients();
@ -128,7 +128,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
string recipeId = model.Id; string recipeId = model.Id;
var removedEvt = RestaurantEvents.TodayMenuRemovedEvent; var removedEvt = RestaurantEvents.TodayMenuRemovedEvent;
if (DataManager.Instance.GetDataSo<RecipeDataAsset>().TryGetDataById(recipeId, out RecipeDataEntry recipeData) == false) return false; if (DataManager.Instance.GetDataAsset<RecipeDataAsset>().TryGetDataById(recipeId, out RecipeDataEntry recipeData) == false) return false;
bool removed = false; bool removed = false;
int refundCount = 0; int refundCount = 0;
@ -142,7 +142,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
if (removed) if (removed)
{ {
var foodData = DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(recipeData.RecipeResult); var foodData = DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(recipeData.RecipeResult);
foodData.RefundIngredients(refundCount); foodData.RefundIngredients(refundCount);
} }
} }
@ -156,7 +156,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
if (removed) if (removed)
{ {
var drinkData = DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(recipeData.RecipeResult); var drinkData = DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(recipeData.RecipeResult);
drinkData.RefundIngredients(refundCount); drinkData.RefundIngredients(refundCount);
} }
} }
@ -183,7 +183,7 @@ public bool TryAddTodayCookware(ItemModel model)
{ {
var cookwareId = model.Id; var cookwareId = model.Id;
if (model.HasItem == false || DataManager.Instance.GetDataSo<CookwareDataAsset>().ContainsData(cookwareId) == false) return false; if (model.HasItem == false || DataManager.Instance.GetDataAsset<CookwareDataAsset>().ContainsData(cookwareId) == false) return false;
if (_cookwareToRecipeIds.Count >= GetRestaurantManagementData().MaxCookwareCount || _cookwareToRecipeIds.ContainsKey(cookwareId)) return false; if (_cookwareToRecipeIds.Count >= GetRestaurantManagementData().MaxCookwareCount || _cookwareToRecipeIds.ContainsKey(cookwareId)) return false;
@ -212,7 +212,7 @@ public bool TryRemoveTodayCookware(ItemModel model)
{ {
var cookwareId = model.Id; var cookwareId = model.Id;
if (DataManager.Instance.GetDataSo<CookwareDataAsset>().ContainsData(cookwareId) == false) return false; if (DataManager.Instance.GetDataAsset<CookwareDataAsset>().ContainsData(cookwareId) == false) return false;
if (_cookwareToRecipeIds.Remove(cookwareId) == false) return false; if (_cookwareToRecipeIds.Remove(cookwareId) == false) return false;
@ -228,14 +228,14 @@ public bool TryRemoveTodayCookware(ItemModel model)
private string GetRequiredCookwareKey(string recipeId) private string GetRequiredCookwareKey(string recipeId)
{ {
if (DataManager.Instance.GetDataSo<RecipeDataAsset>().TryGetDataById(recipeId, out var recipeData) == false) return null; if (DataManager.Instance.GetDataAsset<RecipeDataAsset>().TryGetDataById(recipeId, out var recipeData) == false) return null;
var resultKey = recipeData.RecipeResult; var resultKey = recipeData.RecipeResult;
return recipeData.RecipeType switch return recipeData.RecipeType switch
{ {
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey).CookwareKey, RecipeType.FoodRecipe => DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey).CookwareKey,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey).CookwareKey, RecipeType.DrinkRecipe => DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey).CookwareKey,
_ => null _ => null
}; };
} }

View File

@ -89,7 +89,7 @@ public void SetCookwareType(CookwareType cookwareType)
if (_currentCookwareType == cookwareType) return; if (_currentCookwareType == cookwareType) return;
_currentCookwareType = cookwareType; _currentCookwareType = cookwareType;
var cookwareDatas = DataManager.Instance.GetDataSo<CookwareDataAsset>().GetDataList(); var cookwareDatas = DataManager.Instance.GetDataAsset<CookwareDataAsset>().GetDataList();
var cookwareKey = cookwareDatas.Find(data => data.CookwareType == cookwareType).Id; var cookwareKey = cookwareDatas.Find(data => data.CookwareType == cookwareType).Id;
CookwareIcon = DataManager.Instance.GetIcon(cookwareKey); CookwareIcon = DataManager.Instance.GetIcon(cookwareKey);
CookwareName = LocalizationManager.Instance.GetLocalizedName(cookwareKey); CookwareName = LocalizationManager.Instance.GetLocalizedName(cookwareKey);
@ -119,7 +119,7 @@ public void CreateAddedCookItemSlot(Transform parent)
var cookwareId = cookwareToRecipe.Key; var cookwareId = cookwareToRecipe.Key;
var recipeIds = cookwareToRecipe.Value; var recipeIds = cookwareToRecipe.Value;
if (DataManager.Instance.GetDataSo<CookwareDataAsset>().TryGetDataById(cookwareId, out var cookwareData) && if (DataManager.Instance.GetDataAsset<CookwareDataAsset>().TryGetDataById(cookwareId, out var cookwareData) &&
cookwareData.CookwareType == _currentCookwareType) cookwareData.CookwareType == _currentCookwareType)
{ {
foreach (var recipeId in recipeIds) foreach (var recipeId in recipeIds)

View File

@ -15,7 +15,7 @@ public static List<IngredientEntry> GetIngredients(this DrinkDataEntry dataEntry
public static List<TasteDataEntry> GetTasteDatas(this DrinkDataEntry dataEntry) public static List<TasteDataEntry> GetTasteDatas(this DrinkDataEntry dataEntry)
=> CraftingHelper.ResolveTasteDatas( => CraftingHelper.ResolveTasteDatas(
new[] { dataEntry.TasteKey1, dataEntry.TasteKey2, dataEntry.TasteKey3, dataEntry.TasteKey4, dataEntry.TasteKey5, dataEntry.TasteKey6 }, new[] { dataEntry.TasteKey1, dataEntry.TasteKey2, dataEntry.TasteKey3, dataEntry.TasteKey4, dataEntry.TasteKey5, dataEntry.TasteKey6 },
DataManager.Instance.GetDataSo<TasteDataAsset>() DataManager.Instance.GetDataAsset<TasteDataAsset>()
); );
public static int GetCraftableCount(this DrinkDataEntry dataEntry) public static int GetCraftableCount(this DrinkDataEntry dataEntry)

View File

@ -14,7 +14,7 @@ public static List<IngredientEntry> GetIngredients(this FoodDataEntry dataEntry)
public static List<TasteDataEntry> GetTasteDatas(this FoodDataEntry dataEntry) public static List<TasteDataEntry> GetTasteDatas(this FoodDataEntry dataEntry)
=> CraftingHelper.ResolveTasteDatas( => CraftingHelper.ResolveTasteDatas(
new[] { dataEntry.TasteKey1, dataEntry.TasteKey2, dataEntry.TasteKey3, dataEntry.TasteKey4, dataEntry.TasteKey5, dataEntry.TasteKey6 }, new[] { dataEntry.TasteKey1, dataEntry.TasteKey2, dataEntry.TasteKey3, dataEntry.TasteKey4, dataEntry.TasteKey5, dataEntry.TasteKey6 },
DataManager.Instance.GetDataSo<TasteDataAsset>() DataManager.Instance.GetDataAsset<TasteDataAsset>()
); );
public static int GetCraftableCount(this FoodDataEntry dataEntry) public static int GetCraftableCount(this FoodDataEntry dataEntry)

View File

@ -27,18 +27,18 @@ public ItemModel(string id, ItemType itemType)
public bool HasItem => Count > 0; public bool HasItem => Count > 0;
public string DisplayName => LocalizationManager.Instance.GetName(Id); public string DisplayName => LocalizationManager.Instance.GetName(Id);
public RecipeType RecipeType => ItemType == ItemType.Recipe ? DataManager.Instance.GetDataSo<RecipeDataAsset>().GetDataById(Id).RecipeType : RecipeType.None; public RecipeType RecipeType => ItemType == ItemType.Recipe ? DataManager.Instance.GetDataAsset<RecipeDataAsset>().GetDataById(Id).RecipeType : RecipeType.None;
public Sprite ItemSprite public Sprite ItemSprite
{ {
get get
{ {
if (ItemType == ItemType.Recipe) if (ItemType == ItemType.Recipe)
{ {
DataManager.Instance.GetDataSo<RecipeDataAsset>().TryGetDataById(Id, out var recipe); DataManager.Instance.GetDataAsset<RecipeDataAsset>().TryGetDataById(Id, out var recipe);
return DataManager.Instance.GetSprite(recipe.RecipeResult); return DataManager.Instance.GetSprite(recipe.RecipeResult);
} }
if (DataManager.Instance.GetDataSo<CookwareDataAsset>().ContainsData(Id)) if (DataManager.Instance.GetDataAsset<CookwareDataAsset>().ContainsData(Id))
{ {
return DataManager.Instance.GetIcon(Id); return DataManager.Instance.GetIcon(Id);
} }
@ -52,7 +52,7 @@ public string GetRecipeResultKey
{ {
if (ItemType != ItemType.Recipe) return null; if (ItemType != ItemType.Recipe) return null;
return DataManager.Instance.GetDataSo<RecipeDataAsset>().GetDataById(Id).RecipeResult; return DataManager.Instance.GetDataAsset<RecipeDataAsset>().GetDataById(Id).RecipeResult;
} }
} }
@ -65,8 +65,8 @@ public string GetCookwareKey
return RecipeType switch return RecipeType switch
{ {
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey).CookwareKey, RecipeType.FoodRecipe => DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey).CookwareKey,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey).CookwareKey, RecipeType.DrinkRecipe => DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey).CookwareKey,
_ => null _ => null
}; };
} }
@ -81,8 +81,8 @@ public int GetPrice
return RecipeType switch return RecipeType switch
{ {
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey).Price, RecipeType.FoodRecipe => DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey).Price,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey).Price, RecipeType.DrinkRecipe => DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey).Price,
_ => -1 _ => -1
}; };
} }
@ -98,11 +98,11 @@ public Sprite GetCookwareIcon
string cookwareKey = null; string cookwareKey = null;
if (RecipeType == RecipeType.FoodRecipe) if (RecipeType == RecipeType.FoodRecipe)
{ {
cookwareKey = DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey).CookwareKey; cookwareKey = DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey).CookwareKey;
} }
else if (RecipeType == RecipeType.DrinkRecipe) else if (RecipeType == RecipeType.DrinkRecipe)
{ {
cookwareKey = DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey).CookwareKey; cookwareKey = DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey).CookwareKey;
} }
return DataManager.Instance.GetIcon(cookwareKey); return DataManager.Instance.GetIcon(cookwareKey);
} }
@ -117,9 +117,9 @@ public List<IngredientEntry> GetIngredients
switch (RecipeType) switch (RecipeType)
{ {
case RecipeType.FoodRecipe: case RecipeType.FoodRecipe:
return DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(GetRecipeResultKey).GetIngredients(); return DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(GetRecipeResultKey).GetIngredients();
case RecipeType.DrinkRecipe: case RecipeType.DrinkRecipe:
return DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(GetRecipeResultKey).GetIngredients(); return DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(GetRecipeResultKey).GetIngredients();
} }
return null; return null;
@ -133,9 +133,9 @@ public List<TasteDataEntry> GetTasteDatas
switch (RecipeType) switch (RecipeType)
{ {
case RecipeType.FoodRecipe: case RecipeType.FoodRecipe:
return DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(GetRecipeResultKey).GetTasteDatas(); return DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(GetRecipeResultKey).GetTasteDatas();
case RecipeType.DrinkRecipe: case RecipeType.DrinkRecipe:
return DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(GetRecipeResultKey).GetTasteDatas(); return DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(GetRecipeResultKey).GetTasteDatas();
} }
return null; return null;
@ -153,12 +153,12 @@ public void UpdateCount()
if (RecipeType == RecipeType.FoodRecipe) if (RecipeType == RecipeType.FoodRecipe)
{ {
var foodData = DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey); var foodData = DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey);
craftableCount = foodData.GetCraftableCount(); craftableCount = foodData.GetCraftableCount();
} }
else if (RecipeType == RecipeType.DrinkRecipe) else if (RecipeType == RecipeType.DrinkRecipe)
{ {
var drinkData = DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey); var drinkData = DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey);
craftableCount = drinkData.GetCraftableCount(); craftableCount = drinkData.GetCraftableCount();
} }

View File

@ -33,16 +33,16 @@ public static List<ItemModel> CreateRestaurantManagementInventoryItem()
private static int CalculateCraftableCount(string recipeId) private static int CalculateCraftableCount(string recipeId)
{ {
if (!DataManager.Instance.GetDataSo<RecipeDataAsset>().TryGetDataById(recipeId, out var recipe)) return 0; if (!DataManager.Instance.GetDataAsset<RecipeDataAsset>().TryGetDataById(recipeId, out var recipe)) return 0;
string recipeResult = recipe.RecipeResult; string recipeResult = recipe.RecipeResult;
return recipe.RecipeType switch return recipe.RecipeType switch
{ {
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataAsset>().TryGetDataById(recipeResult, out var food) RecipeType.FoodRecipe => DataManager.Instance.GetDataAsset<FoodDataAsset>().TryGetDataById(recipeResult, out var food)
? food.GetCraftableCount() ? food.GetCraftableCount()
: 0, : 0,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataAsset>().TryGetDataById(recipeResult, out var drink) RecipeType.DrinkRecipe => DataManager.Instance.GetDataAsset<DrinkDataAsset>().TryGetDataById(recipeResult, out var drink)
? drink.GetCraftableCount() ? drink.GetCraftableCount()
: 0, : 0,
_ => 0 _ => 0
@ -51,7 +51,7 @@ private static int CalculateCraftableCount(string recipeId)
public static ItemModel CreateByItemId(string itemId) public static ItemModel CreateByItemId(string itemId)
{ {
var itemSo = DataManager.Instance.GetDataSo<ItemDataAsset>(); var itemSo = DataManager.Instance.GetDataAsset<ItemDataAsset>();
if (!itemSo.TryGetDataById(itemId, out var itemData)) return null; if (!itemSo.TryGetDataById(itemId, out var itemData)) return null;
if (InventoryManager.Instance.GetItemDataByIdOrNull(itemId) == null) return null; if (InventoryManager.Instance.GetItemDataByIdOrNull(itemId) == null) return null;

View File

@ -252,7 +252,7 @@ public void CreateInventoryItemSlot(Transform parent)
} }
else else
{ {
if (DataManager.Instance.GetDataSo<CookwareDataAsset>().TryGetDataById(model.Id, out var cookwareData)) if (DataManager.Instance.GetDataAsset<CookwareDataAsset>().TryGetDataById(model.Id, out var cookwareData))
{ {
interactor.Initialize(TodayMenuEventType.Add, new TodayCookwareInteractorStrategy()); interactor.Initialize(TodayMenuEventType.Add, new TodayCookwareInteractorStrategy());
} }
@ -334,18 +334,18 @@ private bool MatchesCategory(ItemModel model, InventoryCategoryType category)
case InventoryCategoryType.Food: case InventoryCategoryType.Food:
if (model.ItemType != ItemType.Recipe) return false; if (model.ItemType != ItemType.Recipe) return false;
return DataManager.Instance.GetDataSo<RecipeDataAsset>() return DataManager.Instance.GetDataAsset<RecipeDataAsset>()
.TryGetDataById(model.Id, out var foodRecipe) && foodRecipe.RecipeType == RecipeType.FoodRecipe; .TryGetDataById(model.Id, out var foodRecipe) && foodRecipe.RecipeType == RecipeType.FoodRecipe;
case InventoryCategoryType.Drink: case InventoryCategoryType.Drink:
if (model.ItemType != ItemType.Recipe) return false; if (model.ItemType != ItemType.Recipe) return false;
return DataManager.Instance.GetDataSo<RecipeDataAsset>() return DataManager.Instance.GetDataAsset<RecipeDataAsset>()
.TryGetDataById(model.Id, out var drinkRecipe) && .TryGetDataById(model.Id, out var drinkRecipe) &&
drinkRecipe.RecipeType == RecipeType.DrinkRecipe; drinkRecipe.RecipeType == RecipeType.DrinkRecipe;
case InventoryCategoryType.Ingredient: case InventoryCategoryType.Ingredient:
return model.ItemType == ItemType.Ingredient; return model.ItemType == ItemType.Ingredient;
case InventoryCategoryType.Cookware: case InventoryCategoryType.Cookware:
return DataManager.Instance.GetDataSo<CookwareDataAsset>() return DataManager.Instance.GetDataAsset<CookwareDataAsset>()
.TryGetDataById(model.Id, out var cookwareData); .TryGetDataById(model.Id, out var cookwareData);
case InventoryCategoryType.Special: case InventoryCategoryType.Special:
return false; return false;