PropUiDisplay 직렬화 누락 수정

This commit is contained in:
Jeonghyeon Ha 2025-09-01 15:36:49 +09:00
parent 86518fcd84
commit 32d2e31b50
3 changed files with 15 additions and 8 deletions

View File

@ -172,7 +172,7 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 3 Entry: 3
Data: 2 Data: 4
- Name: $v - Name: $v
Entry: 10 Entry: 10
Data: 0 Data: 0
@ -184,7 +184,7 @@ MonoBehaviour:
Data: Data:
- Name: $k - Name: $k
Entry: 3 Entry: 3
Data: 4 Data: 2
- Name: $v - Name: $v
Entry: 10 Entry: 10
Data: 0 Data: 0
@ -200,7 +200,9 @@ MonoBehaviour:
_rotation: {x: 40, y: 0, z: 0} _rotation: {x: 40, y: 0, z: 0}
_defaultSprite: {fileID: 21300000, guid: 94f9e78fc7b864b93842bdfa21276f09, type: 3} _defaultSprite: {fileID: 21300000, guid: 94f9e78fc7b864b93842bdfa21276f09, type: 3}
_offset: {x: 0, y: 1.5, z: 1.35} _offset: {x: 0, y: 1.5, z: 1.35}
_fixedSpriteSize: {x: 0.2, y: 0.2} _disabledOffset: {x: 0, y: 0.2, z: 0.165}
_fixedLocalScale: {x: 0.2, y: 0.2}
_disabledColor: {r: 0.6627451, g: 0.6627451, b: 0.6627451, a: 0.5}
--- !u!114 &1332098886975329103 --- !u!114 &1332098886975329103
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -12,7 +12,7 @@ public abstract class PropUiDisplayComponent<T> : SerializedMonoBehaviour where
[SerializeField] [SerializeField]
protected Sprite _defaultSprite; protected Sprite _defaultSprite;
private IInteractionSubsystemObject<T> _interactionSubsystemObject; private IInteractionSubsystemObject<T> _interactionSubsystemObject;
private Dictionary<T, Material> _materialDictionary; private Dictionary<T, Material> _internalMaterials;
private T _currentInteractionType; private T _currentInteractionType;
protected IInteractable _interactable; protected IInteractable _interactable;
protected SpriteRenderer _spriteRenderer; protected SpriteRenderer _spriteRenderer;
@ -22,7 +22,7 @@ private void Awake()
Initialize(); Initialize();
} }
protected abstract Dictionary<T, Material> SetMaterialDictionary(); protected abstract Dictionary<T, Material> GetInteractionDisplayMaterials();
protected virtual void Initialize() protected virtual void Initialize()
{ {
@ -44,7 +44,7 @@ protected virtual void Initialize()
uiGameObject.layer = LayerMask.NameToLayer("WorldUI"); uiGameObject.layer = LayerMask.NameToLayer("WorldUI");
UpdateSpriteTransform(); UpdateSpriteTransform();
_materialDictionary = SetMaterialDictionary(); _internalMaterials = GetInteractionDisplayMaterials();
} }
protected virtual void UpdateSpriteTransform() protected virtual void UpdateSpriteTransform()
@ -109,7 +109,7 @@ virtual protected Color GetSpriteColor()
private bool UpdateSpriteMaterial(T state) private bool UpdateSpriteMaterial(T state)
{ {
if (!_materialDictionary.TryGetValue(state, out var material) || material == null) if (!_internalMaterials.TryGetValue(state, out var material) || material == null)
{ {
// TODO 캔버스 다운 // TODO 캔버스 다운
_spriteRenderer.enabled = false; _spriteRenderer.enabled = false;

View File

@ -19,11 +19,16 @@ public class RestaurantUiDisplayComponent : PropUiDisplayComponent<RestaurantOrd
private Color _disabledColor = new Color(Color.darkGray.r, Color.darkGray.g, Color.darkGray.b, 0.5f); private Color _disabledColor = new Color(Color.darkGray.r, Color.darkGray.g, Color.darkGray.b, 0.5f);
[OdinSerialize] [OdinSerialize]
private Dictionary<RestaurantOrderType, Material> _materialDictionary = new(); private Dictionary<RestaurantOrderType, Material> _materialDictionary = new();
protected override Dictionary<RestaurantOrderType, Material> SetMaterialDictionary() protected override Dictionary<RestaurantOrderType, Material> GetInteractionDisplayMaterials()
{ {
return _materialDictionary; return _materialDictionary;
} }
protected override void Initialize()
{
base.Initialize();
}
protected override void UpdateSpriteTransform() protected override void UpdateSpriteTransform()
{ {
base.UpdateSpriteTransform(); base.UpdateSpriteTransform();