ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Domestic/DispatchRules.cs

102 lines
4.2 KiB
C#
Raw Normal View History

내정 메뉴 개편(훈련·순찰·개발 배경 장면) + 「책사 → 승병」 게임 전체 - 3탭 배경 = 로비 화풍(연병장·저잣거리·규장각) · 장면 표 Resources/UI/domestic_scene.csv · 연출 LobbyAmbient(Frame 캔버스) - 훈련: 병종별 범용 병사 훈련 동작(UiDrillAnim · 뒷발 고정 · 병종별 박자 · 화면 배율) · 궁병 훈련 전용 클립 drill_ready/drill_action(대기 원화 리그) + 날아가는 화살 · 병종 탭 아이콘 · 카드 = 이름 +수치% - 순찰: 정보 판 1장(시계 + 쌓인 시간 · 게이지 · 시간당 골드·경험치·전리품 오른쪽 정렬 · 금테 안 획득 보상) · 버튼 수확/즉시 수확 · 광고 2배 = 수확 팝업 · 문 앞 순찰 영웅 + 창병 2 · 상인·주민 NPC 5(R22 대기 모션 · 길바닥) - 개발: 양피지 두루마리 위 성장 트리(노드 그림 아이콘 27) · 재화 칩 · 아래 두루마리 = 영웅 배치 + 트리 초기화 - 영웅 파견 3자리(훈련 병종 지휘관 · 순찰 · 개발 · 장면 표시만) · 세이브 필드 3 - 병사 5종 자세·타격 그림 색·크기 대기에 맞춤(전투 그림도 같은 파일) - 승병: UnitTypeInfo 이름/표시 글자 · heroes 병사 3 이름·한자 · 스킬·기믹 설명 · 튜토리얼 팁 + 임포트 자산(HeroDb·SkillInfoDb·GimmickDb·StageGimmickTable) - 테스트 DomesticSceneTests 4 · BattleFlowTests 표시 글자 PD 지시 2026-11-12(대화로그 공유/대화로그/삼국지슬링샷/2026-11-12_내정메뉴_개편.md · 레시피 R23) · QA r1~r12 · 마지막 r11·r12 PASS(B 0) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 13:41:33 +00:00
using System.Collections.Generic;
namespace TKS.OutGame
{
/// <summary>
/// 내정 영웅 파견(PD 2026-11-12 「훈련에 사용할 영웅을 지정(파견) · 병종 별 지휘관 1명」 · 「순찰에도 영웅을 파견」 · 「개발 메뉴에도 영웅을 배치」) —
/// 자리 = 훈련 병종마다 1(그 병종 영웅만) · 순찰 1 · 개발 1. 한 영웅은 한 자리에만(다른 자리에 있으면 옮김). **장면 표시만 · 능력치 효과 없음**(기획 미정).
/// </summary>
public static class DispatchRules
{
public const string Patrol = "patrol";
public const string Dev = "dev";
/// <summary>자리 키 = 「train:&lt;병종 키&gt;」 · 「patrol」 · 「dev」.</summary>
public static string TrainSlot(UnitType t)
{
return "train:" + UnitTypeInfo.Key(t);
}
public static string Get(SaveData d, string slot)
{
if (slot == Patrol) return d.patrol.hero ?? "";
if (slot == Dev) return d.dev.hero ?? "";
foreach (var s in d.training)
if (slot == "train:" + s.type) return s.commander ?? "";
return "";
}
static void Set(SaveData d, string slot, string id)
{
if (slot == Patrol) d.patrol.hero = id;
else if (slot == Dev) d.dev.hero = id;
else if (slot.StartsWith("train:"))
{
string key = slot.Substring(6);
foreach (UnitType t in System.Enum.GetValues(typeof(UnitType)))
if (UnitTypeInfo.Key(t) == key)
{
d.Train(t).commander = id;
return;
}
}
}
/// <summary>그 영웅이 파견된 자리(없으면 null).</summary>
public static string Where(SaveData d, string heroId)
{
if (string.IsNullOrEmpty(heroId)) return null;
if (d.patrol.hero == heroId) return Patrol;
if (d.dev.hero == heroId) return Dev;
foreach (var s in d.training)
if (s.commander == heroId) return "train:" + s.type;
return null;
}
public static string SlotKo(string slot)
{
if (slot == Patrol) return "순찰";
if (slot == Dev) return "개발";
if (slot != null && slot.StartsWith("train:"))
foreach (UnitType t in System.Enum.GetValues(typeof(UnitType)))
if ("train:" + UnitTypeInfo.Key(t) == slot) return UnitTypeInfo.Korean(t) + " 훈련";
return "";
}
/// <summary>그 자리에 보낼 수 있는 보유 영웅(병사 제외 · 훈련 = 그 병종만) — 보유 순서.</summary>
public static List<HeroDb.Hero> Candidates(OutGameData db, SaveData d, string slot)
{
var list = new List<HeroDb.Hero>();
string key = slot != null && slot.StartsWith("train:") ? slot.Substring(6) : null;
foreach (var hs in d.heroes)
{
var h = db.Heroes.Get(hs.id);
if (h == null || h.isSoldier) continue;
if (key != null && UnitTypeInfo.Key(h.type) != key) continue;
list.Add(h);
}
return list;
}
/// <summary>파견(null = 성공 · 아니면 사유) — 다른 자리에 있던 영웅이면 그 자리를 비우고 옮긴다.</summary>
public static string Assign(OutGameData db, SaveData d, string slot, string heroId)
{
var h = db.Heroes.Get(heroId);
if (h == null || !d.Owns(heroId)) return "보유하지 않은 영웅입니다";
if (h.isSoldier) return "영웅만 파견할 수 있습니다";
if (slot.StartsWith("train:") && UnitTypeInfo.Key(h.type) != slot.Substring(6)) return "그 병종 영웅만 지휘관이 될 수 있습니다";
var from = Where(d, heroId);
if (from == slot) return null;
if (from != null) Set(d, from, "");
Set(d, slot, heroId);
return null;
}
public static string Clear(SaveData d, string slot)
{
Set(d, slot, "");
return null;
}
}
}