2026-04-24 미스매치 목록
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameSceneUIManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ClearPanel _clearPanel;
|
||||
[SerializeField] private MissingPanel _missingPanel;
|
||||
|
||||
|
||||
public void ShowClearPanel()
|
||||
{
|
||||
_clearPanel.OpenClear();
|
||||
}
|
||||
|
||||
public void ShowMissingPanel(List<string> missmatchList)
|
||||
{
|
||||
_missingPanel.OpenMissMatch(missmatchList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public void Checkout(CheckoutMachine checkoutMachine)
|
||||
{
|
||||
var parts = new List<string>(missing.Count);
|
||||
foreach (var (group, shortage) in missing) parts.Add($"{group} x{shortage}");
|
||||
Debug.Log($"장보기 목록 미충족 — 부족: {string.Join(", ", parts)}");
|
||||
GameManager.Instance.GameSceneUI.ShowMissingPanel(parts);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
37
Assets/02_Scripts/UI/MissingPanel.cs
Normal file
37
Assets/02_Scripts/UI/MissingPanel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class MissingPanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject _root;
|
||||
[SerializeField] private TMP_Text _missmatchText;
|
||||
|
||||
public void OpenMissMatch(List<string> missmatchList)
|
||||
{
|
||||
_root.SetActive(true);
|
||||
|
||||
StringBuilder sb = new StringBuilder(); //string으로 더하는건 매번 새로 메모리 공간을 할당하므로 비효율적
|
||||
|
||||
for (int i = 0; i < missmatchList.Count; i++)
|
||||
{
|
||||
sb.AppendLine(missmatchList[i]);
|
||||
|
||||
// 마지막 요소가 아닐 때만 줄바꿈 추가
|
||||
if (i < missmatchList.Count - 1)
|
||||
{
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_missmatchText.text = sb.ToString();
|
||||
}
|
||||
|
||||
public void CloseMissMatch()
|
||||
{
|
||||
_missmatchText.text = "";
|
||||
_root.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/MissingPanel.cs.meta
Normal file
2
Assets/02_Scripts/UI/MissingPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a132d7e96c1d719419d8ea88dba2d8c7
|
||||
Reference in New Issue
Block a user