diff --git a/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs b/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs new file mode 100644 index 00000000..eae35692 --- /dev/null +++ b/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs @@ -0,0 +1,23 @@ +using TKS.OutGame; +using UnityEditor; + +namespace TKS.EditorTools +{ + /// + /// 캡처 도구(CaptureUI · CaptureOutGame · ScenarioCapture · TitleCapture · 기믹 캡처)가 켜는 에디터 SessionState 「메모리 저장」 표시(SaveStore.MemoryFlagKey)를 + /// Play 가 끝나면 끈다 — 그 도구를 열린 에디터에서 돌리면 표시가 에디터를 다시 켤 때까지 남아, 그 뒤 PD 의 Play 가 모두 빈 메모리 저장(진행 기록 0)으로 돌았음 + /// (2026-11-18 PD 「이 PC 에서 연의전기가 실행이 안돼」 · 실측 = SessionState TKS_SAVE_MEMORY true · 실제 save.json 마지막 저장 11-17). + /// 도구는 Play 진입 전에 켜고 그 Play 한 번 안에서 찍으므로 Play 가 끝난 뒤 끄면 도구 동작은 그대로다. + /// + [InitializeOnLoad] + static class SaveMemoryFlagGuard + { + static SaveMemoryFlagGuard() + { + EditorApplication.playModeStateChanged += s => + { + if (s == PlayModeStateChange.EnteredEditMode) SessionState.EraseBool(SaveStore.MemoryFlagKey); + }; + } + } +} diff --git a/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs.meta b/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs.meta new file mode 100644 index 00000000..8f26b19a --- /dev/null +++ b/Assets/Scripts/Editor/SaveMemoryFlagGuard.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e5b65456e01b10644bed1eebf6d765fc \ No newline at end of file diff --git a/Assets/Scripts/OutGame/Arena/ArenaScenario.cs b/Assets/Scripts/OutGame/Arena/ArenaScenario.cs index 6a05660d..66888f47 100644 --- a/Assets/Scripts/OutGame/Arena/ArenaScenario.cs +++ b/Assets/Scripts/OutGame/Arena/ArenaScenario.cs @@ -1080,6 +1080,13 @@ namespace TKS.OutGame /// 출전 = 입장 판정(서장 · 잠김 · 열전 잠김 · 군량) → 안 되면 알림 · 되면 상세를 닫고 전투(ArenaScreen.ScenarioGo). public void Go(string id, bool hard) { + var pb = ContentTables.Find("scenario_battles", "s_id", id); + if (pb != null && pb.I("n_no") == 0) // 서장 = 출정 학습 판으로(ArenaScreen.PrologueGo · 2026-11-18) + { + CloseDetail(); + screen.PrologueGo(id); + return; + } var why = ScenarioModeRules.Can(S.Db, S.Save, id, hard, S.Now); if (why != null) { diff --git a/Assets/Scripts/OutGame/Arena/ArenaScreen.Scenario.cs b/Assets/Scripts/OutGame/Arena/ArenaScreen.Scenario.cs index f36fc6e7..b9f09050 100644 --- a/Assets/Scripts/OutGame/Arena/ArenaScreen.Scenario.cs +++ b/Assets/Scripts/OutGame/Arena/ArenaScreen.Scenario.cs @@ -113,9 +113,55 @@ namespace TKS.OutGame Root.Modal(b.S("s_title_ko"), body, bt.ToArray()); } + /// + /// 서장(편 n_no 0 · 도원결의 = 출정 n_spec_chapter 장 학습 판 1 ~ n_acts) 출전 — 아직 안 깬 첫 막(모두 깼으면 1막)을 일반 출정으로 연다 + /// (월드맵 경유 · 군량 · 시나리오 이벤트 · 학습 안내 · 보상 = 출정 규칙 그대로). false = 서장 아님. + /// 2026-11-18 PD 「이 PC 에서 연의전기가 실행이 안돼」 — 서장은 「1장 학습 판」 알림만 띄우고 들어가지 않았음. + /// + static int prologueLast; + + internal bool PrologueGo(string id) + { + var b = ContentTables.Find("scenario_battles", "s_id", id); + if (b == null || b.I("n_no") != 0) return false; + var map = Root.Map; + var cfg = Root.Battle.Config; + if (map == null || !map.HasData) + { + Root.Toast("월드맵 자료 없음"); + return true; + } + int ch = b.I("n_spec_chapter"), acts = Mathf.Max(1, b.I("n_acts")), pick = 0; + for (int s = acts; s >= 1; s--) + { + var st = S.Save.Stage(ch, s, false); + if (st == null || st.clears == 0) pick = s; // 안 깬 막 중 가장 앞 + } + if (pick == 0) pick = prologueLast % acts + 1; // 모두 깼으면 1막 → 2막 → 3막 차례로 다시 보기 + prologueLast = pick; + int ci = -1; + for (int i = 0; i < cfg.chapters.Length; i++) + if (cfg.chapters[i].no == ch) ci = i; + var list = ci >= 0 ? cfg.StagesOfChapter(ch) : new List(); + int node = -1; + for (int n = 0; n < list.Count; n++) + if (cfg.stages[list[n]].stage == pick) node = n; + if (node < 0) + { + Root.Toast(ch + "-" + pick + " 스테이지 없음"); + return true; + } + if (map.TryEnter != null && !map.TryEnter(list[node])) return true; // 군량(시험 메뉴 「군량 면제」면 통과) + ScenarioEvent.AllowReplay(ch, pick); // 연의 전기에서 들어오면 깬 판이어도 시작·승리 연출을 다시 튼다 + Root.OpenWorldMap(); + map.EnterStage(ci, node); + return true; + } + /// 편 id 출전(연의 · 열전) — 아트 화면 상세의 출전 버튼도 이것. internal void ScenarioGo(string id, bool hard) { + if (PrologueGo(id)) return; var cfg = Root.Battle.Config; var stage = new BalanceConfig.StageDef { title = id, subtitle = "연의 전기", kind = StageKind.Normal, aiAccuracy = 1f, aiAggroRange = 999f }; var b = ContentTables.Find("scenario_battles", "s_id", id); diff --git a/Assets/Scripts/OutGame/Scenario/ScenarioModeRules.cs b/Assets/Scripts/OutGame/Scenario/ScenarioModeRules.cs index 986d56f4..ef52de51 100644 --- a/Assets/Scripts/OutGame/Scenario/ScenarioModeRules.cs +++ b/Assets/Scripts/OutGame/Scenario/ScenarioModeRules.cs @@ -53,6 +53,7 @@ namespace TKS.OutGame public static bool Unlocked(SaveData d, ContentRow b) { if (d.scenario.serverView) return d.scenario.serverUnlocked.Contains(b.S("s_id")); + if (TestOptions.UnlockAllStages) return true; // 플레이 테스트 「전 스테이지 열기」 = 연의 전기 편도 모두 열림(2026-11-18 PD 「이 PC 에서 연의전기가 실행이 안돼」) int ch, st; if (!ArenaRules.ParseStageKey(b.S("s_unlock_stage"), out ch, out st)) return true; var s = d.Stage(ch, st, false); diff --git a/Assets/Scripts/Runtime/Scenario/ScenarioEvent.cs b/Assets/Scripts/Runtime/Scenario/ScenarioEvent.cs index ff0f5828..011fd5f3 100644 --- a/Assets/Scripts/Runtime/Scenario/ScenarioEvent.cs +++ b/Assets/Scripts/Runtime/Scenario/ScenarioEvent.cs @@ -126,6 +126,7 @@ namespace TKS { Mode = TutorialMode.Auto; current = null; + replayChapter = replayStage = 0; fainted.Clear(); faintTint.Clear(); faintKeep.Clear(); @@ -137,8 +138,22 @@ namespace TKS } /// 이 판 · 이 발동에 틀 연출이 있는가(켜짐 · 표 행 있음 · 처음 깸 · 가상 실행·연무장 아님 · slot 배우가 있으면 학습 판 배치가 켜져 있을 때만). + static int replayChapter, replayStage; + + /// + /// 다음에 이 판을 시작할 때 이미 깬 판이어도 연출을 다시 튼다(연의 전기 서장 「도원결의」 출전 = 이야기를 보러 들어옴 · 2026-11-18 PD 「결과물을 보고 피드백」). + /// 다른 판이 시작되면 풀린다. + /// + public static void AllowReplay(int chapter, int stage) + { + replayChapter = chapter; + replayStage = stage; + } + public static bool Wants(BattleManager bm, BalanceConfig.StageDef stage, string trigger, bool cleared, int turn = 0) { + if (stage != null && trigger == "stage_start" && (stage.chapter != replayChapter || stage.stage != replayStage)) replayChapter = replayStage = 0; + if (cleared && stage != null && stage.chapter == replayChapter && stage.stage == replayStage) cleared = false; if (!Enabled || Sim.Active || bm == null || stage == null || bm.Mode != null || cleared) return false; var g = ScenarioData.Events(stage.chapter, stage.stage, trigger, turn); if (g.Count == 0) return false;