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

This commit is contained in:
김산 2025-08-29 11:35:33 +09:00
commit 3e49bb8e18
75 changed files with 4057 additions and 117 deletions

Binary file not shown.

View File

@ -348,6 +348,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 4895648053684561955}
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 1633775615311007542}
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
--- !u!1 &1277704713268947483 stripped
GameObject:
@ -627,6 +630,19 @@ MonoBehaviour:
_outlineSharpness: 8
_currentOutlineType: 0
_currentOpacityMultiplier: 1
--- !u!114 &1633775615311007542
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1277704713268947483}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3}
m_Name:
m_EditorClassIdentifier:
<CookwareType>k__BackingField: 3
--- !u!4 &3654677467368248574 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2204914584875671904, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}

View File

@ -229,6 +229,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 6199984767033459821}
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 8977540742820762731}
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
--- !u!1 &4244061870577629946 stripped
GameObject:
@ -508,6 +511,19 @@ MonoBehaviour:
_outlineSharpness: 8
_currentOutlineType: 0
_currentOpacityMultiplier: 1
--- !u!114 &8977540742820762731
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4244061870577629946}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3}
m_Name:
m_EditorClassIdentifier:
<CookwareType>k__BackingField: 2
--- !u!4 &4499382904539758566 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4111453722694982297, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}

View File

