RestaurantOrder-Serve 스프라이트 렌더 수정
This commit is contained in:
parent
92f24af250
commit
e100edc360
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<RestaurantOrd
|
||||
[SerializeField]
|
||||
protected Vector3 _offset = new Vector3(0.0f, 0.75f, 0.675f);
|
||||
[SerializeField]
|
||||
private Vector2 _fixedSpriteSize = new Vector2(.2f, .2f);
|
||||
[OdinSerialize]
|
||||
protected Vector3 _disabledOffset = new Vector3(0.0f, 0.2f, 0.165f);
|
||||
[SerializeField]
|
||||
private Vector2 _fixedLocalScale = new Vector2(.2f, .2f);
|
||||
[SerializeField]
|
||||
private Color _disabledColor = new Color(Color.darkGray.r, Color.darkGray.g, Color.darkGray.b, 0.5f);
|
||||
|
||||
private Dictionary<RestaurantOrderType, Material> _materialDictionary = new();
|
||||
protected override Dictionary<RestaurantOrderType, Material> SetMaterialDictionary()
|
||||
{
|
||||
@ -22,7 +27,25 @@ protected override Dictionary<RestaurantOrderType, Material> 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user