2026-07-07 폰트추가,대화 테스트

This commit is contained in:
2026-07-07 14:20:00 +09:00
parent d88f8770cd
commit 85dae3d159
23 changed files with 266 additions and 30 deletions

View File

@@ -3,4 +3,16 @@
public class GameManager : MonoBehaviour
{
public static GameManager Instance { get; private set; }
private void Awake()
{
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
}
else
{
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
}
}
}

View File

@@ -19,7 +19,6 @@ private void Awake()
if (Instance == null)
{
Instance = this; // 만들어진 자신을 인스턴스로 설정
DontDestroyOnLoad(gameObject);
}
else
{

View File

@@ -16,13 +16,14 @@ public class StoryManager : MonoBehaviour
private void Awake()
{
if (Instance != null && Instance != this)
if (Instance == null)
{
Destroy(gameObject);
return;
Instance = this; //만들어진 자신을 인스턴스로 설정
}
else
{
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
}
Instance = this;
DontDestroyOnLoad(gameObject);
}
// ── 메인 진행도 ──────────────────────────────────────────────
@@ -80,21 +81,31 @@ public void RecordChoice(string code)
public void Save() => File.WriteAllText(SavePath, _state.ToJson());
// 저장 파일이 있으면 불러온다. 성공 여부 반환.
public bool Load()
public void Load()
{
if (!File.Exists(SavePath)) return false;
if (!File.Exists(SavePath))
{
Debug.LogWarning("세이브 파일이 없습니다.");
return;
}
try
{
var loaded = StoryState.FromJson(File.ReadAllText(SavePath));
if (loaded == null) return false;
if (loaded == null)
{
Debug.LogWarning("세이브 파일이 잘못되었습니다.");
return;
}
_state = loaded;
Changed?.Invoke();
return true;
return;
}
catch (Exception e)
{
Debug.LogWarning($"[StoryManager] 저장 파일 로드 실패: {e.Message}");
return false;
return;
}
}