1305 lines
61 KiB
C#
1305 lines
61 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Globalization;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
namespace TKS.OutGame
|
||
{
|
||
/// <summary>
|
||
/// 연의 전기 화면(PD 2026-11-18 「연의 전기 통과 (게임에서 볼 수 있도록 반영해)」 · 아트 시안 scn/final/mock_scn_list*.png · mock_scn_pop.png · Fable 8차 검수 통과) —
|
||
/// 서재(탭마다 병풍 배경) 탁자 위 두루마리 5권 이하(가운데 정렬 · 넘김 없음) + 모은 별 칩 + 안내 줄(빈 탭 = 안내 판) + 아래 탭 5 →
|
||
/// 두루마리 누름 = 펼침 연출 6단계(고름 빛 → 떠오름 → 가운데로 커짐 → 눕혀 위로 → 위에서 아래로 펼침 → 상세 · 누르면 건너뜀) → 상세 = 세로 두루마리(연의 · 열전 · 승리 · 도전 조건 · 편성 · 첫 승리 보상 · 출전).
|
||
/// 표(Resources/UI/Scenario · C45): 화면 설정 scn_screen · 탭 scn_tabs.json · 자리 scn_spots · 두루마리 roll_meta(납품 그대로) · 글자 scn_text(UiText) · 부품 parts/(아틀라스 UI_Scenario).
|
||
/// 편 이름 · 순서 · 조건 문장 = 기획 표 scenario_battles · 조건 종류 = scenario_rules · 진행 상태 = 세이브(시안 예시 상태는 안 씀).
|
||
/// 화면 맞춤: 폭 맞춤 · 위 정렬(16:9 = 시안 그대로) · 긴 화면 = 배경 아래 바닥을 늘려 이음 · 탭 줄 = 아래 내비 위에 붙임.
|
||
/// 층(P41): 화면(Event) → Content(Static) → Art(배경 · Static) · Rolls(두루마리 · Event + 레이캐스터) · Chrome(별 칩 · 안내 · Event) · Floor(Static) · Tabs(Event + 레이캐스터) ·
|
||
/// 상세 = 위 덮개 루트(TopRoot)에 Overlay(Event + 레이캐스터) → Anim(어둡게 · 움직이는 두루마리 · 펼치는 두루마리 · Frame) · Detail(내용 · 버튼 · Event).
|
||
/// </summary>
|
||
public class ArenaScenario
|
||
{
|
||
public const string Table = "UI/Scenario/scn_screen";
|
||
|
||
[Serializable]
|
||
class TabJson
|
||
{
|
||
public string id = "";
|
||
public string bg = "";
|
||
public string[] ids = new string[0];
|
||
}
|
||
|
||
[Serializable]
|
||
class TabsJson
|
||
{
|
||
public TabJson[] tabs = new TabJson[0];
|
||
}
|
||
|
||
class RollMeta
|
||
{
|
||
public string part = "";
|
||
public float w, h, sx, sy, sw, sh;
|
||
}
|
||
|
||
public enum RollState
|
||
{
|
||
Open,
|
||
New,
|
||
Done,
|
||
Lock,
|
||
}
|
||
|
||
readonly ArenaScreen screen;
|
||
readonly Dictionary<string, List<string>> kv = new Dictionary<string, List<string>>();
|
||
readonly Dictionary<string, Rect> spots = new Dictionary<string, Rect>();
|
||
readonly List<TabJson> tabs = new List<TabJson>();
|
||
readonly List<RollMeta> rolls = new List<RollMeta>();
|
||
readonly Dictionary<string, RectTransform> rollRt = new Dictionary<string, RectTransform>();
|
||
readonly Dictionary<string, Text> texts = new Dictionary<string, Text>();
|
||
string tabId;
|
||
Image bgImg;
|
||
RawImage floor;
|
||
|
||
public RectTransform View { get; private set; }
|
||
public RectTransform Content { get; private set; }
|
||
public RectTransform Art { get; private set; }
|
||
public RectTransform Rolls { get; private set; }
|
||
public RectTransform Chrome { get; private set; }
|
||
public RectTransform Tabs { get; private set; }
|
||
public ScenarioFit Fitter { get; private set; }
|
||
public bool Built { get; private set; }
|
||
|
||
/// <summary>지금 탭 · 세운 두루마리 수 · 탭 수(테스트).</summary>
|
||
public string TabId
|
||
{
|
||
get { return tabId; }
|
||
}
|
||
|
||
public int RollCount { get; private set; }
|
||
public int TabCount
|
||
{
|
||
get { return tabs.Count; }
|
||
}
|
||
|
||
ArenaScenario(ArenaScreen s)
|
||
{
|
||
screen = s;
|
||
}
|
||
|
||
OutGameSession S
|
||
{
|
||
get { return screen.S; }
|
||
}
|
||
|
||
// ---------- 표 ----------
|
||
|
||
/// <summary>설정 · 탭 · 자리 · 두루마리 · 글자 표를 읽는다 · 하나라도 없으면 null(호출 쪽 = 예전 더미 화면).</summary>
|
||
public static ArenaScenario Load(ArenaScreen s)
|
||
{
|
||
var rows = UiText.Rows(Table);
|
||
if (rows == null) return null;
|
||
var sc = new ArenaScenario(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 (!sc.kv.TryGetValue(k, out l)) sc.kv[k] = l = new List<string>();
|
||
l.Add(v ?? "");
|
||
}
|
||
UiText.Use(sc.S_("texts"));
|
||
if (!UiText.Has(sc.S_("title_key")) || !sc.LoadSpots() || !sc.LoadTabs() || !sc.LoadRolls()) return null;
|
||
return sc;
|
||
}
|
||
|
||
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 string Cell(Dictionary<string, string> r, string k)
|
||
{
|
||
string v;
|
||
return r.TryGetValue(k, out v) ? v : "";
|
||
}
|
||
|
||
bool LoadSpots()
|
||
{
|
||
var rows = UiText.Rows(S_("spots"));
|
||
if (rows == null) return false;
|
||
foreach (var r in rows)
|
||
{
|
||
string id = Cell(r, "s_id");
|
||
if (id.Length == 0) continue;
|
||
float w = F(Cell(r, "f_w")), h = F(Cell(r, "f_h"));
|
||
spots[id] = new Rect(F(Cell(r, "f_x")) - w * 0.5f, F(Cell(r, "f_y")) - h * 0.5f, w, h);
|
||
}
|
||
return spots.Count > 0;
|
||
}
|
||
|
||
bool LoadTabs()
|
||
{
|
||
var ta = Resources.Load<TextAsset>(S_("tabs"));
|
||
if (ta == null) return false;
|
||
var j = new TabsJson();
|
||
try
|
||
{
|
||
JsonUtility.FromJsonOverwrite(ta.text, j);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
Debug.LogWarning("[TKS] 연의 전기 탭 json 해석 실패: " + e.Message);
|
||
return false;
|
||
}
|
||
if (j.tabs != null)
|
||
foreach (var t in j.tabs)
|
||
if (t != null && t.id.Length > 0) tabs.Add(t);
|
||
return tabs.Count > 0;
|
||
}
|
||
|
||
bool LoadRolls()
|
||
{
|
||
var rows = UiText.Rows(S_("rolls"));
|
||
if (rows == null) return false;
|
||
foreach (var r in rows)
|
||
{
|
||
var m = new RollMeta { part = Cell(r, "s_part").Replace(".png", "") };
|
||
if (m.part.Length == 0) continue;
|
||
m.w = F(Cell(r, "n_w"));
|
||
m.h = F(Cell(r, "n_h"));
|
||
m.sx = F(Cell(r, "n_slip_x"));
|
||
m.sy = F(Cell(r, "n_slip_y"));
|
||
m.sw = F(Cell(r, "n_slip_w"));
|
||
m.sh = F(Cell(r, "n_slip_h"));
|
||
rolls.Add(m);
|
||
}
|
||
return rolls.Count > 0;
|
||
}
|
||
|
||
Rect? Spot(string id)
|
||
{
|
||
Rect r;
|
||
return spots.TryGetValue(id, out r) ? r : (Rect?)null;
|
||
}
|
||
|
||
Sprite Part(string name)
|
||
{
|
||
return name.Length > 0 ? Resources.Load<Sprite>(S_("parts") + "/" + name) : null;
|
||
}
|
||
|
||
static RectTransform Place(Transform p, string name, float x, float y, float w, float h, Vector2 pivot)
|
||
{
|
||
return UiKit.Rect(name, p, TopLeft, pivot, new Vector2(x, -y), new Vector2(w, h));
|
||
}
|
||
|
||
static readonly Vector2 TopLeft = new Vector2(0f, 1f);
|
||
static readonly Vector2 Center = new Vector2(0.5f, 0.5f);
|
||
|
||
Text Txt(Transform p, string name, string s, int size, Color c, bool title, TextAnchor align, Vector2 pivot, float x, float y, float w, float h)
|
||
{
|
||
var t = UiKit.Label(p, s, size, c, align, TopLeft, pivot, new Vector2(x, -y), new Vector2(w, h));
|
||
if (title) UiKit.Title(t);
|
||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
t.name = name;
|
||
texts[name] = t;
|
||
return t;
|
||
}
|
||
|
||
void Stroke(Text t)
|
||
{
|
||
var st = L("stroke");
|
||
UISkin.Stroke(t, Col(st, 0, Color.black), At(st, 1, 3f));
|
||
}
|
||
|
||
// ---------- 편 데이터 ----------
|
||
|
||
ContentRow Battle(string id)
|
||
{
|
||
return ContentTables.Find("scenario_battles", "s_id", id);
|
||
}
|
||
|
||
/// <summary>쪽지 장 글자 = 서장 · 외전 · N장(기획 표 s_part · n_no).</summary>
|
||
string Label(ContentRow b)
|
||
{
|
||
var pk = L("part_kind");
|
||
string part = b.S("s_part");
|
||
if (part == Str(pk, 0)) return UiText.T("scn_label_prologue");
|
||
if (part == Str(pk, 1)) return UiText.T("scn_label_side");
|
||
return UiText.F("scn_label_no", new[] { b.I("n_no").ToString(CultureInfo.InvariantCulture) });
|
||
}
|
||
|
||
/// <summary>쪽지 제목 = 편 이름의 「—」 앞 · 첫 빈칸 하나를 붙임(시안 caseEl).</summary>
|
||
static string ShortTitle(ContentRow b)
|
||
{
|
||
string t = b.S("s_title_ko");
|
||
int dash = t.IndexOf(" — ", StringComparison.Ordinal);
|
||
if (dash >= 0) t = t.Substring(0, dash);
|
||
int sp = t.IndexOf(' ');
|
||
return sp >= 0 ? t.Remove(sp, 1) : t;
|
||
}
|
||
|
||
bool Done(ContentRow b)
|
||
{
|
||
var d = S.Save;
|
||
if (b.I("n_no") == 0)
|
||
{
|
||
var pd = L("prologue_done"); // 장 칸|막 수 칸
|
||
var st = d.Stage(b.I(Str(pd, 0)), b.I(Str(pd, 1)), false);
|
||
return st != null && st.clears > 0;
|
||
}
|
||
var e = d.scenario.Get(b.S("s_id"), false);
|
||
return e != null && e.normal[0];
|
||
}
|
||
|
||
/// <summary>새 편 = 열린 편(서장 제외 · 편 번호 순) 가운데 연의를 아직 못 이긴 첫 편(연무장 허브 상태 줄과 같은 기준) · 없으면 "".</summary>
|
||
string NewId()
|
||
{
|
||
foreach (var b in ScenarioModeRules.Battles())
|
||
if (b.I("n_no") > 0 && ScenarioModeRules.Unlocked(S.Save, b) && !Done(b))
|
||
return b.S("s_id");
|
||
return "";
|
||
}
|
||
|
||
public RollState StateOf(string id)
|
||
{
|
||
var b = Battle(id);
|
||
if (b == null) return RollState.Lock;
|
||
if (b.I("n_no") > 0 && !ScenarioModeRules.Unlocked(S.Save, b)) return RollState.Lock;
|
||
if (Done(b)) return RollState.Done;
|
||
return id == NewId() ? RollState.New : RollState.Open;
|
||
}
|
||
|
||
/// <summary>처음 탭 = 새 편이 있는 탭 · 없으면 열린 미완료 편이 있는 첫 탭 · 없으면 첫 탭.</summary>
|
||
string DefaultTab()
|
||
{
|
||
string nid = NewId();
|
||
foreach (var t in tabs)
|
||
if (nid.Length > 0 && Array.IndexOf(t.ids, nid) >= 0)
|
||
return t.id;
|
||
foreach (var t in tabs)
|
||
foreach (var id in t.ids)
|
||
if (StateOf(id) == RollState.Open)
|
||
return t.id;
|
||
return tabs[0].id;
|
||
}
|
||
|
||
TabJson Tab(string id)
|
||
{
|
||
foreach (var t in tabs)
|
||
if (t.id == id)
|
||
return t;
|
||
return tabs[0];
|
||
}
|
||
|
||
// ---------- 만들기 ----------
|
||
|
||
/// <summary>slot(화면 전체 · 제목 띠 뒤)에 처음 한 번 층을 만들고 지금 탭을 다시 채운다 · 배경이 없으면 false(호출 쪽 = 더미 화면).</summary>
|
||
public bool Show(RectTransform slot)
|
||
{
|
||
if (!Built && !Build(slot)) return false;
|
||
Refresh();
|
||
return true;
|
||
}
|
||
|
||
bool Build(RectTransform slot)
|
||
{
|
||
if (tabId == null) tabId = DefaultTab();
|
||
var bgSp = Resources.Load<Sprite>(string.Format(S_("bg"), Tab(tabId).bg));
|
||
if (bgSp == null)
|
||
{
|
||
Debug.LogWarning("[TKS] 연의 전기 배경 없음: " + string.Format(S_("bg"), Tab(tabId).bg));
|
||
return false;
|
||
}
|
||
var cv = L("canvas");
|
||
var cs = new Vector2(At(cv, 0, 1080f), At(cv, 1, 1920f));
|
||
View = slot;
|
||
// 긴 화면 바닥(배경 아래끝 띠를 늘림 · Static)
|
||
var fl = UiKit.Rect("Floor", View, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), Vector2.zero, Vector2.zero);
|
||
floor = fl.gameObject.AddComponent<RawImage>();
|
||
floor.raycastTarget = false;
|
||
UiLayer.Nest(fl.gameObject, UiRate.Static, false);
|
||
Content = UiKit.Rect("Content", View, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), Vector2.zero, cs);
|
||
UiLayer.Nest(Content.gameObject, UiRate.Static, false);
|
||
Art = UiLayer.Group("Art", Content, UiRate.Static);
|
||
bgImg = Art.gameObject.AddComponent<Image>();
|
||
bgImg.raycastTarget = false;
|
||
Rolls = UiLayer.Group("Rolls", Content, UiRate.Event, true);
|
||
Chrome = UiLayer.Group("Chrome", Content, UiRate.Event);
|
||
// 탭 줄 = 아래 내비 위(화면 아래 기준 · 배율은 내용과 같음)
|
||
Tabs = UiKit.Rect("Tabs", View, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, OutGameRoot.TabBarH), new Vector2(cs.x, 0f));
|
||
UiLayer.Nest(Tabs.gameObject, UiRate.Event, true);
|
||
// 재화 바 뒤 띠(배경이 재화 바 밑까지 깔림)
|
||
UiKit.Paint(UiKit.TopBand("TopBand", View, 0f, OutGameRoot.TopBarH), Col(L("band_top"), 0, UiKit.Bg), false);
|
||
|
||
Fitter = View.gameObject.AddComponent<ScenarioFit>();
|
||
Fitter.content = Content;
|
||
Fitter.tabs = Tabs;
|
||
Fitter.floor = floor;
|
||
Fitter.canvasSize = cs;
|
||
Fitter.floorStrip = F(S_("floor_strip"), 120f);
|
||
Built = true;
|
||
return true;
|
||
}
|
||
|
||
/// <summary>지금 탭 다시 채움(배경 · 두루마리 · 별 칩 · 안내 · 탭).</summary>
|
||
public void Refresh()
|
||
{
|
||
ContentTables.Reload();
|
||
if (tabId == null) tabId = DefaultTab();
|
||
var tab = Tab(tabId);
|
||
var bgSp = Resources.Load<Sprite>(string.Format(S_("bg"), tab.bg));
|
||
if (bgSp != null)
|
||
{
|
||
bgImg.sprite = bgSp;
|
||
floor.texture = bgSp.texture;
|
||
}
|
||
Fitter.Fit(true);
|
||
UiKit.Clear(Rolls);
|
||
UiKit.Clear(Chrome);
|
||
UiKit.Clear(Tabs);
|
||
rollRt.Clear();
|
||
texts.Clear();
|
||
RollCount = 0;
|
||
BuildRolls(tab);
|
||
BuildChrome(tab);
|
||
BuildTabs();
|
||
}
|
||
|
||
/// <summary>다른 쪽에서 들어올 때 = 처음 탭(새 편이 있는 탭)으로 다시 고름.</summary>
|
||
public void ResetTab()
|
||
{
|
||
tabId = null;
|
||
}
|
||
|
||
/// <summary>탭 고름(테스트 · 탭 누름).</summary>
|
||
public void SetTab(string id)
|
||
{
|
||
tabId = Tab(id).id;
|
||
if (Built) Refresh();
|
||
}
|
||
|
||
void BuildRolls(TabJson tab)
|
||
{
|
||
var s1 = Spot("book_slot_1");
|
||
var s2 = Spot("book_slot_2");
|
||
if (s1 == null || s2 == null) return;
|
||
float step = s2.Value.center.x - s1.Value.center.x, foot = s1.Value.yMax, hh = s1.Value.height;
|
||
var list = new List<ContentRow>();
|
||
foreach (var id in tab.ids)
|
||
{
|
||
var b = Battle(id);
|
||
if (b != null) list.Add(b);
|
||
}
|
||
var cv = L("canvas");
|
||
float cx = At(cv, 0, 1080f) * 0.5f;
|
||
for (int j = 0; j < list.Count; j++)
|
||
{
|
||
var b = list[j];
|
||
string id = b.S("s_id");
|
||
float x = cx + (j - (list.Count - 1) * 0.5f) * step;
|
||
var rt = Roll(Rolls, b, StateOf(id), hh, false);
|
||
rt.anchoredPosition = new Vector2(x, -(foot - hh * 0.5f));
|
||
var img = rt.GetComponentInChildren<Image>();
|
||
img.raycastTarget = true;
|
||
var btn = rt.gameObject.AddComponent<Button>();
|
||
btn.transition = Selectable.Transition.None;
|
||
btn.onClick.AddListener(() => Open(id));
|
||
if (DetailOpen && id == openId) rt.gameObject.SetActive(false); // 상세가 열린 채 다시 채움 = 그 권은 계속 숨김
|
||
rollRt[id] = rt;
|
||
RollCount++;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 두루마리 1권(가운데 기준 · 크기 = 높이 hh) — 부품 part_roll_(n_no % 8 + 1) · 쪽지 안 세로 글자(장 글자 붉은 · 제목 · 길면 줄임) ·
|
||
/// 완료 = 오른쪽 위 별 · 새 편 = 위 「새 편」 표 · 잠김 = 어둡게 + 자물쇠 · bare = 눕힐 때(글자 · 표 숨김).
|
||
/// </summary>
|
||
RectTransform Roll(Transform parent, ContentRow b, RollState st, float hh, bool bare)
|
||
{
|
||
var m = rolls[Mathf.Abs(b.I("n_no")) % rolls.Count];
|
||
float k = hh / Mathf.Max(1f, m.h), w = m.w * k;
|
||
var root = UiKit.Rect("Roll_" + b.S("s_id"), parent, TopLeft, Center, Vector2.zero, new Vector2(w, hh));
|
||
bool lk = st == RollState.Lock;
|
||
var img = UiKit.Rect("Img", root, Center, Center, Vector2.zero, new Vector2(w, hh)).gameObject.AddComponent<Image>();
|
||
img.sprite = Part(m.part);
|
||
img.color = lk ? Col(L("roll_lock"), 0, Color.gray) : Color.white;
|
||
img.raycastTarget = false;
|
||
var sh = L("roll_shadow");
|
||
var shadow = img.gameObject.AddComponent<Shadow>();
|
||
shadow.effectDistance = new Vector2(At(sh, 0), At(sh, 1));
|
||
shadow.effectColor = Col(sh, 2, new Color(0f, 0f, 0f, 0.5f));
|
||
|
||
var sl = L("slip"); // 장 글자|제목 최대|배율|위|아래|사이|줄임 비|폭 비|장 글자 간격
|
||
var sc = L("slip_color"); // 장|제목|잠김
|
||
float sx = m.sx * k, sy = m.sy * k, sw = m.sw * k, shh = m.sh * k;
|
||
string label = Label(b), title = ShortTitle(b);
|
||
float fc = At(sl, 0, 30f) * k * At(sl, 2, 1.3f);
|
||
float avail = shh - At(sl, 4, 30f) * k - fc * label.Length - At(sl, 5, 8f) * k;
|
||
float ft = Mathf.Min(At(sl, 1, 44f) * k * At(sl, 2, 1.3f), avail / Mathf.Max(1, title.Length) * At(sl, 6, 0.94f), sw * At(sl, 7, 0.82f));
|
||
var slip = UiKit.Rect("Slip", root, TopLeft, TopLeft, Vector2.zero, new Vector2(w, hh));
|
||
float y = sy + At(sl, 3, 22f) * k;
|
||
float mx = sx + sw * 0.5f;
|
||
var lc = lk ? Col(sc, 2, Color.gray) : Col(sc, 0, UiKit.Red);
|
||
var tc = lk ? Col(sc, 2, Color.gray) : Col(sc, 1, UiKit.Ink);
|
||
foreach (var ch in label)
|
||
{
|
||
var t = UiKit.Title(UiKit.Label(slip, ch.ToString(), Mathf.RoundToInt(fc), lc, TextAnchor.MiddleCenter, TopLeft, Center, new Vector2(mx, -(y + fc * 0.5f)), new Vector2(fc * 1.6f, fc * 1.4f)));
|
||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
y += fc + At(sl, 8, -2f);
|
||
}
|
||
y += At(sl, 5, 8f) * k - At(sl, 8, -2f);
|
||
foreach (var ch in title)
|
||
{
|
||
var t = UiKit.Title(UiKit.Label(slip, ch.ToString(), Mathf.RoundToInt(ft), tc, TextAnchor.MiddleCenter, TopLeft, Center, new Vector2(mx, -(y + ft * 0.5f)), new Vector2(ft * 1.6f, ft * 1.4f)));
|
||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
y += ft;
|
||
}
|
||
slip.gameObject.SetActive(!bare);
|
||
|
||
if (lk)
|
||
{
|
||
var lo = L("lock"); // 아이콘|크기|배율|위끝 = 높이 ×
|
||
float ls = At(lo, 1, 72f) * k * At(lo, 2, 1.3f);
|
||
var ic = UISkin.IconImage(root, Str(lo, 0), TopLeft, new Vector2(0.5f, 1f), new Vector2(w * 0.5f, -hh * At(lo, 3, 0.74f)), new Vector2(ls, ls));
|
||
if (ic != null) ic.name = "Lock";
|
||
}
|
||
if (st == RollState.Done)
|
||
{
|
||
var ds = L("done_star"); // 아이콘|크기|오른끝에서 x|위끝에서 y
|
||
var ic = UISkin.IconImage(root, Str(ds, 0), TopLeft, TopLeft, new Vector2(w + At(ds, 2), -At(ds, 3)), new Vector2(At(ds, 1, 50f), At(ds, 1, 50f)));
|
||
if (ic != null) ic.name = "Done";
|
||
}
|
||
if (st == RollState.New && !bare)
|
||
{
|
||
var nt = L("new_tag"); // 가운데에서 x|위끝에서 y|높이|좌우 여백|글자|바탕|글자 키
|
||
float th = At(nt, 2, 36f);
|
||
var tag = UiKit.Rect("New", root, TopLeft, TopLeft, new Vector2(w * 0.5f + At(nt, 0), -At(nt, 1)), new Vector2(0f, th));
|
||
UiKit.Skin(tag, "card", Col(nt, 5, UiKit.Red));
|
||
var tt = UiKit.Title(UiKit.Label(tag, UiText.T(Str(nt, 6)), (int)At(nt, 4, 21f), Color.white, TextAnchor.MiddleCenter, Center, Center, Vector2.zero, new Vector2(300f, th)));
|
||
tt.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
tag.sizeDelta = new Vector2(tt.preferredWidth + 2f * At(nt, 3, 14f), th);
|
||
}
|
||
return root;
|
||
}
|
||
|
||
void BuildChrome(TabJson tab)
|
||
{
|
||
var d = S.Save;
|
||
// 모은 별(연의 3 + 열전 3 · 서장 제외)
|
||
int got = 0, total = 0;
|
||
foreach (var b in ScenarioModeRules.Battles())
|
||
{
|
||
if (b.I("n_no") <= 0) continue;
|
||
var e = d.scenario.Get(b.S("s_id"), false);
|
||
var probe = e ?? new ScenarioEpisode();
|
||
total += probe.normal.Length + probe.hard.Length;
|
||
if (e == null) continue;
|
||
foreach (var x in e.normal) if (x) got++;
|
||
foreach (var x in e.hard) if (x) got++;
|
||
}
|
||
var sc = L("star_chip"); // 왼 x|위 y|높이|좌우 여백|글자|바탕|아이콘|크기|간격|글자 키
|
||
float h = At(sc, 2, 52f), pad = At(sc, 3, 18f), isz = At(sc, 7, 36f), gap = At(sc, 8, 8f);
|
||
var chip = Place(Chrome, "Stars", At(sc, 0), At(sc, 1), 0f, h, TopLeft);
|
||
UiKit.Skin(chip, "chip", Col(sc, 5, UiKit.Dark));
|
||
var ic = UISkin.IconImage(chip, Str(sc, 6), TopLeft, new Vector2(0f, 0.5f), new Vector2(pad, -h * 0.5f), new Vector2(isz, isz));
|
||
var t = Txt(chip, "StarsText", UiText.F(Str(sc, 9), new[] { got.ToString(CultureInfo.InvariantCulture), total.ToString(CultureInfo.InvariantCulture) }), (int)At(sc, 4, 24f), Color.white, false, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), pad + (ic != null ? isz + gap : 0f), h * 0.5f, 400f, h);
|
||
chip.sizeDelta = new Vector2(pad + (ic != null ? isz + gap : 0f) + t.preferredWidth + pad, h);
|
||
|
||
if (tab.ids.Length > 0)
|
||
{
|
||
var g = L("guide"); // 아래로|글자|글자 키
|
||
var rd = Spot("row_dots");
|
||
if (rd != null)
|
||
{
|
||
int gs = (int)At(g, 1, 24f);
|
||
var gt = Txt(Chrome, "Guide", UiText.T(Str(g, 2)), gs, Color.white, true, TextAnchor.MiddleCenter, Center, rd.Value.center.x, rd.Value.center.y + At(g, 0) + gs * 0.625f, 900f, gs * 1.5f);
|
||
Stroke(gt);
|
||
}
|
||
return;
|
||
}
|
||
// 빈 탭(2부 준비 중) = 가운데 안내 판
|
||
var ep = Spot("empty_plaque");
|
||
if (ep == null) return;
|
||
var em = L("empty"); // 바탕|제목 글자|아래 글자|아래 글자색|사이|글자 키 2
|
||
var r = ep.Value;
|
||
var pl = Place(Chrome, "Empty", r.x, r.y, r.width, r.height, TopLeft);
|
||
UiKit.Skin(pl, "card", Col(em, 0, UiKit.Dark));
|
||
int ts = (int)At(em, 1, 44f), ss = (int)At(em, 2, 24f);
|
||
float colH = ts * 1.25f + At(em, 4, 10f) + ss * 1.25f;
|
||
float y0 = (r.height - colH) * 0.5f;
|
||
var tt = Txt(pl, "EmptyTitle", UiText.F(Str(em, 5), new[] { UiText.T("scn_tab_" + tab.id), UiText.T("scn_arc_" + tab.id) }), ts, Color.white, true, TextAnchor.MiddleCenter, Center, r.width * 0.5f, y0 + ts * 0.625f, r.width, ts * 1.25f);
|
||
Stroke(tt);
|
||
Txt(pl, "EmptySub", UiText.T(Str(em, 6)), ss, Col(em, 3, UiKit.InkSoft), false, TextAnchor.MiddleCenter, Center, r.width * 0.5f, y0 + ts * 1.25f + At(em, 4, 10f) + ss * 0.625f, r.width, ss * 1.25f);
|
||
}
|
||
|
||
void BuildTabs()
|
||
{
|
||
var tb = Spot("tabs_bottom");
|
||
if (tb == null) return;
|
||
var r = tb.Value;
|
||
var st = L("tab"); // 사이|색|고른 색|빈 탭 색|위 글자|아래 글자|글자색|빈 탭 글자색|줄 높이
|
||
float gap = At(st, 0, 10f);
|
||
int n = tabs.Count;
|
||
float w = (r.width - gap * (n - 1)) / Mathf.Max(1, n);
|
||
float navTop = F(S_("nav_top"), 1770f);
|
||
int s1 = (int)At(st, 4, 17f), s2 = (int)At(st, 5, 23f);
|
||
float lh = At(st, 8, 1.08f);
|
||
for (int i = 0; i < n; i++)
|
||
{
|
||
var t = tabs[i];
|
||
bool on = t.id == tabId, empty = t.ids.Length == 0;
|
||
// 탭 줄 좌표 = 내비 위끝(navTop)에서 위로 · 가로 = 시안 x
|
||
var rt = UiKit.Rect("Tab_" + t.id, Tabs, Vector2.zero, new Vector2(0f, 0f), new Vector2(r.x + i * (w + gap), navTop - r.yMax), new Vector2(w, r.height));
|
||
var img = UiKit.Skin(rt, "card", on ? Col(st, 2, UiKit.Red) : empty ? Col(st, 3, UiKit.Dark) : Col(st, 1, UiKit.Dark), true);
|
||
var fc = empty && !on ? Col(st, 7, Color.gray) : Col(st, 6, Color.white);
|
||
float total = (s1 + s2) * lh;
|
||
float top = (r.height - total) * 0.5f;
|
||
var a = UiKit.Title(UiKit.Label(rt, UiText.T("scn_tab_" + t.id), s1, fc, TextAnchor.MiddleCenter, TopLeft, Center, new Vector2(w * 0.5f, -(top + s1 * lh * 0.5f)), new Vector2(w, s1 * lh)));
|
||
a.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
var b = UiKit.Title(UiKit.Label(rt, UiText.T("scn_arc_" + t.id), s2, fc, TextAnchor.MiddleCenter, TopLeft, Center, new Vector2(w * 0.5f, -(top + s1 * lh + s2 * lh * 0.5f)), new Vector2(w, s2 * lh)));
|
||
b.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
var btn = rt.gameObject.AddComponent<Button>();
|
||
btn.targetGraphic = img;
|
||
var id = t.id;
|
||
btn.onClick.AddListener(() =>
|
||
{
|
||
if (id == tabId) return;
|
||
SetTab(id);
|
||
});
|
||
}
|
||
}
|
||
|
||
// ---------- 펼침 연출 · 상세 ----------
|
||
|
||
RectTransform overlay, animDesign, detailDesign, detailBody;
|
||
Image dim;
|
||
ScenarioOpenFx fx;
|
||
string openId = "";
|
||
bool openHard;
|
||
|
||
/// <summary>상세가 열려 있는가 · 연 편 id · 연출 중인가(테스트).</summary>
|
||
public bool DetailOpen
|
||
{
|
||
get { return overlay != null; }
|
||
}
|
||
|
||
public string OpenId
|
||
{
|
||
get { return openId; }
|
||
}
|
||
|
||
public bool Animating
|
||
{
|
||
get { return fx != null && fx.Running; }
|
||
}
|
||
|
||
/// <summary>두루마리 누름 = 펼침 연출 → 상세 · skip = 연출 없이 바로 상세(캡처 · 테스트).</summary>
|
||
public void Open(string id, bool skip = false)
|
||
{
|
||
var b = Battle(id);
|
||
if (b == null) return;
|
||
CloseDetail();
|
||
openId = id;
|
||
openHard = false;
|
||
var top = screen.Root.TopRoot;
|
||
overlay = UiKit.Fill("ScnDetail", top);
|
||
UiLayer.Nest(overlay.gameObject, UiRate.Event, true);
|
||
var hit = overlay.gameObject.AddComponent<Image>();
|
||
hit.color = new Color(1f, 1f, 1f, 0f);
|
||
hit.canvasRenderer.cullTransparentMesh = true; // 누름만(뒤 화면 막기 · 연출 중 누르면 건너뜀)
|
||
hit.raycastTarget = true;
|
||
var anim = UiLayer.Group("Anim", overlay, UiRate.Frame);
|
||
var dimRt = UiKit.Fill("Dim", anim);
|
||
dim = dimRt.gameObject.AddComponent<Image>();
|
||
dim.color = new Color(0.04f, 0.05f, 0.09f, 0f);
|
||
dim.raycastTarget = false;
|
||
animDesign = Stage(anim, "AnimStage");
|
||
var detail = UiLayer.Group("Detail", overlay, UiRate.Event, true);
|
||
detailDesign = Stage(detail, "DetailStage");
|
||
detail.gameObject.SetActive(false);
|
||
|
||
// 연출 두루마리 = 줄의 그 두루마리 자리에서 시작(줄의 것은 숨김)
|
||
RectTransform src;
|
||
rollRt.TryGetValue(id, out src);
|
||
var s1 = Spot("book_slot_1");
|
||
float hh = s1 != null ? s1.Value.height : 430f;
|
||
var st = StateOf(id);
|
||
var roll = Roll(animDesign, b, st, hh, false);
|
||
// 고름 빛 = 두루마리 둘레 노란 테 빛(흰 9 분할 테 × 색 · 시안 drop-shadow 0 0 22px) · 맨 뒤
|
||
var gl = L("glow"); // 색|부품|바깥으로 px|9 분할 배율
|
||
float go = At(gl, 2, 27f);
|
||
var glowRt = UiKit.Rect("Glow", roll, Center, Center, Vector2.zero, roll.sizeDelta + new Vector2(2f * go, 2f * go));
|
||
glowRt.SetAsFirstSibling();
|
||
var glow = glowRt.gameObject.AddComponent<CanvasGroup>();
|
||
glow.alpha = 0f;
|
||
var gi = glowRt.gameObject.AddComponent<Image>();
|
||
gi.sprite = Part(Str(gl, 1));
|
||
if (gi.sprite != null && gi.sprite.border != Vector4.zero)
|
||
{
|
||
gi.type = Image.Type.Sliced;
|
||
gi.pixelsPerUnitMultiplier = At(gl, 3, 1f);
|
||
}
|
||
gi.color = Col(gl, 0, Color.yellow);
|
||
gi.raycastTarget = false;
|
||
Vector2 start = src != null ? ToDesign(animDesign, src.position) : new Vector2(540f, 1225f);
|
||
if (src != null) src.gameObject.SetActive(false);
|
||
|
||
fx = overlay.gameObject.AddComponent<ScenarioOpenFx>();
|
||
fx.roll = roll;
|
||
fx.glow = glow;
|
||
fx.slip = roll.Find("Slip");
|
||
fx.newTag = roll.Find("New");
|
||
fx.dim = dim;
|
||
fx.steps = Array.ConvertAll(L("open_steps"), x => F(x, 0.4f));
|
||
fx.dims = Array.ConvertAll(L("open_dim"), x => F(x, 0.7f));
|
||
var lift = F(S_("open_lift"), 90f);
|
||
var oc = L("open_center"); // x|발 y|높이
|
||
var ol = L("open_lay"); // x|y|높이|도
|
||
fx.pos = new[]
|
||
{
|
||
start,
|
||
start - new Vector2(0f, lift),
|
||
new Vector2(At(oc, 0, 540f), At(oc, 1, 1220f) - At(oc, 2, 760f) * 0.5f),
|
||
new Vector2(At(ol, 0, 540f), At(ol, 1, 390f)),
|
||
};
|
||
fx.scale = new[] { 1f, 1f, At(oc, 2, 760f) / hh, At(ol, 2, 700f) / hh };
|
||
fx.rot = At(ol, 3, 90f);
|
||
fx.scroll = BuildScroll(animDesign);
|
||
fx.scrollMin = ScrollBarsH();
|
||
fx.scrollMax = At(L("detail"), 3, 1302f);
|
||
fx.onDone = () =>
|
||
{
|
||
if (overlay == null) return;
|
||
detail.gameObject.SetActive(true);
|
||
BuildDetail();
|
||
};
|
||
var hb = overlay.gameObject.AddComponent<Button>();
|
||
hb.transition = Selectable.Transition.None;
|
||
hb.onClick.AddListener(() =>
|
||
{
|
||
if (fx != null && fx.Running) fx.Finish();
|
||
});
|
||
fx.Play(skip);
|
||
}
|
||
|
||
/// <summary>시안 좌표(1080×1920 · 왼쪽 위 0,0)를 화면에 맞춘 판 — 내용(Content)과 같은 배율 · 세로는 제목 띠와 아래 내비 사이 가운데.</summary>
|
||
RectTransform Stage(Transform parent, string name)
|
||
{
|
||
var cv = L("canvas");
|
||
var cs = new Vector2(At(cv, 0, 1080f), At(cv, 1, 1920f));
|
||
var r = ((RectTransform)screen.Root.TopRoot).rect;
|
||
float z = Mathf.Min(r.width / cs.x, r.height / cs.y);
|
||
float topH = OutGameRoot.TopBarH + OutGameRoot.HeaderH, navTop = F(S_("nav_top"), 1770f);
|
||
float avail = r.height - topH - OutGameRoot.TabBarH, design = navTop - topH;
|
||
float y = topH + (avail - design * z) * 0.5f - topH * z; // 16:9 = 0
|
||
var st = UiKit.Rect(name, parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -y), cs);
|
||
st.localScale = new Vector3(z, z, 1f);
|
||
return st;
|
||
}
|
||
|
||
static Vector2 ToDesign(RectTransform design, Vector3 world)
|
||
{
|
||
var lp = design.InverseTransformPoint(world);
|
||
var r = design.rect;
|
||
return new Vector2(lp.x - r.xMin, r.yMax - lp.y);
|
||
}
|
||
|
||
float ScrollBarsH()
|
||
{
|
||
var sp = Part(Str(L("detail"), 4));
|
||
return sp != null ? sp.border.y + sp.border.w : 392f; // 위 막대 + 아래 막대(종이 0)
|
||
}
|
||
|
||
RectTransform BuildScroll(RectTransform design)
|
||
{
|
||
var dt = L("detail"); // 왼 x|위 y|폭|높이|부품
|
||
var rt = Place(design, "Scroll", At(dt, 0), At(dt, 1), At(dt, 2, 1000f), ScrollBarsH(), TopLeft);
|
||
var img = rt.gameObject.AddComponent<Image>();
|
||
var sp = Part(Str(dt, 4));
|
||
img.sprite = sp;
|
||
if (sp != null && sp.border != Vector4.zero) img.type = Image.Type.Sliced;
|
||
img.raycastTarget = false;
|
||
rt.gameObject.SetActive(false);
|
||
return rt;
|
||
}
|
||
|
||
public void CloseDetail()
|
||
{
|
||
if (overlay != null)
|
||
{
|
||
overlay.gameObject.SetActive(false);
|
||
UnityEngine.Object.Destroy(overlay.gameObject);
|
||
}
|
||
overlay = null;
|
||
fx = null;
|
||
RectTransform src;
|
||
if (openId.Length > 0 && rollRt.TryGetValue(openId, out src) && src != null) src.gameObject.SetActive(true);
|
||
openId = "";
|
||
}
|
||
|
||
/// <summary>상세 = 펼친 두루마리 위 내용(제목 띠 · 닫기 · 연의/열전 · 설명 · 승리 · 도전 · 편성 · 보상 · 안내) + 아래 버튼(전장 보기 · 출전).</summary>
|
||
void BuildDetail()
|
||
{
|
||
if (detailDesign == null) return;
|
||
UiKit.Clear(detailDesign);
|
||
var b = Battle(openId);
|
||
if (b == null) return;
|
||
var db = S.Db;
|
||
var dt = L("detail");
|
||
float T = At(dt, 1, 214f);
|
||
var cv = L("canvas");
|
||
float cx = At(cv, 0, 1080f) * 0.5f;
|
||
|
||
// 제목 띠
|
||
var bd = L("detail_band"); // 위끝에서|글자|색|좌우 여백|위아래 여백|글자 키
|
||
int bs = (int)At(bd, 1, 46f);
|
||
float bh = bs * 1.25f + 2f * At(bd, 4, 4f) + 10f;
|
||
var band = Place(detailDesign, "Band", cx, T + At(bd, 0, 34f), 0f, bh, new Vector2(0.5f, 1f));
|
||
UiKit.Skin(band, "card", Col(bd, 2, UiKit.Red));
|
||
var bt = Txt(band, "DetailTitle", UiText.F(Str(bd, 5), new[] { Label(b), b.S("s_title_ko") }), bs, Color.white, true, TextAnchor.MiddleCenter, Center, 0f, bh * 0.5f, 1000f, bh);
|
||
Stroke(bt);
|
||
band.sizeDelta = new Vector2(bt.preferredWidth + 2f * At(bd, 3, 30f) + 10f, bh);
|
||
bt.rectTransform.anchoredPosition = new Vector2(band.sizeDelta.x * 0.5f, -bh * 0.5f);
|
||
// 닫기
|
||
var cl = L("detail_close"); // 왼 x|위끝에서|크기
|
||
var x = Place(detailDesign, "Close", At(cl, 0), T + At(cl, 1), At(cl, 2, 68f), At(cl, 2, 68f), TopLeft);
|
||
UiKit.Skin(x, "close", Color.white, true);
|
||
x.gameObject.AddComponent<Button>().onClick.AddListener(CloseDetail);
|
||
|
||
detailBody = UiKit.Rect("Body", detailDesign, TopLeft, TopLeft, Vector2.zero, Vector2.zero);
|
||
BuildBody(b, T);
|
||
BuildButtons(b, T);
|
||
}
|
||
|
||
void BuildBody(ContentRow b, float T)
|
||
{
|
||
UiKit.Clear(detailBody);
|
||
var d = S.Save;
|
||
var db = S.Db;
|
||
var col = L("detail_col"); // 왼 x|위끝에서|폭|글자색
|
||
float x0 = At(col, 0, 172f), y = T + At(col, 1, 206f), cw = At(col, 2, 732f);
|
||
var ink = Col(col, 3, UiKit.Ink);
|
||
var p = detailBody;
|
||
|
||
// 연의 · 열전 탭 + 연도 칩
|
||
var tb = L("detail_tabs"); // 폭|높이|사이|글자|고른 색|색
|
||
float tw = At(tb, 0, 150f), th = At(tb, 1, 56f);
|
||
for (int i = 0; i < 2; i++)
|
||
{
|
||
bool hard = i == 1, on = hard == openHard;
|
||
var rt = Place(p, hard ? "ModeHard" : "ModeNormal", x0 + i * (tw + At(tb, 2, 12f)), y, tw, th, TopLeft);
|
||
var img = UiKit.Skin(rt, "card", on ? Col(tb, 4, UiKit.Red) : Col(tb, 5, UiKit.Dark), true);
|
||
var t = UiKit.Title(UiKit.FillLabel(rt, UiText.T(hard ? "scn_mode_hard" : "scn_mode_normal"), (int)At(tb, 3, 26f), Color.white));
|
||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
var btn = rt.gameObject.AddComponent<Button>();
|
||
btn.targetGraphic = img;
|
||
btn.onClick.AddListener(() =>
|
||
{
|
||
if (openHard == hard) return;
|
||
openHard = hard;
|
||
BuildDetail();
|
||
});
|
||
}
|
||
var yc = L("detail_chip"); // 높이|좌우 여백|글자|바탕|글자 키
|
||
float ch = At(yc, 0, 48f);
|
||
var chip = Place(p, "Year", x0 + cw, y + th * 0.5f, 0f, ch, new Vector2(1f, 0.5f));
|
||
UiKit.Skin(chip, "chip", Col(yc, 3, UiKit.Dark));
|
||
var ct = Txt(chip, "YearText", UiText.F(Str(yc, 4), new[] { b.I("n_year").ToString(CultureInfo.InvariantCulture) }), (int)At(yc, 2, 26f), Color.white, false, TextAnchor.MiddleCenter, Center, 0f, ch * 0.5f, 400f, ch);
|
||
chip.sizeDelta = new Vector2(ct.preferredWidth + 2f * At(yc, 1, 18f), ch);
|
||
ct.rectTransform.anchoredPosition = new Vector2(chip.sizeDelta.x * 0.5f, -ch * 0.5f);
|
||
y += th;
|
||
|
||
// 설명(게임 표에 이야기 문장이 없어 전장 설명)
|
||
var ds = L("detail_desc"); // 글자|줄 간격|위 간격
|
||
y += At(ds, 2, 12f);
|
||
var desc = UiKit.Label(p, b.S("s_gimmick_ko"), (int)At(ds, 0, 23f), ink, TextAnchor.UpperLeft, TopLeft, TopLeft, new Vector2(x0, -y), new Vector2(cw, 10f));
|
||
desc.lineSpacing = At(ds, 1, 1.15f);
|
||
desc.name = "Desc";
|
||
texts["Desc"] = desc;
|
||
float dh = desc.preferredHeight;
|
||
desc.rectTransform.sizeDelta = new Vector2(cw, dh);
|
||
y += dh;
|
||
|
||
// 승리 조건
|
||
var rules = ContentTables.Rows("scenario_rules");
|
||
string sid = b.S("s_id");
|
||
y = Section(p, "SecWin", UiText.T("scn_sec_win"), "", x0, y);
|
||
y = CondRow(p, "Win", "sword", b.S("s_win_cond_ko"), CondTag(rules, sid, "win"), x0, y, cw, ink);
|
||
// 도전 조건
|
||
int gem = ContentTables.Int("scenario", openHard ? "reward_hard_challenge_gem" : "reward_normal_challenge_gem");
|
||
y = Section(p, "SecChallenge", UiText.T("scn_sec_challenge"), UiText.F("scn_sec_challenge_sub", new[] { gem.ToString(CultureInfo.InvariantCulture) }), x0, y);
|
||
y = CondRow(p, "Ch1", "star_on", b.S("s_challenge1_ko"), CondTag(rules, sid, "challenge1"), x0, y, cw, ink);
|
||
y = CondRow(p, "Ch2", "star_on", b.S("s_challenge2_ko"), CondTag(rules, sid, "challenge2"), x0, y, cw, ink);
|
||
// 편성
|
||
y = Section(p, "SecTeam", UiText.T("scn_sec_team"), "", x0, y);
|
||
y = TeamRow(p, b, x0, y);
|
||
// 첫 승리 보상
|
||
y = Section(p, "SecReward", UiText.T("scn_sec_reward"), "", x0, y);
|
||
RewardRow(p, x0, y, cw);
|
||
// 아래 안내(패배 환급)
|
||
var ft = L("detail_foot"); // 위끝에서|글자|색|글자 키
|
||
if (ContentTables.Num("scenario", "refund_on_lose_pct") > 0f)
|
||
{
|
||
int fs = (int)At(ft, 1, 22f);
|
||
Txt(p, "Refund", UiText.T(Str(ft, 3)), fs, Col(ft, 2, UiKit.InkSoft), false, TextAnchor.MiddleCenter, Center, x0 + cw * 0.5f, T + At(ft, 0, 1052f) + fs * 0.625f, cw, fs * 1.25f);
|
||
}
|
||
}
|
||
|
||
float Section(Transform p, string name, string title, string sub, float x0, float y)
|
||
{
|
||
var s = L("detail_sec"); // 글자|색|위 간격|아래 간격|덧말 글자|덧말 색
|
||
int fs = (int)At(s, 0, 27f);
|
||
y += At(s, 2, 12f);
|
||
var t = Txt(p, name, title, fs, Col(s, 1, UiKit.Red), true, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), x0, y + fs * 0.625f, 600f, fs * 1.25f);
|
||
if (sub.Length > 0)
|
||
{
|
||
int ss = (int)At(s, 4, 20f);
|
||
Txt(p, name + "_sub", sub, ss, Col(s, 5, UiKit.InkSoft), false, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), x0 + t.preferredWidth + ss * 0.4f, y + fs * 0.625f, 600f, ss * 1.25f);
|
||
}
|
||
return y + fs * 1.25f + At(s, 3, 4f);
|
||
}
|
||
|
||
/// <summary>조건 종류 칩 = scenario_rules 그 칸(win · challenge1 · challenge2)의 조건 코드 → 글자 키 scn_cond_* · 여러 개 = cond_join 으로 이음 · 글자 키가 없는 코드는 뺌.</summary>
|
||
string CondTag(List<ContentRow> rules, string battle, string slot)
|
||
{
|
||
var names = new List<string>();
|
||
foreach (var r in rules)
|
||
{
|
||
if (r.S("s_battle") != battle || r.S("e_slot") != slot) continue;
|
||
string key = "scn_cond_" + r.S("s_cond");
|
||
if (UiText.Has(key)) names.Add(UiText.T(key));
|
||
}
|
||
return string.Join(" " + S_("cond_join") + " ", names.ToArray());
|
||
}
|
||
|
||
float CondRow(Transform p, string name, string icon, string text, string tag, float x0, float y, float cw, Color ink)
|
||
{
|
||
var r = L("detail_row"); // 아이콘|글자|사이|위아래 여백|칩 높이|칩 글자|칩 바탕|점선 굵기|점선 색
|
||
float isz = At(r, 0, 40f), gap = At(r, 2, 12f), pad = At(r, 3, 6f);
|
||
int fs = (int)At(r, 1, 24f);
|
||
float rh = Mathf.Max(isz, fs * 1.25f) + 2f * pad;
|
||
float cy = y + rh * 0.5f;
|
||
var ic = UISkin.IconImage(p, icon, TopLeft, new Vector2(0f, 0.5f), new Vector2(x0 + 4f, -cy), new Vector2(isz, isz));
|
||
if (ic != null) ic.name = name + "_icon";
|
||
float tagW = 0f;
|
||
if (tag.Length > 0)
|
||
{
|
||
float chh = At(r, 4, 38f);
|
||
var chip = Place(p, name + "_tag", x0 + cw - 4f, cy, 0f, chh, new Vector2(1f, 0.5f));
|
||
UiKit.Skin(chip, "chip", Col(r, 6, UiKit.Dark));
|
||
var tt = Txt(chip, name + "_tagText", tag, (int)At(r, 5, 20f), Color.white, true, TextAnchor.MiddleCenter, Center, 0f, chh * 0.5f, 400f, chh);
|
||
tagW = tt.preferredWidth + 2f * 18f;
|
||
chip.sizeDelta = new Vector2(tagW, chh);
|
||
tt.rectTransform.anchoredPosition = new Vector2(tagW * 0.5f, -chh * 0.5f);
|
||
}
|
||
var t = Txt(p, name, text, fs, ink, false, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), x0 + 4f + isz + gap, cy, cw - isz - gap - tagW - 16f, rh);
|
||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||
var line = Place(p, name + "_line", x0, y + rh, cw, At(r, 7, 3f), TopLeft);
|
||
var li = line.gameObject.AddComponent<Image>();
|
||
li.color = Col(r, 8, new Color(0f, 0f, 0f, 0.25f));
|
||
li.raycastTarget = false;
|
||
return y + rh + At(r, 7, 3f);
|
||
}
|
||
|
||
float TeamRow(Transform p, ContentRow b, float x0, float y)
|
||
{
|
||
var db = S.Db;
|
||
var tm = L("detail_team"); // 얼굴|바탕|테두리|테두리색|사이|이름 글자|표 높이|표 글자|표 바탕|표 글자색|아래 줄 글자|아래 줄 색
|
||
float fd = At(tm, 0, 84f), gap = At(tm, 4, 14f);
|
||
var ids = b.S("l_fixed_hero").Split(';');
|
||
float x = x0;
|
||
int faces = 0;
|
||
foreach (var raw in ids)
|
||
{
|
||
var h = db.Heroes.Get(raw.Trim());
|
||
if (h == null) continue;
|
||
Face(p, "Face" + faces, h, x + fd * 0.5f, y + fd * 0.5f, fd, At(tm, 2, 5f), Col(tm, 3, Color.black), Col(tm, 1, UiKit.Dark));
|
||
x += fd + gap;
|
||
faces++;
|
||
}
|
||
int ns = (int)At(tm, 5, 28f), ls = (int)At(tm, 10, 20f);
|
||
float tagH = At(tm, 6, 32f);
|
||
float colH = Mathf.Max(ns * 1.25f, tagH) + 2f + ls * 1.25f;
|
||
float y0 = y + (fd - colH) * 0.5f;
|
||
var name = Txt(p, "TeamName", b.S("l_fixed_hero_ko").Replace(";", " · "), ns, Col(L("detail_col"), 3, UiKit.Ink), true, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), x, y0 + ns * 0.625f, 600f, ns * 1.25f);
|
||
var tag = Place(p, "Fixed", x + name.preferredWidth + 8f, y0 + ns * 0.625f, 0f, tagH, new Vector2(0f, 0.5f));
|
||
UiKit.Skin(tag, "card", Col(tm, 8, UiKit.Coin));
|
||
var tt = Txt(tag, "FixedText", UiText.T("scn_fixed"), (int)At(tm, 7, 19f), Col(tm, 9, UiKit.Ink), true, TextAnchor.MiddleCenter, Center, 0f, tagH * 0.5f, 300f, tagH);
|
||
tag.sizeDelta = new Vector2(tt.preferredWidth + 24f, tagH);
|
||
tt.rectTransform.anchoredPosition = new Vector2(tag.sizeDelta.x * 0.5f, -tagH * 0.5f);
|
||
int comp = 0;
|
||
foreach (var c in b.S("l_companion").Split(';'))
|
||
if (c.Trim().Length > 0) comp++;
|
||
string note = UiText.F("scn_team_note", new[] { comp.ToString(CultureInfo.InvariantCulture) });
|
||
if (comp == 0 && faces == 1) note += " " + UiText.T("scn_team_solo");
|
||
Txt(p, "TeamNote", note, ls, Col(tm, 11, UiKit.InkSoft), false, TextAnchor.MiddleLeft, new Vector2(0f, 0.5f), x, y0 + Mathf.Max(ns * 1.25f, tagH) + 2f + ls * 0.625f, 700f, ls * 1.25f);
|
||
return y + fd;
|
||
}
|
||
|
||
void RewardRow(Transform p, float x0, float y, float cw)
|
||
{
|
||
var db = S.Db;
|
||
var rw = L("detail_reward"); // 칸|사이|덧말 글자|색
|
||
float sz = At(rw, 0, 76f), gap = At(rw, 1, 20f);
|
||
var icons = new Dictionary<string, string>();
|
||
foreach (var r in All("reward_icon")) icons[Str(r, 0)] = Str(r, 1);
|
||
float x = x0;
|
||
int i = 0;
|
||
foreach (var kvp in ContentTables.ParseMap(ContentTables.Str("scenario", openHard ? "reward_hard" : "reward_normal")))
|
||
{
|
||
string ic;
|
||
if (!icons.TryGetValue(kvp.Key, out ic)) continue;
|
||
var tile = UiKit.RewardTile(p, "Reward" + i, x, y, sz, "gear_white_", ic, Mathf.RoundToInt(kvp.Value).ToString("N0", CultureInfo.InvariantCulture), false);
|
||
tile.name = "Reward_" + kvp.Key;
|
||
x += sz + gap;
|
||
i++;
|
||
}
|
||
// 오른쪽 덧말 = 조건을 모두 채우면 + 상자
|
||
foreach (var kvp in ContentTables.ParseMap(ContentTables.Str("scenario", "reward_all_star")))
|
||
{
|
||
string nm = kvp.Key;
|
||
if (nm.EndsWith("_chest"))
|
||
{
|
||
var c = db.Chests.Get(nm.Substring(0, nm.Length - "_chest".Length));
|
||
if (c != null) nm = c.nameKo;
|
||
}
|
||
int fs = (int)At(rw, 2, 20f);
|
||
var col = Col(rw, 3, UiKit.InkSoft);
|
||
Txt(p, "AllStar1", UiText.T("scn_allstar_1"), fs, col, false, TextAnchor.MiddleRight, new Vector2(1f, 0.5f), x0 + cw, y + sz * 0.5f - fs * 0.65f, 500f, fs * 1.3f);
|
||
Txt(p, "AllStar2", UiText.F("scn_allstar_2", new[] { nm, Mathf.RoundToInt(kvp.Value).ToString(CultureInfo.InvariantCulture) }), fs, col, false, TextAnchor.MiddleRight, new Vector2(1f, 0.5f), x0 + cw, y + sz * 0.5f + fs * 0.65f, 500f, fs * 1.3f);
|
||
break;
|
||
}
|
||
}
|
||
|
||
void BuildButtons(ContentRow b, float T)
|
||
{
|
||
var bt = L("detail_btns"); // 왼 x|아래에서|전체 폭|높이|사이|왼 폭|왼 스킨|오른 스킨|글자|왼 글자색|오른 글자색|출전 아이콘|크기
|
||
float top = T + At(L("detail"), 3, 1302f) + At(bt, 1, 22f);
|
||
float x0 = At(bt, 0, 60f), w = At(bt, 2, 960f), h = At(bt, 3, 104f), gap = At(bt, 4, 20f), lw = At(bt, 5, 300f);
|
||
int fs = (int)At(bt, 8, 44f);
|
||
var l = Place(detailDesign, "ViewField", x0, top, lw, h, TopLeft);
|
||
var li = UiKit.Skin(l, Str(bt, 6), Col(bt, 13, Color.white), true);
|
||
var lt = UiKit.Title(UiKit.FillLabel(l, UiText.T("scn_view_field"), fs, Col(bt, 9, Color.white)), true);
|
||
lt.rectTransform.offsetMin = new Vector2(0f, h * 0.1f);
|
||
var lb = l.gameObject.AddComponent<Button>();
|
||
lb.targetGraphic = li;
|
||
lb.onClick.AddListener(() => screen.Root.ComingSoon(UiText.T("scn_view_field")));
|
||
|
||
float rx = x0 + lw + gap, rw = w - lw - gap;
|
||
var r = Place(detailDesign, "Go", rx, top, rw, h, TopLeft);
|
||
var ri = UiKit.Skin(r, Str(bt, 7), Color.white, true);
|
||
int cost = ContentTables.Int("scenario", "stamina_cost");
|
||
var go = UiKit.Rect("Label", r, Center, Center, new Vector2(0f, h * 0.05f), new Vector2(rw, h)); // 팩 버튼 아래 턱만큼 위로
|
||
InlineGo(go, UiText.F("scn_go", new[] { cost.ToString(CultureInfo.InvariantCulture) }), Str(bt, 11), At(bt, 12, 64f), fs, Col(bt, 10, UiKit.Ink), rw, h);
|
||
var rb = r.gameObject.AddComponent<Button>();
|
||
rb.targetGraphic = ri;
|
||
string id = openId;
|
||
rb.onClick.AddListener(() => Go(id, openHard));
|
||
}
|
||
|
||
/// <summary>「출전 {icon} 3」 한 줄(가운데) · 반환 = 폭.</summary>
|
||
float InlineGo(RectTransform p, string s, string icon, float isz, int fs, Color c, float w, float h)
|
||
{
|
||
int at = s.IndexOf("{icon}", StringComparison.Ordinal);
|
||
string a = (at >= 0 ? s.Substring(0, at) : s).TrimEnd();
|
||
string bstr = at >= 0 ? s.Substring(at + 6).TrimStart() : "";
|
||
var ta = UiKit.Title(UiKit.Label(p, a, fs, c, TextAnchor.MiddleLeft, Center, new Vector2(0f, 0.5f), Vector2.zero, new Vector2(10f, h)));
|
||
ta.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
ta.name = "GoText";
|
||
texts["GoText"] = ta;
|
||
Text tb = null;
|
||
if (bstr.Length > 0)
|
||
{
|
||
tb = UiKit.Title(UiKit.Label(p, bstr, fs, c, TextAnchor.MiddleLeft, Center, new Vector2(0f, 0.5f), Vector2.zero, new Vector2(10f, h)));
|
||
tb.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||
tb.name = "GoCost";
|
||
texts["GoCost"] = tb;
|
||
}
|
||
var sp = at >= 0 ? UISkin.Icon(icon) : null;
|
||
float gap = fs * 0.25f;
|
||
float wa = ta.preferredWidth, wb = tb != null ? tb.preferredWidth : 0f, wi = sp != null ? isz : 0f;
|
||
float total = wa + (sp != null ? gap + wi : 0f) + (tb != null ? gap + wb : 0f);
|
||
float x = -total * 0.5f;
|
||
ta.rectTransform.anchoredPosition = new Vector2(x, 0f);
|
||
ta.rectTransform.sizeDelta = new Vector2(wa + 2f, h);
|
||
x += wa + gap;
|
||
if (sp != null)
|
||
{
|
||
var ic = UiKit.Rect("GoIcon", p, Center, new Vector2(0f, 0.5f), new Vector2(x, 0f), new Vector2(isz, isz)).gameObject.AddComponent<Image>();
|
||
ic.sprite = sp;
|
||
ic.preserveAspect = true;
|
||
ic.raycastTarget = false;
|
||
x += isz + gap;
|
||
}
|
||
if (tb != null)
|
||
{
|
||
tb.rectTransform.anchoredPosition = new Vector2(x, 0f);
|
||
tb.rectTransform.sizeDelta = new Vector2(wb + 2f, h);
|
||
}
|
||
return total;
|
||
}
|
||
|
||
/// <summary>출전 = 입장 판정(서장 · 잠김 · 열전 잠김 · 군량) → 안 되면 알림 · 되면 상세를 닫고 전투(ArenaScreen.ScenarioGo).</summary>
|
||
public void Go(string id, bool hard)
|
||
{
|
||
var why = ScenarioModeRules.Can(S.Db, S.Save, id, hard, S.Now);
|
||
if (why != null)
|
||
{
|
||
screen.Root.Toast(why);
|
||
return;
|
||
}
|
||
CloseDetail();
|
||
screen.ScenarioGo(id, hard);
|
||
}
|
||
|
||
/// <summary>얼굴 = 원(테두리) → 안쪽 원(바탕 · 마스크) → 대기 첫 프레임(시안 .face img 자리 · 설정 face_art).</summary>
|
||
void Face(Transform p, string name, HeroDb.Hero h, float cx, float cy, float d, float bw, Color line, Color bgc)
|
||
{
|
||
var fa = L("face_art"); // 폭 배율|왼쪽|위
|
||
var outer = Place(p, name, cx, cy, d, d, Center);
|
||
var oi = outer.gameObject.AddComponent<Image>();
|
||
oi.sprite = UiKit.Circle;
|
||
oi.color = line;
|
||
oi.raycastTarget = false;
|
||
float di = d - 2f * bw;
|
||
var inner = UiKit.Rect("In", outer, Center, Center, Vector2.zero, new Vector2(di, di));
|
||
var ii = inner.gameObject.AddComponent<Image>();
|
||
ii.sprite = UiKit.Circle;
|
||
ii.color = bgc;
|
||
ii.raycastTarget = false;
|
||
inner.gameObject.AddComponent<Mask>().showMaskGraphic = true;
|
||
var sp = h != null ? UiKit.ArtSprite(h.art) : null;
|
||
if (sp == null) return;
|
||
float aw = di * At(fa, 0, 1.72f), ah = aw * sp.rect.height / Mathf.Max(1f, sp.rect.width);
|
||
var a = UiKit.Rect("Art", inner, TopLeft, TopLeft, new Vector2(di * At(fa, 1, -0.36f), -di * At(fa, 2, -0.06f)), new Vector2(aw, ah));
|
||
var ai = a.gameObject.AddComponent<Image>();
|
||
ai.sprite = sp;
|
||
ai.raycastTarget = false;
|
||
}
|
||
|
||
/// <summary>값 글자(테스트 · 이름 = StarsText · Guide · EmptyTitle · DetailTitle · Desc · Win · Ch1 · Ch2 · Win_tagText · TeamName · TeamNote · GoText · GoCost).</summary>
|
||
public string TextOf(string name)
|
||
{
|
||
Text t;
|
||
return texts.TryGetValue(name, out t) && t != null ? t.text : null;
|
||
}
|
||
|
||
/// <summary>줄의 두루마리(테스트 · 없으면 null).</summary>
|
||
public RectTransform RollOf(string id)
|
||
{
|
||
RectTransform t;
|
||
return rollRt.TryGetValue(id, out t) ? t : null;
|
||
}
|
||
}
|
||
|
||
/// <summary>연의 전기 화면 맞춤 — 폭 맞춤(세로가 더 길면 위 정렬 + 아래 바닥 늘림 · 넓은 화면 = 높이 맞춤) · 탭 줄 = 같은 배율 · 아래 내비 위.</summary>
|
||
public class ScenarioFit : MonoBehaviour
|
||
{
|
||
public RectTransform content;
|
||
public RectTransform tabs;
|
||
public RawImage floor;
|
||
public Vector2 canvasSize;
|
||
public float floorStrip = 120f;
|
||
Vector2 lastSize;
|
||
|
||
public float Zoom { get; private set; }
|
||
|
||
void OnEnable()
|
||
{
|
||
Fit(true);
|
||
}
|
||
|
||
void OnRectTransformDimensionsChange()
|
||
{
|
||
Fit(false);
|
||
}
|
||
|
||
public void Fit(bool force)
|
||
{
|
||
if (content == null || canvasSize.x < 1f || canvasSize.y < 1f) return;
|
||
var r = ((RectTransform)transform).rect;
|
||
if (r.width < 1f || r.height < 1f) return;
|
||
if (!force && (r.size - lastSize).sqrMagnitude < 0.01f) return;
|
||
lastSize = r.size;
|
||
float z = Mathf.Min(r.width / canvasSize.x, r.height / canvasSize.y);
|
||
Zoom = z;
|
||
content.localScale = new Vector3(z, z, 1f);
|
||
content.anchoredPosition = Vector2.zero;
|
||
if (tabs != null && tabs.localScale.x != z) tabs.localScale = new Vector3(z, z, 1f);
|
||
if (floor != null)
|
||
{
|
||
float fh = Mathf.Max(0f, r.height - canvasSize.y * z);
|
||
floor.rectTransform.sizeDelta = new Vector2(canvasSize.x * z, fh + 2f); // 2 px 겹침 = 이음새 없앰
|
||
floor.uvRect = new Rect(0f, 0f, 1f, Mathf.Clamp01(floorStrip / canvasSize.y));
|
||
floor.enabled = fh > 0.5f && floor.texture != null;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>펼침 연출(시안 o0~o5) — ① 고름 빛 ② 떠오름 ③ 가운데로 커짐 ④ 눕혀 위로 ⑤ 위에서 아래로 펼침 → 끝(onDone = 상세) · Finish = 건너뜀.</summary>
|
||
public class ScenarioOpenFx : MonoBehaviour
|
||
{
|
||
public RectTransform roll;
|
||
public CanvasGroup glow;
|
||
public Transform slip;
|
||
public Transform newTag;
|
||
public Image dim;
|
||
public RectTransform scroll;
|
||
public float scrollMin, scrollMax;
|
||
public float[] steps = new float[0];
|
||
public float[] dims = new float[0];
|
||
public Vector2[] pos = new Vector2[0];
|
||
public float[] scale = new float[0];
|
||
public float rot;
|
||
public Action onDone;
|
||
|
||
int step;
|
||
float t;
|
||
bool done;
|
||
|
||
public bool Running
|
||
{
|
||
get { return !done; }
|
||
}
|
||
|
||
float Dur(int i)
|
||
{
|
||
return i < steps.Length ? Mathf.Max(0.01f, steps[i]) : 0.3f;
|
||
}
|
||
|
||
float DimAt(int i)
|
||
{
|
||
return i < dims.Length ? dims[i] : (dims.Length > 0 ? dims[dims.Length - 1] : 0.7f);
|
||
}
|
||
|
||
public void Play(bool skip)
|
||
{
|
||
step = 0;
|
||
t = 0f;
|
||
done = false;
|
||
Apply(0, 0f);
|
||
if (skip) Finish();
|
||
}
|
||
|
||
public void Finish()
|
||
{
|
||
if (done) return;
|
||
done = true;
|
||
if (roll != null) roll.gameObject.SetActive(false);
|
||
if (scroll != null)
|
||
{
|
||
scroll.gameObject.SetActive(true);
|
||
scroll.sizeDelta = new Vector2(scroll.sizeDelta.x, scrollMax);
|
||
}
|
||
SetDim(DimAt(4));
|
||
if (onDone != null) onDone();
|
||
}
|
||
|
||
void SetDim(float a)
|
||
{
|
||
if (dim == null) return;
|
||
var c = dim.color;
|
||
if (Mathf.Abs(c.a - a) > 0.001f)
|
||
{
|
||
c.a = a;
|
||
dim.color = c;
|
||
}
|
||
}
|
||
|
||
void Update()
|
||
{
|
||
if (done) return;
|
||
t += Time.unscaledDeltaTime;
|
||
float d = Dur(step);
|
||
float u = Mathf.Clamp01(t / d);
|
||
Apply(step, u);
|
||
if (u < 1f) return;
|
||
step++;
|
||
t = 0f;
|
||
if (step >= 5) Finish();
|
||
}
|
||
|
||
/// <summary>단계 i 의 진행 u(0~1) — 0 = 빛 · 1 = 떠오름 · 2 = 가운데 · 3 = 눕힘 · 4 = 펼침.</summary>
|
||
void Apply(int i, float u)
|
||
{
|
||
float e = u * u * (3f - 2f * u); // smoothstep
|
||
float prevDim = i == 0 ? 0f : DimAt(i - 1);
|
||
SetDim(Mathf.Lerp(prevDim, DimAt(i), e));
|
||
if (glow != null)
|
||
{
|
||
float ga = i == 0 ? e : 1f;
|
||
if (Mathf.Abs(glow.alpha - ga) > 0.001f) glow.alpha = ga;
|
||
}
|
||
if (i == 0)
|
||
{
|
||
if (roll != null && pos.Length > 0 && scale.Length > 0)
|
||
{
|
||
roll.anchoredPosition = new Vector2(pos[0].x, -pos[0].y);
|
||
roll.localScale = new Vector3(scale[0], scale[0], 1f);
|
||
}
|
||
return;
|
||
}
|
||
if (i <= 3 && roll != null && pos.Length >= 4 && scale.Length >= 4)
|
||
{
|
||
roll.anchoredPosition = new Vector2(Mathf.Lerp(pos[i - 1].x, pos[i].x, e), -Mathf.Lerp(pos[i - 1].y, pos[i].y, e));
|
||
float s = Mathf.Lerp(scale[i - 1], scale[i], e);
|
||
roll.localScale = new Vector3(s, s, 1f);
|
||
roll.localEulerAngles = new Vector3(0f, 0f, i == 3 ? Mathf.Lerp(0f, rot, e) : 0f);
|
||
if (i == 3)
|
||
{
|
||
if (slip != null && slip.gameObject.activeSelf) slip.gameObject.SetActive(false); // 눕힐 때 쪽지 글자 · 새 편 표 숨김(시안 o3)
|
||
if (newTag != null && newTag.gameObject.activeSelf) newTag.gameObject.SetActive(false);
|
||
}
|
||
return;
|
||
}
|
||
if (i == 4)
|
||
{
|
||
if (roll != null && roll.gameObject.activeSelf) roll.gameObject.SetActive(false);
|
||
if (scroll != null)
|
||
{
|
||
if (!scroll.gameObject.activeSelf) scroll.gameObject.SetActive(true);
|
||
scroll.sizeDelta = new Vector2(scroll.sizeDelta.x, Mathf.Lerp(scrollMin, scrollMax, e));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|