From e100edc360ec0837143e191fb5a398a4694fc42d Mon Sep 17 00:00:00 2001 From: Jeonghyeon Ha Date: Mon, 1 Sep 2025 15:16:01 +0900 Subject: [PATCH] =?UTF-8?q?RestaurantOrder-Serve=20=EC=8A=A4=ED=94=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=ED=8A=B8=20=EB=A0=8C=EB=8D=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/RestaurantOrder.prefab | 4 +-- .../Component/PropUiDisplayComponent.cs | 12 +++++-- .../Component/RestaurantUiDisplayComponent.cs | 31 ++++++++++++++++--- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab b/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab index 84946ab73..003272451 100644 --- a/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab +++ b/Assets/_DDD/Restaurant/Environments/Interactables/Common/RestaurantOrder.prefab @@ -197,9 +197,9 @@ MonoBehaviour: - Name: Entry: 8 Data: - _offset: {x: 0, y: 1.5, z: 1.35} _rotation: {x: 40, y: 0, z: 0} - _temporarySprite: {fileID: 21300000, guid: 94f9e78fc7b864b93842bdfa21276f09, type: 3} + _defaultSprite: {fileID: 21300000, guid: 94f9e78fc7b864b93842bdfa21276f09, type: 3} + _offset: {x: 0, y: 1.5, z: 1.35} _fixedSpriteSize: {x: 0.2, y: 0.2} --- !u!114 &1332098886975329103 MonoBehaviour: diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs index e7ade474d..707183dcc 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/PropUiDisplayComponent.cs @@ -95,25 +95,31 @@ public void SetCurrentInteractionType(T interactionType) private void UpdateView(T state) { - if (UpdateSpriteMaterial(state)) + if (!UpdateSpriteMaterial(state)) { return; } UpdateSpriteTransform(); } + virtual protected Color GetSpriteColor() + { + return Color.white; + } + private bool UpdateSpriteMaterial(T state) { if (!_materialDictionary.TryGetValue(state, out var material) || material == null) { // TODO 캔버스 다운 _spriteRenderer.enabled = false; - return true; + return false; } + material.color = GetSpriteColor(); // ui 머티리얼 교체 _spriteRenderer.enabled = true; _spriteRenderer.material = material; - return false; + return true; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs index 2edef1651..9829eb4d6 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/OrderUi/Component/RestaurantUiDisplayComponent.cs @@ -2,6 +2,7 @@ using UnityEngine; using Sirenix.OdinInspector; using Sirenix.Serialization; +using UnityEngine.Serialization; namespace DDD.Restaurant @@ -11,8 +12,12 @@ public class RestaurantUiDisplayComponent : PropUiDisplayComponent _materialDictionary = new(); protected override Dictionary SetMaterialDictionary() { @@ -22,7 +27,25 @@ protected override Dictionary SetMaterialDictiona protected override void UpdateSpriteTransform() { base.UpdateSpriteTransform(); - _spriteRenderer.transform.localScale = _fixedSpriteSize; + _spriteRenderer.transform.localScale = _fixedLocalScale; + } + + protected override Sprite GetDisplaySprite() + { + if (GetCurrentInteractionType() == RestaurantOrderType.Serve) + { + // TODO : Sprite by current restaurant order type. get from RestaurantOrderObject. + } + return base.GetDisplaySprite(); + } + + protected override Color GetSpriteColor() + { + if (GetCurrentInteractionType() == RestaurantOrderType.Serve) + { + return _disabledColor; + } + return base.GetSpriteColor(); } protected override Vector3 GetDisplayPosition() @@ -36,7 +59,7 @@ protected override Vector3 GetDisplayPosition() return points[0] + _offset; } } - return transform.position; + return transform.position + _disabledOffset; } } } \ No newline at end of file