2026-04-17 장보기 목록 버튼 할당 진행중
This commit is contained in:
8
Assets/02_Scripts/Data.meta
Normal file
8
Assets/02_Scripts/Data.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42138610c79ac4d458c8348120e399c4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/Data/Shopping.meta
Normal file
8
Assets/02_Scripts/Data/Shopping.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a796fd34ac5e02e4391fefa802c64cb9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/02_Scripts/Data/Shopping/ShoppingOrderEntry.cs
Normal file
15
Assets/02_Scripts/Data/Shopping/ShoppingOrderEntry.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using VRShopping.Items;
|
||||
|
||||
namespace VRShopping.Shopping
|
||||
{
|
||||
[Serializable]
|
||||
public class ShoppingOrderEntry
|
||||
{
|
||||
[UnityEngine.SerializeField] private ProductGroup _productGroup;
|
||||
[UnityEngine.SerializeField, UnityEngine.Min(1)] private int _requiredQuantity = 1;
|
||||
|
||||
public ProductGroup ProductGroup => _productGroup;
|
||||
public int RequiredQuantity => _requiredQuantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a087096c894c024aa409c35c9b1b87d
|
||||
14
Assets/02_Scripts/Data/Shopping/ShoppingOrderList.cs
Normal file
14
Assets/02_Scripts/Data/Shopping/ShoppingOrderList.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRShopping.Shopping
|
||||
{
|
||||
[CreateAssetMenu(fileName = "ShoppingOrderList", menuName = "VR Shopping/Shopping Order List", order = 1)]
|
||||
public class ShoppingOrderList : ScriptableObject
|
||||
{
|
||||
[SerializeField] private List<ShoppingOrderEntry> _entries = new List<ShoppingOrderEntry>();
|
||||
|
||||
public IReadOnlyList<ShoppingOrderEntry> Entries => _entries;
|
||||
public int Count => _entries.Count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79a3b1f54c1b0164ab96b9fc0618d0d5
|
||||
@@ -10,22 +10,24 @@ public class ItemData : ScriptableObject
|
||||
[SerializeField] private string _displayName;
|
||||
[SerializeField] private string _brand;
|
||||
[SerializeField] private ItemCategory _category;
|
||||
[SerializeField] private ProductGroup _productGroup;
|
||||
|
||||
[Header("Pricing")]
|
||||
[SerializeField, Min(0)] private int _basePrice;
|
||||
[SerializeField, Range(0f, 1f)] private float _discountRate;
|
||||
|
||||
[Header("Visuals")]
|
||||
[SerializeField] private Sprite _icon;
|
||||
//[SerializeField] private Sprite _icon;
|
||||
[SerializeField] private GameObject _prefab;
|
||||
|
||||
public string ItemId => _itemId;
|
||||
public string DisplayName => _displayName;
|
||||
public string Brand => _brand;
|
||||
public ItemCategory Category => _category;
|
||||
public ProductGroup ProductGroup => _productGroup;
|
||||
public int BasePrice => _basePrice;
|
||||
public float DiscountRate => _discountRate;
|
||||
public Sprite Icon => _icon;
|
||||
//public Sprite Icon => _icon;
|
||||
public GameObject Prefab => _prefab;
|
||||
|
||||
public int FinalPrice => Mathf.RoundToInt(_basePrice * (1f - _discountRate));
|
||||
@@ -43,4 +45,11 @@ public enum ItemCategory
|
||||
Household,
|
||||
Etc
|
||||
}
|
||||
|
||||
public enum ProductGroup
|
||||
{
|
||||
None,
|
||||
ChocoBar,
|
||||
PotatoChip,
|
||||
}
|
||||
}
|
||||
|
||||
29
Assets/02_Scripts/Managers/InputManager.cs
Normal file
29
Assets/02_Scripts/Managers/InputManager.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InputManager : MonoBehaviour
|
||||
{
|
||||
public static InputManager Instance;
|
||||
|
||||
//인풋 매니저는 눌린 키에 대한 이벤트만 실행함. 어떤 로직이 등록되어있는지는 모른다.
|
||||
public event Action XRLeftControllerPrimaryButton_Event;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
public void XRLeftControllerPrimaryButton(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if(ctx.started)
|
||||
XRLeftControllerPrimaryButton_Event?.Invoke();
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/InputManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/InputManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7932f9ffafd2066489578f2cc9e366d9
|
||||
@@ -104,6 +104,8 @@ private async Awaitable SceneChange(string sceneName)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetSceneLoadingProgressValue(0f);
|
||||
|
||||
await SetSceneLoadingActive(true,1f);
|
||||
|
||||
AsyncOperation op = SceneManager.LoadSceneAsync(sceneName);
|
||||
|
||||
8
Assets/02_Scripts/Player.meta
Normal file
8
Assets/02_Scripts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b429503fb9f36be47b514764a3aaeadf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/02_Scripts/Player/PlayerController.cs
Normal file
10
Assets/02_Scripts/Player/PlayerController.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//InputManager.Instance.XRLeftControllerPrimaryButton_Event += 장보기 목록 온오프 함수
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Player/PlayerController.cs.meta
Normal file
2
Assets/02_Scripts/Player/PlayerController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e811ab6255885cc4cba7041d4f936b75
|
||||
@@ -9,7 +9,7 @@ public class ItemInfoPanel : MonoBehaviour
|
||||
{
|
||||
[Header("Refs")]
|
||||
[SerializeField] private GameObject _root;
|
||||
[SerializeField] private Image _iconImage;
|
||||
//[SerializeField] private Image _iconImage;
|
||||
[SerializeField] private TMP_Text _nameText;
|
||||
[SerializeField] private TMP_Text _brandText;
|
||||
[SerializeField] private TMP_Text _priceText;
|
||||
@@ -31,11 +31,13 @@ public void Show(ItemData data)
|
||||
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;
|
||||
|
||||
24
Assets/02_Scripts/UI/ShoppingOrderRow.cs
Normal file
24
Assets/02_Scripts/UI/ShoppingOrderRow.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using VRShopping.Shopping;
|
||||
|
||||
namespace VRShopping.UI
|
||||
{
|
||||
public class ShoppingOrderRow : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Text _nameText;
|
||||
[SerializeField] private TMP_Text _quantityText;
|
||||
|
||||
public void Bind(ShoppingOrderEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_nameText != null) _nameText.text = entry.ProductGroup.ToString();
|
||||
if (_quantityText != null) _quantityText.text = $"x{entry.RequiredQuantity}";
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/ShoppingOrderRow.cs.meta
Normal file
2
Assets/02_Scripts/UI/ShoppingOrderRow.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83f128a612dc1154e829fd29b9537948
|
||||
33
Assets/02_Scripts/UI/ShoppingOrderView.cs
Normal file
33
Assets/02_Scripts/UI/ShoppingOrderView.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using VRShopping.Shopping;
|
||||
|
||||
namespace VRShopping.UI
|
||||
{
|
||||
public class ShoppingOrderView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ShoppingOrderList _orderList;
|
||||
[SerializeField] private ShoppingOrderRow _rowPrefab;
|
||||
[SerializeField] private Transform _rowContainer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public void Rebuild()
|
||||
{
|
||||
if (_orderList == null || _rowPrefab == null || _rowContainer == null) return;
|
||||
|
||||
for (int i = _rowContainer.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(_rowContainer.GetChild(i).gameObject);
|
||||
}
|
||||
|
||||
foreach (var entry in _orderList.Entries)
|
||||
{
|
||||
var row = Instantiate(_rowPrefab, _rowContainer);
|
||||
row.Bind(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/ShoppingOrderView.cs.meta
Normal file
2
Assets/02_Scripts/UI/ShoppingOrderView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cc0bf1dd5e1c2a459d8fb6ace6a166a
|
||||
Reference in New Issue
Block a user