장보기 프로젝트

This commit is contained in:
2026-04-14 18:02:07 +09:00
commit dc19679985
2658 changed files with 235852 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
namespace VRShopping.UI
{
public enum Handedness
{
Left,
Right
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1a0d39e1f63994241808d2d7d877caf3

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using VRShopping.Items;
namespace VRShopping.UI
{
public class ItemInfoHud : MonoBehaviour
{
public static ItemInfoHud Instance { get; private set; }
[SerializeField] private ItemInfoPanel _leftPanel;
[SerializeField] private ItemInfoPanel _rightPanel;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
}
private void OnDestroy()
{
if (Instance == this) Instance = null;
}
public void Show(Handedness hand, ItemData data)
{
GetPanel(hand)?.Show(data);
}
public void Hide(Handedness hand)
{
GetPanel(hand)?.Hide();
}
private ItemInfoPanel GetPanel(Handedness hand)
{
return hand == Handedness.Left ? _leftPanel : _rightPanel;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 03f393b2916cda845895fdd629622563

View File

@@ -0,0 +1,66 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using VRShopping.Items;
namespace VRShopping.UI
{
public class ItemInfoPanel : MonoBehaviour
{
[Header("Refs")]
[SerializeField] private GameObject _root;
[SerializeField] private Image _iconImage;
[SerializeField] private TMP_Text _nameText;
[SerializeField] private TMP_Text _brandText;
[SerializeField] private TMP_Text _priceText;
[SerializeField] private TMP_Text _originalPriceText;
[SerializeField] private GameObject _discountBadge;
[SerializeField] private TMP_Text _discountRateText;
private void Awake()
{
if (_root == null) _root = gameObject;
Hide();
}
public void Show(ItemData data)
{
if (data == null)
{
Hide();
return;
}
if (_iconImage != null)
{
_iconImage.sprite = data.Icon;
_iconImage.enabled = data.Icon != null;
}
if (_nameText != null) _nameText.text = data.DisplayName;
if (_brandText != null) _brandText.text = data.Brand;
if (_priceText != null) _priceText.text = FormatPrice(data.FinalPrice);
bool hasDiscount = data.DiscountRate > 0f;
if (_originalPriceText != null)
{
_originalPriceText.gameObject.SetActive(hasDiscount);
if (hasDiscount) _originalPriceText.text = $"<s>{FormatPrice(data.BasePrice)}</s>";
}
if (_discountBadge != null) _discountBadge.SetActive(hasDiscount);
if (_discountRateText != null && hasDiscount)
{
_discountRateText.text = $"-{Mathf.RoundToInt(data.DiscountRate * 100f)}%";
}
_root.SetActive(true);
}
public void Hide()
{
_root.SetActive(false);
}
private static string FormatPrice(int price) => $"₩{price:N0}";
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4ee2f146032fb094aa2a69f2843dac33