2026-07-07 폰트추가,대화 테스트
This commit is contained in:
@@ -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); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ private void Awake()
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; // 만들어진 자신을 인스턴스로 설정
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
Assets/02_Scripts/UI/View.meta
Normal file
8
Assets/02_Scripts/UI/View.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f1a9ff343024774f8862222db2926b1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/02_Scripts/UI/View/AffectionHud.cs
Normal file
16
Assets/02_Scripts/UI/View/AffectionHud.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class AffectionHud : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CharacterData _characterData;
|
||||
|
||||
[Header("Refs")]
|
||||
[SerializeField] private GameObject _root;
|
||||
[SerializeField] private TMP_Text _attectionText;
|
||||
|
||||
public void RefreshUI()
|
||||
{
|
||||
_attectionText.text = StoryManager.Instance.GetAffection(_characterData).ToString();
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/View/AffectionHud.cs.meta
Normal file
2
Assets/02_Scripts/UI/View/AffectionHud.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40ff35620b18f6444939867b13de4cb9
|
||||
Reference in New Issue
Block a user