From 61018c9f460dfcf15a984c3d2ef723ab4d6d0523 Mon Sep 17 00:00:00 2001 From: swrring Date: Sun, 29 Nov 2026 01:08:21 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=9C=ED=97=98=20=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=E3=80=8CTKS/=ED=85=8C=EC=8A=A4=ED=8A=B8/=ED=8A=9C=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=EC=96=BC=20=EC=8A=A4=ED=82=B5=E3=80=8D=20=EC=98=AC?= =?UTF-8?q?=EB=A6=BC=20=E2=80=94=20=ED=8A=9C=ED=86=A0=EB=A6=AC=EC=96=BC?= =?UTF-8?q?=EC=9D=84=20=EB=81=9D=EB=82=B8=20=EC=A7=81=ED=9B=84=20=EB=B3=B8?= =?UTF-8?q?=EC=98=81=20=EB=A1=9C=EB=B9=84=EB=A1=9C=20=EC=8B=9C=EC=9E=91(?= =?UTF-8?q?=EC=8B=9C=ED=97=98=20=EC=84=B8=EC=9D=B4=EB=B8=8C=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=20=C2=B7=20=EB=82=B4=20=EC=84=B8=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=8A=94=20=EA=B7=B8=EB=8C=80=EB=A1=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PC(sw) 에서 만든 기능(PD 2026-11-26 「게임을 초기화 한 후 튜토리얼을 종료한 직후 로비 진입상태로 시작」)이 미커밋으로 남아 다른 PC 에서 찾을 수 없던 것을 올림. - FirstFlowSkip.cs(새 파일 · FirstFlow 의 partial): 서장 1 ~ n 막 승리 → 대사 줄 표를 차례로 끝냄(등용 · 편성 저장 · s_wait 스테이지 승리 = 지금 규칙 그대로) → 본영 로비 - FirstFlow.cs: partial + BootBegin 에서 SkipForTest 1회 - TestOptions.cs: SkipTutorial 대기 값 - TestMenu.cs: 메뉴 항목 · 시험 세이브 지운 뒤 첫 씬부터 Play · 「모두 끄기」에 포함 - OutGameSession.cs: ClearForTest(전투 없이 그 스테이지를 이긴 것으로) 만 — 같은 파일의 다른 작업은 넣지 않음 확인 = 이 커밋의 소스만 Unity 컴파일러로 따로 컴파일(TKS.Runtime · TKS.Editor · TKS.Tests.PlayMode) 오류 0. 거래 UI 재설계(d7f531db) 를 합친 뒤의 실제 스킵 동작은 다시 돌려 보지 않음. (PD 2026-11-29 「체크해보고 다른 로컬 PC에서 작업할 수 있게 푸시해줘」) Co-Authored-By: Claude Fable 5.2 --- Assets/Scripts/Editor/TestMenu.cs | 57 ++++++- Assets/Scripts/OutGame/FirstFlow/FirstFlow.cs | 3 +- .../OutGame/FirstFlow/FirstFlowSkip.cs | 150 ++++++++++++++++++ .../OutGame/FirstFlow/FirstFlowSkip.cs.meta | 2 + Assets/Scripts/OutGame/OutGameSession.cs | 20 +++ Assets/Scripts/Runtime/TestOptions.cs | 12 ++ 6 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs create mode 100644 Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs.meta diff --git a/Assets/Scripts/Editor/TestMenu.cs b/Assets/Scripts/Editor/TestMenu.cs index 470183ae..3eada9f1 100644 --- a/Assets/Scripts/Editor/TestMenu.cs +++ b/Assets/Scripts/Editor/TestMenu.cs @@ -131,6 +131,53 @@ namespace TKS.EditorTools [MenuItem(FirstFlowItem, true)] static bool FirstFlowSaveCheck() { Menu.SetChecked(FirstFlowItem, TestOptions.FirstFlowSave); return true; } + // 튜토리얼 스킵(2026-11-26 PD 「게임을 초기화 한 후 튜토리얼을 종료한 직후 로비 진입상태로 시작」) — 시험 세이브를 새로 만들고 Play → + // 타이틀을 누르면 튜토리얼(인트로 · 서장 · 등용 · 편성 · 출정 1-1 · 군영 소개)을 끝낸 세이브로 본영 로비(OutGame/FirstFlow/FirstFlowSkip) · 내 세이브는 그대로 + const string SkipTutorialItem = Root + "튜토리얼 스킵 — 튜토리얼을 끝낸 직후 로비로 시작 (시험 세이브 새로 · 내 세이브는 그대로)"; + const string SkipReplayKey = "TKS_SKIP_TUT_REPLAY"; + const string SkipStartSceneKey = "TKS_SKIP_TUT_START_SCENE"; // 이번 Play 전의 시작 씬(없음 = 빈 글자) + + /// CLI: -executeMethod TKS.EditorTools.TestMenu.SkipTutorial + [MenuItem(SkipTutorialItem, false, 57)] + public static void SkipTutorial() + { + TestOptions.FirstFlowSave = true; + TestOptions.SkipTutorial = true; + SessionState.SetBool(SkipReplayKey, true); + if (EditorApplication.isPlayingOrWillChangePlaymode) + { + SessionState.SetBool(FirstFlowDeleteKey, true); + EditorApplication.isPlaying = false; // 끈 뒤(FirstFlowHook) 지우고 다시 Play + return; + } + if (File.Exists(FirstFlowSavePath)) File.Delete(FirstFlowSavePath); + SkipReplay(true); + } + + /// now = 바로 Play(메뉴) · false = 다음 에디터 틱에(Play 를 끈 알림 안에서는 바로 켜지 않음). + static void SkipReplay(bool now) + { + if (!SessionState.GetBool(SkipReplayKey, false)) return; + SessionState.EraseBool(SkipReplayKey); + Notify("튜토리얼 스킵: 시험 세이브를 새로 만들고 Play — 타이틀을 누르면 튜토리얼을 끝낸 본영 로비 (내 세이브는 그대로)"); + // 게임 처음(빌드 첫 씬 = 스플래시)부터 — 열려 있는 씬과 무관 · 이번 Play 한 번만(EnteredPlayMode 에서 원래대로) + var first = EditorBuildSettings.scenes.Length > 0 ? AssetDatabase.LoadAssetAtPath(EditorBuildSettings.scenes[0].path) : null; + if (first != null) + { + var prev = UnityEditor.SceneManagement.EditorSceneManager.playModeStartScene; + SessionState.SetString(SkipStartSceneKey, prev != null ? AssetDatabase.GetAssetPath(prev) : ""); + UnityEditor.SceneManagement.EditorSceneManager.playModeStartScene = first; + } + if (now) EditorApplication.EnterPlaymode(); + else EditorApplication.update += PlayNextTick; + } + + static void PlayNextTick() + { + EditorApplication.update -= PlayNextTick; + EditorApplication.EnterPlaymode(); + } + [InitializeOnLoadMethod] static void FirstFlowHook() { @@ -140,7 +187,14 @@ namespace TKS.EditorTools { SessionState.EraseBool(FirstFlowDeleteKey); if (File.Exists(FirstFlowSavePath)) File.Delete(FirstFlowSavePath); - Notify("첫 실행 흐름: 시험 세이브를 새로 만들었습니다 — Play 하면 인트로부터 (내 세이브는 그대로)"); + if (SessionState.GetBool(SkipReplayKey, false)) SkipReplay(false); // 튜토리얼 스킵 = 지운 뒤 다시 Play + else Notify("첫 실행 흐름: 시험 세이브를 새로 만들었습니다 — Play 하면 인트로부터 (내 세이브는 그대로)"); + } + if (s == PlayModeStateChange.EnteredPlayMode && SessionState.GetString(SkipStartSceneKey, null) != null) + { + string prev = SessionState.GetString(SkipStartSceneKey, ""); + SessionState.EraseString(SkipStartSceneKey); + UnityEditor.SceneManagement.EditorSceneManager.playModeStartScene = prev.Length > 0 ? AssetDatabase.LoadAssetAtPath(prev) : null; // 튜토리얼 스킵이 바꾼 시작 씬을 원래대로 } // Play 를 켤 때마다 어느 세이브로 도는지 알림(시험 세이브를 켜 둔 채 내 세이브인 줄 아는 일이 없게) if (s == PlayModeStateChange.EnteredPlayMode && TestOptions.FirstFlowSave) @@ -161,6 +215,7 @@ namespace TKS.EditorTools { if (TestOptions.FirstFlowSave) Notify("첫 실행 흐름: 시험 세이브도 끔 — 내 세이브로 돌아갑니다(다시 보려면 「처음부터 보기」)"); TestOptions.FirstFlowSave = false; + TestOptions.SkipTutorial = false; TestOptions.UnlockAllStages = false; TestOptions.StandardSpec = false; TestOptions.LineupIds = ""; diff --git a/Assets/Scripts/OutGame/FirstFlow/FirstFlow.cs b/Assets/Scripts/OutGame/FirstFlow/FirstFlow.cs index 90f58804..ab4e5d6b 100644 --- a/Assets/Scripts/OutGame/FirstFlow/FirstFlow.cs +++ b/Assets/Scripts/OutGame/FirstFlow/FirstFlow.cs @@ -13,7 +13,7 @@ namespace TKS.OutGame /// 메모리 세이브(자동 테스트 · 검증 캡처) = 건너뜀(ForceOn 으로 켬). 진행 = 세이브 firstFlow.line(끝낸 마지막 줄) — 도중에 꺼도 다음 줄부터, 그 줄의 화면에 들어왔을 때 이어진다. /// 값 · 문구 · 대상 · 영웅 · 배너 · 스테이지 = 표(FirstFlowData · C45). 1 ~ 3막의 연출 · 안내 · 배치 표와 연의 전기 화면의 서장 다시 보기는 건드리지 않는다. /// - public class FirstFlow : MonoBehaviour + public partial class FirstFlow : MonoBehaviour { /// 테스트: 메모리 세이브에서도 흐름을 켠다(기본 = 메모리 세이브는 건너뜀 · 기존 테스트 「Battle 씬 2 프레임 안 로비」). public static bool ForceOn; @@ -108,6 +108,7 @@ namespace TKS.OutGame /// public bool BootBegin() { + SkipForTest(); // 시험 메뉴 「튜토리얼 스킵」(에디터 · 새 시험 세이브 1회) = 흐름을 끝낸 세이브로 → 아래에서 본영 로비(FirstFlowSkip) if (!Available) return false; var st = State; if (st.done) return false; diff --git a/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs new file mode 100644 index 00000000..19342803 --- /dev/null +++ b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs @@ -0,0 +1,150 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace TKS.OutGame +{ + /// + /// 시험 메뉴 「TKS/테스트/튜토리얼 스킵」(PD 2026-11-26 「게임을 초기화 한 후 튜토리얼을 종료한 직후 로비 진입상태로 시작」) — + /// 메뉴가 시험 세이브를 새로 만들고(내 세이브는 그대로) TestOptions.SkipTutorial 을 켠 뒤 Play → 타이틀 누름 뒤 BootBegin 이 여기서 한 번: + /// 새 유저 보유 영웅 맞춤 → 서장 1 ~ n 막 승리(입장 군량 · 막 기록 · 서장 보상 = 연의 규칙 그대로) → 대사 줄 표(first_flow_lines)를 차례로 끝냄 + /// (건너뛰기 조건 · 등용 배너 · 「1회 등용」 = 첫 장 가신 · 편성 저장 · s_wait 스테이지 승리 = 지금 규칙 그대로) → 흐름 끝 기록 → 본영 로비. + /// 실제로 끝까지 한 세이브와 다른 점 = 전투 안의 처치 · 보스 · 전투 횟수 카운터(임무 「적 처치」 · 보물 조건)를 세지 않음 · 출정 스테이지 = 전원 생존 · 별 턴 안(별 3). + /// 에디터 · 기기 세이브 모드 · 새 세이브만(메모리 세이브 = 자동 테스트는 손대지 않음 · 서버 모드 = 하지 않고 알림). + /// + public partial class FirstFlow + { + /// 「1회 등용」 버튼 이름(TradeScreen Single = DoDraw(1)) — 그 밖(Ten) = 10회. + const string RecruitSingle = "Single"; + + void SkipForTest() + { +#if UNITY_EDITOR + if (SaveStore.MemoryOnly || !TestOptions.SkipTutorial) return; + TestOptions.SkipTutorial = false; // 1회 + if (!Available || !S.IsNewUser || State.started) + { + Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵 안 함 — 새 시험 세이브가 아님(available=" + Available + " newUser=" + (S != null && S.IsNewUser) + " started=" + (S != null && State.started) + ") · 메뉴를 다시 누르면 새로 만듦"); + return; + } + SkipAll(); +#endif + } + + void SkipAll() + { + var st = State; + st.started = true; + st.intro = true; + ResetRoster(); + S.Commit(); + + // 서장 1 ~ n 막(PrologueGo · OnActWin · 마지막 막 결과와 같은 정산) + int acts = PrologueActs; + for (int a = ScenarioModeRules.ActsCleared(S.Save, PrologueId) + 1; a <= acts; a++) + { + var why = S.ScenarioEnter(PrologueId, false); + if (why != null) + { + Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵: 서장 " + a + "막 입장 못 함 — " + why); + break; + } + ScenarioModeRules.ActResult(S.Db, S.Save, PrologueId, a, acts, true, new List(), S.Now, S.Rng); + S.Commit(); + } + FillEmptyLineup(); // 서장 보상 영웅(유비)을 빈 출전 편성에 + + // 대사 줄(Next 의 건너뛰기 · 줄마다 그 화면에서 하던 일) + GachaConfig.Banner banner = null; + int step = st.line + 1; + for (int guard = 0; guard < 256; guard++) + { + var l = FirstFlowData.LineOf(step); + if (l == null) break; + if (l.skipIf.Length > 0 && SkipCond(l.skipIf)) + { + step = Mathf.Max(step + 1, l.skipTo); + continue; + } + SkipWait(l); + string bid = FirstFlowData.Arg(l.onShow, FirstFlowData.OnShowBanner); + if (bid != null) banner = S.Db.Gacha.Get(bid); + if (l.mode == FirstFlowData.Press && l.targetScreen == FirstFlowData.ScreenRecruit) SkipDraw(l, banner); + if (l.onDone == FirstFlowData.AfterSaveFormation) SkipPlace(l); + Mark(step); + if (l.done == FirstFlowData.DoneEnd) break; + step++; + } + Finish(); + S.SyncWorldProgress(); + S.Commit(); + Debug.Log("[TKS 테스트] 튜토리얼 스킵 — 흐름 끝(줄 " + st.line + ") · 영웅 " + S.Save.heroes.Count + " · 편성 " + string.Join(",", S.Save.ActivePreset != null ? S.Save.ActivePreset.slots.ToArray() : new string[0]) + + " · 골드 " + S.Save.gold + " · 보옥 " + S.Save.gem + " · 군량 " + S.Save.stamina + " · 등용 " + S.Save.gacha.total + "회"); + } + + /// s_wait stage_clear:장-판 = 그 출정 스테이지를 이김(입장 군량 · 보상 = 출정 규칙 · OutGameRoot 의 임무 카운터 군량 사용 · 출정 승리). + void SkipWait(FirstFlowData.Line l) + { + if (l.wait.Length == 0 || WaitOk(l)) return; + int ch, stg; + string key = FirstFlowData.Arg(l.wait, FirstFlowData.WaitStageClear); + if (key == null || !FirstFlowData.ParseStage(key, out ch, out stg)) return; + BalanceConfig.StageDef def = null; + foreach (var s in S.Cfg.stages) + if (s.chapter == ch && s.stage == stg) + { + def = s; + break; + } + if (def == null) + { + Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵: 스테이지 " + key + " 정의 없음"); + return; + } + int cost = EconomyRules.StageCost(S.Db, S.Save, def, false); + if (S.ClearForTest(def) == null) + { + Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵: 스테이지 " + key + " 군량 부족"); + return; + } + if (!TestOptions.UnlockAllStages) MissionRules.Count(S.Db, S.Save, "stamina_spent", cost, S.Now, S.Rng); + MissionRules.Count(S.Db, S.Save, "stage_win", 1, S.Now, S.Rng); + S.Commit(); + } + + /// 명장 등용 화면의 누르기 줄 = 그 버튼의 등용(TradeScreen.DoDraw · 첫 실행 흐름의 첫 장 = 가신). + void SkipDraw(FirstFlowData.Line l, GachaConfig.Banner banner) + { + int count = S.Db.Gacha.TenCount; + foreach (var n in l.targetNames) + if (n == RecruitSingle) count = 1; + var why = GachaRules.CanDraw(S.Db, S.Save, banner, count, S.Now); + if (why != null) + { + Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵: 등용 못 함 — " + why); + return; + } + var pulls = S.Draw(banner, count); + if (pulls != null) S.CountMission("gacha_pull", pulls.Count); + } + + /// 편성 화면의 영웅 카드 줄(C_<id> · save_formation) = 그 영웅을 첫 빈 자리에 세우고 저장(FormationScreen.TapCard · SaveNow). + void SkipPlace(FirstFlowData.Line l) + { + var p = S.Save.ActivePreset; + if (p == null) return; + var work = new List(p.slots); + while (work.Count < S.FormationSlots) work.Add(""); + foreach (var raw in l.targetNames) + { + string name = raw.Replace(FirstFlowData.RetainerToken, RetainerId); + if (!name.StartsWith("C_")) continue; + string id = name.Substring(2); + if (!S.Save.Owns(id) || work.Contains(id)) continue; + int at = work.IndexOf(""); + if (at >= 0) work[at] = id; + } + var why = S.SavePreset(S.Save.presetIdx, work); + if (why != null) Debug.LogWarning("[TKS 테스트] 튜토리얼 스킵: 편성 저장 못 함 — " + why); + } + } +} diff --git a/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs.meta b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs.meta new file mode 100644 index 00000000..f3613f1a --- /dev/null +++ b/Assets/Scripts/OutGame/FirstFlow/FirstFlowSkip.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3a465ab2daaf9594ca093a3cdef4a950 \ No newline at end of file diff --git a/Assets/Scripts/OutGame/OutGameSession.cs b/Assets/Scripts/OutGame/OutGameSession.cs index b1d807de..83207d70 100644 --- a/Assets/Scripts/OutGame/OutGameSession.cs +++ b/Assets/Scripts/OutGame/OutGameSession.cs @@ -630,6 +630,26 @@ namespace TKS.OutGame return r; } + /// + /// 시험 메뉴 「튜토리얼 스킵」(FirstFlowSkip) — 전투 없이 그 스테이지(일반)를 이긴 것으로: 입장 군량 · 전리품 · 보상 · 기록 = 출정 규칙 그대로(TryPayEntry → OnBattleEnd 와 같은 계산) · + /// 출전 = 출전 프리셋 · 전원 생존 · 별 턴 안(별 3) — 전투 안의 처치 · 보스 카운터는 세지 않는다. null = 군량 부족. + /// + public StageReward ClearForTest(BalanceConfig.StageDef s) + { + if (!TryPayEntry(s)) return null; + var row = Db.Rewards.For(s.chapter); + var r = EconomyRules.Compute(Db, Save, s, true, true, row != null ? row.starTurns : 0, false, Rng, PendingLoot, BattleHard); + PendingLoot = null; + r.stamina = EconomyRules.StageCost(Db, Save, s, BattleHard); + var ids = new List(); + foreach (var e in BuildLineup()) ids.Add(e.id); + EconomyRules.Apply(Save, r, ids); + EventRules.Count(Save, EventRules.KStageClear, 1, Now); + LastReward = r; + Commit(); + return r; + } + /// 월드맵 진행(챕터별 앞에서부터 연속으로 깬 노드 수) = 세이브 스테이지 기록. public void SyncWorldProgress() { diff --git a/Assets/Scripts/Runtime/TestOptions.cs b/Assets/Scripts/Runtime/TestOptions.cs index 09cf3ea7..719c0032 100644 --- a/Assets/Scripts/Runtime/TestOptions.cs +++ b/Assets/Scripts/Runtime/TestOptions.cs @@ -39,6 +39,18 @@ namespace TKS set { PlayerPrefs.SetInt(KeyFirstFlowSave, value ? 1 : 0); PlayerPrefs.Save(); } } + /// + /// 튜토리얼 스킵 대기(2026-11-26 PD 「게임을 초기화 한 후 튜토리얼을 종료한 직후 로비 진입상태로 시작」) — 메뉴 TKS/테스트/튜토리얼 스킵 이 시험 세이브를 새로 만들고 켠다 · + /// 다음 Play 의 새 세이브에서 한 번 쓰고 끈다(OutGame/FirstFlow/FirstFlowSkip). + /// + public static bool SkipTutorial + { + get { return PlayerPrefs.GetInt(KeySkipTutorial, 0) == 1; } + set { PlayerPrefs.SetInt(KeySkipTutorial, value ? 1 : 0); PlayerPrefs.Save(); } + } + + public const string KeySkipTutorial = "TKS_TEST_SKIP_TUTORIAL"; + /// 기준 편성 영웅 id(; 로 · 비면 내 편성). public static string LineupIds {