using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 행운 룰렛 쪽(시안 mock_event_roulette = build_mock_e2.py roulette_base_v3 · 14차) — 축제 마당 배경(어둡게) · 제목 · 남은 기간 · 보유 복주머니 · 확률 정보 · /// 바둑판(생성 그림 · 안쪽 나무 면 실측 = 표) + 둘레 12칸 바둑알(보통 = 흰 돌 · 한정 = 검은 돌 · 최종 보상 = 검은 돌 + 금 상감 · 지금 칸 = 금빛 고리 · PD 결정 ⑤) · /// 가운데 = 현판 「최종 보상」 + 게임 유닛 원화 전신(언덕 위 · 눕힌 그림자) + 별 + 「n회마다 반드시 · 남은 n회」 · 안내 띠 · 횟수 보상 · 뽑기 1회/10회 · 이벤트 미션 · 선물 팩 팝업. /// 뽑기 = 금빛 고리가 칸을 돌다 멈춤(Fx 층 · Frame · 누르면 건너뜀) → 받은 보상 팝업. /// public partial class EventScreen { static readonly int[,] Ring = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 3 }, { 2, 3 }, { 3, 3 }, { 3, 2 }, { 3, 1 }, { 3, 0 }, { 2, 0 }, { 1, 0 } }; EventSpin spin; /// 뽑기 고리가 도는 중(테스트). public bool Spinning { get { return spin != null && spin.Running; } } /// 칸 n 의 왼쪽 위(시안 좌표). Vector2 SlotPos(int n) { var g = L("rou_grid"); int k = ((n % 12) + 12) % 12; return new Vector2(At(g, 0) + Ring[k, 1] * (At(g, 2) + At(g, 3)), At(g, 1) + Ring[k, 0] * (At(g, 2) + At(g, 3))); } // ---------- Art(Static) ---------- void RouletteArt() { var rb = L("rou_bg"); float top = At(rb, 0), bottom = Hm - OutGameRoot.TabBarH; // 축제 마당 배경 = 폭 1080 기준 위에서부터(긴 화면 = 높이에 맞춰 키우고 가운데 자름) var tex = Resources.Load(S_("rou_bg_tex")); if (tex != null) { var raw = UiKit.At(art, "RouBg", 0f, top, 1080f, bottom - top).gameObject.AddComponent(); raw.texture = tex; raw.raycastTarget = false; float hNeed = bottom - top, hTex = 1080f * tex.height / tex.width; if (hNeed <= hTex) raw.uvRect = new Rect(0f, 1f - hNeed / hTex, 1f, hNeed / hTex); else { float wv = 1080f * hTex / hNeed / 1080f; // 보이는 가로 비율 raw.uvRect = new Rect((1f - wv) * 0.5f, 0f, wv, 1f); } } Solid(art, "RouDim", Col(rb, 1), 0f, top, 1080f, bottom - top); var shade = Solid(art, "RouShade", Color.white, 0f, top, 1080f, At(rb, 2)); var sc = Col(rb, 3); UiGradient.Add(shade, sc, A(sc, 0f)); var hd = L("rou_head"); var hc = L("rou_head_col"); Lab(art, "RouTitle", T("ev_rou_title"), At(hd, 2), Color.white, 'l', At(hd, 0), At(hd, 1), Col(hc, 0), 4f); // 바둑판(안쪽 나무 면 = 칸 묶음 둘레 pad · 표 실측) + 그림자 var g = L("rou_grid"); var bd = L("rou_board"); float pad = At(bd, 5); float bx0 = At(g, 0) - pad - At(bd, 1), by0 = At(g, 1) - pad - At(bd, 2), bw = At(bd, 3), bh = At(bd, 4); Glow(art, "BoardShadow", Col(bd, 6), bx0, by0 + At(bd, 7), bw, bh); Img(art, "Board", Sp(Str(bd, 0)), bx0, by0, bw, bh, Color.white); // 아래 묶음 바탕(횟수 판 · 긴 화면 = 아래로) var rc = L("rou_count"); var rcc = L("rou_count_col"); float cy0 = At(rc, 0) + Extra, cy1 = At(rc, 1) + Extra; Box(art, "CountPanel", "card", Col(rcc, 0), 20f, cy0, 1040f, cy1 - cy0); Box(art, "CountInner", "soft", Col(rcc, 1), At(rc, 2), cy0 + 14f, At(rc, 3) - At(rc, 2), cy1 - cy0 - 28f); Lab(art, "DrawsLabel", T("ev_rou_draws"), At(rc, 5), Col(rcc, 2), 'm', (At(rc, 2) + At(rc, 3)) * 0.5f, cy1 - 38f, Color.clear, 0f); // 안내 띠(판 아래) var nt = L("rou_notice"); float ny = Mathf.Max(At(g, 1) + 4f * At(g, 2) + 3f * At(g, 3) + At(nt, 0), by0 + bh + At(nt, 1)); var nl = Lab(art, "RouNotice", F("ev_rou_notice", Num(EventData.CfgInt("roulette_limited_every"))), At(nt, 2), Color.white, 'm', 540f, ny + At(nt, 3) * 0.5f + 1f, Color.clear, 0f); float nw = Mathf.Ceil(nl.preferredWidth) + At(nt, 4); var nb = Box(art, "RouNoticeBg", "soft", Col(nt, 5), 540f - nw * 0.5f, ny, nw, At(nt, 3)); nb.transform.SetSiblingIndex(nl.transform.GetSiblingIndex()); // 아래 버튼 줄 바탕(이벤트 미션 · 선물 팩 · 안내) var su = L("rou_sub"); var suc = L("rou_sub_col"); float sy = At(su, 0) + Extra; Box(art, "HintBg", "soft", Col(suc, 1), At(su, 7), sy + 6f, At(su, 8), At(su, 9)); var hint = Lab(art, "RouHint", T("ev_rou_hint"), At(su, 10), Color.white, 'm', 540f, sy + 6f + At(su, 9) * 0.5f, Col(suc, 2), 3f); hint.lineSpacing = 1.05f; } // ---------- Info(Event) ---------- void RouletteInfo() { var d = S.Save; var now = S.Now; var e = EventRules.St(d); var hd = L("rou_head"); var hc = L("rou_head_col"); Pill(info, "RouLeft", Left(EventRules.RouletteLeft(now)), At(hd, 3), At(hd, 4), At(hd, 5), At(hd, 6), 0f, true); // 보유 복주머니 float pbw = N("pill", 2); Box(info, "PouchRing", "soft", C("pill", 1), At(hd, 7), At(hd, 8), At(hd, 9), At(hd, 10)); Box(info, "PouchPill", "soft", C("pill", 0), At(hd, 7) + pbw, At(hd, 8) + pbw, At(hd, 9) - 2f * pbw, At(hd, 10) - 2f * pbw); ItemIcon(info, "PouchIcon", "ev_pouch", At(hd, 11), At(hd, 12), At(hd, 13), Color.white); Lab(info, "Pouch", Num(e.pouch), At(hd, 16), Color.white, 'm', At(hd, 14), At(hd, 15), C("stroke_dark"), 3f); // 확률 정보 var prob = Box(info, "Prob", "card", Col(hc, 1), At(hd, 17), At(hd, 18), At(hd, 19), At(hd, 20)); prob.raycastTarget = true; prob.gameObject.AddComponent