using System; using System.Collections.Generic; using System.Linq; using Sirenix.OdinInspector; using UnityEngine; namespace DDD { [Serializable] public class TestInventoryEditorTool { [ValueDropdown(nameof(GetItemIds))] public string SelectedItemId; [MinValue(1)] public int Quantity = 1; [Button("아이템 추가")] private void AddItem() { if (!Application.isPlaying) { Debug.LogWarning("플레이 중에만 아이템 추가가 가능합니다."); return; } if (!string.IsNullOrEmpty(SelectedItemId)) { InventoryManager.Instance.AddItem(SelectedItemId, Quantity); } } [Button("아이템 제거")] private void RemoveItem() { if (!Application.isPlaying) { Debug.LogWarning("플레이 중에만 아이템 제거가 가능합니다."); return; } if (!string.IsNullOrEmpty(SelectedItemId)) { InventoryManager.Instance.RemoveItem(SelectedItemId, Quantity); } } private IEnumerable GetItemIds() { if (!Application.isPlaying || DataManager.Instance?.GetDataSo() == null) return Enumerable.Empty(); return DataManager.Instance.GetDataSo().GetDataList() .Select(data => data.Id) .Where(id => !string.IsNullOrEmpty(id)); } } }