@ -265,6 +265,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 4049645275774486586}
- targetCorrespondingSourceObject: {fileID: 4438924429928472453, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
insertIndex: -1
addedObject: {fileID: 216072919608443244}
m_SourcePrefab: {fileID: 100100000, guid: 1d634c3376e4a4684bc984ced9134847, type: 3}
--- !u!4 &8675645304246391653 stripped
Transform:
@ -549,6 +552,19 @@ MonoBehaviour:
_outlineSharpness: 8
_currentOutlineType: 0
_currentOpacityMultiplier: 1
--- !u!114 &216072919608443244
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9003538228676253305}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 51968825b07cc964fafbc62c69322b30, type: 3}
m_Name:
m_EditorClassIdentifier:
<CookwareType>k__BackingField: 1
--- !u!1001 &5406243702551518767
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -426,7 +426,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 81e01dd8c1cc3404d805400eba1bb4ae, type: 3}
m_Name:
m_EditorClassIdentifier:
_availableInteractions: 7
_availableInteractions: 15
_nearColliders:
- {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
{
private readonly Dictionary<Type, ScriptableObject> _dataSoTable = new();
private Dictionary<Type, ScriptableObject> _dataAssetTable = new();
private Dictionary<string, Sprite> _spriteAtlas;
private const string SoLabel = "GoogleSheetSo";
private const string AssetLabel = "GoogleSheetSo";
private const string Icon = "_icon";
public void PreInit()
@ -32,15 +32,15 @@ public void PostInit()
private async Task LoadAllGameDataSo()
{
var soList = await AssetManager.Instance.LoadAssetsByLabel<ScriptableObject>(SoLabel);
foreach (var so in soList)
var assets = await AssetManager.Instance.LoadAssetsByLabel<ScriptableObject>(AssetLabel);
_dataAssetTable = new Dictionary<Type, ScriptableObject>(assets.Count);
foreach (var asset in assets)
{
var type = so.GetType();
_dataSoTable.TryAdd(type, so);
var type = asset.GetType();
_dataAssetTable.TryAdd(type, asset);
}
Debug.Log($"[DataManager] {_dataSoTable.Count}개의 SO가 로드되었습니다.");
Debug.Log($"[DataManager] {_dataAssetTable.Count}개의 DataAsset이 로드되었습니다.");
}
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;
}
Debug.LogError($"[DataManager] {typeof(T).Name} SO를 찾을 수 없습니다.");
Debug.LogError($"[DataManager] {typeof(T).Name} 찾을 수 없습니다.");
return null;
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
namespace DDD
{
@ -28,11 +29,12 @@ public InteractionExecutionParameters(float holdTime = 0f)
[System.Serializable]
public struct InteractionDisplayParameters
{
[SerializeField] private string _messageKey;
public string MessageKey => _messageKey;
public InteractionDisplayParameters(string messageKey = "")
[field: SerializeField] public string DefaultMessageKey { get; private set; }
[field: SerializeField] public string ConditionalMessageKey { get; private set; }
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();
bool CanInteract();
bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null);
string GetCurrentSubsystemTypeName();
}
public interface IInteractionSubsystemObject<T> : IInteractionSubsystemObject where T : Enum
{

View File

@ -70,6 +70,8 @@ public void PostInit()
/// </summary>
public LocalizedString GetLocalizedString(string key)
{
if (string.IsNullOrWhiteSpace(key)) return null;
if (!_isInitialized)
{
Debug.LogWarning("[LocalizationManager] 호출 전에 초기화되지 않았습니다.");

View File

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

View File

@ -47,10 +47,10 @@ private void RemoveItem()
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 DataManager.Instance.GetDataSo<ItemDataAsset>().GetDataList()
return DataManager.Instance.GetDataAsset<ItemDataAsset>().GetDataList()
.Select(data => data.Id)
.Where(id => !string.IsNullOrEmpty(id));
}

View File

@ -47,13 +47,14 @@ public void HandleEvent(HideInteractionUiEvent evt)
private void ShowInteractionUiEvent(ShowInteractionUiEvent evt)
{
_previousLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey);
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
if (_textLabelLocalizeStringEvent.StringReference != _previousLocalizedString)
var currentLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey);
if (currentLocalizedString != _previousLocalizedString)
{
_textLabelLocalizeStringEvent.StringReference = _previousLocalizedString;
_textLabelLocalizeStringEvent.StringReference = currentLocalizedString;
_previousLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey);
}
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
_filledImage.fillAmount = evt.HoldProgress;
if (_panel.activeInHierarchy == false)

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",
"CookTime:int": 10,
"Price:int": 30,
"IngredientKey1:string": "item_ingredient_005",
"IngredientKey1:string": "item_ingredient_012",
"IngredientAmount1:string": 1,
"IngredientKey2:string": "item_ingredient_006",
"IngredientAmount2:string": 2,
@ -1755,5 +1755,56 @@
"SpriteKey:string": "",
"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)
{
var displayParameters = interactable.GetDisplayParameters();
var evt = GameEvents.ShowInteractionUiEvent;
evt.CanInteract = canInteract;
evt.TextKey = interactable.GetDisplayParameters().MessageKey;
evt.TextKey = canInteract ? displayParameters.DefaultMessageKey : displayParameters.ConditionalMessageKey;
evt.HoldProgress = ratio;
EventBus.Broadcast(evt);
}

View File

@ -31,7 +31,7 @@ public override Task OnExitCurrentFlow(GameFlowState exitingFlowState)
private void GenerateDummyEnvironmentProps()
{
// 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++)
{

View File

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

View File

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

View File

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

View File

@ -0,0 +1,14 @@
using UnityEngine;
namespace DDD.Restaurant
{
public interface ICookware
{
CookwareType CookwareType { get; }
}
public class CookwareComponent : MonoBehaviour, ICookware
{
[field: SerializeField] public CookwareType CookwareType { get; private set; }
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 51968825b07cc964fafbc62c69322b30

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ public class RestaurantEnvironment : MonoBehaviour
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>();
_rootObject = transform.Find(CommonConstants.RootObject);

View File

@ -11,8 +11,9 @@ public static class RestaurantInteractionSubsystems
{
public static Dictionary<InteractionType, Type> TypeToSubsystem = new()
{
{InteractionType.RestaurantOrder, typeof(InteractionSubsystem_Order)},
{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
[ValueDropdown("GetAllInteractionTypes")]
[SerializeField] protected InteractionType _interactionType = InteractionType.None;
[SerializeField] protected InteractionExecutionParameters _executionParameters = new InteractionExecutionParameters(1f);
[SerializeField] protected InteractionDisplayParameters _displayParameters = new InteractionDisplayParameters("");
[SerializeField] protected InteractionExecutionParameters _executionParameters = new(1f);
[SerializeField] protected InteractionDisplayParameters _displayParameters;
[SerializeField] protected GameFlowState _interactionAvailableFlows;
[SerializeField] private Transform[] _aiInteractionPoints;
[SerializeField] private bool autoInitialize = true;
@ -141,6 +142,13 @@ public virtual InteractionExecutionParameters GetExecutionParameters()
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;
}
@ -152,7 +160,7 @@ public float GetRequiredHoldTime()
public string GetInteractionMessageKey()
{
return _displayParameters.MessageKey;
return _displayParameters.DefaultMessageKey;
}
public Vector3[] GetInteractionPoints()

View File

@ -4,19 +4,37 @@ namespace DDD.Restaurant
{
public class RestaurantCookSolver_OpenCookUi : MonoBehaviour, IInteractionSubsystemSolver<RestaurantCookType>
{
private CookwareType _cookwareType;
public bool ExecuteInteractionSubsystem(IInteractor interactor, IInteractable interactable, ScriptableObject payload = null)
{
if (CanExecuteInteractionSubsystem(interactor, interactable, payload) == false) return false;
var evt = GameEvents.OpenPopupUiEvent;
evt.UiType = typeof(CookUi);
//evt.Payload = cookwareTypePayload.CookwareType;
evt.Payload = _cookwareType;
EventBus.Broadcast(evt);
return true;
}
public bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null)
{
_cookwareType = CookwareType.None;
var iCookware = interactable?.GetInteractableGameObject().GetComponent<ICookware>();
if (iCookware == null) return false;
var interactableCookwareType = iCookware.CookwareType;
if (DataManager.Instance.GetDataAsset<CookwareDataAsset>().TryGetValueByCookwareType(interactableCookwareType, out var cookwareData) == false)
{
return false;
}
if (RestaurantState.Instance.ManagementState.HasAddedCookByCookwareKey(cookwareData.Id) == false)
{
return false;
}
_cookwareType = interactableCookwareType;
GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState;
return currentGameFlowState == GameFlowState.RunRestaurant;
}

View File

@ -8,8 +8,8 @@ public class RestaurantManagementSolver : RestaurantSubsystemSolver<RestaurantMa
private Dictionary<RestaurantManagementType, Type> _typeToManagementSolver = new()
{
{ RestaurantManagementType.OpenRestaurantMenu, typeof(RestaurantManagementSolver_Menu) },
{ RestaurantManagementType.StartRestaurant, typeof(RestaurantManagementSolver_Start) },
{ RestaurantManagementType.OpenManagementUi, typeof(RestaurantManagementSolver_Menu) },
{ RestaurantManagementType.RunRestaurant, typeof(RestaurantManagementSolver_Start) },
};
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 (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;
@ -87,7 +87,7 @@ public bool TryAddTodayMenu(ItemModel model)
{
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();
foodData.ConsumeAllCraftableIngredients();
@ -98,7 +98,7 @@ public bool TryAddTodayMenu(ItemModel model)
{
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();
drinkData.ConsumeAllCraftableIngredients();
@ -128,7 +128,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
string recipeId = model.Id;
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;
int refundCount = 0;
@ -142,7 +142,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
if (removed)
{
var foodData = DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(recipeData.RecipeResult);
var foodData = DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(recipeData.RecipeResult);
foodData.RefundIngredients(refundCount);
}
}
@ -156,7 +156,7 @@ public bool TryRemoveTodayMenu(ItemModel model)
if (removed)
{
var drinkData = DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(recipeData.RecipeResult);
var drinkData = DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(recipeData.RecipeResult);
drinkData.RefundIngredients(refundCount);
}
}
@ -183,7 +183,7 @@ public bool TryAddTodayCookware(ItemModel model)
{
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;
@ -212,7 +212,7 @@ public bool TryRemoveTodayCookware(ItemModel model)
{
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;
@ -228,14 +228,14 @@ public bool TryRemoveTodayCookware(ItemModel model)
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;
return recipeData.RecipeType switch
{
RecipeType.FoodRecipe => DataManager.Instance.GetDataSo<FoodDataAsset>().GetDataById(resultKey).CookwareKey,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataSo<DrinkDataAsset>().GetDataById(resultKey).CookwareKey,
RecipeType.FoodRecipe => DataManager.Instance.GetDataAsset<FoodDataAsset>().GetDataById(resultKey).CookwareKey,
RecipeType.DrinkRecipe => DataManager.Instance.GetDataAsset<DrinkDataAsset>().GetDataById(resultKey).CookwareKey,
_ => null
};
}
@ -254,5 +254,10 @@ public bool IsTodayMenuMatched(string cookwareId)
return false;
}
public bool HasAddedCookByCookwareKey(string cookwareKey)
{
return _cookwareToRecipeIds.ContainsKey(cookwareKey) && _cookwareToRecipeIds[cookwareKey].Count > 0;;
}
}
}

View File

@ -89,7 +89,7 @@ public void SetCookwareType(CookwareType cookwareType)
if (_currentCookwareType == cookwareType) return;
_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;
CookwareIcon = DataManager.Instance.GetIcon(cookwareKey);
CookwareName = LocalizationManager.Instance.GetLocalizedName(cookwareKey);
@ -119,7 +119,7 @@ public void CreateAddedCookItemSlot(Transform parent)
var cookwareId = cookwareToRecipe.Key;
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)
{
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)
=> CraftingHelper.ResolveTasteDatas(
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)

View File

@ -14,7 +14,7 @@ public static List<IngredientEntry> GetIngredients(this FoodDataEntry dataEntry)
public static List<TasteDataEntry> GetTasteDatas(this FoodDataEntry dataEntry)
=> CraftingHelper.ResolveTasteDatas(
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)

View File

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

View File

@ -33,16 +33,16 @@ public static List<ItemModel> CreateRestaurantManagementInventoryItem()
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;
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()
: 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()
: 0,
_ => 0
@ -51,7 +51,7 @@ private static int CalculateCraftableCount(string recipeId)
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 (InventoryManager.Instance.GetItemDataByIdOrNull(itemId) == null) return null;

View File

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