2026-11-19 13:37:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TKS.OutGame
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// 행운 룰렛 쪽 v4(PD 2026-11-22 「레퍼런스(지붕 달린 둥근 룰렛 · 걸린 목패 임무 판 · 궁전 전각) 참고해 다시 구성 · 지금은 조잡 · 화풍 불일치」 · 그림 = 아트 폴더 roulette_v4 · 좌표 = 표 rou_*) —
|
|
|
|
|
|
/// 궁전 전각 배경 · 남은 기간 · 한정 안내 · 보유 복주머니 · 왼쪽 등롱(제목 글자) · 오른쪽 걸린 목패(확률 정보) ·
|
|
|
|
|
|
/// 지붕 달린 둥근 바퀴(원판 12칸 = 틀 밑 · 최종 · 한정 칸 = 색 물 · 칸 = 아이콘 + 수량 · 꼬리표) · 가운데 금 단추(최종 보상 얼굴) · 금 바늘(지금 칸 + 칸 빛) ·
|
|
|
|
|
|
/// 받침 글자(최종 보상 · 규칙) · 문틀에 걸린 목패(뽑기 횟수 보상 · 막대 · 받기) · 뽑기 1회/10회 · 이벤트 미션 · 선물 팩 팝업.
|
|
|
|
|
|
/// 뽑기 = 바늘이 몇 바퀴 돌다 느려지며 멈춤(Under · Over 층 · Frame · 누르면 건너뜀) → 받은 보상 팝업.
|
2026-11-19 13:37:08 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class EventScreen
|
|
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
EventWheelSpin spin;
|
|
|
|
|
|
RectTransform needleRig, cursorRig;
|
|
|
|
|
|
int spinFrom;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>뽑기 바늘이 도는 중(테스트).</summary>
|
2026-11-19 13:37:08 +00:00
|
|
|
|
public bool Spinning
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return spin != null && spin.Running; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
// ---------- 바퀴 좌표 ----------
|
|
|
|
|
|
|
|
|
|
|
|
float WheelX
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return At(L("rou_shrine"), 1); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>긴 화면에서 바퀴 묶음이 내려가는 값(늘어난 몫 × 표 rou_extra).</summary>
|
|
|
|
|
|
float WheelShift
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return Extra * At(L("rou_extra"), 0); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float WheelY
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var sh = L("rou_shrine");
|
|
|
|
|
|
return At(sh, 2) + WheelShift + At(sh, 5) * At(sh, 3);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>걸이 끈(처마 끝 밑 y0 ~ 등롱 · 목패 위끝 · 굵기 · 색 = 표 rou_cord).</summary>
|
|
|
|
|
|
void Cord(Transform p, string name, float cx, float y0, float yEnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
var cd = L("rou_cord");
|
|
|
|
|
|
float w = At(cd, 0);
|
|
|
|
|
|
if (yEnd > y0) Solid(p, name, Col(cd, 1), cx - w * 0.5f, y0, w, yEnd - y0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SlotCount
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
get { return Mathf.Max(1, EventData.Slots.Count); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float SlotStep
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return 360f / SlotCount; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>칸 slot 가운데 방향으로 바퀴 가운데에서 r 떨어진 점(시안 좌표 · 칸 0 = 위 · 시계 방향).</summary>
|
|
|
|
|
|
Vector2 WheelPos(int slot, float r)
|
|
|
|
|
|
{
|
|
|
|
|
|
float a = slot * SlotStep * Mathf.Deg2Rad;
|
|
|
|
|
|
return new Vector2(WheelX + r * Mathf.Sin(a), WheelY - r * Mathf.Cos(a));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>바퀴 가운데에 붙은 빈 받침(돌리면 자식이 바퀴 가운데를 축으로 돈다) · 각 = 칸 0 에서 시계 방향.</summary>
|
|
|
|
|
|
RectTransform WheelRig(Transform p, string name, float deg)
|
|
|
|
|
|
{
|
|
|
|
|
|
var rig = UiKit.Rect(name, p, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(WheelX, -WheelY), Vector2.zero);
|
|
|
|
|
|
rig.localEulerAngles = new Vector3(0f, 0f, -deg);
|
|
|
|
|
|
return rig;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>칸 부채꼴(흰 그림 · 색 곱) — 받침 위에 칸 0 방향으로 놓고 받침을 칸 각도로 돌림.</summary>
|
|
|
|
|
|
RectTransform Wedge(Transform p, string name, int slot, Color c)
|
|
|
|
|
|
{
|
|
|
|
|
|
var wd = L("rou_wedge");
|
|
|
|
|
|
var sp = Sp(Str(wd, 0));
|
|
|
|
|
|
float sc = At(L("rou_shrine"), 3);
|
|
|
|
|
|
var rig = WheelRig(p, name + "Rig", slot * SlotStep);
|
|
|
|
|
|
if (sp == null) return rig;
|
|
|
|
|
|
float w = sp.rect.width * sc, h = sp.rect.height * sc, below = At(wd, 1) * sc;
|
|
|
|
|
|
Img(rig, name, sp, -w * 0.5f, -(below + h), w, h, c);
|
|
|
|
|
|
return rig;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------- Art(Static) ----------
|
|
|
|
|
|
|
|
|
|
|
|
void RouletteArt()
|
|
|
|
|
|
{
|
|
|
|
|
|
var rb = L("rou_bg");
|
|
|
|
|
|
float top = At(rb, 0), bottom = Hm - OutGameRoot.TabBarH;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
// 궁전 전각 배경 = 폭 1080 기준 위에서부터(긴 화면 = 높이에 맞춰 키우고 가운데 자름)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
var tex = Resources.Load<Texture2D>(S_("rou_bg_tex"));
|
|
|
|
|
|
if (tex != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var raw = UiKit.At(art, "RouBg", 0f, top, 1080f, bottom - top).gameObject.AddComponent<RawImage>();
|
|
|
|
|
|
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));
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var sc0 = Col(rb, 3);
|
|
|
|
|
|
UiGradient.Add(shade, sc0, A(sc0, 0f));
|
|
|
|
|
|
// 바퀴: 원판(틀 밑) → 최종 · 한정 칸 색 물 → 틀(원판 자리 = 투명 구멍)
|
|
|
|
|
|
var sh = L("rou_shrine");
|
|
|
|
|
|
float sc = At(sh, 3), wx = WheelX, wy = WheelY;
|
|
|
|
|
|
var fc = L("rou_face");
|
|
|
|
|
|
if (Mathf.RoundToInt(At(fc, 2)) != EventData.Slots.Count)
|
|
|
|
|
|
Debug.LogWarning("[TKS] 룰렛 원판 그림 칸 수(" + At(fc, 2) + ") ≠ 룰렛 칸 수(" + EventData.Slots.Count + ") — 아트 폴더 roulette_v4 wheel_parts.json n 을 바꿔 다시 그림");
|
|
|
|
|
|
float fw = At(fc, 1) * sc;
|
|
|
|
|
|
Img(art, "WheelFace", Sp(Str(fc, 0)), wx - fw * 0.5f, wy - fw * 0.5f, fw, fw, Color.white);
|
|
|
|
|
|
var wc = L("rou_wheel_col");
|
|
|
|
|
|
foreach (var s in EventData.Slots)
|
|
|
|
|
|
if (s.tag == EventData.TagFinal || s.tag == EventData.TagLimited)
|
|
|
|
|
|
Wedge(art, "Tint" + s.slot, s.slot, Col(wc, s.tag == EventData.TagFinal ? 0 : 1));
|
|
|
|
|
|
var ssp = Sp(Str(sh, 0));
|
|
|
|
|
|
if (ssp != null) Img(art, "Shrine", ssp, wx - At(sh, 4) * sc, At(sh, 2) + WheelShift, ssp.rect.width * sc, ssp.rect.height * sc, Color.white);
|
|
|
|
|
|
// 왼쪽 등롱 2(제목 글자 = 등 가운데) · 걸이 끈
|
|
|
|
|
|
var ln = L("rou_lantern");
|
|
|
|
|
|
var lsp = Sp(Str(ln, 0));
|
|
|
|
|
|
float lh = At(ln, 3), lw = lsp != null ? lh * lsp.rect.width / lsp.rect.height : lh * 0.4f, ly = At(ln, 2) + WheelShift;
|
|
|
|
|
|
Cord(art, "LanternCord", At(ln, 1), At(ln, 8) + WheelShift, ly + 4f);
|
|
|
|
|
|
Img(art, "Lanterns", lsp, At(ln, 1) - lw * 0.5f, ly, lw, lh, Color.white);
|
|
|
|
|
|
Lab(art, "Lamp1", T("ev_rou_lamp1"), At(ln, 4), Col(ln, 7), 'm', At(ln, 1), ly + lh * At(ln, 5), Color.clear, 0f).lineSpacing = 0.9f;
|
|
|
|
|
|
Lab(art, "Lamp2", T("ev_rou_lamp2"), At(ln, 4), Col(ln, 7), 'm', At(ln, 1), ly + lh * At(ln, 6), Color.clear, 0f).lineSpacing = 0.9f;
|
|
|
|
|
|
var ptg = L("rou_probtag");
|
|
|
|
|
|
Cord(art, "ProbCord", At(ptg, 1), At(ptg, 7) + WheelShift, At(ptg, 2) + WheelShift + 4f);
|
|
|
|
|
|
// 횟수 보상 문틀 + 걸린 목패 바탕(긴 화면 = 아래로)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
var bd = L("rou_board");
|
2026-11-23 05:34:20 +00:00
|
|
|
|
Img(art, "Gate", Sp(Str(bd, 0)), At(bd, 1), At(bd, 2) + Extra, At(bd, 3), At(bd, 4), Color.white);
|
|
|
|
|
|
var tb = L("rou_tablet");
|
|
|
|
|
|
var tsp = Sp(Str(tb, 0));
|
|
|
|
|
|
int n = EventData.Of("count").Count;
|
|
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
|
|
Img(art, "Tablet" + i, tsp, TabletX(i, n), At(tb, 3) + Extra, At(tb, 1), At(tb, 2), Color.white);
|
|
|
|
|
|
// 아래 버튼 줄 안내 판(이벤트 미션 · 선물 팩 사이)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>걸린 목패 i 왼쪽 x(n 장을 가운데 정렬 · 표 rou_tablet 폭 · 간격).</summary>
|
|
|
|
|
|
float TabletX(int i, int n)
|
|
|
|
|
|
{
|
|
|
|
|
|
var tb = L("rou_tablet");
|
|
|
|
|
|
float w = At(tb, 1), gap = At(tb, 4);
|
|
|
|
|
|
return 540f - (n * w + (n - 1) * gap) * 0.5f + i * (w + gap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-19 13:37:08 +00:00
|
|
|
|
// ---------- Info(Event) ----------
|
|
|
|
|
|
|
|
|
|
|
|
void RouletteInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
var d = S.Save;
|
|
|
|
|
|
var now = S.Now;
|
|
|
|
|
|
var e = EventRules.St(d);
|
|
|
|
|
|
var hd = L("rou_head");
|
2026-11-23 05:34:20 +00:00
|
|
|
|
float pw = Pill(info, "RouLeft", Left(EventRules.RouletteLeft(now)), At(hd, 0), At(hd, 1), At(hd, 2), At(hd, 3), 0f, true);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
// 보유 복주머니
|
|
|
|
|
|
float pbw = N("pill", 2);
|
2026-11-23 05:34:20 +00:00
|
|
|
|
Box(info, "PouchRing", "soft", C("pill", 1), At(hd, 4), At(hd, 5), At(hd, 6), At(hd, 7));
|
|
|
|
|
|
Box(info, "PouchPill", "soft", C("pill", 0), At(hd, 4) + pbw, At(hd, 5) + pbw, At(hd, 6) - 2f * pbw, At(hd, 7) - 2f * pbw);
|
|
|
|
|
|
ItemIcon(info, "PouchIcon", "ev_pouch", At(hd, 8), At(hd, 9), At(hd, 10), Color.white);
|
|
|
|
|
|
Lab(info, "Pouch", Num(e.pouch), At(hd, 13), Color.white, 'm', At(hd, 11), At(hd, 12), C("stroke_dark"), 3f);
|
|
|
|
|
|
// 한정 안내(남은 기간 ~ 복주머니 사이 가운데 · 넘치면 글자를 줄임)
|
|
|
|
|
|
var nt = L("rou_notice");
|
|
|
|
|
|
float nx0 = At(hd, 0) + pw + At(nt, 3), nx1 = At(hd, 4) - At(nt, 3), mid = (nx0 + nx1) * 0.5f, ny = At(hd, 1) + At(hd, 2) * 0.5f;
|
|
|
|
|
|
var nl = Lab(info, "RouNotice", F("ev_rou_notice", Num(EventData.CfgInt("roulette_limited_every"))), At(nt, 0), Color.white, 'm', mid, ny + 1f, Color.clear, 0f);
|
|
|
|
|
|
float avail = nx1 - nx0 - 2f * At(nt, 2);
|
|
|
|
|
|
if (nl.preferredWidth > avail && avail > 0f) nl.fontSize = Mathf.Max(1, Mathf.FloorToInt(nl.fontSize * avail / nl.preferredWidth));
|
|
|
|
|
|
float nw = Mathf.Min(nx1 - nx0, Mathf.Ceil(nl.preferredWidth) + 2f * At(nt, 2));
|
|
|
|
|
|
var nb = Box(info, "RouNoticeBg", "soft", Col(nt, 4), mid - nw * 0.5f, ny - At(nt, 1) * 0.5f, nw, At(nt, 1));
|
|
|
|
|
|
nb.transform.SetSiblingIndex(nl.transform.GetSiblingIndex());
|
|
|
|
|
|
// 확률 정보 = 오른쪽 걸린 목패(누름)
|
|
|
|
|
|
var pt = L("rou_probtag");
|
|
|
|
|
|
var psp = Sp(Str(pt, 0));
|
|
|
|
|
|
float ph = At(pt, 3), pw2 = psp != null ? ph * psp.rect.width / psp.rect.height : ph * 0.5f;
|
|
|
|
|
|
var prob = Img(info, "Prob", psp, At(pt, 1) - pw2 * 0.5f, At(pt, 2) + WheelShift, pw2, ph, Color.white);
|
|
|
|
|
|
prob.type = Image.Type.Simple; // 9 분할 그림이지만 여기는 비율 그대로(작게)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
prob.raycastTarget = true;
|
|
|
|
|
|
prob.gameObject.AddComponent<Button>().onClick.AddListener(ShowProb);
|
2026-11-23 05:34:20 +00:00
|
|
|
|
Lab(prob.transform, "ProbText", T("ev_rou_prob_tag"), At(pt, 4), Col(pt, 6), 'm', pw2 * 0.5f, ph * At(pt, 5), Color.clear, 0f).lineSpacing = 0.95f;
|
|
|
|
|
|
WheelSlots(e);
|
|
|
|
|
|
PedestalText(d);
|
|
|
|
|
|
if (!Spinning) WheelPointer(e.cursor);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
CountInfo(d);
|
|
|
|
|
|
// 뽑기 1회 · 10회
|
|
|
|
|
|
var rbn = L("rou_btn");
|
|
|
|
|
|
var bs = L("btn_stroke");
|
|
|
|
|
|
float by = At(rbn, 0) + Extra, bh = At(rbn, 1);
|
|
|
|
|
|
int n10 = EventData.CfgInt("roulette_count_10");
|
|
|
|
|
|
DrawBtn("Draw1", "btn_sky", Col(bs, 1), 1, At(rbn, 2), by, At(rbn, 3), bh, At(rbn, 5));
|
|
|
|
|
|
DrawBtn("Draw10", "btn_l_yellow", Col(bs, 3), n10, At(rbn, 4), by, At(rbn, 3), bh, At(rbn, 5));
|
|
|
|
|
|
// 이벤트 미션 · 선물 팩
|
|
|
|
|
|
var su = L("rou_sub");
|
|
|
|
|
|
float sy = At(su, 0) + Extra;
|
|
|
|
|
|
SubBtn("QuestBtn", S_("quest_icon"), T("ev_rou_quest"), At(su, 3), sy, EventRules.AnyQuest(d, now), OpenQuest);
|
|
|
|
|
|
SubBtn("PackBtn", S_("pack_icon"), T("ev_rou_pack"), At(su, 4), sy, false, OpenPack);
|
|
|
|
|
|
if (Spinning) SpinSkip();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>바퀴 칸(아이콘 + 수량 · 최종 = 장수 얼굴 + 별 · 최종 · 한정 = 꼬리표) — 칸 이름 Slot<n>(테스트).</summary>
|
|
|
|
|
|
void WheelSlots(EventState e)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var w = L("rou_wheel");
|
|
|
|
|
|
var wc = L("rou_wheel_col");
|
|
|
|
|
|
float isz = At(w, 1);
|
|
|
|
|
|
foreach (var s in EventData.Slots)
|
|
|
|
|
|
{
|
|
|
|
|
|
var p = WheelPos(s.slot, At(w, 0));
|
|
|
|
|
|
float cy = p.y + At(w, 2);
|
|
|
|
|
|
var cell = UiKit.At(info, "Slot" + s.slot, p.x - isz * 0.5f, cy - isz * 0.5f, isz, isz);
|
|
|
|
|
|
var it = EventData.ItemOf(s.reward.id);
|
|
|
|
|
|
ItemIcon(cell, "Icon", s.reward.id, 0f, 0f, isz, Color.white);
|
|
|
|
|
|
float ly = isz * 0.5f + At(w, 3) - At(w, 2);
|
|
|
|
|
|
if (it != null && it.kind == "hero")
|
|
|
|
|
|
{
|
|
|
|
|
|
float ss = Mathf.Floor(At(w, 4) * 1.1f);
|
|
|
|
|
|
for (int k = 0; k < it.star; k++)
|
|
|
|
|
|
UiKit.Icon(cell, "star_l", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(isz * 0.5f - it.star * ss * 0.46f + k * ss * 0.92f, -(ly - ss * 0.5f)), ss);
|
|
|
|
|
|
}
|
|
|
|
|
|
else Lab(cell, "Slot" + s.slot + "_Qty", Qty(s.reward.n, true), At(w, 4), Col(wc, 3), 'm', isz * 0.5f, ly, Col(wc, 4), 3f);
|
|
|
|
|
|
string tag = s.tag == EventData.TagFinal ? T("ev_rou_wtag_final") : s.tag == EventData.TagLimited ? T("ev_rou_wtag_limited") : null;
|
|
|
|
|
|
if (string.IsNullOrEmpty(tag)) continue;
|
|
|
|
|
|
var tp = WheelPos(s.slot, At(w, 5));
|
|
|
|
|
|
var tt = Lab(info, "Slot" + s.slot + "_Tag", tag, At(w, 6), Col(wc, 7), 'm', tp.x, tp.y, Color.clear, 0f);
|
|
|
|
|
|
float tw = Mathf.Ceil(tt.preferredWidth) + At(w, 6) * 0.9f, th = At(w, 6) * 1.5f;
|
|
|
|
|
|
var tb = Box(info, "Slot" + s.slot + "_TagBg", "soft", Col(wc, 5), tp.x - tw * 0.5f, tp.y - th * 0.5f, tw, th);
|
|
|
|
|
|
UiKit.Border(tb, Col(wc, 6), 2f);
|
|
|
|
|
|
tb.transform.SetSiblingIndex(tt.transform.GetSiblingIndex());
|
|
|
|
|
|
}
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>받침 글자 — 첫 줄 = 「최종 보상 · 3성 장비」 · 둘째 = 「n회마다 반드시 획득 · 남은 n회」.</summary>
|
|
|
|
|
|
void PedestalText(SaveData d)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var fin = EventData.FinalSlot;
|
|
|
|
|
|
if (fin == null) return;
|
|
|
|
|
|
var it = EventData.ItemOf(fin.reward.id);
|
|
|
|
|
|
string name;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
if (it != null && it.kind == "hero")
|
|
|
|
|
|
{
|
|
|
|
|
|
var h = S.Db.Heroes.Get(it.arg);
|
2026-11-23 05:34:20 +00:00
|
|
|
|
name = F("ev_hero_star", it.star.ToString(CultureInfo.InvariantCulture), h != null ? h.nameKo : it.arg);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
2026-11-23 05:34:20 +00:00
|
|
|
|
else name = ItemName(S.Db, fin.reward.id);
|
|
|
|
|
|
var pd = L("rou_pedestal");
|
|
|
|
|
|
Lab(info, "FinalName", F("ev_rou_final_title", name), At(pd, 2), Col(pd, 4), 'm', WheelX, At(pd, 0) + WheelShift, Col(pd, 6), 3f);
|
|
|
|
|
|
Lab(info, "FinalRule", F("ev_rou_final_rule", Num(EventData.CfgInt("roulette_final_every")), Num(EventRules.FinalLeft(d))), At(pd, 3), Col(pd, 5), 'm', WheelX, At(pd, 1) + WheelShift, Col(pd, 6), 3f);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>지금 칸 빛(Under · 칸 아이콘 밑) + 금 바늘 · 가운데 단추 · 최종 보상 얼굴(Over · 칸 위) — slot 방향으로.</summary>
|
|
|
|
|
|
void WheelPointer(int slot)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
UiKit.Clear(under);
|
|
|
|
|
|
UiKit.Clear(over);
|
|
|
|
|
|
var wc = L("rou_wheel_col");
|
|
|
|
|
|
var w = L("rou_wheel");
|
|
|
|
|
|
cursorRig = Wedge(under, "Cursor", slot, Col(wc, 2));
|
|
|
|
|
|
needleRig = WheelRig(over, "NeedleRig", slot * SlotStep);
|
|
|
|
|
|
var nsp = Sp(S_("rou_needle"));
|
|
|
|
|
|
float nh = At(w, 9), nw = nsp != null ? nh * nsp.rect.width / nsp.rect.height : nh * 0.6f;
|
|
|
|
|
|
Img(needleRig, "Needle", nsp, -nw * 0.5f, -(At(w, 10) + nh), nw, nh, Color.white);
|
|
|
|
|
|
float hd = At(w, 7), fd = At(w, 8);
|
|
|
|
|
|
Img(over, "Hub", Sp(S_("rou_hub")), WheelX - hd * 0.5f, WheelY - hd * 0.5f, hd, hd, Color.white);
|
|
|
|
|
|
// 최종 보상 얼굴 = 금 고리 구멍 가운데(단추 가운데보다 표 값만큼 위) · 밑에 구멍 전체 자주 원(그림 투명 부분 · 가장자리 틈이 크림으로 비치지 않게 · QA r1 B-1)
|
|
|
|
|
|
float fy = WheelY + At(w, 11);
|
|
|
|
|
|
var back = UiKit.Dot("HubBack", over, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(WheelX, -fy), fd + 4f, Col(wc, 8));
|
|
|
|
|
|
back.sprite = UiKit.Circle;
|
|
|
|
|
|
back.raycastTarget = false;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
var fin = EventData.FinalSlot;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
if (fin != null) ItemIcon(over, "HubFace", fin.reward.id, WheelX - fd * 0.5f, fy - fd * 0.5f, fd, Color.white, true);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>뽑기 횟수 보상 = 문틀 현판(누적 횟수) + 걸린 목패(보상 아이콘 · 수량 · 막대 / 받기 / 받음 · 누름 = 받기).</summary>
|
2026-11-19 13:37:08 +00:00
|
|
|
|
void CountInfo(SaveData d)
|
|
|
|
|
|
{
|
|
|
|
|
|
var e = EventRules.St(d);
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var pl = L("rou_plaque");
|
|
|
|
|
|
float py = At(pl, 1) + Extra;
|
|
|
|
|
|
var pt = Lab(info, "CountTitle", F("ev_rou_count_title", Num(e.draws)), At(pl, 3), Col(pl, 5), 'm', 540f, py + 1f, Color.clear, 0f);
|
|
|
|
|
|
float plw = Mathf.Ceil(pt.preferredWidth) + 2f * At(pl, 4);
|
|
|
|
|
|
var pimg = Img(info, "CountPlaque", Sp(Str(pl, 0)), 540f - plw * 0.5f, py - At(pl, 2) * 0.5f, plw, At(pl, 2), Color.white);
|
|
|
|
|
|
pimg.transform.SetSiblingIndex(pt.transform.GetSiblingIndex());
|
|
|
|
|
|
var tb = L("rou_tablet");
|
|
|
|
|
|
var tc = L("rou_tablet_col");
|
|
|
|
|
|
var bs = L("btn_stroke");
|
2026-11-19 13:37:08 +00:00
|
|
|
|
var cnt = EventData.Of("count");
|
2026-11-23 05:34:20 +00:00
|
|
|
|
float tw = At(tb, 1), th = At(tb, 2), ty = At(tb, 3) + Extra, isz = At(tb, 5);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
for (int i = 0; i < cnt.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var c = cnt[i];
|
2026-11-23 05:34:20 +00:00
|
|
|
|
float x = TabletX(i, cnt.Count), cx = x + tw * 0.5f, iy = ty + At(tb, 6);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
bool got = EventRules.CountGot(d, c), ready = EventRules.CountReady(d, c);
|
|
|
|
|
|
var cc = c;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var hit = Img(info, "CountHit" + i, null, x, ty, tw, th, new Color(0f, 0f, 0f, 0f));
|
|
|
|
|
|
hit.raycastTarget = true;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
hit.gameObject.AddComponent<Button>().onClick.AddListener(() => After(EventRules.ClaimCount(S.Db, S.Save, cc, S.Rng), null));
|
2026-11-23 05:34:20 +00:00
|
|
|
|
if (ready) Glow(info, "CountGlow" + i, C("cell_col", 9), cx - isz * 0.6f, iy - isz * 0.6f, isz * 1.2f, isz * 1.2f);
|
|
|
|
|
|
var rw = c.rewards.Count > 0 ? c.rewards[0] : new EventData.Reward { id = "", n = 0 };
|
|
|
|
|
|
var ic = ItemIcon(info, "Count" + i, rw.id, cx - isz * 0.5f, iy - isz * 0.5f, isz, Color.white);
|
|
|
|
|
|
if (got) Gray(ic);
|
|
|
|
|
|
Lab(info, "CountQty" + i, Qty(rw.n, true), At(tb, 13), Color.white, 'r', cx + At(tb, 11), iy + At(tb, 12), Col(tc, 2), 3f);
|
|
|
|
|
|
float bw = At(tb, 10), bh = At(tb, 8), by = ty + th - At(tb, 7);
|
|
|
|
|
|
if (ready)
|
|
|
|
|
|
{
|
|
|
|
|
|
Btn(info, "CountBtn" + i, "btn_l_green", Color.white, T("ev_claim"), At(tb, 9) + 2f, Col(bs, 0), cx - bw * 0.5f, by - 6f, bw, bh + 12f, () => After(EventRules.ClaimCount(S.Db, S.Save, cc, S.Rng), null));
|
|
|
|
|
|
RedDot(info, x + tw - 18f, iy - isz * 0.45f, N("red_dot", 2) * 0.93f);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var groove = Box(info, "CountBar" + i, "soft", Col(tc, 0), cx - bw * 0.5f, by, bw, bh);
|
|
|
|
|
|
UiKit.Border(groove, Col(tc, 3), 2f);
|
|
|
|
|
|
float pr = got ? 1f : Mathf.Clamp01(c.target > 0 ? e.draws / (float)c.target : 0f);
|
|
|
|
|
|
float fwid = Mathf.Floor((bw - 6f) * pr);
|
|
|
|
|
|
if (fwid > 0f) Box(info, "CountFill" + i, "soft", Col(tc, 1), cx - bw * 0.5f + 3f, by + 3f, Mathf.Max(fwid, bh - 6f), bh - 6f);
|
|
|
|
|
|
string lab = got ? T("ev_rou_got") : F("ev_rou_count_prog", Num(Mathf.Min(e.draws, c.target)), Num(c.target));
|
|
|
|
|
|
Lab(info, "CountLab" + i, lab, At(tb, 9), Color.white, 'm', cx, by + bh * 0.5f + 1f, Col(tc, 2), 3f);
|
|
|
|
|
|
if (got) Check(info, cx + isz * 0.25f, iy - isz * 0.62f, N("check", 2));
|
|
|
|
|
|
}
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
void SubBtn(string name, string icon, string label, float x, float y, bool dot, Action onClick)
|
|
|
|
|
|
{
|
|
|
|
|
|
var su = L("rou_sub");
|
|
|
|
|
|
var suc = L("rou_sub_col");
|
|
|
|
|
|
float w = At(su, 1), h = At(su, 2);
|
|
|
|
|
|
var b = Box(info, name, "card", Col(suc, 0), x, y, w, h);
|
|
|
|
|
|
b.raycastTarget = true;
|
|
|
|
|
|
b.gameObject.AddComponent<Button>().onClick.AddListener(() => onClick());
|
|
|
|
|
|
Img(b.transform, "Icon", Sp(icon), 14f, (h - At(su, 5)) * 0.5f, At(su, 5), At(su, 5), Color.white).preserveAspect = true;
|
|
|
|
|
|
Lab(b.transform, name + "_Text", label, At(su, 6), Color.white, 'l', 100f, h * 0.5f + 1f, Col(suc, 2), 3f);
|
|
|
|
|
|
if (dot) RedDot(b.transform, w - 10f, 8f, N("red_dot", 2));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>뽑기 버튼(「뽑기 n회 [복주머니] 비용」 한 줄 · 시안 button sub_icon).</summary>
|
|
|
|
|
|
void DrawBtn(string name, string skin, Color stroke, int count, float x, float y, float w, float h, float font)
|
|
|
|
|
|
{
|
|
|
|
|
|
var b = Btn(info, name, skin, Color.white, "", font, stroke, x, y, w, h, () => DoDraw(count));
|
|
|
|
|
|
var t1 = Lab(b.transform, name + "_Text", F("ev_rou_draw", Num(count)), font, Color.white, 'l', 0f, h * 0.47f, stroke, 3f);
|
|
|
|
|
|
float isz = Mathf.Floor(h * At(L("rou_btn"), 6));
|
|
|
|
|
|
var t2 = Lab(b.transform, name + "_Cost", Num(EventRules.Cost(count)), font, Color.white, 'l', 0f, h * 0.47f, stroke, 3f);
|
|
|
|
|
|
float w1 = Mathf.Ceil(t1.preferredWidth), w2 = Mathf.Ceil(t2.preferredWidth);
|
|
|
|
|
|
float tw = w1 + 14f + isz + 6f + w2, x0 = (w - tw) * 0.5f;
|
|
|
|
|
|
t1.rectTransform.anchoredPosition = new Vector2(x0, t1.rectTransform.anchoredPosition.y);
|
|
|
|
|
|
ItemIcon(b.transform, name + "_Icon", "ev_pouch", x0 + w1 + 14f, h * 0.47f - isz * 0.5f, isz, Color.white);
|
|
|
|
|
|
t2.rectTransform.anchoredPosition = new Vector2(x0 + w1 + 14f + isz + 6f, t2.rectTransform.anchoredPosition.y);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-19 13:37:08 +00:00
|
|
|
|
// ---------- 뽑기 ----------
|
|
|
|
|
|
|
|
|
|
|
|
void DoDraw(int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Spinning) return;
|
|
|
|
|
|
var got = new List<EventRules.Granted>();
|
|
|
|
|
|
string why;
|
|
|
|
|
|
int from = EventRules.St(S.Save).cursor;
|
|
|
|
|
|
var res = EventRules.Draw(S.Db, S.Save, count, S.Now, S.Rng, got, out why);
|
|
|
|
|
|
if (res == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Root.Toast(T(why));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
spinFrom = from;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
S.Commit(); // 저장 먼저(연출 중 종료돼도 보상 유지) · 바늘은 연출이 끝난 뒤 지금 칸으로
|
2026-11-19 13:37:08 +00:00
|
|
|
|
StartSpin(res.Count > 0 ? res[res.Count - 1] : 0, () => ShowRewards(got, "ev_rou_result"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>바늘 = 화면에 있던 칸(spinFrom)에서 표 바퀴 수만큼 돌고 멈출 칸까지 · 끝으로 갈수록 느려짐(3차 감속) · 칸 빛 = 바늘 아래 칸.</summary>
|
2026-11-19 13:37:08 +00:00
|
|
|
|
void StartSpin(int target, Action done)
|
|
|
|
|
|
{
|
|
|
|
|
|
StopSpin();
|
2026-11-23 05:34:20 +00:00
|
|
|
|
var sp = L("wheel_spin");
|
|
|
|
|
|
int n = SlotCount;
|
|
|
|
|
|
WheelPointer(spinFrom);
|
|
|
|
|
|
int steps = ((target - spinFrom) % n + n) % n;
|
|
|
|
|
|
float from = spinFrom * SlotStep, to = from + Mathf.RoundToInt(At(sp, 0)) * 360f + steps * SlotStep;
|
|
|
|
|
|
if (to - from < SlotStep) to += 360f;
|
|
|
|
|
|
spin = over.gameObject.AddComponent<EventWheelSpin>();
|
|
|
|
|
|
spin.Run(needleRig, cursorRig, from, to, At(sp, 1), At(sp, 2), SlotStep, () =>
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
StopSpin();
|
|
|
|
|
|
BuildInfo();
|
|
|
|
|
|
done();
|
|
|
|
|
|
});
|
2026-11-23 05:34:20 +00:00
|
|
|
|
BuildInfo(); // 도는 동안 = 건너뛰기 덮개(RouletteInfo · 바늘은 그대로)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>도는 동안 누르면 건너뜀(정보 층 맨 위 투명 덮개 · 다른 버튼 막음).</summary>
|
|
|
|
|
|
void SpinSkip()
|
|
|
|
|
|
{
|
|
|
|
|
|
var skip = UiKit.At(info, "SpinSkip", 0f, 0f, 1080f, Hm).gameObject.AddComponent<Image>();
|
|
|
|
|
|
skip.color = new Color(0f, 0f, 0f, 0f);
|
|
|
|
|
|
skip.raycastTarget = true;
|
|
|
|
|
|
skip.gameObject.AddComponent<Button>().onClick.AddListener(() => { if (spin != null) spin.Finish(); });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void StopSpin()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (spin != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
spin.Cancel();
|
2026-11-23 05:34:20 +00:00
|
|
|
|
UnityEngine.Object.Destroy(spin);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
spin = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fx != null) UiKit.Clear(fx);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>확률 정보(게임 팝업 · 칸마다 등급 색 점 + 아이콘 + 이름 × 수량 + 확률 · 최종 · 한정 규칙 · PD 결정 ⑤ = 등급 색은 이 창에만).</summary>
|
|
|
|
|
|
void ShowProb()
|
|
|
|
|
|
{
|
|
|
|
|
|
var pp = L("prob_pop");
|
|
|
|
|
|
float lh = At(pp, 0), icon = At(pp, 1), font = At(pp, 2);
|
|
|
|
|
|
var slots = EventData.Slots;
|
|
|
|
|
|
float sum = 0f;
|
|
|
|
|
|
foreach (var s in slots) sum += Mathf.Max(0f, s.weight);
|
|
|
|
|
|
var content = Root.ModalCustom(T("ev_prob_title"), At(pp, 3) + (slots.Count + 2) * lh, new OutGameRoot.ModalButton(T("ev_ok"), UiKit.Dark, null));
|
|
|
|
|
|
float y = 0f;
|
|
|
|
|
|
var colors = L("frame_col");
|
|
|
|
|
|
foreach (var s in slots)
|
|
|
|
|
|
{
|
|
|
|
|
|
Color fc = Color.white;
|
|
|
|
|
|
foreach (var kv in colors)
|
|
|
|
|
|
{
|
|
|
|
|
|
var p = kv.Split(':');
|
|
|
|
|
|
Color cc;
|
|
|
|
|
|
if (p.Length == 2 && p[0].Trim() == s.frame && ColorUtility.TryParseHtmlString(p[1].Trim(), out cc)) fc = cc;
|
|
|
|
|
|
}
|
|
|
|
|
|
var dot = UiKit.Dot("ProbDot" + s.slot, content, new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(At(pp, 4), -(y + lh * 0.5f)), At(pp, 5), fc);
|
|
|
|
|
|
dot.sprite = UiKit.Circle;
|
|
|
|
|
|
ItemIcon(content, "ProbIcon" + s.slot, s.reward.id, At(pp, 6), y + (lh - icon) * 0.5f, icon, Color.white);
|
|
|
|
|
|
string nm = F("ev_prob_line", ItemName(S.Db, s.reward.id), Qty(s.reward.n, false));
|
|
|
|
|
|
if (s.tag == EventData.TagFinal) nm += " · " + T("ev_tag_final");
|
|
|
|
|
|
else if (s.tag == EventData.TagLimited) nm += " · " + T("ev_tag_limited");
|
|
|
|
|
|
UiKit.Label(content, nm, Mathf.RoundToInt(font), UiKit.Ink, TextAnchor.MiddleLeft, new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(At(pp, 6) + icon + 14f, -(y + lh * 0.5f)), new Vector2(At(pp, 7), lh)).name = "ProbName" + s.slot;
|
|
|
|
|
|
float pct = sum > 0f ? s.weight / sum * 100f : 0f;
|
|
|
|
|
|
UiKit.Label(content, F("ev_prob_pct", pct.ToString("0.##", CultureInfo.InvariantCulture)), Mathf.RoundToInt(font), UiKit.Ink, TextAnchor.MiddleRight, new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(-10f, -(y + lh * 0.5f)), new Vector2(200f, lh)).name = "ProbPct" + s.slot;
|
|
|
|
|
|
y += lh;
|
|
|
|
|
|
}
|
|
|
|
|
|
UiKit.Label(content, F("ev_prob_final", Num(EventData.CfgInt("roulette_final_every"))) + "\n" + F("ev_prob_limited", Num(EventData.CfgInt("roulette_limited_every"))), Mathf.RoundToInt(font * 0.9f), UiKit.InkSoft, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(10f, -(y + 10f)), new Vector2(At(pp, 7) + 200f, lh * 2f));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------- 팝업: 이벤트 미션 · 선물 팩 ----------
|
|
|
|
|
|
|
|
|
|
|
|
void OpenQuest()
|
|
|
|
|
|
{
|
|
|
|
|
|
float x0, y0, x1, y1;
|
|
|
|
|
|
var fit = OpenPopup("EventQuest", "ev_quest_title", out x0, out y0, out x1, out y1);
|
|
|
|
|
|
var body = UiKit.At(fit, "Body", 0f, 0f, 1080f, Hm);
|
|
|
|
|
|
UiLayer.Nest(body.gameObject, UiRate.Event, true);
|
|
|
|
|
|
PopBanner(fit, S_("quest_head"), x0 + 30f, y0 + At(L("pop_banner"), 7), Left(EventRules.RouletteLeft(S.Now)));
|
|
|
|
|
|
popupRefresh = () => QuestRows(body, x0, y0, x1, y1);
|
|
|
|
|
|
popupRefresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QuestRows(RectTransform body, float x0, float y0, float x1, float y1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UiKit.Clear(body);
|
|
|
|
|
|
var q = L("pop_quest");
|
|
|
|
|
|
var d = S.Save;
|
|
|
|
|
|
var now = S.Now;
|
|
|
|
|
|
var bs = L("btn_stroke");
|
|
|
|
|
|
var list = EventData.Of("quest");
|
|
|
|
|
|
list.Sort((a, b) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
int ka = EventRules.QuestGot(d, a) ? 2 : EventRules.QuestReady(d, a, now) ? 0 : 1;
|
|
|
|
|
|
int kb = EventRules.QuestGot(d, b) ? 2 : EventRules.QuestReady(d, b, now) ? 0 : 1;
|
|
|
|
|
|
return ka != kb ? ka.CompareTo(kb) : a.order.CompareTo(b.order);
|
|
|
|
|
|
});
|
|
|
|
|
|
float ry = y0 + At(q, 0), rh = At(q, 1), gap = At(q, 2), inset = At(q, 3);
|
|
|
|
|
|
foreach (var r in list)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ry + rh > y1 - 26f) break;
|
|
|
|
|
|
int p = EventRules.QuestProgress(d, r);
|
|
|
|
|
|
bool got = EventRules.QuestGot(d, r), ready = EventRules.QuestReady(d, r, now);
|
|
|
|
|
|
var row = Box(body, "Quest" + r.order, "soft", C("pop_row"), x0 + inset, ry, x1 - x0 - 2f * inset, rh).transform;
|
|
|
|
|
|
float lx = At(q, 5) - inset;
|
|
|
|
|
|
Lab(row, "QText" + r.order, MissionText(r.sKind, r.arg, r.target, r.textKey), At(q, 4), Color.white, 'l', lx, At(q, 16), Color.clear, 0f);
|
|
|
|
|
|
float bx0 = lx, bx1 = At(q, 6) - inset, byy = At(q, 7), bh = At(q, 8);
|
|
|
|
|
|
Box(row, "Track", "card", C("pop_track"), bx0, byy - bh * 0.5f, bx1 - bx0, bh);
|
|
|
|
|
|
float fw = Mathf.Floor((bx1 - bx0 - 8f) * Mathf.Min(1f, r.target > 0 ? p / (float)r.target : 0f));
|
|
|
|
|
|
if (fw > 10f)
|
|
|
|
|
|
{
|
|
|
|
|
|
var fill = Box(row, "Fill", "soft", Color.white, bx0 + 4f, byy - bh * 0.5f + 4f, fw, bh - 8f);
|
|
|
|
|
|
UiGradient.Add(fill, C("pop_green", 0), C("pop_green", 1));
|
|
|
|
|
|
}
|
|
|
|
|
|
Lab(row, "QProg" + r.order, F("ev_rou_count_prog", Num(Mathf.Min(p, r.target)), Num(r.target)), At(q, 9), Color.white, 'm', (bx0 + bx1) * 0.5f, byy + 1f, C("stroke_dark"), 3f);
|
|
|
|
|
|
var rw = r.rewards.Count > 0 ? r.rewards[0] : new EventData.Reward { id = "ev_pouch", n = 0 };
|
|
|
|
|
|
Framed(row, "QRw" + r.order, rw.id, rw.n, At(q, 12), S_("frame_pouch"), At(q, 10) - inset, At(q, 11));
|
|
|
|
|
|
float bw = At(q, 13), bhh = At(q, 14), bxx = x1 - x0 - 2f * inset - At(q, 15) - bw, byb = Mathf.Floor((rh - bhh) * 0.5f);
|
|
|
|
|
|
if (got) Btn(row, "QBtn" + r.order, "btn_gray", Color.white, T("ev_done"), 36f, Col(bs, 2), bxx, byb, bw, bhh, null).interactable = false;
|
|
|
|
|
|
else if (ready)
|
|
|
|
|
|
{
|
|
|
|
|
|
var rr = r;
|
|
|
|
|
|
Btn(row, "QBtn" + r.order, "btn_l_green", Color.white, T("ev_claim"), 38f, Col(bs, 0), bxx, byb, bw, bhh, () => After(EventRules.ClaimQuest(S.Db, S.Save, rr, S.Now, S.Rng), null));
|
|
|
|
|
|
RedDot(row, bxx + bw - 8f, byb + 6f, N("red_dot", 2));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var kind = r.sKind;
|
|
|
|
|
|
Btn(row, "QBtn" + r.order, "btn_sky", Color.white, T("ev_go"), 38f, Col(bs, 1), bxx, byb, bw, bhh, () => Go(kind));
|
|
|
|
|
|
}
|
|
|
|
|
|
ry += rh + gap;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OpenPack()
|
|
|
|
|
|
{
|
|
|
|
|
|
float x0, y0, x1, y1;
|
|
|
|
|
|
var fit = OpenPopup("EventPack", "ev_pack_title", out x0, out y0, out x1, out y1);
|
|
|
|
|
|
var body = UiKit.At(fit, "Body", 0f, 0f, 1080f, Hm);
|
|
|
|
|
|
UiLayer.Nest(body.gameObject, UiRate.Event, true);
|
|
|
|
|
|
PopBanner(fit, S_("pack_head"), x0 + 30f, y0 + At(L("pop_banner"), 7), Left(EventRules.RouletteLeft(S.Now)));
|
|
|
|
|
|
popupRefresh = () => PackRows(body, x0, y0, x1, y1);
|
|
|
|
|
|
popupRefresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PackRows(RectTransform body, float x0, float y0, float x1, float y1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UiKit.Clear(body);
|
|
|
|
|
|
var q = L("pop_pack");
|
|
|
|
|
|
var pc = L("pop_pack_col");
|
|
|
|
|
|
var bs = L("btn_stroke");
|
|
|
|
|
|
var d = S.Save;
|
|
|
|
|
|
float ry = y0 + At(q, 0), rh = At(q, 1), gap = At(q, 2), inset = At(q, 3);
|
|
|
|
|
|
foreach (var r in EventData.Of("pack"))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ry + rh > y1 - 26f) break;
|
|
|
|
|
|
float rw = x1 - x0 - 2f * inset;
|
|
|
|
|
|
var row = Box(body, "Pack" + r.order, "soft", C("pop_row"), x0 + inset, ry, rw, rh).transform;
|
|
|
|
|
|
// 이름 = 붉은 꼬리 띠(게임 Label_Tail 부품)
|
|
|
|
|
|
var nm = Lab(row, "PName" + r.order, T(r.textKey), At(q, 4), Color.white, 'l', At(q, 8), At(q, 7) + At(q, 6) * 0.5f, Col(pc, 1), 2f);
|
|
|
|
|
|
var tail = Img(row, "Tail", Sp(S_("tail_red")), 0f, At(q, 7), Mathf.Ceil(nm.preferredWidth) + At(q, 5), At(q, 6), Color.white);
|
|
|
|
|
|
tail.transform.SetSiblingIndex(nm.transform.GetSiblingIndex());
|
|
|
|
|
|
float ix = At(q, 17) - inset;
|
|
|
|
|
|
foreach (var it in r.rewards)
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = EventData.ItemOf(it.id);
|
|
|
|
|
|
Framed(row, "PRw" + r.order + "_" + it.id, it.id, it.n, At(q, 9), item != null && item.kind == "pouch" ? S_("frame_pouch") : S_("frame_other"), ix, At(q, 11));
|
|
|
|
|
|
ix += At(q, 9) + At(q, 10);
|
|
|
|
|
|
}
|
|
|
|
|
|
float bw = At(q, 12), bh = At(q, 13), bxx = rw - At(q, 15) - bw, byb = rh - bh - At(q, 14);
|
|
|
|
|
|
int bought = EventRules.PackBought(d, r);
|
|
|
|
|
|
var rr = r;
|
|
|
|
|
|
if (r.price <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Lab(row, "PInfo" + r.order, F("ev_pack_today", Num(bought), Num(r.limit)), At(q, 16), Col(pc, 0), 'm', bxx + bw * 0.5f, At(q, 18), Color.clear, 0f);
|
|
|
|
|
|
Btn(row, "PBtn" + r.order, "btn_l_green", Color.white, T("ev_pack_ad_btn"), 34f, Col(bs, 0), bxx, byb, bw, bh, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
string why;
|
|
|
|
|
|
var got = EventRules.Ad(S.Db, S.Save, rr, S.Now, S.Rng, out why);
|
|
|
|
|
|
if (got == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Root.Toast(T(why));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
S.Commit();
|
|
|
|
|
|
int n = 0;
|
|
|
|
|
|
foreach (var g in got) n += g.n;
|
|
|
|
|
|
Root.Toast(F("ev_ad_toast", Num(n)));
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Lab(row, "PInfo" + r.order, F("ev_pack_limit", Num(bought), Num(r.limit)), At(q, 16), Col(pc, 0), 'm', bxx + bw * 0.5f, At(q, 18), Color.clear, 0f);
|
|
|
|
|
|
// 유료 = 결제 준비 중 토스트만(PD 결정 ② · 지급 없음) · 가격 = 「₩」(본문 글꼴 · Maplestory 에 글자 없음) + 숫자(게임 글꼴)
|
|
|
|
|
|
var b = Btn(row, "PBtn" + r.order, "btn_l_green", Color.white, "", 38f, Col(bs, 0), bxx, byb, bw, bh, () => Root.Toast(T("ev_pack_soon")));
|
|
|
|
|
|
var sym = Lab(b.transform, "PSym" + r.order, T("ev_price_symbol"), 38f, Color.white, 'l', 0f, bh * 0.47f, Col(bs, 0), 3f);
|
|
|
|
|
|
TextUtil.UseBody(sym, true);
|
|
|
|
|
|
sym.fontStyle = FontStyle.Bold; // 숫자(제목 글꼴)와 굵기 맞춤(QA r1 U)
|
|
|
|
|
|
var num = Lab(b.transform, "PPrice" + r.order, Num(r.price), 38f, Color.white, 'l', 0f, bh * 0.47f, Col(bs, 0), 3f);
|
|
|
|
|
|
float w1 = Mathf.Ceil(sym.preferredWidth), w2 = Mathf.Ceil(num.preferredWidth), sx = (bw - w1 - 2f - w2) * 0.5f;
|
|
|
|
|
|
sym.rectTransform.anchoredPosition = new Vector2(sx, sym.rectTransform.anchoredPosition.y);
|
|
|
|
|
|
num.rectTransform.anchoredPosition = new Vector2(sx + w1 + 2f, num.rectTransform.anchoredPosition.y);
|
|
|
|
|
|
}
|
|
|
|
|
|
ry += rh + gap;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 룰렛 바늘 연출 v4(Over · Under 층 · Frame) — 바늘 받침을 from → to 도(칸 0 = 위 · 시계 방향)로 3차 감속 회전 · 칸 빛 받침 = 바늘 아래 칸으로 칸 단위 이동 ·
|
|
|
|
|
|
/// 끝 = hold 초 멈춘 뒤 done · Finish = 바로 끝 · Cancel = 콜백 없이 멈춤.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class EventWheelSpin : MonoBehaviour
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
RectTransform needle, cursor;
|
|
|
|
|
|
float from, to, dur, hold, step, t;
|
2026-11-19 13:37:08 +00:00
|
|
|
|
Action done;
|
|
|
|
|
|
bool running;
|
|
|
|
|
|
|
|
|
|
|
|
public bool Running
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return running; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
public void Run(RectTransform needleRig, RectTransform cursorRig, float fromDeg, float toDeg, float duration, float holdEnd, float stepDeg, Action onDone)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
needle = needleRig;
|
|
|
|
|
|
cursor = cursorRig;
|
|
|
|
|
|
from = fromDeg;
|
|
|
|
|
|
to = toDeg;
|
|
|
|
|
|
dur = Mathf.Max(0.01f, duration);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
hold = holdEnd;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
step = Mathf.Max(1f, stepDeg);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
done = onDone;
|
|
|
|
|
|
t = 0f;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
running = true;
|
|
|
|
|
|
Set(from);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-11-23 05:34:20 +00:00
|
|
|
|
void Set(float deg)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
if (needle != null) needle.localEulerAngles = new Vector3(0f, 0f, -deg);
|
|
|
|
|
|
if (cursor != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float snap = Mathf.Round(deg / step) * step;
|
|
|
|
|
|
var e = new Vector3(0f, 0f, -snap);
|
|
|
|
|
|
if (cursor.localEulerAngles != Quaternion.Euler(e).eulerAngles) cursor.localEulerAngles = e;
|
|
|
|
|
|
}
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!running) return;
|
|
|
|
|
|
t += Time.unscaledDeltaTime;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
if (t < dur)
|
2026-11-19 13:37:08 +00:00
|
|
|
|
{
|
2026-11-23 05:34:20 +00:00
|
|
|
|
float u = 1f - t / dur;
|
|
|
|
|
|
Set(Mathf.Lerp(from, to, 1f - u * u * u));
|
2026-11-19 13:37:08 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-11-23 05:34:20 +00:00
|
|
|
|
Set(to);
|
|
|
|
|
|
if (t >= dur + hold) Done();
|
2026-11-19 13:37:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Finish()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!running) return;
|
2026-11-23 05:34:20 +00:00
|
|
|
|
Set(to);
|
2026-11-19 13:37:08 +00:00
|
|
|
|
Done();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Cancel()
|
|
|
|
|
|
{
|
|
|
|
|
|
running = false;
|
|
|
|
|
|
done = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Done()
|
|
|
|
|
|
{
|
|
|
|
|
|
running = false;
|
|
|
|
|
|
var d = done;
|
|
|
|
|
|
done = null;
|
|
|
|
|
|
if (d != null) d();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|