From 533ca8ccf127fb9a9ffc75f3468b29e41afda257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Thu, 28 Aug 2025 15:46:53 +0900 Subject: [PATCH] =?UTF-8?q?MealSubsystem,=20Solver=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/RestaurantOrder.prefab | 75 ++++++++++++++++++- .../Interactions/InteractionSubsystem_Meal.cs | 66 ---------------- .../InteractionSubsystem_Meal.cs.meta | 3 - .../Event/Solvers/RestaurantMeals.meta | 3 - .../RestaurantMeals/RestaurantMealSolver.cs | 18 ----- .../RestaurantMealSolver.cs.meta | 3 - .../RestaurantMealSolver_WaitForOrder.cs | 18 ----- .../RestaurantMealSolver_WaitForOrder.cs.meta | 3 - .../RestaurantMealSolver_WaitForServe.cs | 17 ----- .../RestaurantMealSolver_WaitForServe.cs.meta | 3 - .../_DDD/_Scripts/Restaurant/Ui/OrderUi.meta | 3 + .../Restaurant/Ui/OrderUi/Component.meta | 3 + .../Component/PropUiDisplayComponent.cs | 62 +++++++++++++++ .../Component}/PropUiDisplayComponent.cs.meta | 0 .../Component/RestaurantUiDisplayComponent.cs | 18 +++++ .../RestaurantUiDisplayComponent.cs.meta | 3 + .../Restaurant/Ui/PropUiDisplayComponent.cs | 9 --- 17 files changed, 163 insertions(+), 144 deletions(-) delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs.meta delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals.meta delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs.meta delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs.meta delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs.meta create mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta create mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component.meta create mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs rename Assets/_DDD/_Scripts/Restaurant/Ui/{ => OrderUi/Component}/PropUiDisplayComponent.cs.meta (100%) create mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs create mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs.meta delete mode 100644 Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs diff --git a/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab b/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab index 546d96553..112c3c0c4 100644 --- a/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab +++ b/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab @@ -98,6 +98,7 @@ GameObject: - component: {fileID: 3697702677815423220} - component: {fileID: 3591347921553422000} - component: {fileID: 4456475204957017828} + - component: {fileID: 7969024827453302529} m_Layer: 7 m_Name: RestaurantOrder m_TagString: Untagged @@ -154,4 +155,76 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c0b1e0992510498b8d33d5b6094b8f4b, type: 3} m_Name: m_EditorClassIdentifier: - orderType: 0 + _orderType: 0 +--- !u!114 &7969024827453302529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4103096974375017811} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 239c77aa6dcf4bf9a04aaf76685da13d, type: 3} + m_Name: + m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: + - {fileID: 2100000, guid: efc890589b4c46948885cd750384bc6f, type: 2} + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: _materialDictionary + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[DDD.RestaurantOrderType, Assembly-CSharp],[UnityEngine.Material, + UnityEngine.CoreModule]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.EnumEqualityComparer`1[[DDD.RestaurantOrderType, + Assembly-CSharp]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 3 + Data: 2 + - Name: $v + Entry: 10 + Data: 0 + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 3 + Data: 4 + - Name: $v + Entry: 10 + Data: 0 + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs deleted file mode 100644 index 48b1b410d..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Unity.VisualScripting; -using UnityEngine; - -namespace DDD -{ - public enum RestaurantMealType : uint - { - None = 0u, - WaitForOrder = 1u, - WaitForServe = 1u << 1 - } - public class InteractionSubsystem_Meal : MonoBehaviour, IInteractionSubsystemObject - { - private RestaurantMealType _currentRestaurantMealType; - private void Awake() - { - _currentRestaurantMealType = RestaurantMealType.None; - } - public RestaurantMealType GetInteractionSubsystemType() - { - return _currentRestaurantMealType; - } - - public void SetInteractionSubsystemType(RestaurantMealType inValue) - { - Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] SetInteractionSubsystemType {inValue.ToString()}"); - _currentRestaurantMealType = inValue; - } - - public void InitializeSubsystem() - { - Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] InitializeSubsystem"); - _currentRestaurantMealType = RestaurantMealType.None; - } - - public bool CanInteract() - { - return _currentRestaurantMealType != RestaurantMealType.None; - } - - public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null) - { - Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] OnInteracted"); - var prev = _currentRestaurantMealType; - _currentRestaurantMealType = GetNextState(prev); - return true; - } - - public ScriptableObject GetPayload() - { - return null; - } - - private RestaurantMealType GetNextState(RestaurantMealType state) - { - switch (state) - { - case RestaurantMealType.None : return RestaurantMealType.WaitForOrder; - case RestaurantMealType.WaitForOrder : return RestaurantMealType.WaitForServe; - case RestaurantMealType.WaitForServe : return RestaurantMealType.None; - default: return RestaurantMealType.None; - } - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs.meta deleted file mode 100644 index 16a96ce29..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Environment/Interactions/InteractionSubsystem_Meal.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 31d5c600061a4f05b19824e068e0c2af -timeCreated: 1756176676 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals.meta b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals.meta deleted file mode 100644 index 00588c64d..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 601164c0231c43fca9349170e1e0ccec -timeCreated: 1756176395 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs deleted file mode 100644 index cd4b2a565..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DDD -{ - public class RestaurantMealSolver : RestaurantSubsystemSolver - { - private Dictionary _typeToMealSolver = new() - { - { RestaurantMealType.WaitForOrder, typeof(RestaurantMealSolver_WaitForOrder) }, - { RestaurantMealType.WaitForServe, typeof(RestaurantMealSolver_WaitForServe) } - }; - protected override Dictionary GetSubsystemSolverTypeMappings() - { - return _typeToMealSolver; - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs.meta deleted file mode 100644 index f0fbded31..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 391c551614be4f21a2e700f44569e92a -timeCreated: 1756176491 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs deleted file mode 100644 index 08e335c53..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; - -namespace DDD -{ - public class RestaurantMealSolver_WaitForOrder : MonoBehaviour, IInteractionSubsystemSolver - { - public bool ExecuteInteractionSubsystem(IInteractor interactor, IInteractable interactable, ScriptableObject payload = null) - { - return true; - } - - public bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null) - { - - return true; - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs.meta deleted file mode 100644 index b77d17fa1..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForOrder.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: cff2611181194e4a92576bdbcead4fad -timeCreated: 1756181225 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs deleted file mode 100644 index cddc8d0b3..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs +++ /dev/null @@ -1,17 +0,0 @@ -using UnityEngine; - -namespace DDD -{ - public class RestaurantMealSolver_WaitForServe : MonoBehaviour, IInteractionSubsystemSolver - { - public bool ExecuteInteractionSubsystem(IInteractor interactor, IInteractable interactable, ScriptableObject payload = null) - { - return true; - } - - public bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null) - { - return true; - } - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs.meta deleted file mode 100644 index 4174d79c1..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Event/Solvers/RestaurantMeals/RestaurantMealSolver_WaitForServe.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e9292616267b4299a3d2e0d29c84f69b -timeCreated: 1756181667 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta new file mode 100644 index 000000000..91f40a2f7 --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 87ed47ac3b814346aee2f613d39082b3 +timeCreated: 1756357383 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component.meta b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component.meta new file mode 100644 index 000000000..8c73fa698 --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8ffa0a2f63cc4324a4ae90ff95b29cb5 +timeCreated: 1756357391 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs new file mode 100644 index 000000000..43a5ab87a --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using Sirenix.OdinInspector; +using UnityEngine; + +namespace DDD.Restaurant +{ + public abstract class PropUiDisplayComponent : SerializedMonoBehaviour where T : Enum + { + private IInteractionSubsystemObject _interactionSubsystemObject; + private Dictionary _materialDictionary; + private T _prevInteractionType; + private SpriteRenderer _spriteRenderer; + private void Awake() + { + Initialize(); + } + + protected abstract Dictionary SetMaterialDictionary(); + + protected virtual void Initialize() + { + bool isInteractionSubsystem = gameObject.TryGetComponent(out _interactionSubsystemObject); + if (!isInteractionSubsystem) + { + Debug.LogError($"Interaction Subsystem<{typeof(T)}> is not exist"); + return; + } + + if (!TryGetComponent(out _spriteRenderer)) + { + _spriteRenderer = gameObject.AddComponent(); + // TODO 임시값, 나중에 제대로 수정할 것 + _spriteRenderer.sortingOrder = 100; + _spriteRenderer.enabled = false; + } + + _materialDictionary = SetMaterialDictionary(); + } + + private void Update() + { + T currentInteractionType = _interactionSubsystemObject.GetInteractionSubsystemType(); + if (EqualityComparer.Default.Equals(_prevInteractionType, currentInteractionType)) return; + _prevInteractionType = currentInteractionType; + UpdateView(_prevInteractionType); + } + + private void UpdateView(T state) + { + if (!_materialDictionary.TryGetValue(state, out var material) || material == null) + { + // TODO 캔버스 다운 + _spriteRenderer.enabled = false; + return; + } + // ui 머티리얼 교체 + _spriteRenderer.enabled = true; + _spriteRenderer.material = material; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs.meta rename to Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs.meta diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs new file mode 100644 index 000000000..8113d294f --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using UnityEngine; +using Sirenix.OdinInspector; +using Sirenix.Serialization; + + +namespace DDD.Restaurant +{ + public class RestaurantUiDisplayComponent : PropUiDisplayComponent + { + [OdinSerialize] + private Dictionary _materialDictionary = new(); + protected override Dictionary SetMaterialDictionary() + { + return _materialDictionary; + } + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs.meta b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs.meta new file mode 100644 index 000000000..12fb47894 --- /dev/null +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 239c77aa6dcf4bf9a04aaf76685da13d +timeCreated: 1756357438 \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs deleted file mode 100644 index 817d2635c..000000000 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/PropUiDisplayComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; - -namespace DDD.Restaurant -{ - public class PropUiDisplayComponent : MonoBehaviour - { - - } -} \ No newline at end of file