ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Mission/MailBox.cs

89 lines
5.0 KiB
C#
Raw Normal View History

성장 · 임무 · 출정 · 외형 · 정보 일괄 — 임무(미션) 메뉴 · 영웅 각성 · 진화(진영 비서) · 스킬 강화(영웅 조각 + 만능 조각) · 각성 칸 = 승급 장비 등급 · 장비 등급 7(불멸 red · 신화 rainbow) · 병종 장비 210 · 장별 드랍 · 영웅 Lv100 · 출정 = 로비 편성(학습 판 = 연의 전기만) · 보스 말풍선만 · 1장 레벨디자인 · 외형(코스튬) 꾸미기 레이어 · 영웅 정보(능력치 · 열전) - 임무: 일일 · 주간 · 업적 · 카운터 36 · 우편 · 로비 버튼(MissionTests) - 각성 · 진화: 표 11장 · 진화 = ★ 최대 레벨 + 진영 비서 + 골드 · 비서 교환 · 각성 굴림 · 잠금 · 칸 = 승급 장비 등급(AwakenTests) - 스킬 강화: skill_upgrade · skill_config(최고 Lv10 · 상한 = 영웅 레벨 10 단위) · 만능 조각 확인 팝업 - 장비: gear_grades · gear_kinds · gear_drop_chapters · gear_drop_stages · 승급 7단계 · 무지개 7색 순환(UiRainbow) · TKS/Import Gear(GearTests) - 출정: 학습 판 = 연의 전기 서장만(WantsTutorialPlan) · boss_intro_config talk_main · 1장 표 · 1-4 가시덤불 정정(MainStageTests · TutorialTests [Ignore]) - 외형: 부위 4(외형 = 추후) · 꾸미기 9 · 기준점 · 알파 경계 · 전투 · UI 레이어 · 미리보기 · 상세(CostumeTests) - 정보: 능력치(기본 + 성장 = 합계 · HeroRules 그대로) · 전투 능력치 7 · 성장 내역 · 내역 창 · 열전(HeroInfoTests) - 같은 작업 트리의 다른 세션 미커밋 변경(스킬 이펙트 · 전투 해석기 · 보급전 표 · 스킬 표 등)은 넣지 않음 PD 2026-11-20 「지금까지 본 PC에서 구현된 모든 성장 관련 기능을 다른 세션에서 확인할 수 있도록 푸시까지 진행해」 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 03:15:36 +00:00
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
namespace TKS.OutGame
{
/// <summary>
/// 기기 우편함(2026-11-20 · 임무 메뉴 요청서 §0-6 「우편 최소 기능」 · 목업 07_pop_mail) — 로비 「우편」(기기 세이브 모드) → 목록 · 받기 · 모두 받기.
/// 우편 = SaveData.mail(임무 초기화 때 받지 않은 구간 보상) · 글 = mission_text 의 mail_&lt;kind&gt;_title/body · 보상 아이콘 = mission_screen reward_icon.
/// 서버 모드는 기존 서버 우편함(Net/MailPanel).
/// </summary>
public static class MailBox
{
const float RowH = 330f;
public static string Title(MailEntry m)
{
return MissionScreen.T("mail_" + m.kind + "_title");
}
public static string Body(MailEntry m)
{
string date = m.args.Count > 0 ? m.args[0] : "";
DateTime_Parts(date, out var mo, out var dd);
var needs = new List<string>();
if (m.args.Count > 1)
foreach (var n in m.args[1].Split(';'))
if (n.Length > 0) needs.Add(MissionScreen.F("mail_need", n));
return MissionScreen.F("mail_" + m.kind + "_body", mo, dd, string.Join(" · ", needs.ToArray()));
}
static void DateTime_Parts(string yyyymmdd, out string month, out string day)
{
month = day = "";
if (yyyymmdd == null || yyyymmdd.Length != 8) return;
int mo, dd;
if (int.TryParse(yyyymmdd.Substring(4, 2), NumberStyles.Integer, CultureInfo.InvariantCulture, out mo)) month = mo.ToString(CultureInfo.InvariantCulture);
if (int.TryParse(yyyymmdd.Substring(6, 2), NumberStyles.Integer, CultureInfo.InvariantCulture, out dd)) day = dd.ToString(CultureInfo.InvariantCulture);
}
public static void Open(OutGameRoot root)
{
UiText.Use(MissionScreen.Texts);
var s = root.Session;
var items = s.Save.mail != null ? s.Save.mail.items : new List<MailEntry>();
var ids = new List<int>();
foreach (var m in items) ids.Add(m.id);
float h = Mathf.Clamp(330f + Mathf.Max(1, items.Count) * (RowH + 14f), 620f, 1500f);
var buttons = new List<OutGameRoot.ModalButton>();
if (items.Count > 0) buttons.Add(new OutGameRoot.ModalButton(MissionScreen.T("mail_claim_all"), UiKit.Coin, () => Claim(root, ids)));
buttons.Add(new OutGameRoot.ModalButton(MissionScreen.T("mail_close"), UiKit.Dark, null));
var content = root.ModalCustom(MissionScreen.T("mail_title"), h, buttons.ToArray());
var head = content.parent.Find("Head");
if (head != null && head.GetComponent<Image>() != null) head.GetComponent<Image>().color = MissionScreen.Col("pop_mail", UiKit.Header);
if (items.Count == 0)
{
UiKit.Label(content, MissionScreen.T("mail_empty"), 32, UiKit.InkSoft, TextAnchor.MiddleCenter, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(820f, 60f), false);
return;
}
ScrollRect sr;
var grid = UiKit.ScrollGrid("Mails", content, 0f, 0f, 0f, 0f, new Vector2(860f, RowH), new Vector2(0f, 14f), 1, out sr);
foreach (var m in items)
{
var mail = m;
var go = new GameObject("Mail_" + mail.id, typeof(RectTransform));
go.transform.SetParent(grid, false);
var cell = (RectTransform)go.transform;
UiKit.Skin(cell, "panel12", MissionScreen.Col("row", UiKit.Dark), true); // 팝업 판 = 어두운 테마 → 칸도 어둡게 · 흰 글자
UiKit.Title(UiKit.Label(cell, Title(mail), 32, MissionScreen.Col("text", UiKit.White), TextAnchor.MiddleLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(24f, -12f), new Vector2(600f, 46f)), true);
var b = UiKit.Label(cell, Body(mail), 24, MissionScreen.Col("text_dim", UiKit.InkSoft), TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(24f, -80f), new Vector2(812f, 64f), false);
b.lineSpacing = 1.1f;
MissionScreen.RewardRow(cell, mail.reward, 140f, 96f, true);
UiKit.SkinBtn(cell, "Claim", UISkin.Has("btn_l_yellow") ? "btn_l_yellow" : "button", UiKit.White, MissionScreen.T("mail_claim"), 30, UiKit.Col("text_on_yellow", UiKit.Ink), 860f - 180f, 8f, 160f, 62f, () => Claim(root, new List<int> { mail.id }));
}
}
static void Claim(OutGameRoot root, List<int> ids)
{
var s = root.Session;
var got = MissionRules.ClaimMail(s.Db, s.Save, ids, s.Rng);
if (got.Count == 0) return;
s.Commit();
root.Toast(MissionScreen.F("mail_got", got.Count.ToString(CultureInfo.InvariantCulture)));
Open(root); // 받은 우편이 빠진 목록으로 다시 연다
}
}
}