증거품 UI

This commit is contained in:
2026-07-30 16:26:39 +09:00
parent 519e351fa5
commit 23e93a67f8
127 changed files with 55106 additions and 4 deletions

View File

@@ -10,7 +10,10 @@ public class InputManager : MonoBehaviour, GameInput.IPlayerActions
private GameInput _input;
public event Action OnDialogNext_Event;
public event Action OnDialogNext_Event;
public event Action OnEvidence_Event;
public event Action OnEvidencePrev_Event;
public event Action OnEvidenceNext_Event;
private void Awake()
{
@@ -37,4 +40,22 @@ public void OnDialogNext(InputAction.CallbackContext ctx)
if (ctx.phase == InputActionPhase.Started)
OnDialogNext_Event?.Invoke();
}
public void OnEvidence(InputAction.CallbackContext ctx)
{
if (ctx.phase == InputActionPhase.Started)
OnEvidence_Event?.Invoke();
}
public void OnEvidencePrev(InputAction.CallbackContext ctx)
{
if (ctx.phase == InputActionPhase.Started)
OnEvidencePrev_Event?.Invoke();
}
public void OnEvidenceNext(InputAction.CallbackContext ctx)
{
if (ctx.phase == InputActionPhase.Started)
OnEvidenceNext_Event?.Invoke();
}
}

View File

@@ -25,6 +25,11 @@ private struct InitialAffection
"진행도 초기값과 마찬가지로 플레이를 시작한 씬의 값만 적용되고, 씬 전환으로 넘어온 경우엔 무시된다")]
[SerializeField] private List<InitialAffection> _initialAffections = new();
[Tooltip("플레이 시작 시 소지 아이템 — 이 씬만 직접 열어 테스트할 때 앞 과정 없이 증거품을 들고 시작하게. " +
"다른 초기값과 마찬가지로 플레이를 시작한 씬의 값만 적용되고, 씬 전환으로 넘어온 경우엔 무시된다. " +
"실제 게임에서의 획득은 AddItem(터치존·버튼 UnityEvent 등)으로")]
[SerializeField] private List<ItemData> _initialItems = new();
private StoryState _state = new();
// 상태가 바뀔 때마다 발행 (호감도 게이지 등 UI 갱신용)
@@ -41,6 +46,11 @@ private void Awake()
foreach (var init in _initialAffections)
if (init.Character != null)
_state.Affection[IdOf(init.Character)] = init.Amount;
// 테스트용 초기 소지 아이템
foreach (var item in _initialItems)
if (item != null && !_state.Items.Contains(ItemIdOf(item)))
_state.Items.Add(ItemIdOf(item));
}
else
{
@@ -100,6 +110,30 @@ public void SetTrigger(string id)
Changed?.Invoke();
}
// ── 아이템(증거품) ───────────────────────────────────────────
public IReadOnlyList<string> ItemIds => _state.Items;
public bool HasItem(ItemData item) => item != null && _state.Items.Contains(ItemIdOf(item));
// UnityEvent 연결용 (대화 터치존·월드 버튼 등에서 증거품 획득). 중복 획득은 무시된다.
public void AddItem(ItemData item)
{
if (item == null) return;
string id = ItemIdOf(item);
if (_state.Items.Contains(id)) return;
_state.Items.Add(id);
Changed?.Invoke();
}
public void RemoveItem(ItemData item)
{
if (item == null || !_state.Items.Remove(ItemIdOf(item))) return;
Changed?.Invoke();
}
// ItemData의 Id를 키로 사용 (비어있으면 에셋 이름) — 캐릭터 IdOf와 같은 규칙
private static string ItemIdOf(ItemData i) => string.IsNullOrEmpty(i.Id) ? i.name : i.Id;
// ── 선택 이력 ────────────────────────────────────────────────
public bool HasChosen(string code) => _state.ChosenCodes.Contains(code);