행성 Level 1~100 수치표 적용 · 행성 컬러 마스터

This commit is contained in:
Sn-Kinos
2026-10-05 22:20:51 +09:00
parent cc0f2fb292
commit 000c058097
12 changed files with 424 additions and 64 deletions
+33
View File
@@ -22,8 +22,41 @@ const planetColors = <(String, Color)>[
('purple', Color(0xFFC300C8)),
];
/// 컬러 마스터 `config/planetColors` 에서 읽은 **전체** 목록(숨긴 색 포함 — 이미 그 색인 행성을 그려야 한다).
/// 10/3 통합회신 #6 「발주사가 컬러 항목을 추가할 수 있는 구조 · 8색 고정 적용 안 함」. 읽기 전에는 [planetColors].
List<(String, Color)> _planetColorMaster = planetColors;
/// `config/planetColors` 문서 → (그리기용 전체, 생성 화면에 내놓을 노출 목록). 형식이 틀린 항목은 건너뛴다.
/// 읽을 수 있는 항목이 없으면 기본 목록([planetColors]).
({List<(String, Color)> all, List<(String, Color)> visible}) planetColorsFrom(
Map<String, dynamic>? doc,
) {
final all = <(String, Color)>[];
final visible = <(String, Color)>[];
final raw = doc?['colors'];
if (raw is List) {
for (final c in raw) {
if (c is! Map) continue;
final key = c['key'];
final hex = c['hex'];
final m = hex is String ? RegExp(r'^#?([0-9a-fA-F]{6})$').firstMatch(hex) : null;
if (key is! String || key.isEmpty || m == null) continue;
final entry = (key, Color(0xFF000000 | int.parse(m.group(1)!, radix: 16)));
all.add(entry);
if (c['visible'] != false) visible.add(entry);
}
}
return visible.isEmpty
? (all: [...all, ...planetColors], visible: planetColors)
: (all: all, visible: visible);
}
/// 마스터를 읽은 뒤 그리기 목록을 바꾼다.
void setPlanetColorMaster(List<(String, Color)> all) => _planetColorMaster = all;
/// 서버 `colorKey` → 칩 색. 모르는 키(서버 기본값 `violet` 포함)는 null — 원래 일러스트 그대로.
Color? planetColorOf(String? key) =>
_planetColorMaster.where((c) => c.$1 == key).firstOrNull?.$2 ??
planetColors.where((c) => c.$1 == key).firstOrNull?.$2;
/// Figma 본체에 UX/FX v1.5 §2의 Stage별 레이어를 조합한다.