442 lines
22 KiB
C#
442 lines
22 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TKS.OutGame
|
|
{
|
|
/// <summary>
|
|
/// 훈련장(보급전) 메뉴 화면(PD 2026-11-18 「위 내용으로 게임에 반영 · 매일 열림 = 요일 없음 · 정해진 요일 = 여는 요일만 · 「/」 판 더 왼쪽으로 짧게」 · 아트 시안 content_screens_2/supply/final/mock/mock_s_*.png · Fable QA r2 PASS) —
|
|
/// 위 띠(오늘 요일 · 오늘 완료 · 주간 도장 · 하루 횟수 · 광고) + 배너 카드 목록(위아래 스크롤): 배너(배경 + 게임 유닛) · 메뉴 색 「/」 글자 판(이름 · 제한 턴 · 최고 단계 · 여는 요일 · 보상) · 오른쪽 = 남은 + 입장 / 닫힌 날 = 「오늘 닫힘 · 여는 요일」 + 닫힘 / 모드 잠김 = 붉은 띠 + 잠김.
|
|
/// 입장 = 예전과 같은 단계 고르기(ArenaScreen.OpenSupplyTiers) · 던전 · 이름 · 요일 · 제한 턴 · 보상 = 게임 표 supply_dungeons(SupplyData) · 이 화면 표 = 그림 · 색 · 배치(Resources/UI/Supply/supply_screen · C45) · 글자 = supply_text(UiText).
|
|
/// 층(P41): 화면(Event) → Strip(위 띠 · Event) · 목록(UiKit.ScrollGrid = 보는 칸 RectMask2D + 내용 Frame · 레이캐스터 · 카드 = 배너 · 판 · 글자 · 버튼).
|
|
/// </summary>
|
|
public class ArenaSupply
|
|
{
|
|
public const string Table = "UI/Supply/supply_screen";
|
|
|
|
readonly ArenaScreen screen;
|
|
readonly Dictionary<string, List<string>> kv = new Dictionary<string, List<string>>();
|
|
readonly Dictionary<string, string[]> banners = new Dictionary<string, string[]>();
|
|
readonly Dictionary<string, Text> texts = new Dictionary<string, Text>();
|
|
readonly Dictionary<string, int> dayDots = new Dictionary<string, int>();
|
|
readonly HashSet<string> closed = new HashSet<string>();
|
|
|
|
public RectTransform View { get; private set; }
|
|
public RectTransform Strip { get; private set; }
|
|
public RectTransform List { get; private set; }
|
|
public ScrollRect Scroll { get; private set; }
|
|
public bool Built { get; private set; }
|
|
public bool Locked { get; private set; }
|
|
|
|
/// <summary>카드 수 · 카드마다 요일 점 수 · 오늘 닫힌 카드(테스트).</summary>
|
|
public int CardCount { get; private set; }
|
|
|
|
public int DayDotsOf(string id)
|
|
{
|
|
int n;
|
|
return dayDots.TryGetValue(id, out n) ? n : -1;
|
|
}
|
|
|
|
public bool IsClosed(string id)
|
|
{
|
|
return closed.Contains(id);
|
|
}
|
|
|
|
/// <summary>제목 띠 부제(던전 수 넣음).</summary>
|
|
public string Subtitle
|
|
{
|
|
get { return UiText.F(S_("subtitle_key"), new[] { SupplyData.AllDungeons().Count.ToString(CultureInfo.InvariantCulture) }); }
|
|
}
|
|
|
|
ArenaSupply(ArenaScreen s)
|
|
{
|
|
screen = s;
|
|
}
|
|
|
|
OutGameSession S
|
|
{
|
|
get { return screen.S; }
|
|
}
|
|
|
|
// ---------- 표 ----------
|
|
|
|
public static ArenaSupply Load(ArenaScreen s)
|
|
{
|
|
var rows = UiText.Rows(Table);
|
|
if (rows == null) return null;
|
|
var sp = new ArenaSupply(s);
|
|
foreach (var r in rows)
|
|
{
|
|
string k, v;
|
|
if (!r.TryGetValue("s_key", out k) || k.Length == 0) continue;
|
|
r.TryGetValue("s_value", out v);
|
|
List<string> l;
|
|
if (!sp.kv.TryGetValue(k, out l)) sp.kv[k] = l = new List<string>();
|
|
l.Add(v ?? "");
|
|
}
|
|
foreach (var b in sp.All("banner"))
|
|
if (b.Length >= 2 && b[0].Trim().Length > 0) sp.banners[b[0].Trim()] = b;
|
|
UiText.Use(sp.S_("texts"));
|
|
if (sp.banners.Count == 0 || !UiText.Has(sp.S_("title_key"))) return null;
|
|
return sp;
|
|
}
|
|
|
|
public string S_(string key, string def = "")
|
|
{
|
|
List<string> l;
|
|
return kv.TryGetValue(key, out l) && l.Count > 0 && l[0].Length > 0 ? l[0] : def;
|
|
}
|
|
|
|
string[] L(string key)
|
|
{
|
|
return S_(key).Split('|');
|
|
}
|
|
|
|
List<string[]> All(string key)
|
|
{
|
|
var list = new List<string[]>();
|
|
List<string> l;
|
|
if (kv.TryGetValue(key, out l))
|
|
foreach (var v in l)
|
|
list.Add(v.Split('|'));
|
|
return list;
|
|
}
|
|
|
|
static float F(string v, float def = 0f)
|
|
{
|
|
float f;
|
|
return v != null && float.TryParse(v.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out f) ? f : def;
|
|
}
|
|
|
|
static float At(string[] a, int i, float def = 0f)
|
|
{
|
|
return a != null && i < a.Length && a[i].Trim().Length > 0 ? F(a[i], def) : def;
|
|
}
|
|
|
|
static string Str(string[] a, int i)
|
|
{
|
|
return a != null && i < a.Length ? a[i].Trim() : "";
|
|
}
|
|
|
|
static Color Col(string[] a, int i, Color def)
|
|
{
|
|
Color c;
|
|
return a != null && i < a.Length && ColorUtility.TryParseHtmlString(a[i].Trim(), out c) ? c : def;
|
|
}
|
|
|
|
static Color Alpha(Color c, float a)
|
|
{
|
|
c.a = a;
|
|
return c;
|
|
}
|
|
|
|
static string N(int v)
|
|
{
|
|
return v.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
/// <summary>정보 글자(테스트 · 없으면 null).</summary>
|
|
public string TextOf(string name)
|
|
{
|
|
Text t;
|
|
return texts.TryGetValue(name, out t) && t != null ? t.text : null;
|
|
}
|
|
|
|
// ---------- 만들기 ----------
|
|
|
|
/// <summary>slot(화면 전체 · 제목 띠 뒤)에 위 띠 · 카드 목록을 다시 채운다 · 배너가 하나도 없으면 false(호출 쪽 = 예전 더미 목록).</summary>
|
|
public bool Show(RectTransform slot)
|
|
{
|
|
if (!Built)
|
|
{
|
|
bool any = false;
|
|
foreach (var b in banners.Values)
|
|
if (Resources.Load<Sprite>(Str(b, 1)) != null) any = true;
|
|
if (!any)
|
|
{
|
|
Debug.LogWarning("[TKS] 훈련장 배너 없음: " + Table);
|
|
return false;
|
|
}
|
|
View = slot;
|
|
Built = true;
|
|
}
|
|
Rebuild();
|
|
return true;
|
|
}
|
|
|
|
float Z;
|
|
|
|
void Rebuild()
|
|
{
|
|
UiKit.Clear(View);
|
|
texts.Clear();
|
|
dayDots.Clear();
|
|
closed.Clear();
|
|
var r = View.rect;
|
|
Z = Mathf.Min(r.width / 1080f, r.height / 1920f);
|
|
if (Z <= 0f) Z = 1f;
|
|
var db = S.Db;
|
|
var d = S.Save;
|
|
var now = S.Now;
|
|
Locked = !SupplyRules.Unlocked(d);
|
|
|
|
// 위 띠(Event)
|
|
Strip = UiLayer.Group("Strip", View, UiRate.Event);
|
|
var st = L("strip");
|
|
float stTop = OutGameRoot.TopBarH + OutGameRoot.HeaderH + (At(st, 0, 240f) - 224f) * Z;
|
|
float stH = At(st, 1, 52f) * Z;
|
|
var cd = L("card");
|
|
float cw = At(cd, 0, 1040f) * Z, ch = At(cd, 1, 360f) * Z, gap = At(cd, 2, 22f) * Z;
|
|
float x0 = (r.width - cw) * 0.5f;
|
|
if (Locked) LockStrip(x0, stTop, cw);
|
|
else InfoStrip(db, d, now, x0, stTop, cw, stH);
|
|
|
|
// 카드 목록(UiKit.ScrollGrid = 내용 Frame + 레이캐스터 · RectMask2D)
|
|
float listTop = OutGameRoot.TopBarH + OutGameRoot.HeaderH + (At(cd, 4, 316f) - 224f - 6f) * Z;
|
|
ScrollRect sc;
|
|
List = UiKit.ScrollGrid("List", View, 0f, 0f, listTop, OutGameRoot.TabBarH, new Vector2(cw, ch), new Vector2(0f, gap), 1, out sc);
|
|
Scroll = sc;
|
|
var grid = List.GetComponent<GridLayoutGroup>();
|
|
if (grid != null) grid.padding = new RectOffset(0, 0, 6, Mathf.RoundToInt(At(cd, 5, 16f) * Z));
|
|
CardCount = 0;
|
|
foreach (var dg in SupplyData.AllDungeons())
|
|
{
|
|
string[] b;
|
|
if (!banners.TryGetValue(dg.id, out b)) continue;
|
|
Card(dg, b, cw, ch, db, d, now);
|
|
CardCount++;
|
|
}
|
|
}
|
|
|
|
Text Lab(Transform p, string name, string s, float size, Color c, TextAnchor a, float x, float y, float w, float h, bool stroke)
|
|
{
|
|
var t = UiKit.Label(p, s, Mathf.RoundToInt(size), c, a, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, -y), new Vector2(w, h));
|
|
UiKit.Title(t, stroke);
|
|
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
t.raycastTarget = false;
|
|
t.name = name;
|
|
texts[name] = t;
|
|
return t;
|
|
}
|
|
|
|
/// <summary>칩(글자 폭 맞춤) · 반환 = 칩 폭.</summary>
|
|
float Chip(Transform p, string name, string s, float x, float y, float h, float fs, Color bg, Color border, float bw)
|
|
{
|
|
var c = UiKit.Skin(UiKit.At(p, name, x, y, 10f, h), "chip", bg);
|
|
if (bw > 0f) UiKit.Border(c, border, bw);
|
|
var t = UiKit.Title(UiKit.FillLabel(c.transform, s, Mathf.RoundToInt(fs), Color.white), true);
|
|
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
t.name = name;
|
|
texts[name] = t;
|
|
float w = Mathf.Ceil(t.preferredWidth) + 36f * Z;
|
|
c.rectTransform.sizeDelta = new Vector2(w, h);
|
|
return w;
|
|
}
|
|
|
|
void InfoStrip(OutGameData db, SaveData d, DateTime now, float x0, float y, float w, float h)
|
|
{
|
|
var st = L("strip");
|
|
float fs = At(st, 2, 25f) * Z, g = At(st, 3, 18f) * Z, bw = At(st, 5, 4f) * Z;
|
|
var bc = Col(st, 4, UiKit.Dark);
|
|
var chipC = UiKit.Col("chip_dark", UiKit.Dark);
|
|
var s = d.supply;
|
|
int open = 0, done = 0;
|
|
foreach (var dg in SupplyData.AllDungeons())
|
|
if (SupplyRules.OpenToday(dg, now))
|
|
{
|
|
open++;
|
|
if (s.doneDay == EconomyRules.DayKey(now) && s.doneIds.Contains(dg.id)) done++;
|
|
}
|
|
int stampNeed = ContentTables.Int(SupplyData.Mode, "weekly_stamp_need");
|
|
int stampDays = s.stampWeek == ArenaRules.WeekKey(now) ? s.stampDays.Count : 0;
|
|
bool bonus = s.doneBonus && s.doneDay == EconomyRules.DayKey(now);
|
|
float x = x0 + bw; // 칩 테(바깥으로 그려짐)만큼 안쪽 · 칩 사이 = 테 둘 + 틈(게임 QA r1 M1)
|
|
x += Chip(Strip, "Today", UiText.F("supply_today", new[] { UiText.T("supply_day_" + SupplyRules.Weekday(now)) }), x, y, h, fs, chipC, bc, bw) + g;
|
|
x += Chip(Strip, "Done", UiText.F(bonus ? "supply_done_bonus" : "supply_done", new[] { N(done), N(open) }), x, y, h, fs, chipC, bc, bw) + g;
|
|
Chip(Strip, "Stamp", UiText.F(s.stampClaimed ? "supply_stamp_got" : "supply_stamp", new[] { N(stampDays), N(stampNeed) }), x, y, h, fs, chipC, bc, bw);
|
|
// 오른쪽 끝 = 하루 횟수 · 광고(오른쪽 맞춤)
|
|
string es = UiText.F("supply_entries", new[] { N(ContentTables.Int(SupplyData.Mode, "entries_per_day")), N(ContentTables.Int(SupplyData.Mode, "ad_entries_per_day")) });
|
|
float ew = Chip(Strip, "Entries", es, 0f, y, h, fs * 0.88f, chipC, bc, bw);
|
|
var er = texts["Entries"].transform.parent as RectTransform;
|
|
if (er != null) er.anchoredPosition = new Vector2(x0 + w - ew - bw, -y);
|
|
}
|
|
|
|
void LockStrip(float x0, float y, float w)
|
|
{
|
|
var ls = L("lock_strip");
|
|
float h = At(ls, 2, 56f) * Z;
|
|
var band = UiKit.Skin(UiKit.At(Strip, "Locked", x0, y, w, h), "chip", Alpha(Col(ls, 0, UiKit.Red), At(ls, 1, 0.92f)));
|
|
UiKit.Border(band, UiKit.Col("line", UiKit.Line), 4f * Z);
|
|
var t = Lab(band.transform, "LockText", UiText.F("supply_unlock", new[] { ContentTables.Str(SupplyData.Mode, "unlock_stage") }), At(ls, 3, 28f) * Z, Color.white, TextAnchor.MiddleCenter, 0f, 0f, w, h, true);
|
|
float lsz = At(ls, 4, 40f) * Z;
|
|
var ic = UiKit.Icon(band.transform, "lock", new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(w * 0.5f - t.preferredWidth * 0.5f - lsz * 0.7f, 0f), lsz);
|
|
UiKit.DropShadow(ic, 2f);
|
|
}
|
|
|
|
static readonly string[] Week = { "mon", "tue", "wed", "thu", "fri", "sat", "sun" };
|
|
|
|
void Card(SupplyData.Dungeon dg, string[] b, float cw, float ch, OutGameData db, SaveData d, DateTime now)
|
|
{
|
|
string id = dg.id;
|
|
bool isOpen = SupplyRules.OpenToday(dg, now);
|
|
if (!isOpen) closed.Add(id);
|
|
bool active = isOpen && !Locked;
|
|
var cell = new GameObject("Card_" + id, typeof(RectTransform)).GetComponent<RectTransform>();
|
|
cell.SetParent(List, false);
|
|
// 배너(둥근 모서리 · 테 굽기) · 닫힘 = 곱하기 색
|
|
var bi = UiKit.Fill("Banner", cell).gameObject.AddComponent<Image>();
|
|
bi.sprite = Resources.Load<Sprite>(Str(b, 1));
|
|
bi.raycastTarget = true; // 카드 위 끌기 = 목록 스크롤(ScrollRect 가 받음)
|
|
if (!active) bi.color = Col(L("closed_tint"), 0, new Color(0.55f, 0.55f, 0.58f));
|
|
// 「/」 글자 판 + 비스듬 선(흰 그림 틴트)
|
|
var pn = L("panel");
|
|
var cardCol = Col(b, 2, UiKit.Dark);
|
|
var pf = Resources.Load<Sprite>(Str(pn, 0));
|
|
if (pf != null)
|
|
{
|
|
var pi = UiKit.At(cell, "Panel", 0f, 0f, pf.rect.width * ch / pf.rect.height, ch).gameObject.AddComponent<Image>();
|
|
pi.sprite = pf;
|
|
pi.color = Alpha(cardCol, active ? At(pn, 2, 0.84f) : At(pn, 3, 0.74f));
|
|
pi.raycastTarget = false;
|
|
}
|
|
var pl = Resources.Load<Sprite>(Str(pn, 1));
|
|
if (pl != null)
|
|
{
|
|
var li = UiKit.At(cell, "Slant", 0f, 0f, pl.rect.width * ch / pl.rect.height, ch).gameObject.AddComponent<Image>();
|
|
li.sprite = pl;
|
|
li.color = Alpha(Col(pn, 4, Color.white), At(pn, 5, 0.45f));
|
|
li.raycastTarget = false;
|
|
}
|
|
// 이름 · 칩(제한 턴 · 최고 단계) · 여는 요일 · 보상
|
|
var nm = L("name");
|
|
float x = At(nm, 0, 28f) * Z, y = At(nm, 1, 20f) * Z;
|
|
float nfs = At(nm, 2, 50f) * Z;
|
|
Lab(cell, "Name_" + id, dg.nameKo, nfs, Color.white, TextAnchor.MiddleLeft, x, y, cw * 0.4f, nfs * 1.15f, true);
|
|
y += nfs * 1.15f;
|
|
var cp = L("chips");
|
|
y += At(cp, 0, 12f) * Z;
|
|
float chh = At(cp, 1, 42f) * Z, cfs = At(cp, 2, 23f) * Z;
|
|
var chc = Alpha(Col(cp, 4, Color.black), At(cp, 5, 0.55f));
|
|
float cx = x;
|
|
cx += Chip(cell, "Turns_" + id, UiText.F("supply_turns", new[] { N(dg.turnLimit) }), cx, y, chh, cfs, chc, Color.clear, 0f) + At(cp, 3, 8f) * Z;
|
|
int best = 0;
|
|
foreach (var t in SupplyData.AllTiers())
|
|
if (d.supply.Best(id, t.tier).Length > 0) best = Mathf.Max(best, t.tier);
|
|
Chip(cell, "Best_" + id, best > 0 ? UiText.F("supply_best", new[] { N(best) }) : UiText.T("supply_best_none"), cx, y, chh, cfs, chc, Color.clear, 0f);
|
|
y += chh;
|
|
// 요일: 매일 열림 = 없음 · 정해진 요일 = 여는 요일만(PD 2026-11-18)
|
|
int dots = 0;
|
|
if (dg.weekdays.Count < Week.Length)
|
|
{
|
|
var dy = L("days");
|
|
y += At(dy, 0, 12f) * Z;
|
|
float dd = At(dy, 1, 40f) * Z, dg_ = At(dy, 3, 6f) * Z, rw = At(dy, 7, 4f) * Z;
|
|
string today = SupplyRules.Weekday(now);
|
|
float dx = x;
|
|
foreach (var w in Week)
|
|
{
|
|
if (!dg.weekdays.Contains(w)) continue;
|
|
if (w == today)
|
|
{
|
|
var ring = UiKit.At(cell, "DayRing_" + w, dx - rw, y - rw, dd + 2f * rw, dd + 2f * rw).gameObject.AddComponent<Image>();
|
|
ring.sprite = UiKit.Circle;
|
|
ring.color = Col(dy, 6, UiKit.Coin);
|
|
ring.raycastTarget = false;
|
|
}
|
|
var dot = UiKit.At(cell, "Day_" + w, dx, y, dd, dd).gameObject.AddComponent<Image>();
|
|
dot.sprite = UiKit.Circle;
|
|
dot.color = Col(dy, 4, Color.white);
|
|
dot.raycastTarget = false;
|
|
var dt = UiKit.Title(UiKit.FillLabel(dot.transform, UiText.T("supply_day_" + w), Mathf.RoundToInt(At(dy, 2, 22f) * Z), Col(dy, 5, UiKit.Ink)));
|
|
dt.raycastTarget = false;
|
|
dx += dd + dg_;
|
|
dots++;
|
|
}
|
|
y += dd;
|
|
}
|
|
dayDots[id] = dots;
|
|
var rw2 = L("rewards");
|
|
y += At(rw2, 0, 12f) * Z;
|
|
float rs = At(rw2, 1, 76f) * Z, rg = At(rw2, 2, 12f) * Z;
|
|
var icons = new Dictionary<string, string>();
|
|
foreach (var kvp in L("reward_icons"))
|
|
{
|
|
var p = kvp.Split(':');
|
|
if (p.Length == 2) icons[p[0].Trim()] = p[1].Trim();
|
|
}
|
|
float rx = x;
|
|
foreach (var k in dg.rewardKinds)
|
|
{
|
|
string ic;
|
|
icons.TryGetValue(k, out ic);
|
|
UiKit.RewardTile(cell, "Rw_" + id + "_" + k, rx, y, rs, "gear_white_", ic ?? "", "", false);
|
|
rx += rs + rg;
|
|
}
|
|
if (dg.rewardKinds.Count == 1) // 보상 1개 = 이름 글자(QA r1 M6)
|
|
Lab(cell, "RwName_" + id, UiText.T("supply_rw_" + dg.rewardKinds[0]), At(rw2, 3, 24f) * Z, Color.white, TextAnchor.MiddleLeft, rx, y, cw * 0.3f, rs, true);
|
|
|
|
// 오른쪽 열: 남은 + 입장 / 닫힘 / 잠김
|
|
var rc = L("right");
|
|
var go = L("go");
|
|
float bw = At(go, 0, 236f) * Z, bh = At(go, 1, 92f) * Z;
|
|
float bx = cw - At(rc, 0, 24f) * Z - bw, by = ch - At(rc, 1, 22f) * Z - bh;
|
|
if (active)
|
|
{
|
|
int left = SupplyRules.Left(db, d, id, now), limit = SupplyRules.Limit(db, d, id, now);
|
|
float lh = At(go, 3, 40f) * Z;
|
|
float lw = Chip(cell, "Left_" + id, UiText.F("supply_left", new[] { N(left), N(limit) }), 0f, by - At(go, 5, 6f) * Z - lh, lh, At(go, 4, 22f) * Z, UiKit.Col("chip_dark", UiKit.Dark), UiKit.Col("line", UiKit.Line), 3f * Z);
|
|
var lr = texts["Left_" + id].transform.parent as RectTransform;
|
|
if (lr != null) lr.anchoredPosition = new Vector2(bx + (bw - lw) * 0.5f, lr.anchoredPosition.y);
|
|
var btn = UiKit.SkinBtn(cell, "Go_" + id, "btn_l_red", UISkin.Col("red", UiKit.Red), "", 10, Color.white, bx, by, bw, bh, () => screen.OpenSupplyTiers(id));
|
|
var bl = btn.GetComponentInChildren<Text>();
|
|
if (bl != null) bl.gameObject.SetActive(false);
|
|
Lab(btn.transform, "GoText_" + id, UiText.T("supply_go"), At(go, 2, 44f) * Z, Color.white, TextAnchor.MiddleCenter, 0f, -2f * Z, bw, bh, true);
|
|
}
|
|
else
|
|
{
|
|
var gb = UiKit.SkinBtn(cell, "Go_" + id, "btn_gray", UiKit.White, "", 10, Color.white, bx, by, bw, bh, null);
|
|
gb.interactable = false;
|
|
var bl = gb.GetComponentInChildren<Text>();
|
|
if (bl != null) bl.gameObject.SetActive(false);
|
|
var gt = Lab(gb.transform, "GoText_" + id, UiText.T(Locked ? "supply_locked_btn" : "supply_closed_btn"), At(go, 2, 44f) * Z * 0.9f, UiKit.Col("text_soft", UiKit.InkSoft), TextAnchor.MiddleCenter, 0f, -2f * Z, bw, bh, true);
|
|
if (Locked)
|
|
{
|
|
float isz = At(L("closed"), 0, 40f) * Z;
|
|
UiKit.Icon(gb.transform, "lock", new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(bw * 0.5f - gt.preferredWidth * 0.5f - isz * 0.6f, -bh * 0.5f), isz);
|
|
}
|
|
else ClosedPlate(cell, dg, bx + bw, by);
|
|
}
|
|
}
|
|
|
|
/// <summary>닫힌 날 판 = 오른쪽 열(닫힘 버튼 위 · QA r1 B2) · 자물쇠 + 「오늘 닫힘」 + 여는 요일.</summary>
|
|
void ClosedPlate(RectTransform cell, SupplyData.Dungeon dg, float right, float btnTop)
|
|
{
|
|
var cl = L("closed");
|
|
float isz = At(cl, 0, 40f) * Z, tfs = At(cl, 1, 27f) * Z, sfs = At(cl, 2, 20f) * Z;
|
|
var days = new List<string>();
|
|
foreach (var w in Week)
|
|
if (dg.weekdays.Contains(w)) days.Add(UiText.T("supply_day_" + w));
|
|
string sub = UiText.F("supply_open_days", new[] { string.Join(" · ", days.ToArray()) });
|
|
float pad = 16f * Z, ph = Mathf.Max(isz, tfs * 1.2f + sfs * 1.3f) + 16f * Z;
|
|
// 판을 먼저(글자 뒤) → 글자 → 글자 폭으로 판 크기 · 자리 맞춤
|
|
var plate = UiKit.Skin(UiKit.At(cell, "ClosedPlate_" + dg.id, 0f, 0f, 10f, ph), "chip", Alpha(Col(cl, 4, Color.black), At(cl, 5, 0.86f)));
|
|
UiKit.Border(plate, UiKit.Col("line", UiKit.Line), 4f * Z);
|
|
var ic = UiKit.Icon(plate.transform, "lock", new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(pad + isz * 0.5f, 0f), isz);
|
|
UiKit.DropShadow(ic, 2f);
|
|
var tt = Lab(cell, "Closed_" + dg.id, UiText.T("supply_closed"), tfs, Color.white, TextAnchor.UpperLeft, 0f, 0f, 400f * Z, tfs * 1.2f, true);
|
|
var probe = Lab(cell, "ClosedSub_" + dg.id, sub, sfs, UiKit.Col("text_soft", new Color(0.81f, 0.84f, 0.92f)), TextAnchor.UpperLeft, 0f, 0f, 400f * Z, sfs * 1.3f, false);
|
|
float tw = Mathf.Max(probe.preferredWidth, tt.preferredWidth);
|
|
float pw = pad * 2f + isz + 10f * Z + tw;
|
|
float px = right - pw, py = btnTop - At(cl, 3, 10f) * Z - ph;
|
|
plate.rectTransform.sizeDelta = new Vector2(pw, ph);
|
|
plate.rectTransform.anchoredPosition = new Vector2(px, -py);
|
|
float txl = px + pad + isz + 10f * Z;
|
|
float ty = py + (ph - tfs * 1.2f - sfs * 1.3f) * 0.5f;
|
|
tt.rectTransform.anchoredPosition = new Vector2(txl, -ty);
|
|
probe.rectTransform.anchoredPosition = new Vector2(txl, -(ty + tfs * 1.2f));
|
|
}
|
|
}
|
|
}
|