updated Candidate System with Voice System
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NightclubArcadia.Skills
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class CandidateClue
|
||||
{
|
||||
[SerializeField] string id;
|
||||
[SerializeField] CandidateEvidenceType type;
|
||||
[SerializeField] string sceneId;
|
||||
[SerializeField] string unlockFlag;
|
||||
[SerializeField] CandidateClueStatus status;
|
||||
[SerializeField] string skillId;
|
||||
[SerializeField] string notes;
|
||||
|
||||
public string Id => id;
|
||||
public CandidateEvidenceType Type => type;
|
||||
public string SceneId => sceneId;
|
||||
public string UnlockFlag => unlockFlag;
|
||||
public CandidateClueStatus Status => status;
|
||||
public string SkillId => skillId;
|
||||
public string Notes => notes;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void EditorSet(CandidateClueEntry entry)
|
||||
{
|
||||
if (entry == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entry));
|
||||
}
|
||||
|
||||
id = entry.id ?? string.Empty;
|
||||
type = ParseEnumRequired<CandidateEvidenceType>(entry.type, nameof(entry.type), entry.id);
|
||||
sceneId = entry.sceneId ?? string.Empty;
|
||||
unlockFlag = entry.unlockFlag ?? string.Empty;
|
||||
status = ParseEnumRequired<CandidateClueStatus>(
|
||||
string.IsNullOrEmpty(entry.status) ? "Planned" : entry.status,
|
||||
nameof(entry.status),
|
||||
entry.id);
|
||||
skillId = entry.skillId ?? string.Empty;
|
||||
notes = entry.notes ?? string.Empty;
|
||||
}
|
||||
|
||||
static TEnum ParseEnumRequired<TEnum>(string value, string fieldName, string clueId)
|
||||
where TEnum : struct
|
||||
{
|
||||
if (!Enum.TryParse(value, ignoreCase: true, out TEnum parsed))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
$"Clue '{clueId}': invalid {fieldName} '{value}' for {typeof(TEnum).Name}.");
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user