MealSubsystem, Solver 제거
This commit is contained in:
parent
86c0f67c7c
commit
533ca8ccf1
@ -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:
|
||||
|
@ -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<RestaurantMealType>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31d5c600061a4f05b19824e068e0c2af
|
||||
timeCreated: 1756176676
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 601164c0231c43fca9349170e1e0ccec
|
||||
timeCreated: 1756176395
|
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantMealSolver : RestaurantSubsystemSolver<RestaurantMealType>
|
||||
{
|
||||
private Dictionary<RestaurantMealType, Type> _typeToMealSolver = new()
|
||||
{
|
||||
{ RestaurantMealType.WaitForOrder, typeof(RestaurantMealSolver_WaitForOrder) },
|
||||
{ RestaurantMealType.WaitForServe, typeof(RestaurantMealSolver_WaitForServe) }
|
||||
};
|
||||
protected override Dictionary<RestaurantMealType, Type> GetSubsystemSolverTypeMappings()
|
||||
{
|
||||
return _typeToMealSolver;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 391c551614be4f21a2e700f44569e92a
|
||||
timeCreated: 1756176491
|
@ -1,18 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantMealSolver_WaitForOrder : MonoBehaviour, IInteractionSubsystemSolver<RestaurantMealType>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cff2611181194e4a92576bdbcead4fad
|
||||
timeCreated: 1756181225
|
@ -1,17 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
public class RestaurantMealSolver_WaitForServe : MonoBehaviour, IInteractionSubsystemSolver<RestaurantMealType>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9292616267b4299a3d2e0d29c84f69b
|
||||
timeCreated: 1756181667
|
3
Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta
Normal file
3
Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87ed47ac3b814346aee2f613d39082b3
|
||||
timeCreated: 1756357383
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ffa0a2f63cc4324a4ae90ff95b29cb5
|
||||
timeCreated: 1756357391
|
@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD.Restaurant
|
||||
{
|
||||
public abstract class PropUiDisplayComponent<T> : SerializedMonoBehaviour where T : Enum
|
||||
{
|
||||
private IInteractionSubsystemObject<T> _interactionSubsystemObject;
|
||||
private Dictionary<T, Material> _materialDictionary;
|
||||
private T _prevInteractionType;
|
||||
private SpriteRenderer _spriteRenderer;
|
||||
private void Awake()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
protected abstract Dictionary<T, Material> 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<SpriteRenderer>();
|
||||
// TODO 임시값, 나중에 제대로 수정할 것
|
||||
_spriteRenderer.sortingOrder = 100;
|
||||
_spriteRenderer.enabled = false;
|
||||
}
|
||||
|
||||
_materialDictionary = SetMaterialDictionary();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
T currentInteractionType = _interactionSubsystemObject.GetInteractionSubsystemType();
|
||||
if (EqualityComparer<T>.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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.Serialization;
|
||||
|
||||
|
||||
namespace DDD.Restaurant
|
||||
{
|
||||
public class RestaurantUiDisplayComponent : PropUiDisplayComponent<RestaurantOrderType>
|
||||
{
|
||||
[OdinSerialize]
|
||||
private Dictionary<RestaurantOrderType, Material> _materialDictionary = new();
|
||||
protected override Dictionary<RestaurantOrderType, Material> SetMaterialDictionary()
|
||||
{
|
||||
return _materialDictionary;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 239c77aa6dcf4bf9a04aaf76685da13d
|
||||
timeCreated: 1756357438
|
@ -1,9 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD.Restaurant
|
||||
{
|
||||
public class PropUiDisplayComponent : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user