2026-11-20 03:15:36 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace TKS.OutGame
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 외형(코스튬) 창(2026-11-20 개발요청_코스튬 §2 · 목업 영웅정보_img 04 · 05) — 영웅 화면 「외형」 버튼 · 무대(유닛 대기 + 착용 레이어 · 미리보기) ·
|
|
|
|
|
/// 부위 칸 4(외형 = 잠김 「추후」) · 고른 부위 꾸미기 칸(벗기 · 보유 ✓ · 미보유 자물쇠 + 얻는 곳 · 추가 예정) · 모두 벗기 · 적용(보유만) · 미보유 두 번 = 상세 창.
|
|
|
|
|
/// 미리보기 = 창을 닫으면 버림. 글자 = UI/Costume/costume_text · 값 = 표(C45).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class CostumeWindow
|
|
|
|
|
{
|
|
|
|
|
public const string Texts = "UI/Costume/costume_text";
|
|
|
|
|
const float W = 940f;
|
|
|
|
|
const float L = 34f;
|
|
|
|
|
const float RW = 872f;
|
|
|
|
|
const int GridCols = 4;
|
|
|
|
|
const int GridRows = 2;
|
|
|
|
|
|
|
|
|
|
static string heroId;
|
|
|
|
|
static string slotSel;
|
|
|
|
|
static Dictionary<string, string> preview;
|
|
|
|
|
static string lastTapped;
|
|
|
|
|
|
|
|
|
|
/// <summary>시험 · 캡처 — 마지막 창(costume · detail) · 지금 미리보기.</summary>
|
|
|
|
|
public static string Last { get; private set; }
|
|
|
|
|
|
|
|
|
|
public static Dictionary<string, string> Preview
|
|
|
|
|
{
|
|
|
|
|
get { return preview; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
|
|
|
static void ResetStatics()
|
|
|
|
|
{
|
|
|
|
|
heroId = slotSel = lastTapped = Last = null;
|
|
|
|
|
preview = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static string T(string k)
|
|
|
|
|
{
|
|
|
|
|
return UiText.T(k).Replace("\\n", "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static string F(string k, params string[] a)
|
|
|
|
|
{
|
|
|
|
|
return UiText.F(k, a).Replace("\\n", "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Text Txt(RectTransform p, string name, string s, int size, Color c, float x, float y, float w, float h, TextAnchor a = TextAnchor.MiddleLeft, bool title = false)
|
|
|
|
|
{
|
|
|
|
|
var t = UiKit.Label(p, s, size, c, a, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, -y), new Vector2(w, h), title);
|
|
|
|
|
t.name = name;
|
|
|
|
|
if (title) UiKit.Title(t, true);
|
|
|
|
|
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Image Box(RectTransform p, string name, float x, float y, float w, float h, Color c, bool raycast = false)
|
|
|
|
|
{
|
|
|
|
|
return UiKit.Skin(UiKit.At(p, name, x, y, w, h), "card", c, raycast);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Button Btn(RectTransform p, string name, string skin, string label, int size, Color fg, float x, float y, float w, float h, Action onClick)
|
|
|
|
|
{
|
|
|
|
|
return UiKit.SkinBtn(p, name, UISkin.Has(skin) ? skin : "button", UiKit.White, label, size, fg, x, y, w, h, onClick);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Color Grade(string rarity)
|
|
|
|
|
{
|
|
|
|
|
var db = CostumeView.Db;
|
|
|
|
|
return UiKit.Col("gear_" + (db != null ? db.RarityGrade(rarity) : "white") + "_bg", UiKit.Dark);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>영웅 화면 「외형」 — 새로 열면 미리보기 = 지금 착용 · 빨간 점 끔.</summary>
|
|
|
|
|
public static void Open(OutGameRoot root, string id)
|
|
|
|
|
{
|
|
|
|
|
heroId = id;
|
|
|
|
|
preview = CostumeRules.Worn(CostumeView.Db, root.Session.Save.Hero(id));
|
|
|
|
|
lastTapped = null;
|
|
|
|
|
if (root.Session.Save.costumeNew)
|
|
|
|
|
{
|
|
|
|
|
root.Session.Save.costumeNew = false;
|
|
|
|
|
root.Session.Commit();
|
|
|
|
|
}
|
|
|
|
|
Draw(root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Step(OutGameRoot root, int d)
|
|
|
|
|
{
|
|
|
|
|
Open(root, root.HeroDetail.StepHero(d));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Draw(OutGameRoot root)
|
|
|
|
|
{
|
|
|
|
|
UiText.Use(Texts);
|
|
|
|
|
var s = root.Session;
|
|
|
|
|
var db = CostumeView.Db;
|
|
|
|
|
var h = s.Def(heroId);
|
|
|
|
|
if (db == null || h == null || h.isSoldier || s.Save.Hero(heroId) == null)
|
|
|
|
|
{
|
|
|
|
|
root.Toast(T("cos_none"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (slotSel == null || db.SlotOf(slotSel) == null || !db.SlotOf(slotSel).open) slotSel = CostumeRules.DrawOrder(db).Count > 0 ? db.slots[0].slot : null;
|
2026-11-20 08:35:04 +00:00
|
|
|
if (GrowthUi.On)
|
|
|
|
|
{
|
|
|
|
|
Draw2(root, null);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-11-20 03:15:36 +00:00
|
|
|
Last = "costume";
|
|
|
|
|
var content = root.ModalCustom(T("cos_title"), 1720f);
|
|
|
|
|
var panel = (RectTransform)content.parent;
|
|
|
|
|
foreach (var dd in new[] { -1, 1 })
|
|
|
|
|
{
|
|
|
|
|
int k = dd;
|
|
|
|
|
var b = Box(panel, dd < 0 ? "Prev" : "Next", W - (dd < 0 ? 300f : 216f), 26f, 72f, 72f, UiKit.Col("chip_dark", UiKit.Dark), true);
|
|
|
|
|
b.gameObject.AddComponent<Button>().onClick.AddListener(() => Step(root, k));
|
|
|
|
|
UiKit.Icon(b.rectTransform, dd < 0 ? "arrow_prev" : "arrow_next", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 46f);
|
|
|
|
|
}
|
|
|
|
|
// 무대 = 유닛 대기 + 착용 레이어(미리보기)
|
|
|
|
|
float y = 130f;
|
|
|
|
|
var stage = Box(panel, "Stage", L, y, RW, 760f, UiKit.Col("cos_stage", new Color(0.22f, 0.27f, 0.45f, 1f)));
|
|
|
|
|
Txt(stage.rectTransform, "Note", T("cos_note"), 24, UiKit.Col("text_soft", UiKit.InkSoft), RW - 520f, 16f, 500f, 70f, TextAnchor.UpperRight);
|
|
|
|
|
bool unowned = CostumeRules.CanApply(db, s.Save, preview) == "unowned";
|
|
|
|
|
if (unowned)
|
|
|
|
|
{
|
|
|
|
|
var pb = Box(stage.rectTransform, "PreviewBadge", 16f, 16f, 360f, 54f, UiKit.Col("cos_preview", new Color(0.55f, 0.45f, 0.12f, 1f)));
|
|
|
|
|
UiKit.Title(UiKit.FillLabel(pb.transform, T("cos_preview"), 24, UiKit.Col("gold", UiKit.Coin)), true);
|
|
|
|
|
}
|
|
|
|
|
var shadow = UiKit.At(stage.rectTransform, "Shadow", RW * 0.5f - 300f, 640f, 600f, 90f).gameObject.AddComponent<Image>();
|
|
|
|
|
shadow.sprite = UiKit.Circle; // 발밑 타원 그림자
|
|
|
|
|
shadow.color = new Color(0f, 0f, 0f, 0.25f);
|
|
|
|
|
shadow.raycastTarget = false;
|
|
|
|
|
var stand = UiKit.UnitStand("Hero", stage.rectTransform, h, new Vector2(0.5f, 0f), new Vector2(0f, 90f), 560f, 1f);
|
|
|
|
|
if (stand != null)
|
|
|
|
|
{
|
|
|
|
|
var img = stand.GetComponent<Image>();
|
|
|
|
|
UiFrameAnim.Attach(img, UnitArt.Load(h.art), "front_idle");
|
|
|
|
|
var uc = UiCostume.Attach(img, UnitArt.Load(h.art), heroId);
|
|
|
|
|
if (uc != null) uc.Override = preview;
|
|
|
|
|
}
|
|
|
|
|
y += 780f;
|
|
|
|
|
// 부위 칸 4
|
|
|
|
|
float cw = (RW - 3 * 16f) / 4f;
|
|
|
|
|
for (int i = 0; i < db.slots.Count && i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
var sl = db.slots[i];
|
|
|
|
|
float x = L + i * (cw + 16f);
|
|
|
|
|
bool sel = sl.slot == slotSel;
|
|
|
|
|
var c = Box(panel, "Slot_" + sl.slot, x, y, cw, 110f, sel ? UiKit.Col("cos_sel", new Color(0.24f, 0.36f, 0.86f, 1f)) : UiKit.Col("cos_cell", UiKit.Dark), true);
|
|
|
|
|
string sk = sl.slot;
|
|
|
|
|
c.gameObject.AddComponent<Button>().onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
if (!db.SlotOf(sk).open)
|
|
|
|
|
{
|
|
|
|
|
root.Toast(T("cos_later_toast"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
slotSel = sk;
|
|
|
|
|
lastTapped = null;
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
if (!sl.open)
|
|
|
|
|
{
|
|
|
|
|
c.color = new Color(c.color.r, c.color.g, c.color.b, 0.5f);
|
|
|
|
|
UiKit.Icon(c.rectTransform, "lock", new Vector2(0.5f, 1f), new Vector2(0.5f, 0.5f), new Vector2(0f, -38f), 52f);
|
|
|
|
|
Txt(c.rectTransform, "Name", F("cos_slot_later", sl.nameKo), 26, UiKit.Col("text_soft", UiKit.InkSoft), 0f, 66f, cw, 36f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
string worn;
|
|
|
|
|
preview.TryGetValue(sl.slot, out worn);
|
|
|
|
|
var wit = worn != null ? db.ItemOf(worn) : null;
|
|
|
|
|
var art = CostumeRules.Art(wit);
|
|
|
|
|
if (art != null)
|
|
|
|
|
{
|
|
|
|
|
var ai = UiKit.At(c.rectTransform, "Art", cw * 0.5f - 30f, 8f, 60f, 60f).gameObject.AddComponent<Image>();
|
|
|
|
|
ai.sprite = art;
|
|
|
|
|
ai.preserveAspect = true;
|
|
|
|
|
ai.raycastTarget = false;
|
|
|
|
|
}
|
|
|
|
|
Txt(c.rectTransform, "Name", sl.nameKo, 28, UiKit.White, 0f, 66f, cw, 36f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
}
|
|
|
|
|
y += 126f;
|
|
|
|
|
// 고른 부위 꾸미기 칸 = 벗기 · 꾸미기 · 추가 예정
|
|
|
|
|
var cells = new List<CostumeDb.Item> { null };
|
|
|
|
|
foreach (var it in db.items)
|
|
|
|
|
if (it.slot == slotSel) cells.Add(it);
|
|
|
|
|
float gh = 200f;
|
|
|
|
|
for (int i = 0; i < GridCols * GridRows; i++)
|
|
|
|
|
{
|
|
|
|
|
float x = L + (i % GridCols) * (cw + 16f), gy = y + (i / GridCols) * (gh + 16f);
|
|
|
|
|
if (i >= cells.Count)
|
|
|
|
|
{
|
|
|
|
|
var e = Box(panel, "Empty" + i, x, gy, cw, gh, UiKit.Col("cos_empty", new Color(0.18f, 0.2f, 0.3f, 0.6f)));
|
|
|
|
|
Txt(e.rectTransform, "Q", "?", 56, UiKit.Col("text_soft", UiKit.InkSoft), 0f, 40f, cw, 70f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
Txt(e.rectTransform, "T", T("cos_more"), 24, UiKit.Col("text_soft", UiKit.InkSoft), 0f, 120f, cw, 40f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
var it = cells[i];
|
|
|
|
|
string cur;
|
|
|
|
|
preview.TryGetValue(slotSel, out cur);
|
|
|
|
|
bool on = it == null ? string.IsNullOrEmpty(cur) : cur == it.id;
|
|
|
|
|
bool owned = it == null || CostumeRules.Owns(s.Save, it.id);
|
|
|
|
|
var cell = Box(panel, it == null ? "Off" : "Item_" + it.id, x, gy, cw, gh, it == null ? UiKit.Col("cos_cell", UiKit.Dark) : Grade(it.rarity) * new Color(0.55f, 0.55f, 0.6f, 1f), true);
|
|
|
|
|
if (on) UiKit.Border(cell, UiKit.Col("gold", UiKit.Coin), 5f);
|
|
|
|
|
var item = it;
|
|
|
|
|
cell.gameObject.AddComponent<Button>().onClick.AddListener(() => Tap(root, item));
|
|
|
|
|
if (it == null)
|
|
|
|
|
{
|
|
|
|
|
Txt(cell.rectTransform, "Dash", "—", 40, UiKit.Col("text_soft", UiKit.InkSoft), 0f, 50f, cw, 60f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
Txt(cell.rectTransform, "T", T("cos_off"), 26, UiKit.White, 0f, 120f, cw, 40f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
var ai = UiKit.At(cell.rectTransform, "Art", cw * 0.5f - 60f, 24f, 120f, 110f).gameObject.AddComponent<Image>();
|
|
|
|
|
ai.sprite = CostumeRules.Art(it);
|
|
|
|
|
ai.preserveAspect = true;
|
|
|
|
|
ai.raycastTarget = false;
|
|
|
|
|
if (!owned)
|
|
|
|
|
{
|
|
|
|
|
ai.color = new Color(0.5f, 0.5f, 0.5f, 0.8f);
|
|
|
|
|
UiKit.Icon(cell.rectTransform, "lock", new Vector2(0.5f, 1f), new Vector2(0.5f, 0.5f), new Vector2(0f, -60f), 56f);
|
|
|
|
|
Txt(cell.rectTransform, "Src", it.sourceKo, 20, UiKit.Col("gold", UiKit.Coin), 0f, 162f, cw, 30f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
}
|
|
|
|
|
else if (on) UiKit.Icon(cell.rectTransform, "check", new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-30f, -30f), 44f);
|
|
|
|
|
Txt(cell.rectTransform, "Name", it.nameKo, 26, owned ? UiKit.White : UiKit.Col("text_soft", UiKit.InkSoft), 0f, owned ? 140f : 128f, cw, 36f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
}
|
|
|
|
|
y += GridRows * (gh + 16f) + 8f;
|
|
|
|
|
Btn(panel, "OffAll", "btn_s_gray", T("cos_off_all"), 34, UiKit.White, L, y, 280f, 100f, () =>
|
|
|
|
|
{
|
|
|
|
|
preview = new Dictionary<string, string>();
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
var why = CostumeRules.CanApply(db, s.Save, preview);
|
|
|
|
|
Btn(panel, "Apply", why == null ? "btn_l_yellow" : "btn_s_gray", why == null ? T("cos_apply") : T("cos_apply_lack"), 36, why == null ? UiKit.Col("text_on_yellow", UiKit.Ink) : UiKit.White, L + 300f, y, RW - 300f, 100f, () =>
|
|
|
|
|
{
|
|
|
|
|
var r = root.Session.CostumeApply(heroId, preview);
|
|
|
|
|
if (r != null)
|
|
|
|
|
{
|
|
|
|
|
root.Toast(T(r == "unowned" ? "cos_apply_lack" : "cos_fail"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
root.HeroDetail.Refresh();
|
|
|
|
|
root.Toast(T("cos_applied"));
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
y += 112f;
|
|
|
|
|
Txt(panel, "Foot", T("cos_foot"), 22, UiKit.Col("text_soft", UiKit.InkSoft), L, y, RW, 34f, TextAnchor.MiddleCenter);
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-20 08:35:04 +00:00
|
|
|
/// <summary>외형 창(PD 2026-11-20 재설계 · Fable 초안 2-9 「로비에 서 보는 옷 입히기」) — 무대 = 로비 배경 장면 창(입힌 모습 · 미리보기 꼬리표 · ⓘ) ·
|
|
|
|
|
/// 부위 탭 4(외형 = 추후 잠김) · 꾸미기 격자(벗기 + 그 부위 꾸미기 · 「추가 예정」 빈칸 폐지) · 모두 벗기 · 적용 · 상세 = 격자 위 아래쪽 판(무대를 가리지 않음).</summary>
|
|
|
|
|
static void Draw2(OutGameRoot root, CostumeDb.Item detail)
|
|
|
|
|
{
|
|
|
|
|
var s = root.Session;
|
|
|
|
|
var db = CostumeView.Db;
|
|
|
|
|
var h = s.Def(heroId);
|
|
|
|
|
Last = detail != null ? "detail" : "costume";
|
|
|
|
|
var content = root.ModalCustom(T("cos_title"), 1600f);
|
|
|
|
|
var panel = (RectTransform)content.parent;
|
|
|
|
|
GrowthUi.TitleArrows(panel, d => Step(root, d));
|
|
|
|
|
Image unit;
|
|
|
|
|
var sc = GrowthUi.Scene(panel, "costume", h, out unit);
|
|
|
|
|
if (unit != null)
|
|
|
|
|
{
|
|
|
|
|
var uc = unit.GetComponent<UiCostume>();
|
|
|
|
|
if (uc == null) uc = UiCostume.Attach(unit, UnitArt.Load(h.art), heroId);
|
|
|
|
|
if (uc != null) uc.Override = preview;
|
|
|
|
|
}
|
|
|
|
|
float y = -sc.anchoredPosition.y;
|
|
|
|
|
var info = Box(panel, "Info", L + 14f, y + 14f, 64f, 64f, new Color(0.08f, 0.09f, 0.16f, 0.8f), true);
|
|
|
|
|
info.gameObject.AddComponent<Button>().onClick.AddListener(() => root.Toast(T("cos_note") + "\n" + T("cos_foot")));
|
|
|
|
|
UiKit.Icon(info.rectTransform, "info", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 48f);
|
|
|
|
|
if (CostumeRules.CanApply(db, s.Save, preview) == "unowned")
|
|
|
|
|
GrowthUi.Tag(panel, "PreviewBadge", null, T("cos_preview"), W - L - 14f - 440f, y + 18f, 440f, 60f, 26, UiKit.Col("gold", UiKit.Coin));
|
|
|
|
|
y += sc.rect.height + 20f;
|
|
|
|
|
// 부위 탭 4
|
|
|
|
|
float cw = (RW - 3 * 16f) / 4f;
|
|
|
|
|
for (int i = 0; i < db.slots.Count && i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
var sl = db.slots[i];
|
|
|
|
|
float x = L + i * (cw + 16f);
|
|
|
|
|
bool sel = sl.slot == slotSel;
|
|
|
|
|
string sk = sl.slot;
|
|
|
|
|
var tb = UiKit.SkinBtn(panel, "Slot_" + sl.slot, sel ? "btn_red" : "btn_s_gray", UiKit.White, sl.open ? sl.nameKo : F("cos_slot_later", sl.nameKo), 30, sl.open ? UiKit.White : UiKit.Col("text_soft", UiKit.InkSoft), x, y, cw, 84f, () =>
|
|
|
|
|
{
|
|
|
|
|
if (!db.SlotOf(sk).open)
|
|
|
|
|
{
|
|
|
|
|
root.Toast(T("cos_later_toast"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
slotSel = sk;
|
|
|
|
|
lastTapped = null;
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
if (!UISkin.Has(sel ? "btn_red" : "btn_s_gray")) tb.GetComponent<Image>().color = sel ? UiKit.Red : UiKit.Dark; // 정보 창 탭과 같은 처리(붉은 버튼 그림 없음)
|
|
|
|
|
if (!sl.open) UiKit.Icon(tb.transform, "lock_on", new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-24f, -22f), 40f);
|
|
|
|
|
}
|
|
|
|
|
y += 100f;
|
|
|
|
|
// 꾸미기 격자 = 벗기 + 그 부위 꾸미기(늘면 줄이 늘어남)
|
|
|
|
|
var cells = new List<CostumeDb.Item> { null };
|
|
|
|
|
foreach (var it in db.items)
|
|
|
|
|
if (it.slot == slotSel) cells.Add(it);
|
|
|
|
|
string cur;
|
|
|
|
|
preview.TryGetValue(slotSel ?? "", out cur);
|
|
|
|
|
float gh = cw;
|
|
|
|
|
for (int i = 0; i < cells.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
float x = L + (i % 4) * (cw + 16f), gy = y + (i / 4) * (gh + 16f);
|
|
|
|
|
var it = cells[i];
|
|
|
|
|
bool on = it == null ? string.IsNullOrEmpty(cur) : cur == it.id;
|
|
|
|
|
bool owned = it == null || CostumeRules.Owns(s.Save, it.id);
|
|
|
|
|
Color bg = it == null ? GrowthUi.Col("row_bg", UiKit.Dark) : Grade(it.rarity) * new Color(0.62f, 0.62f, 0.66f, 1f);
|
|
|
|
|
var cell = Box(panel, it == null ? "Off" : "Item_" + it.id, x, gy, cw, gh, bg, true);
|
|
|
|
|
var item = it;
|
|
|
|
|
cell.gameObject.AddComponent<Button>().onClick.AddListener(() => Tap(root, item));
|
|
|
|
|
if (on)
|
|
|
|
|
{
|
|
|
|
|
var ring = GrowthUi.Paint(UiKit.At(cell.rectTransform, "On", -6f, -6f, cw + 12f, gh + 12f), "grow_scene_frame", Color.white);
|
|
|
|
|
ring.raycastTarget = false;
|
|
|
|
|
}
|
|
|
|
|
var nb = UiKit.Skin(UiKit.At(cell.rectTransform, "NameBand", 0f, gh - 52f, cw, 52f), "card", new Color(0.05f, 0.06f, 0.12f, 0.7f));
|
|
|
|
|
nb.raycastTarget = false;
|
|
|
|
|
if (it == null)
|
|
|
|
|
{
|
|
|
|
|
var off = UiKit.Icon(cell.rectTransform, "ic_menu_costume", new Vector2(0.5f, 1f), new Vector2(0.5f, 0.5f), new Vector2(0f, -(gh - 52f) * 0.5f), 104f);
|
|
|
|
|
if (off != null) off.color = new Color(0.55f, 0.55f, 0.6f, 0.9f);
|
|
|
|
|
Txt(cell.rectTransform, "T", T("cos_off"), 26, UiKit.White, 0f, gh - 48f, cw, 44f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
var ai = UiKit.At(cell.rectTransform, "Art", cw * 0.5f - 70f, 10f, 140f, 140f).gameObject.AddComponent<Image>();
|
|
|
|
|
ai.sprite = IconOf(it); // F4 = 원화 불투명 상자만 자른 아이콘(Resources/UI/Costume/icon · 없으면 원화)
|
|
|
|
|
ai.preserveAspect = true;
|
|
|
|
|
ai.raycastTarget = false;
|
|
|
|
|
if (!owned)
|
|
|
|
|
{
|
|
|
|
|
ai.color = new Color(0.6f, 0.6f, 0.6f, 0.55f);
|
|
|
|
|
UiKit.Icon(cell.rectTransform, "lock_on", new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-28f, -28f), 46f);
|
|
|
|
|
Txt(cell.rectTransform, "Src", it.sourceKo, 20, UiKit.Col("gold", UiKit.Coin), 0f, gh - 82f, cw, 30f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
}
|
|
|
|
|
else if (on) UiKit.Icon(cell.rectTransform, "check", new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(-28f, -28f), 46f);
|
|
|
|
|
Txt(cell.rectTransform, "Name", it.nameKo, 24, owned ? UiKit.White : UiKit.Col("text_soft", UiKit.InkSoft), 0f, gh - 48f, cw, 44f, TextAnchor.MiddleCenter, true);
|
|
|
|
|
}
|
|
|
|
|
int rows = Mathf.Max(1, (cells.Count + 3) / 4);
|
|
|
|
|
float gridTop = y;
|
|
|
|
|
y += rows * (gh + 16f) + 8f;
|
|
|
|
|
y = Mathf.Max(y, gridTop + 2f * (gh + 16f) + 8f);
|
|
|
|
|
Btn(panel, "OffAll", "btn_s_gray", T("cos_off_all"), 34, UiKit.White, L, y, 280f, 108f, () =>
|
|
|
|
|
{
|
|
|
|
|
preview = new Dictionary<string, string>();
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
var why = CostumeRules.CanApply(db, s.Save, preview);
|
|
|
|
|
Btn(panel, "Apply", why == null ? "btn_l_yellow" : "btn_s_gray", why == null ? T("cos_apply") : T("cos_apply_lack"), 36, why == null ? UiKit.Col("text_on_yellow", UiKit.Ink) : UiKit.White, L + 300f, y, RW - 300f, 108f, () =>
|
|
|
|
|
{
|
|
|
|
|
var r = root.Session.CostumeApply(heroId, preview);
|
|
|
|
|
if (r != null)
|
|
|
|
|
{
|
|
|
|
|
root.Toast(T(r == "unowned" ? "cos_apply_lack" : "cos_fail"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
root.HeroDetail.Refresh();
|
|
|
|
|
root.Toast(T("cos_applied"));
|
|
|
|
|
Draw(root);
|
|
|
|
|
});
|
|
|
|
|
if (detail != null) DetailSheet(root, panel, detail, gridTop - 8f);
|
|
|
|
|
GrowthUi.Place(panel, Mathf.Max(y + 108f, detail != null ? gridTop - 8f + 560f : 0f));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static readonly Dictionary<string, Sprite> icons = new Dictionary<string, Sprite>();
|
|
|
|
|
|
|
|
|
|
/// <summary>꾸미기 칸 아이콘 = 원화의 불투명 상자만 자른 그림(유닛 캔버스 512² 그대로면 칸에서 점처럼 작음 · Fable QA r1 F4) · 없으면 원화.</summary>
|
|
|
|
|
static Sprite IconOf(CostumeDb.Item it)
|
|
|
|
|
{
|
|
|
|
|
if (it == null) return null;
|
|
|
|
|
Sprite sp;
|
|
|
|
|
if (icons.TryGetValue(it.id, out sp) && sp != null) return sp;
|
|
|
|
|
var tex = Resources.Load<Texture2D>("UI/Costume/icon/" + System.IO.Path.GetFileName(it.art ?? ""));
|
|
|
|
|
sp = tex != null ? Sprite.Create(tex, new Rect(0f, 0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100f) : CostumeRules.Art(it);
|
|
|
|
|
icons[it.id] = sp;
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>미보유 꾸미기 상세 = 격자 위에 덮는 아래쪽 판(무대의 입힌 모습은 그대로 보임 · PD 2026-11-20 재설계) — 그림 · 등급 · 부위 · 얻는 곳 · 닫기 / 얻으러 가기.</summary>
|
|
|
|
|
static void DetailSheet(OutGameRoot root, RectTransform panel, CostumeDb.Item it, float y)
|
|
|
|
|
{
|
|
|
|
|
var db = CostumeView.Db;
|
|
|
|
|
var gk = db.RarityGrade(it.rarity);
|
|
|
|
|
var sheet = UiKit.At(panel, "DetailSheet", L - 10f, y, RW + 20f, 560f);
|
|
|
|
|
var bg = UiKit.Skin(sheet, "popup", UiKit.Paper, true);
|
|
|
|
|
var head = UiKit.Skin(UiKit.At(sheet, "Head", 6f, 6f, RW + 8f, 92f), "popup_head", Grade(it.rarity));
|
|
|
|
|
head.raycastTarget = false;
|
|
|
|
|
UiKit.Title(UiKit.FillLabel(head.transform, it.nameKo, 38, UiKit.White), true);
|
|
|
|
|
var ib = Box(sheet, "Icon", 36f, 122f, 220f, 220f, Grade(it.rarity) * new Color(0.62f, 0.62f, 0.66f, 1f));
|
|
|
|
|
ib.gameObject.AddComponent<RectMask2D>();
|
|
|
|
|
var ai = UiKit.At(ib.rectTransform, "Art", 20f, 20f, 180f, 180f).gameObject.AddComponent<Image>();
|
|
|
|
|
ai.sprite = IconOf(it);
|
|
|
|
|
ai.preserveAspect = true;
|
|
|
|
|
ai.raycastTarget = false;
|
|
|
|
|
float tx = 290f;
|
|
|
|
|
Txt(sheet, "Grade", F("cos_d_grade", "<color=#" + ColorUtility.ToHtmlStringRGB(Grade(it.rarity)) + ">" + UiKit.GearGradeKo(gk) + "</color>"), 30, UiKit.Col("text_soft", UiKit.InkSoft), tx, 130f, 580f, 46f, TextAnchor.MiddleLeft, true).supportRichText = true;
|
|
|
|
|
var sl = db.SlotOf(it.slot);
|
|
|
|
|
Txt(sheet, "Part", F("cos_d_part", sl != null ? sl.nameKo : it.slot), 30, UiKit.White, tx, 184f, 580f, 46f, TextAnchor.MiddleLeft, true);
|
|
|
|
|
Txt(sheet, "Src", F("cos_d_src", "<color=#" + ColorUtility.ToHtmlStringRGB(UiKit.Col("gold", UiKit.Coin)) + ">" + it.sourceKo + "</color>"), 30, UiKit.White, tx, 238f, 580f, 46f, TextAnchor.MiddleLeft, true).supportRichText = true;
|
|
|
|
|
var hint = Txt(sheet, "Hint", T("cos_d_hint"), 22, UiKit.Col("text_soft", UiKit.InkSoft), tx, 296f, 580f, 40f);
|
|
|
|
|
hint.horizontalOverflow = HorizontalWrapMode.Wrap;
|
|
|
|
|
Btn(sheet, "DetailClose", "btn_s_gray", T("cos_d_close"), 34, UiKit.White, 36f, 400f, 380f, 104f, () => Draw(root));
|
|
|
|
|
Btn(sheet, "DetailGo", "btn_sky", T("cos_d_go"), 34, UiKit.White, RW + 20f - 36f - 420f, 400f, 420f, 104f, () => GoSource(root, it));
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-20 03:15:36 +00:00
|
|
|
/// <summary>칸 누름 = 바로 미리 입힘(미보유 포함) · 미보유를 두 번 = 상세 창.</summary>
|
|
|
|
|
static void Tap(OutGameRoot root, CostumeDb.Item it)
|
|
|
|
|
{
|
|
|
|
|
if (it == null)
|
|
|
|
|
{
|
|
|
|
|
preview[slotSel] = "";
|
|
|
|
|
lastTapped = null;
|
|
|
|
|
Draw(root);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool owned = CostumeRules.Owns(root.Session.Save, it.id);
|
|
|
|
|
if (!owned && lastTapped == it.id)
|
|
|
|
|
{
|
|
|
|
|
OpenDetail(root, it);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
preview[it.slot] = it.id;
|
|
|
|
|
lastTapped = it.id;
|
|
|
|
|
Draw(root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>미보유 꾸미기 상세(목업 05) — 그림 · 등급 · 부위 · 얻는 곳 · 닫기 / 얻으러 가기.</summary>
|
|
|
|
|
public static void OpenDetail(OutGameRoot root, CostumeDb.Item it)
|
|
|
|
|
{
|
|
|
|
|
UiText.Use(Texts);
|
2026-11-20 08:35:04 +00:00
|
|
|
if (GrowthUi.On && heroId != null && preview != null)
|
|
|
|
|
{
|
|
|
|
|
Draw2(root, it);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-11-20 03:15:36 +00:00
|
|
|
var db = CostumeView.Db;
|
|
|
|
|
Last = "detail";
|
|
|
|
|
var content = root.ModalCustom(it.nameKo, 560f);
|
|
|
|
|
var panel = (RectTransform)content.parent;
|
|
|
|
|
var head = panel.Find("Head");
|
|
|
|
|
if (head != null && head.GetComponent<Image>() != null) head.GetComponent<Image>().color = Grade(it.rarity);
|
|
|
|
|
float y = 136f;
|
|
|
|
|
var ib = Box(panel, "Icon", L + 10f, y, 220f, 200f, UiKit.Col("cos_cell", UiKit.Dark));
|
|
|
|
|
ib.gameObject.AddComponent<RectMask2D>();
|
|
|
|
|
// 꾸미기 그림 = 유닛 그림 폭 캔버스(가운데 작은 그림) → 칸에서 크게(임시 그림 기준 2.5 배 · 칸 밖은 잘림)
|
|
|
|
|
var ai = UiKit.At(ib.rectTransform, "Art", 110f - 225f, 100f - 225f, 450f, 450f).gameObject.AddComponent<Image>();
|
|
|
|
|
ai.sprite = CostumeRules.Art(it);
|
|
|
|
|
ai.preserveAspect = true;
|
|
|
|
|
float tx = L + 260f;
|
|
|
|
|
var gk = db.RarityGrade(it.rarity);
|
|
|
|
|
Txt(panel, "Grade", F("cos_d_grade", "<color=#" + ColorUtility.ToHtmlStringRGB(Grade(it.rarity)) + ">" + UiKit.GearGradeKo(gk) + "</color>"), 30, UiKit.Col("text_soft", UiKit.InkSoft), tx, y + 4f, 600f, 44f, TextAnchor.MiddleLeft, true).supportRichText = true;
|
|
|
|
|
var sl = db.SlotOf(it.slot);
|
|
|
|
|
Txt(panel, "Part", F("cos_d_part", sl != null ? sl.nameKo : it.slot), 30, UiKit.White, tx, y + 52f, 600f, 44f, TextAnchor.MiddleLeft, true);
|
|
|
|
|
Txt(panel, "Src", F("cos_d_src", "<color=#" + ColorUtility.ToHtmlStringRGB(UiKit.Col("gold", UiKit.Coin)) + ">" + it.sourceKo + "</color>"), 30, UiKit.White, tx, y + 100f, 600f, 44f, TextAnchor.MiddleLeft, true).supportRichText = true;
|
|
|
|
|
Txt(panel, "Hint", T("cos_d_hint"), 24, UiKit.Col("text_soft", UiKit.InkSoft), tx, y + 150f, 600f, 40f);
|
|
|
|
|
y += 230f;
|
|
|
|
|
Btn(panel, "DetailClose", "btn_s_gray", T("cos_d_close"), 36, UiKit.White, L + 20f, y, 400f, 96f, () => Draw(root));
|
|
|
|
|
Btn(panel, "DetailGo", "btn_sky", T("cos_d_go"), 36, UiKit.White, W - L - 420f, y, 400f, 96f, () => GoSource(root, it));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>얻으러 가기 = s_source 앞 말(mission = 임무 화면 · 그 밖 = 준비 중 안내 · 이벤트 = 준비 중).</summary>
|
|
|
|
|
static void GoSource(OutGameRoot root, CostumeDb.Item it)
|
|
|
|
|
{
|
|
|
|
|
string kind = (it.source ?? "").Split(':')[0];
|
|
|
|
|
if (kind == "mission" && root.Missions != null)
|
|
|
|
|
{
|
|
|
|
|
root.CloseModal();
|
|
|
|
|
root.Show(root.Missions);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
root.Toast(F("cos_d_soon", it.sourceKo));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|