한글 깨지는거 수정

This commit is contained in:
2026-07-07 14:28:54 +09:00
parent acc55b09d3
commit 86a0f2c8eb
4 changed files with 30 additions and 21 deletions

6
.editorconfig Normal file
View File

@@ -0,0 +1,6 @@
root = true
# C# 스크립트는 항상 UTF-8(BOM)로 저장 — 한국어 Windows에서 CP949 오판으로 한글이 깨지는 것 방지
[*.cs]
charset = utf-8-bom
end_of_line = crlf

View File

@@ -1,4 +1,4 @@
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
public class StoryComputerSystem : MonoBehaviour public class StoryComputerSystem : MonoBehaviour
@@ -16,8 +16,8 @@ public void TogglePower()
isPowerOn = !isPowerOn; isPowerOn = !isPowerOn;
Debug.Log(isPowerOn Debug.Log(isPowerOn
? "[StoryComputer] 컴퓨터 전원이 켜졌습니다." ? "[StoryComputer] 컴퓨터 전원이 켜졌습니다."
: "[StoryComputer] 컴퓨터 전원이 꺼졌습니다."); : "[StoryComputer] 컴퓨터 전원이 꺼졌습니다.");
if (isPowerOn) if (isPowerOn)
{ {
@@ -30,7 +30,7 @@ public void SaveFromComputer()
if (!CanUseComputer()) return; if (!CanUseComputer()) return;
StoryManager.Instance.Save(); StoryManager.Instance.Save();
Debug.Log("[StoryComputer] 현재 스토리 상태를 저장했습니다."); Debug.Log("[StoryComputer] 현재 스토리 상태를 저장했습니다.");
} }
public void LoadFromComputer() public void LoadFromComputer()
@@ -41,12 +41,12 @@ public void LoadFromComputer()
if (success) if (success)
{ {
Debug.Log("[StoryComputer] 저장된 스토리 상태를 불러왔습니다."); Debug.Log("[StoryComputer] 저장된 스토리 상태를 불러왔습니다.");
PrintCurrentState(); PrintCurrentState();
} }
else else
{ {
Debug.LogWarning("[StoryComputer] 불러올 저장 파일이 없습니다."); Debug.LogWarning("[StoryComputer] 불러올 저장 파일이 없습니다.");
} }
} }
@@ -55,7 +55,7 @@ public void ResetStoryFromComputer()
if (!CanUseComputer()) return; if (!CanUseComputer()) return;
StoryManager.Instance.ResetAll(); StoryManager.Instance.ResetAll();
Debug.Log("[StoryComputer] 스토리 상태를 초기화했습니다."); Debug.Log("[StoryComputer] 스토리 상태를 초기화했습니다.");
PrintCurrentState(); PrintCurrentState();
} }
@@ -63,21 +63,21 @@ public void PrintCurrentState()
{ {
if (StoryManager.Instance == null) if (StoryManager.Instance == null)
{ {
Debug.LogWarning("[StoryComputer] StoryManager가 없습니다."); Debug.LogWarning("[StoryComputer] StoryManager가 없습니다.");
return; return;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendLine("========== 현재 스토리 상태 =========="); sb.AppendLine("========== 현재 스토리 상태 ==========");
sb.AppendLine($"메인 진행도: {StoryManager.Instance.MainProgress}"); sb.AppendLine($"메인 진행도: {StoryManager.Instance.MainProgress}");
sb.AppendLine(); sb.AppendLine();
sb.AppendLine("공룡별 호감도:"); sb.AppendLine("공룡별 호감도:");
if (characters == null || characters.Length == 0) if (characters == null || characters.Length == 0)
{ {
sb.AppendLine("- 등록된 캐릭터 없음"); sb.AppendLine("- 등록된 캐릭터 없음");
} }
else else
{ {
@@ -99,13 +99,13 @@ private bool CanUseComputer()
{ {
if (!isPowerOn) if (!isPowerOn)
{ {
Debug.LogWarning("[StoryComputer] 컴퓨터 전원이 꺼져 있어서 사용할 수 없습니다."); Debug.LogWarning("[StoryComputer] 컴퓨터 전원이 꺼져 있어서 사용할 수 없습니다.");
return false; return false;
} }
if (StoryManager.Instance == null) if (StoryManager.Instance == null)
{ {
Debug.LogWarning("[StoryComputer] StoryManager가 씬에 없습니다."); Debug.LogWarning("[StoryComputer] StoryManager가 씬에 없습니다.");
return false; return false;
} }

View File

@@ -78,15 +78,18 @@ public void RecordChoice(string code)
// 이어하기를 만들 때 타이틀 화면 등에서 Load()를 호출하면 된다. // 이어하기를 만들 때 타이틀 화면 등에서 Load()를 호출하면 된다.
private static string SavePath => Path.Combine(Application.persistentDataPath, "story_state.json"); private static string SavePath => Path.Combine(Application.persistentDataPath, "story_state.json");
public void Save() => File.WriteAllText(SavePath, _state.ToJson()); public void Save() => File.WriteAllText(SavePath, _state.ToJson());
public void CallLoad() => Load();
// 저장 파일이 있으면 불러온다. 성공 여부 반환. // 저장 파일이 있으면 불러온다. 성공 여부 반환.
public void Load() public bool Load()
{ {
if (!File.Exists(SavePath)) if (!File.Exists(SavePath))
{ {
Debug.LogWarning("세이브 파일이 없습니다."); Debug.LogWarning("세이브 파일이 없습니다.");
return; return false;
} }
try try
@@ -95,17 +98,17 @@ public void Load()
if (loaded == null) if (loaded == null)
{ {
Debug.LogWarning("세이브 파일이 잘못되었습니다."); Debug.LogWarning("세이브 파일이 잘못되었습니다.");
return; return false;
} }
_state = loaded; _state = loaded;
Changed?.Invoke(); Changed?.Invoke();
return; return true;
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogWarning($"[StoryManager] 저장 파일 로드 실패: {e.Message}"); Debug.LogWarning($"[StoryManager] 저장 파일 로드 실패: {e.Message}");
return; return false;
} }
} }