From 5321610b0243c01d0d517bb49d752de9cf781306 Mon Sep 17 00:00:00 2001 From: "DESKTOP-VVOCIJO\\PC" Date: Wed, 22 Apr 2026 16:51:55 +0900 Subject: [PATCH] =?UTF-8?q?2026-04-22=20=EA=B3=84=EC=82=B0=EB=8C=80=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=86=A0=20=ED=83=80=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/01_Scenes/MyProject/GameScene.unity | 4 +-- Assets/02_Scripts/Interact/CheckoutMachine.cs | 16 --------- Assets/02_Scripts/Shopping.meta | 8 +++++ .../{Interact => Shopping}/BarcodeScaner.cs | 3 +- .../BarcodeScaner.cs.meta | 0 Assets/02_Scripts/Shopping/CheckoutMachine.cs | 35 +++++++++++++++++++ .../CheckoutMachine.cs.meta | 0 Assets/02_Scripts/UI/CheckoutProductionRow.cs | 30 ++++++++++++++++ .../UI/CheckoutProductionRow.cs.meta | 2 ++ .../Shopping/Prefabs/CheckoutItemRow.prefab | 3 ++ .../Prefabs/CheckoutItemRow.prefab.meta | 7 ++++ .../Prefabs/ShelfCheckouts.prefab | 4 +-- 12 files changed, 90 insertions(+), 22 deletions(-) delete mode 100644 Assets/02_Scripts/Interact/CheckoutMachine.cs create mode 100644 Assets/02_Scripts/Shopping.meta rename Assets/02_Scripts/{Interact => Shopping}/BarcodeScaner.cs (91%) rename Assets/02_Scripts/{Interact => Shopping}/BarcodeScaner.cs.meta (100%) create mode 100644 Assets/02_Scripts/Shopping/CheckoutMachine.cs rename Assets/02_Scripts/{Interact => Shopping}/CheckoutMachine.cs.meta (100%) create mode 100644 Assets/02_Scripts/UI/CheckoutProductionRow.cs create mode 100644 Assets/02_Scripts/UI/CheckoutProductionRow.cs.meta create mode 100644 Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab create mode 100644 Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab.meta diff --git a/Assets/01_Scenes/MyProject/GameScene.unity b/Assets/01_Scenes/MyProject/GameScene.unity index 73988011..804cb171 100644 --- a/Assets/01_Scenes/MyProject/GameScene.unity +++ b/Assets/01_Scenes/MyProject/GameScene.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9ee07b4961584c758d3c0d9fd0b161ce3c3abbaa29d79f2268e3cdb40c6e4f9 -size 13287416 +oid sha256:f04c70a4eb329fdc016ef5242b222f9c8fa7ef298eb96e0468ff06db579a1c07 +size 13288644 diff --git a/Assets/02_Scripts/Interact/CheckoutMachine.cs b/Assets/02_Scripts/Interact/CheckoutMachine.cs deleted file mode 100644 index 284ff7b6..00000000 --- a/Assets/02_Scripts/Interact/CheckoutMachine.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEngine; - -namespace VRShopping.Interact -{ - public class CheckoutMachine : MonoBehaviour - { - private int _checkoutSum; - - public int CheckoutSum => _checkoutSum; - - public void AddCheckoutSum(int price) - { - _checkoutSum += price; - } - } -} diff --git a/Assets/02_Scripts/Shopping.meta b/Assets/02_Scripts/Shopping.meta new file mode 100644 index 00000000..92aa1f45 --- /dev/null +++ b/Assets/02_Scripts/Shopping.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41cd13da1f2c3254ba295b12e84e5f4b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/02_Scripts/Interact/BarcodeScaner.cs b/Assets/02_Scripts/Shopping/BarcodeScaner.cs similarity index 91% rename from Assets/02_Scripts/Interact/BarcodeScaner.cs rename to Assets/02_Scripts/Shopping/BarcodeScaner.cs index e1158d53..b4c74258 100644 --- a/Assets/02_Scripts/Interact/BarcodeScaner.cs +++ b/Assets/02_Scripts/Shopping/BarcodeScaner.cs @@ -39,8 +39,7 @@ public void ScanArea() //ItemInstance의 상품 정보를 스캔 public void ScanProduction(ItemInstance itemIns) { - //AddCheckoutSum으로 총 계산금액에 더함 - _checkoutMachine.AddCheckoutSum(itemIns.ItemDataInfo.FinalPrice); + _checkoutMachine.AddCheckoutProduction(itemIns.ItemDataInfo); if (_scanVisualEffect != null) _scanVisualEffect.Play(); if (_scanSoundEffect != null) _scanSoundEffect.Play(); diff --git a/Assets/02_Scripts/Interact/BarcodeScaner.cs.meta b/Assets/02_Scripts/Shopping/BarcodeScaner.cs.meta similarity index 100% rename from Assets/02_Scripts/Interact/BarcodeScaner.cs.meta rename to Assets/02_Scripts/Shopping/BarcodeScaner.cs.meta diff --git a/Assets/02_Scripts/Shopping/CheckoutMachine.cs b/Assets/02_Scripts/Shopping/CheckoutMachine.cs new file mode 100644 index 00000000..8549799e --- /dev/null +++ b/Assets/02_Scripts/Shopping/CheckoutMachine.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using UnityEngine; +using VRShopping.Items; +using VRShopping.UI; + +namespace VRShopping.Interact +{ + public class CheckoutMachine : MonoBehaviour + { + public int CheckoutSum { get; private set; } + + [SerializeField] private Transform _rowContainer; + [SerializeField] private CheckoutProductionRow _rowPrefab; + + private readonly Dictionary _rowByItem = new(); + + public void AddCheckoutProduction(ItemData itemData) + { + if (itemData == null) return; + + if (_rowByItem.TryGetValue(itemData, out CheckoutProductionRow row)) + { + row.Bind(itemData, row.Quantity + 1); + } + else + { + row = Instantiate(_rowPrefab, _rowContainer); + row.Bind(itemData, 1); + _rowByItem[itemData] = row; + } + + CheckoutSum += itemData.FinalPrice; + } + } +} diff --git a/Assets/02_Scripts/Interact/CheckoutMachine.cs.meta b/Assets/02_Scripts/Shopping/CheckoutMachine.cs.meta similarity index 100% rename from Assets/02_Scripts/Interact/CheckoutMachine.cs.meta rename to Assets/02_Scripts/Shopping/CheckoutMachine.cs.meta diff --git a/Assets/02_Scripts/UI/CheckoutProductionRow.cs b/Assets/02_Scripts/UI/CheckoutProductionRow.cs new file mode 100644 index 00000000..2b2eb4e8 --- /dev/null +++ b/Assets/02_Scripts/UI/CheckoutProductionRow.cs @@ -0,0 +1,30 @@ +using TMPro; +using UnityEngine; +using VRShopping.Items; + +namespace VRShopping.UI +{ + public class CheckoutProductionRow : MonoBehaviour + { + [SerializeField] private TMP_Text _nameText; + [SerializeField] private TMP_Text _quantityText; + [SerializeField] private TMP_Text _priceText; + + public int Quantity { get; private set; } + + public void Bind(ItemData item, int quantity) + { + if (item == null) + { + gameObject.SetActive(false); + return; + } + + Quantity = quantity; + + if (_nameText != null) _nameText.text = item.DisplayName; + if (_quantityText != null) _quantityText.text = $"x{quantity}"; + if (_priceText != null) _priceText.text = (item.FinalPrice * quantity).ToString(); + } + } +} diff --git a/Assets/02_Scripts/UI/CheckoutProductionRow.cs.meta b/Assets/02_Scripts/UI/CheckoutProductionRow.cs.meta new file mode 100644 index 00000000..9f5e83b0 --- /dev/null +++ b/Assets/02_Scripts/UI/CheckoutProductionRow.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 92bbb02bca8248745bf81725ed4e0423 \ No newline at end of file diff --git a/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab b/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab new file mode 100644 index 00000000..b8f9b22a --- /dev/null +++ b/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e469efe96d72e17d1d74d238707504b5fe5a95f21d2e8cdc1b6520320d80bddd +size 13814 diff --git a/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab.meta b/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab.meta new file mode 100644 index 00000000..b3f83d76 --- /dev/null +++ b/Assets/07_UI/Shopping/Prefabs/CheckoutItemRow.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cbc51e3dcec83df4bbbae3a93c76db6d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Supermarket Store/Prefabs/ShelfCheckouts.prefab b/Assets/Supermarket Store/Prefabs/ShelfCheckouts.prefab index cfc0fcce..a19e631e 100644 --- a/Assets/Supermarket Store/Prefabs/ShelfCheckouts.prefab +++ b/Assets/Supermarket Store/Prefabs/ShelfCheckouts.prefab @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01fdf16de3eefd90edb2764b38996e9e37d0150c53cca434683bad4bf8b8d661 -size 9658 +oid sha256:071de2b625fd03708eb994c76b0362c9c56e4df78916afe8a99b1a5fb29f359b +size 46072