2026-11-20 03:15:36 +00:00
using System ;
using System.Collections.Generic ;
using System.Globalization ;
using UnityEngine ;
using UnityEngine.UI ;
namespace TKS.OutGame
{
/// <summary>
/// 임무 화면(2026-11-20 PD 컨펌 · 목업 미션_img 02~06) — 탭 3(일일 · 주간 · 업적 · 빨간 점 = 받기 줄 수) · 포인트 판(원 + 막대 + 구간 상자 + 초기화 시계) ·
/// 임무 줄(아이콘 · 제목 · 대체 표시 · 진행 막대 · 도움말 · +포인트 · 받기/완료/이동/진행 중) · 업적(분류 칩 · 지금 단계 1줄 · 연쇄 안내) · 모두 받기 · 보상 팝업.
2026-11-21 04:50:28 +00:00
/// 화풍(PD 2026-11-20 「미션 메뉴에 적합한 UI 배경 · UI 디자인」 · Fable 초안 `mission_ui/design/디자인기획_초안_r1.md`) = 「본영 마당의 방(榜) 게시판」:
/// 군막 앞 마당 배경 + 어둠 한 겹 · 포인트 판 = 붉은 현판 + 금 테 · 나무 게시판 위에 크림 종이 쪽지 줄(왼쪽 금 띠 + 스티커 아이콘) · 버튼 · 탭 = 팩 그대로.
/// 값 = 임무 표(MissionDb) · 글자 = UI/Mission/mission_text · 아이콘 · 색 · 좌표 · 그림 · 바로가기 = UI/Mission/mission_screen(C45).
/// 캔버스 = 배경 · 나무 판 = Static(탭을 바꿀 때만) · 화면 Event(OutGameRoot.Add) · 줄 목록 = ScrollGrid Frame · 시계 칩 = 자기 Event 캔버스(1초마다 글자만) · 받을 상자 빛 = UiPulse.
2026-11-20 03:15:36 +00:00
/// </summary>
public class MissionScreen : OutGameScreen
{
public const string Table = "UI/Mission/mission_screen" ;
public const string Texts = "UI/Mission/mission_text" ;
public const int DailyTab = 0 , WeeklyTab = 1 , AchieveTab = 2 ;
2026-11-21 04:50:28 +00:00
const float PageTop = 116f ;
2026-11-20 03:15:36 +00:00
static Dictionary < string , string > cfg ;
2026-11-21 04:50:28 +00:00
static readonly Dictionary < string , Sprite > sprites = new Dictionary < string , Sprite > ( ) ;
static Material grayMat ;
2026-11-20 03:15:36 +00:00
int tab ;
string cat = "" ;
2026-11-21 04:50:28 +00:00
string boardKey ;
2026-11-20 03:15:36 +00:00
RectTransform body ;
RectTransform page ;
2026-11-21 04:50:28 +00:00
RectTransform artPage ;
2026-11-20 03:15:36 +00:00
readonly Button [ ] tabs = new Button [ 3 ] ;
readonly Text [ ] tabBadges = new Text [ 3 ] ;
/// <summary>시험 · 캡처용 — 지금 탭 · 줄 상태(claim · done · go · wait) · 마지막 팝업 제목.</summary>
public int CurrentTab
{
get { return tab ; }
}
public readonly List < string > RowStates = new List < string > ( ) ;
public readonly List < string > RowTitles = new List < string > ( ) ;
public string LastPopup { get ; private set ; }
public static string T ( string key )
{
return UiText . T ( key ) . Replace ( "\\n" , "\n" ) ;
}
public static string F ( string key , params string [ ] args )
{
return UiText . F ( key , args ) . Replace ( "\\n" , "\n" ) ;
}
/// <summary>화면 표 값(없으면 def).</summary>
public static string Cfg ( string key , string def = "" )
{
if ( cfg = = null )
{
cfg = new Dictionary < string , string > ( ) ;
var rows = UiText . Rows ( Table ) ;
if ( rows ! = null )
foreach ( var r in rows )
{
string k , v ;
if ( r . TryGetValue ( "s_key" , out k ) & & r . TryGetValue ( "s_value" , out v ) & & k . Length > 0 ) cfg [ k ] = v ;
}
}
string s ;
return cfg . TryGetValue ( key , out s ) & & s . Length > 0 ? s : def ;
}
public static Color Col ( string key , Color def )
{
Color c ;
return ColorUtility . TryParseHtmlString ( Cfg ( "color." + key ) , out c ) ? c : def ;
}
2026-11-21 04:50:28 +00:00
/// <summary>표 값 「a|b|c」 → 숫자 배열(칸이 없거나 숫자가 아니면 def 의 같은 칸).</summary>
public static float [ ] V ( string key , params float [ ] def )
{
var p = Cfg ( key ) . Split ( '|' ) ;
var r = new float [ Mathf . Max ( p . Length , def . Length ) ] ;
for ( int i = 0 ; i < r . Length ; i + + )
{
float f ;
r [ i ] = i < p . Length & & float . TryParse ( p [ i ] . Trim ( ) , NumberStyles . Float , CultureInfo . InvariantCulture , out f ) ? f : i < def . Length ? def [ i ] : 0f ;
}
return r ;
}
/// <summary>Resources 스프라이트(표의 경로 · 없으면 null).</summary>
public static Sprite Res ( string path )
{
if ( string . IsNullOrEmpty ( path ) ) return null ;
Sprite s ;
if ( ! sprites . TryGetValue ( path , out s ) )
{
s = Resources . Load < Sprite > ( path ) ;
sprites [ path ] = s ;
}
return s ;
}
2026-11-20 03:15:36 +00:00
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics ( )
{
cfg = null ;
2026-11-21 04:50:28 +00:00
sprites . Clear ( ) ;
grayMat = null ;
2026-11-20 03:15:36 +00:00
}
public override void Build ( )
{
UiText . Use ( Texts ) ;
2026-11-21 04:50:28 +00:00
SceneBg ( ) ;
2026-11-20 03:15:36 +00:00
Header ( T ( "mission_title" ) , T ( "mission_sub" ) , true ) ;
body = Body ( ) ;
2026-11-21 04:50:28 +00:00
// 나무 게시판 = Static 층(탭을 바꿀 때만 다시 그림 · 쪽 목록보다 뒤)
artPage = UiKit . Fill ( "ArtPage" , UiLayer . Group ( "BoardArt" , body , UiRate . Static ) , 0f , 0f , PageTop , 0f ) ;
2026-11-20 03:15:36 +00:00
string [ ] keys = { "tab_daily" , "tab_weekly" , "tab_achieve" } ;
for ( int i = 0 ; i < 3 ; i + + )
{
int k = i ;
tabs [ i ] = UiKit . SubTab ( body , "Tab" + i , T ( keys [ i ] ) , 24f + i * 348f , 18f , 332f , 84f , ( ) = > SetTab ( k ) ) ;
var b = UiKit . Skin ( UiKit . Rect ( "Badge" , tabs [ i ] . transform , new Vector2 ( 1f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( - 10f , - 6f ) , new Vector2 ( 48f , 50f ) ) , "badge_circle" , Col ( "badge" , UiKit . Red ) ) ;
b . preserveAspect = true ;
tabBadges [ i ] = UiKit . Title ( UiKit . FillLabel ( b . transform , "" , 26 , UiKit . White ) , true ) ;
}
2026-11-21 04:50:28 +00:00
page = UiKit . Fill ( "Page" , body , 0f , 0f , PageTop , 0f ) ;
}
/// <summary>화면 전체 배경(표 bg = Resources 그림 · 화면 비가 달라도 덮음) + 어둠 한 겹(color.dim) — Static 층 · 재화 바 · 제목 띠 뒤.</summary>
void SceneBg ( )
{
var sp = Res ( Cfg ( "bg" ) ) ;
if ( sp = = null ) return ;
var g = UiLayer . Group ( "SceneArt" , Rt , UiRate . Static ) ;
g . SetAsFirstSibling ( ) ;
var bg = UiKit . Rect ( "SceneBg" , g , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , Vector2 . zero , OutGameRoot . Reference ) . gameObject . AddComponent < Image > ( ) ;
bg . sprite = sp ;
bg . raycastTarget = false ;
var fit = bg . gameObject . AddComponent < AspectRatioFitter > ( ) ;
fit . aspectMode = AspectRatioFitter . AspectMode . EnvelopeParent ;
fit . aspectRatio = sp . rect . width / Mathf . Max ( 1f , sp . rect . height ) ;
var dim = UiKit . Fill ( "Dim" , g ) . gameObject . AddComponent < Image > ( ) ;
dim . color = Col ( "dim" , Color . clear ) ;
dim . raycastTarget = false ;
2026-11-20 03:15:36 +00:00
}
public override void OnShow ( )
{
S . MissionRoll ( ) ;
}
public void SetTab ( int t )
{
tab = Mathf . Clamp ( t , 0 , 2 ) ;
Refresh ( ) ;
}
public void SetCategory ( string c )
{
cat = c ? ? "" ;
Refresh ( ) ;
}
public override void Refresh ( )
{
if ( page = = null | | S . Db . Missions = = null ) return ;
var og = S . Db ;
var d = S . Save ;
int [ ] n = { MissionRules . Badge ( og , d , MissionDb . Daily ) , MissionRules . Badge ( og , d , MissionDb . Weekly ) , MissionRules . AchBadge ( og , d ) } ;
for ( int i = 0 ; i < 3 ; i + + )
{
UiKit . SetSubTab ( tabs [ i ] , i = = tab ) ;
tabBadges [ i ] . text = n [ i ] . ToString ( CultureInfo . InvariantCulture ) ;
tabBadges [ i ] . transform . parent . gameObject . SetActive ( n [ i ] > 0 ) ;
}
2026-11-21 04:50:28 +00:00
string bk = tab = = AchieveTab ? "achieve" : tab = = DailyTab ? MissionDb . Daily : MissionDb . Weekly ;
if ( bk ! = boardKey ) Board ( bk ) ;
2026-11-20 03:15:36 +00:00
UiKit . Clear ( page ) ;
RowStates . Clear ( ) ;
RowTitles . Clear ( ) ;
if ( tab = = AchieveTab ) BuildAchievements ( ) ;
else BuildMissions ( tab = = DailyTab ? MissionDb . Daily : MissionDb . Weekly ) ;
}
2026-11-21 04:50:28 +00:00
static float PageH
{
get { return OutGameRoot . BodyH - PageTop ; }
}
/// <summary>나무 게시판(표 board.<탭> = x | 위 y | 아래 여백 | 안쪽 들임 · 테 = 팩 card · 안쪽 = soft · 네 귀 못) — 탭이 바뀔 때만(Static).</summary>
void Board ( string key )
{
boardKey = key ;
UiKit . Clear ( artPage ) ;
// 3차(PD 2026-11-21 · Fable 디자인기획_r3) = 금 마개 들보 + 두 기둥 + 밑틀의 나무 게시대 그림(표 board_art · board_art.<탭> = x | 위 y | 폭 | 아래 여백) · 없으면 예전 색 판
var bart = V ( "board_art." + key , 4f , 238f , 1072f , 132f ) ;
if ( SlicedArt ( UiKit . At ( artPage , "Board" , bart [ 0 ] , bart [ 1 ] , bart [ 2 ] , PageH - bart [ 1 ] - bart [ 3 ] ) , Cfg ( "board_art" ) ) ! = null ) return ;
UiKit . Clear ( artPage ) ;
var b = V ( "board." + key , 20f , 268f , 140f , 14f ) ;
float w = OutGameRoot . Reference . x - 2f * b [ 0 ] , h = PageH - b [ 1 ] - b [ 2 ] ;
var frame = UiKit . At ( artPage , "Board" , b [ 0 ] , b [ 1 ] , w , h ) ;
UiKit . Skin ( frame , "card" , Col ( "board" , new Color ( 0.42f , 0.27f , 0.16f ) ) ) ;
UiKit . Skin ( UiKit . Fill ( "Inner" , frame , b [ 3 ] , b [ 3 ] , b [ 3 ] , b [ 3 ] ) , "soft" , Col ( "board_in" , new Color ( 0.55f , 0.36f , 0.21f ) ) ) ;
var nl = V ( "board_nail" , 0f , 0f ) ;
if ( nl [ 0 ] < = 0f ) return ;
foreach ( var p in new [ ] { new Vector2 ( nl [ 1 ] , nl [ 1 ] ) , new Vector2 ( w - nl [ 1 ] , nl [ 1 ] ) , new Vector2 ( nl [ 1 ] , h - nl [ 1 ] ) , new Vector2 ( w - nl [ 1 ] , h - nl [ 1 ] ) } )
{
var rim = UiKit . Rect ( "Nail" , frame , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( p . x , - p . y ) , new Vector2 ( nl [ 0 ] , nl [ 0 ] ) ) . gameObject . AddComponent < Image > ( ) ;
rim . sprite = UiKit . Circle ;
rim . color = Col ( "nail_rim" , Color . black ) ;
rim . raycastTarget = false ;
var dot = UiKit . Fill ( "Head" , rim . transform , 4f , 4f , 4f , 4f ) . gameObject . AddComponent < Image > ( ) ;
dot . sprite = UiKit . Circle ;
dot . color = Col ( "nail" , UiKit . Coin ) ;
dot . raycastTarget = false ;
}
}
2026-11-20 03:15:36 +00:00
// ---------- 일일 · 주간 ----------
void BuildMissions ( string kind )
{
var og = S . Db ;
var db = og . Missions ;
var d = S . Save ;
int max = db . PointMax ( kind ) ;
int pts = MissionRules . Points ( d , kind ) ;
2026-11-21 04:50:28 +00:00
// 포인트 띠(PD 2026-11-21 「포인트 정보를 심플하게 · 레퍼런스 참고」) = 붉은 칠 띠 한 장 + 금 테
// · 왼쪽 = 임무 포인트 아이콘 크게 + 그 아래 지금 포인트 숫자만 · 막대 위 상자 · 상자 밑 어두운 알약에 구간 숫자 · 시계 = 오른쪽 위 작게
// (현판 · 원 · 상한 · 안내 글 · 「받기」 꼬리표 없앰 · 받을 상자 = 번짐 빛만)
var pr = V ( "points_rect" , 20f , 4f , 1040f , 250f ) ;
var panel = UiKit . At ( page , "Points" , pr [ 0 ] , pr [ 1 ] , pr [ 2 ] , pr [ 3 ] ) ;
// 3차(PD 2026-11-21 「배경 패널을 컨셉으로 다시」 · Fable 디자인기획_r3) = 금 테 · 금 구름 귀 붉은 옻칠 현판 그림(표 points_art · 9 분할 좌우) · 없으면 예전 색 띠
var plaque = SlicedArt ( panel , Cfg ( "points_art" ) ) ;
if ( plaque = = null )
{
var band = UiKit . Skin ( panel , "card" , Col ( "points_band" , Col ( "panel" , UiKit . Dark ) ) ) ;
if ( band ! = null & & Cfg ( "color.points_top" ) . Length > 0 ) UiGradient . Add ( band , Col ( "points_top" , UiKit . Red ) , Col ( "points_bottom" , UiKit . Red ) ) ;
Line ( panel , Cfg ( "points_line" ) , Col ( "panel_line" , UiKit . Coin ) , 0f ) ;
}
// 옻칠 면 구름 음각 무늬(PD 2026-11-21 8차 「상단 UI 의 남는 여백을 좀 더 꾸며봐」 · Fable 디자인기획_r4 §2 · 표 points_pattern = 그림 | x | y | 폭 | 높이 · 정보 뒤 · 금 테 · 귀 구름 밖으로 안 나감)
if ( plaque ! = null )
{
var pp = Cfg ( "points_pattern" ) . Split ( '|' ) ;
var pv4 = V ( "points_pattern" , 0f , 32f , 38f , 976f , 172f ) ;
var psp = pp . Length > 0 & & pp [ 0 ] . Length > 0 ? UISkin . Icon ( pp [ 0 ] ) : null ;
if ( psp ! = null )
{
var pimg = UiKit . At ( panel , "Pattern" , pv4 [ 1 ] , pv4 [ 2 ] , pv4 [ 3 ] , pv4 [ 4 ] ) . gameObject . AddComponent < Image > ( ) ;
pimg . sprite = psp ;
pimg . raycastTarget = false ;
}
}
// 시계 = 게시대 제목 줄(PD 2026-11-21 8차 시안 「초기화 시간을 아래쪽 상단에」 · 표 list_head = x | y | 폭 | 높이 | 제목 글자 | 제목 x · 없으면 예전처럼 현판 위)
var lh = V ( "list_head" , 0f , 0f , 0f , 0f , 40f , 0f ) ;
if ( lh [ 2 ] > 0f & & lh [ 3 ] > 0f ) ListHead ( kind , lh ) ;
else Timer ( panel , kind ) ;
2026-11-20 03:15:36 +00:00
2026-11-21 04:50:28 +00:00
// 임무 포인트 아이콘(표 point_icon.<종류> · 일일 = 백호 · 주간 = 청룡 = 타이틀 로고 그림 · PD 2026-11-21) + 지금 포인트(표 point_big = 가운데 x | 가운데 y | 크기 | 숫자 가운데 y | 글자 · 숫자는 아이콘 아래 따로)
var pb = V ( "point_big" , 104f , 112f , 150f , 196f , 52f ) ;
var big = UiKit . Icon ( panel , PointIcon ( kind ) , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( pb [ 0 ] , - pb [ 1 ] ) , pb [ 2 ] ) ;
if ( big ! = null )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
big . name = "PointIcon" ;
UiKit . DropShadow ( big , 4f ) ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
var pv = UiKit . Title ( UiKit . Label ( panel , pts . ToString ( CultureInfo . InvariantCulture ) , ( int ) pb [ 4 ] , Col ( "text_panel" , UiKit . White ) , TextAnchor . MiddleCenter , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( pb [ 0 ] , - pb [ 3 ] ) , new Vector2 ( 200f , pb [ 4 ] + 18f ) ) , true ) ;
2026-11-20 03:15:36 +00:00
pv . name = "PointValue" ;
2026-11-21 04:50:28 +00:00
// 막대(홈 + 금 채움) + 구간 상자(상자 + 접지 그림자 · 받을 것 = 번짐 빛 · 받음 = 탈색 + 체크) + 구간 숫자 알약
var br = V ( "bar" , 216f , 140f , 760f , 30f ) ;
float X0 = br [ 0 ] , BarY = br [ 1 ] , W = br [ 2 ] ;
2026-11-20 03:15:36 +00:00
var steps = db . Steps ( kind ) ;
2026-11-21 04:50:28 +00:00
// 상자 줄 가운데 y(표 box_y · 비면 막대 위에 걸침 = 막대 y − 4) — PD 2026-11-21 「게이지는 아이콘 하단에」 = 상자가 막대 위 · 막대는 상자 아래
float BoxY = V ( "box_y" , BarY - 4f ) [ 0 ] ;
// 받을 상자 빛 = 막대보다 먼저(뒤) 그림 — 빛이 막대 홈을 밝혀 채움 끝이 흐려지지 않게(QA r4 M1)
foreach ( var s in steps )
if ( ! MissionRules . BoxClaimed ( d , kind , s . step ) & & pts > = s . need )
ReadyGlow ( panel , new Vector2 ( X0 + W * Mathf . Clamp01 ( s . need / ( float ) Mathf . Max ( 1 , max ) ) , - BoxY ) ) ;
var fill = UiKit . Bar ( "Bar" , panel , new Vector2 ( 0f , 1f ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( X0 , - BarY ) , new Vector2 ( W , br [ 3 ] ) , Col ( "track_panel" , UiKit . Dark ) , Col ( "bar_full" , UiKit . Coin ) ) ;
Track ( fill , Col ( "track_panel" , UiKit . Dark ) ) ;
if ( plaque ! = null ) Groove ( fill , Col ( "track_panel" , UiKit . Dark ) ) ;
UiKit . SetBar ( fill , max > 0 ? pts / ( float ) max : 0f ) ;
var fimg = fill . GetComponent < Image > ( ) ;
if ( fimg ! = null & & Cfg ( "color.bar_top" ) . Length > 0 ) UiGradient . Add ( fimg , Col ( "bar_top" , UiKit . Coin ) , Col ( "bar_bottom" , UiKit . Coin ) ) ;
// 구간 눈금(PD 2026-11-21 「상자가 실제 달성도 % 에 맞게」 → 막대 위 구간 자리에 금 눈금 · 상자 · 숫자가 그 눈금 위아래 · 표 bar_tick = 폭 | 높이 · 비면 없음)
var tk = V ( "bar_tick" , 0f , 0f ) ;
if ( tk [ 0 ] > 0f )
foreach ( var s in steps )
{
float tx = X0 + W * Mathf . Clamp01 ( s . need / ( float ) Mathf . Max ( 1 , max ) ) ;
var ol = UiKit . Box ( "Tick" + s . step , panel , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( tx , - BarY ) , new Vector2 ( tk [ 0 ] + 4f , tk [ 1 ] + 4f ) , Col ( "bar_tick_line" , UiKit . Ink ) , false ) ;
ol . raycastTarget = false ;
var inn = UiKit . Box ( "In" , ol . transform , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , Vector2 . zero , new Vector2 ( tk [ 0 ] , tk [ 1 ] ) , Col ( "bar_tick" , UiKit . Coin ) , false ) ;
inn . raycastTarget = false ;
}
2026-11-20 03:15:36 +00:00
var icons = Split ( Cfg ( "box_icons" ) ) ;
2026-11-21 04:50:28 +00:00
var bx = V ( "box" , 96f , 88f , 196f ) ;
2026-11-20 03:15:36 +00:00
for ( int i = 0 ; i < steps . Count ; i + + )
{
var s = steps [ i ] ;
float x = X0 + W * Mathf . Clamp01 ( s . need / ( float ) Mathf . Max ( 1 , max ) ) ;
bool got = MissionRules . BoxClaimed ( d , kind , s . step ) ;
string icon = icons . Count = = 0 ? "" : icons [ Mathf . Min ( icons . Count - 1 , Mathf . RoundToInt ( i * ( icons . Count - 1 ) / ( float ) Mathf . Max ( 1 , steps . Count - 1 ) ) ) ] ;
2026-11-21 04:50:28 +00:00
var box = UiKit . Rect ( "Box" + s . step , panel , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( x , - BoxY ) , new Vector2 ( bx [ 0 ] , bx [ 0 ] ) ) ;
var hit = box . gameObject . AddComponent < Image > ( ) ;
hit . color = Color . clear ; // 누름 칸(그림 없음)
Shadow ( box , bx [ 1 ] ) ;
2026-11-20 03:15:36 +00:00
var bt = box . gameObject . AddComponent < Button > ( ) ;
var step = s ;
bt . onClick . AddListener ( ( ) = > OnBox ( kind , step ) ) ;
2026-11-21 04:50:28 +00:00
var ic = UiKit . Icon ( box , icon , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0f , 2f ) , bx [ 1 ] ) ;
if ( ic ! = null & & got ) Gray ( ic ) ;
if ( got )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
var ckv = V ( "box_check" , 6f , - 4f , 64f ) ; // 받은 상자 체크 x | y | 크기(상자 크기에 맞춰 표에서)
var ck = UiKit . Icon ( box , Cfg ( "check_icon" , "check" ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( ckv [ 0 ] , ckv [ 1 ] ) , ckv [ 2 ] ) ;
if ( ck ! = null ) UiKit . DropShadow ( ck , 2f ) ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
// 구간 숫자 = 상자 밑 어두운 알약(표 box_pill = 폭 | 높이 | 글자 · 가운데 y = box 셋째 값)
var bp = V ( "box_pill" , 88f , 38f , 28f ) ;
var pill = UiKit . Skin ( UiKit . Rect ( "Need" + s . step , panel , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( x , - bx [ 2 ] ) , new Vector2 ( bp [ 0 ] , bp [ 1 ] ) ) , "chip" , Col ( "box_pill" , UiKit . Dark ) ) ;
UiKit . Title ( UiKit . FillLabel ( pill . transform , s . need . ToString ( CultureInfo . InvariantCulture ) , ( int ) bp [ 2 ] , Col ( "text_panel" , UiKit . White ) ) , true ) ;
}
// 백호 · 청룡이 막대 왼쪽 끝 위에(PD 2026-11-21 7차 「청룡이나 백호 아래에 게이지가 배치되게 · 끝이 허전함」) — 아이콘 · 숫자를 막대 · 상자보다 위로
if ( big ! = null ) big . transform . SetAsLastSibling ( ) ;
pv . transform . SetAsLastSibling ( ) ;
// 다음 상자 안내 한 줄(PD 2026-11-21 10차 「상자 하단 디자인 다른 방안 제안」 C안 · 표 points_next = x | 가운데 y | 폭 | 글자 · 비면 없음 · 글 = points_next / points_next_done)
var pn = V ( "points_next" , 0f , 0f , 0f , 0f ) ;
if ( pn [ 2 ] > 0f )
{
MissionDb . PointReward nx = null ;
foreach ( var s in steps )
if ( pts < s . need ) { nx = s ; break ; }
string msg = nx ! = null ? F ( "points_next" , nx . need . ToString ( CultureInfo . InvariantCulture ) , ( nx . need - pts ) . ToString ( CultureInfo . InvariantCulture ) ) : T ( "points_next_done" ) ;
var nt = Txt ( panel , "Next" , msg , ( int ) pn [ 3 ] , Col ( "points_next" , UiKit . Coin ) , pn [ 0 ] , pn [ 1 ] - pn [ 3 ] , pn [ 2 ] , pn [ 3 ] * 2f , TextAnchor . MiddleCenter , true ) ;
nt . name = "Next" ;
}
// 현판을 게시대 들보에 거는 금 고리 2(표 points_hook = 그림 | 왼 x | 오른 x | 위 y | 폭 | 높이 · 판 기준) — 현판 그림일 때만
if ( plaque ! = null )
{
var hk = Cfg ( "points_hook" ) . Split ( '|' ) ;
var hv = V ( "points_hook" , 0f , 150f , 890f , 226f , 40f , 54f ) ;
if ( hk . Length > 0 & & hk [ 0 ] . Length > 0 )
for ( int i = 1 ; i < = 2 ; i + + )
{
var hi = UiKit . Icon ( panel , hk [ 0 ] , new Vector2 ( 0f , 1f ) , new Vector2 ( 0f , 1f ) , new Vector2 ( hv [ i ] , - hv [ 3 ] ) , hv [ 4 ] ) ;
if ( hi = = null ) break ;
hi . name = "Hook" + i ;
hi . rectTransform . sizeDelta = new Vector2 ( hv [ 4 ] , hv [ 5 ] ) ;
}
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
// 줄 목록(나무 게시판 안)
var rr = V ( "rows." + kind , 38f , 290f , 1004f , 100f , 12f , 162f ) ;
2026-11-20 03:15:36 +00:00
ScrollRect sr ;
2026-11-21 04:50:28 +00:00
var grid = UiKit . ScrollGrid ( "Rows" , page , rr [ 0 ] , OutGameRoot . Reference . x - rr [ 0 ] - rr [ 2 ] , rr [ 1 ] , rr [ 5 ] , new Vector2 ( rr [ 2 ] , rr [ 3 ] ) , new Vector2 ( 0f , rr [ 4 ] ) , 1 , out sr ) ;
foreach ( var r in MissionRules . Rows ( og , d , kind ) ) MissionRow ( grid , kind , r , rr [ 2 ] , rr [ 3 ] ) ;
2026-11-20 03:15:36 +00:00
Bottom ( T ( "foot_" + kind ) , ( ) = > OnClaimAll ( kind ) ) ;
}
2026-11-21 04:50:28 +00:00
void MissionRow ( RectTransform grid , string kind , MissionRow r , float w , float h )
2026-11-20 03:15:36 +00:00
{
var m = r . m ;
string state = r . claimed ? "done" : r . done ? "claim" : m . go ! = "none" ? "go" : "wait" ;
RowStates . Add ( state ) ;
RowTitles . Add ( m . titleKo ) ;
2026-11-21 04:50:28 +00:00
var cc = r . claimed ? Col ( "row_done" , UiKit . Dark ) : Col ( "row" , UiKit . Dark ) ;
var row = Cell ( grid , "Row_" + m . id , cc ) ;
Head ( row , V ( "row_head" , 104f , 4f ) , h , w , cc ) ;
var ri = V ( "row_icon" , 10f , 8f , 84f , 0.93f ) ;
RowIcon ( row , Cfg ( "icon." + m . counter ) , ri ) ;
2026-11-20 03:15:36 +00:00
var dim = Col ( "text_dim" , UiKit . InkSoft ) ;
2026-11-21 04:50:28 +00:00
var tc = Col ( "text" , UiKit . Ink ) ;
var rt = V ( "row_title" , 120f , 6f , 560f , 46f , 32f ) ;
var title = Txt ( row , "Title" , m . titleKo , ( int ) rt [ 4 ] , tc , rt [ 0 ] , rt [ 1 ] , rt [ 2 ] , rt [ 3 ] , TextAnchor . MiddleLeft , true , false ) ;
2026-11-20 03:15:36 +00:00
bool alt = m . role = = MissionDb . Fallback ;
if ( alt )
{
2026-11-21 04:50:28 +00:00
float tw = Mathf . Min ( rt [ 2 ] , Mathf . Ceil ( title . preferredWidth ) ) ;
var tag = UiKit . Skin ( UiKit . At ( row , "Alt" , rt [ 0 ] + tw + 12f , 13f , 68f , 34f ) , "chip" , Col ( "alt" , UiKit . Red ) ) ;
2026-11-20 03:15:36 +00:00
UiKit . Title ( UiKit . FillLabel ( tag . transform , T ( "alt_badge" ) , 22 , UiKit . White ) , true ) ;
}
2026-11-21 04:50:28 +00:00
var rb = V ( "row_bar" , 122f , 72f , 240f , 24f , 20f ) ;
Progress ( row , r . count , m . goal , rb [ 0 ] , rb [ 1 ] , rb [ 2 ] , rb [ 3 ] , true , ( int ) rb [ 4 ] ) ;
2026-11-20 03:15:36 +00:00
string hint = m . hintKo ;
if ( alt )
{
var main = S . Db . Missions . MainOf ( m ) ;
if ( main ! = null ) hint = F ( "alt_hint" , MissionRules . CfgRef ( main . unlock ) , main . titleKo ) ;
}
2026-11-21 04:50:28 +00:00
var rh = V ( "row_hint" , 378f , 54f , 340f , 36f , 24f ) ;
var ht = Txt ( row , "Hint" , hint , ( int ) rh [ 4 ] , dim , rh [ 0 ] , rh [ 1 ] , rh [ 2 ] , rh [ 3 ] , TextAnchor . MiddleLeft , false ) ;
ht . horizontalOverflow = HorizontalWrapMode . Wrap ;
ht . verticalOverflow = VerticalWrapMode . Truncate ;
// 보상 포인트 = 어두운 알약 안 임무 포인트 아이콘 + 수량(PD 2026-11-20 「+20 대신 포인트 아이콘과 수량」 · 상아 별이 크림 줄에 묻히지 않게 어두운 알약 · 표 row_point = x | y | 폭 | 높이 | 아이콘 | 글자)
var rp = V ( "row_point" , 724f , 22f , 112f , 56f , 50f , 30f ) ;
var pt = UiKit . Skin ( UiKit . At ( row , "Pt" , rp [ 0 ] , rp [ 1 ] , rp [ 2 ] , rp [ 3 ] ) , "chip" , Col ( "chip" , UiKit . Dark ) ) ;
var pic = UiKit . Icon ( pt . transform , PointIcon ( kind ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( rp [ 4 ] * 0.5f + 2f , 1f ) , rp [ 4 ] ) ;
if ( pic ! = null ) UiKit . DropShadow ( pic , 2f ) ;
var pq = UiKit . Title ( UiKit . Label ( pt . transform , pic ! = null ? m . point . ToString ( CultureInfo . InvariantCulture ) : F ( "point_plus" , m . point . ToString ( CultureInfo . InvariantCulture ) ) , ( int ) rp [ 5 ] , Col ( "text_gold" , UiKit . Coin ) , TextAnchor . MiddleCenter ,
new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( pic ! = null ? ( rp [ 4 ] + rp [ 2 ] ) * 0.5f : rp [ 2 ] * 0.5f , 0f ) , new Vector2 ( pic ! = null ? rp [ 2 ] - rp [ 4 ] : rp [ 2 ] , rp [ 3 ] ) ) , true ) ;
pq . name = "PtQty" ;
var bb = V ( "row_btn" , 852f , 16f , 136f , 68f , 32f ) ;
2026-11-20 03:15:36 +00:00
int id = m . id ;
switch ( state )
{
2026-11-21 04:50:28 +00:00
case "claim" :
RowBtn ( row , "btn_l_yellow" , UiKit . White , T ( "btn_claim" ) , UiKit . Col ( "text_on_yellow" , UiKit . Ink ) , ( ) = > OnClaim ( kind , id ) , bb , bb [ 1 ] ) ;
Line ( row , Cfg ( "row_ready_line" ) , Col ( "row_ready" , UiKit . Coin ) , - 2f ) ;
break ;
case "go" : RowBtn ( row , "btn_sky" , UiKit . White , T ( "btn_go" ) , UiKit . White , ( ) = > Go ( m . go ) , bb , bb [ 1 ] ) ; break ;
case "done" : DoneBtn ( row , T ( "btn_done" ) , bb , bb [ 1 ] ) ; break ;
default : RowBtn ( row , "btn_s_gray" , UiKit . White , T ( "btn_wait" ) , UiKit . White , null , bb , bb [ 1 ] ) . interactable = false ; break ;
}
if ( r . claimed ) Dim ( row ) ;
}
/// <summary>받은 줄 흐림 = 줄 위 덮개 한 장(승인 이벤트 카드와 같은 방법 · color.row_dim) — 표에 없으면 예전 CanvasGroup(done_alpha).
/// 겹친 판마다 알파가 따로 곱해져 띠 · 바탕이 줄무늬로 보이던 것(QA r1 B1)을 피한다.</summary>
static void Dim ( RectTransform row )
{
if ( Cfg ( "color.row_dim" ) . Length > 0 )
{
UiKit . Skin ( UiKit . Fill ( "Dim" , row ) , "card" , Col ( "row_dim" , Color . clear ) ) ;
return ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
float a ;
if ( float . TryParse ( Cfg ( "done_alpha" ) , NumberStyles . Float , CultureInfo . InvariantCulture , out a ) )
row . gameObject . AddComponent < CanvasGroup > ( ) . alpha = Mathf . Clamp01 ( a ) ;
2026-11-20 03:15:36 +00:00
}
// ---------- 업적 ----------
void BuildAchievements ( )
{
var og = S . Db ;
var db = og . Missions ;
var d = S . Save ;
var cats = new List < string > { "" } ;
foreach ( var a in db . achievements )
if ( ! cats . Contains ( a . category ) ) cats . Add ( a . category ) ;
float x = 24f ;
foreach ( var c in cats )
{
string label = T ( c . Length = = 0 ? "ach_cat_all" : "ach_cat_" + c ) ;
var chip = UiKit . At ( page , "Cat_" + ( c . Length = = 0 ? "all" : c ) , x , 4f , 100f , 58f ) ;
2026-11-21 04:50:28 +00:00
UiKit . Skin ( chip , "chip" , c = = cat ? Col ( "cat_on" , UiKit . Red ) : Col ( "cat_off" , Col ( "panel" , UiKit . Dark ) ) , true ) ;
2026-11-20 03:15:36 +00:00
var t = UiKit . Title ( UiKit . FillLabel ( chip , label , 27 , UiKit . White ) , true ) ;
float w = Mathf . Ceil ( t . preferredWidth ) + 48f ;
chip . sizeDelta = new Vector2 ( w , 58f ) ;
string cc = c ;
chip . gameObject . AddComponent < Button > ( ) . onClick . AddListener ( ( ) = > SetCategory ( cc ) ) ;
x + = w + 12f ;
}
2026-11-21 04:50:28 +00:00
// 「29종 · …」 = 배경 위 글자 금지 → 어두운 알약 위
var cp = V ( "count_pill" , 40f , 22f ) ;
var ct = UiKit . Label ( page , F ( "ach_count" , db . achievements . Count . ToString ( CultureInfo . InvariantCulture ) ) , ( int ) cp [ 1 ] , Col ( "foot_text" , UiKit . InkSoft ) , TextAnchor . MiddleCenter , new Vector2 ( 0f , 1f ) , new Vector2 ( 1f , 0.5f ) , new Vector2 ( OutGameRoot . Reference . x - 24f , - 33f ) , new Vector2 ( 400f , cp [ 0 ] ) , false ) ;
ct . name = "Count" ;
ct . horizontalOverflow = HorizontalWrapMode . Overflow ;
float cw = Mathf . Min ( OutGameRoot . Reference . x - 24f - x , Mathf . Ceil ( ct . preferredWidth ) + 32f ) ;
ct . rectTransform . sizeDelta = new Vector2 ( cw , cp [ 0 ] ) ;
var pill = UiKit . Skin ( UiKit . Rect ( "CountPill" , page , new Vector2 ( 0f , 1f ) , new Vector2 ( 1f , 0.5f ) , new Vector2 ( OutGameRoot . Reference . x - 24f , - 33f ) , new Vector2 ( cw , cp [ 0 ] ) ) , "chip" , Col ( "foot" , UiKit . Dark ) ) ;
pill . transform . SetSiblingIndex ( ct . transform . GetSiblingIndex ( ) ) ;
2026-11-20 03:15:36 +00:00
2026-11-21 04:50:28 +00:00
var rr = V ( "rows.achieve" , 38f , 94f , 1004f , 132f , 10f , 162f ) ;
2026-11-20 03:15:36 +00:00
ScrollRect sr ;
2026-11-21 04:50:28 +00:00
var grid = UiKit . ScrollGrid ( "Rows" , page , rr [ 0 ] , OutGameRoot . Reference . x - rr [ 0 ] - rr [ 2 ] , rr [ 1 ] , rr [ 5 ] , new Vector2 ( rr [ 2 ] , rr [ 3 ] ) , new Vector2 ( 0f , rr [ 4 ] ) , 1 , out sr ) ;
foreach ( var r in MissionRules . AchRows ( og , d , cat ) ) AchRow ( grid , r , rr [ 2 ] , rr [ 3 ] ) ;
2026-11-20 03:15:36 +00:00
Bottom ( T ( "foot_achieve" ) , OnAchAll ) ;
}
2026-11-21 04:50:28 +00:00
void AchRow ( RectTransform grid , AchRow r , float w , float h )
2026-11-20 03:15:36 +00:00
{
var a = r . a ;
string state = r . allDone ? "done" : r . Claimable ? "claim" : "wait" ;
RowStates . Add ( state ) ;
RowTitles . Add ( a . nameKo ) ;
var row = Cell ( grid , "Ach_" + a . id , Col ( "row" , UiKit . Dark ) ) ;
2026-11-21 04:50:28 +00:00
Head ( row , V ( "ach_head" , 120f , 24f ) , h , w , Col ( "row" , UiKit . Dark ) ) ;
RowIcon ( row , Cfg ( "icon." + a . counter ) , V ( "ach_icon" , 12f , 18f , 96f , 0.92f ) ) ;
var tc = Col ( "text" , UiKit . Ink ) ;
2026-11-20 03:15:36 +00:00
var dim = Col ( "text_dim" , UiKit . InkSoft ) ;
2026-11-21 04:50:28 +00:00
var an = V ( "ach_name" , 134f , 8f , 400f , 44f , 32f ) ;
var name = Txt ( row , "Name" , a . nameKo , ( int ) an [ 4 ] , tc , an [ 0 ] , an [ 1 ] , an [ 2 ] , an [ 3 ] , TextAnchor . MiddleLeft , true , false ) ;
float nw = Mathf . Min ( an [ 2 ] , Mathf . Ceil ( name . preferredWidth ) ) ;
2026-11-20 03:15:36 +00:00
string stepText = r . allDone ? T ( "ach_all_done" ) : r . repeat ? F ( "ach_step_repeat" , r . step . ToString ( CultureInfo . InvariantCulture ) ) : F ( "ach_step" , r . step . ToString ( CultureInfo . InvariantCulture ) , a . goals . Length . ToString ( CultureInfo . InvariantCulture ) ) ;
2026-11-21 04:50:28 +00:00
var tag = UiKit . Skin ( UiKit . At ( row , "Step" , an [ 0 ] + nw + 12f , 13f , 150f , 34f ) , "chip" , Col ( "tag" , UiKit . Dark ) ) ;
2026-11-20 03:15:36 +00:00
var tt = UiKit . Title ( UiKit . FillLabel ( tag . transform , stepText , 22 , UiKit . White ) , true ) ;
tag . rectTransform . sizeDelta = new Vector2 ( Mathf . Ceil ( tt . preferredWidth ) + 30f , 34f ) ;
2026-11-21 04:50:28 +00:00
var ad = V ( "ach_desc" , 134f , 52f , 580f , 34f , 24f ) ;
Txt ( row , "Desc" , a . descKo . Replace ( "{n}" , r . goal . ToString ( "N0" , CultureInfo . InvariantCulture ) ) , ( int ) ad [ 4 ] , dim , ad [ 0 ] , ad [ 1 ] , ad [ 2 ] , ad [ 3 ] , TextAnchor . MiddleLeft , false ) ;
var ab = V ( "ach_bar" , 136f , 94f , 320f , 24f , 20f ) ;
Progress ( row , r . value , r . goal , ab [ 0 ] , ab [ 1 ] , ab [ 2 ] , ab [ 3 ] , false , ( int ) ab [ 4 ] ) ; // 업적 = 쌓인 값 그대로(목업 「120 / 50」)
2026-11-20 03:15:36 +00:00
if ( r . Claimable )
{
var next = MissionRules . AchAt ( S . Db , S . Save , a , Counts . Get ( S . Save . mission . achieve , a . id ) + 1 ) ;
2026-11-21 04:50:28 +00:00
var nx = V ( "ach_next" , 470f , 92f , 300f , 30f , 22f ) ;
2026-11-20 03:15:36 +00:00
if ( ! next . allDone & & r . value > = next . goal )
2026-11-21 04:50:28 +00:00
Txt ( row , "Next" , F ( "ach_next_also" , next . step . ToString ( CultureInfo . InvariantCulture ) , next . goal . ToString ( "N0" , CultureInfo . InvariantCulture ) ) , ( int ) nx [ 4 ] , Col ( "text_next" , UiKit . Coin ) , nx [ 0 ] , nx [ 1 ] , nx [ 2 ] , nx [ 3 ] , TextAnchor . MiddleLeft , false ) ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
var bb = V ( "row_btn" , 852f , 16f , 136f , 68f , 32f ) ;
float by = V ( "ach_btn_y" , 32f ) [ 0 ] ;
2026-11-20 03:15:36 +00:00
if ( ! r . allDone )
{
2026-11-21 04:50:28 +00:00
// 보상 = 등급 틀 칸 안 재화 + 수량 칩(PD 2026-11-20 「업적 보상은 아이템 프레임에 재화를 담아서」 · 팝업 보상 칸과 같은 그리기 · 표 ach_reward = x | y | 칸)
var ar = V ( "ach_reward" , 748f , 24f , 84f ) ;
RewardCell ( row , "Reward" , "gem" , r . gem , new Vector2 ( 0f , 1f ) , new Vector2 ( ar [ 0 ] + ar [ 2 ] * 0.5f , - ( ar [ 1 ] + ar [ 2 ] * 0.5f ) ) , ar [ 2 ] ) ;
2026-11-20 03:15:36 +00:00
}
string id = a . id ;
switch ( state )
{
2026-11-21 04:50:28 +00:00
case "claim" :
RowBtn ( row , "btn_l_yellow" , UiKit . White , T ( "btn_claim" ) , UiKit . Col ( "text_on_yellow" , UiKit . Ink ) , ( ) = > OnAchClaim ( id ) , bb , by ) ;
Line ( row , Cfg ( "row_ready_line" ) , Col ( "row_ready" , UiKit . Coin ) , - 2f ) ;
break ;
case "done" : DoneBtn ( row , T ( "btn_done" ) , bb , by ) ; break ;
default : RowBtn ( row , "btn_s_gray" , UiKit . White , T ( "btn_wait" ) , UiKit . White , null , bb , by ) . interactable = false ; break ;
2026-11-20 03:15:36 +00:00
}
}
// ---------- 동작 ----------
void OnClaim ( string kind , int id )
{
int p = MissionRules . Claim ( S . Db , S . Save , kind , id ) ;
if ( p < = 0 ) return ;
2026-11-21 06:13:26 +00:00
Sound . Play ( SoundKeys . UiMission ) ; // 소리: 임무 수령(2026-11-20 사운드)
2026-11-20 03:15:36 +00:00
S . Commit ( ) ;
Root . Toast ( F ( "pop_all_points" , p . ToString ( CultureInfo . InvariantCulture ) ) ) ;
}
public void OnBox ( string kind , MissionDb . PointReward s )
{
var got = MissionRules . ClaimBox ( S . Db , S . Save , kind , s . step , S . Rng ) ;
2026-11-21 06:13:26 +00:00
if ( got ! = null ) Sound . Play ( SoundKeys . UiReward ) ; // 소리: 임무 상자 보상(2026-11-20 사운드)
2026-11-20 03:15:36 +00:00
if ( got = = null ) return ;
S . Commit ( ) ;
2026-11-21 04:50:28 +00:00
var content = Popup ( F ( "pop_box_title_" + kind , s . need . ToString ( CultureInfo . InvariantCulture ) ) , V ( "pop_box_h" , 640f ) [ 0 ] , "pop_gold" ) ;
RewardRow ( content , got , 20f , V ( "pop_cell" , 130f ) [ 0 ] , true ) ;
2026-11-20 03:15:36 +00:00
MissionDb . PointReward next = null ;
foreach ( var x in S . Db . Missions . Steps ( kind ) )
if ( x . step > s . step )
{
next = x ;
break ;
}
string tail = next ! = null ? F ( "pop_box_next" , next . need . ToString ( CultureInfo . InvariantCulture ) ) : T ( "pop_box_last" ) ;
2026-11-21 04:50:28 +00:00
var tl = UiKit . Label ( content , tail , 28 , UiKit . InkSoft , TextAnchor . MiddleCenter , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0f , - 250f ) , new Vector2 ( 820f , 44f ) , false ) ;
if ( next ! = null )
{
// 다음 구간 상자 아이콘(글자 앞)
var icons = Split ( Cfg ( "box_icons" ) ) ;
var steps = S . Db . Missions . Steps ( kind ) ;
int ni = steps . IndexOf ( next ) ;
if ( icons . Count > 0 & & ni > = 0 )
{
string nic = icons [ Mathf . Min ( icons . Count - 1 , Mathf . RoundToInt ( ni * ( icons . Count - 1 ) / ( float ) Mathf . Max ( 1 , steps . Count - 1 ) ) ) ] ;
float tw = Mathf . Ceil ( tl . preferredWidth ) ;
UiKit . Icon ( content , nic , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( - tw * 0.5f - 30f , - 272f ) , 48f ) ;
}
}
2026-11-20 03:15:36 +00:00
}
public void OnClaimAll ( string kind )
{
int pts ;
var got = MissionRules . ClaimAll ( S . Db , S . Save , kind , S . Rng , out pts ) ;
if ( pts < = 0 & & got . Count = = 0 )
{
Root . Toast ( T ( "pop_nothing" ) ) ;
return ;
}
S . Commit ( ) ;
var parts = new List < string > ( ) ;
2026-11-21 06:13:26 +00:00
Sound . Play ( SoundKeys . UiMission ) ; // 소리: 임무 모두 수령(2026-11-20 사운드)
2026-11-20 03:15:36 +00:00
foreach ( var g in got ) parts . Add ( g . reward ) ;
var content = Popup ( T ( "pop_all_title" ) , parts . Count > 0 ? 660f : 480f , "pop_gold" ) ;
UiKit . Title ( UiKit . Label ( content , F ( "pop_all_points" , pts . ToString ( CultureInfo . InvariantCulture ) ) , 34 , UiKit . Ink , TextAnchor . MiddleCenter , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0f , - 8f ) , new Vector2 ( 820f , 50f ) ) , false ) ;
if ( parts . Count > 0 ) RewardRow ( content , MissionRules . Merge ( parts ) , 80f , 120f , true ) ;
}
void OnAchClaim ( string id )
{
var a = S . Db . Missions . Ach ( id ) ;
var r = a ! = null ? MissionRules . AchOf ( S . Db , S . Save , a ) : null ;
if ( r = = null | | MissionRules . ClaimAch ( S . Db , S . Save , id ) < = 0 ) return ;
2026-11-21 06:13:26 +00:00
Sound . Play ( SoundKeys . UiMission ) ; // 소리: 업적 수령(2026-11-20 사운드)
2026-11-20 03:15:36 +00:00
S . Commit ( ) ;
ChainPopup ( new List < AchClaim > { new AchClaim { a = a , step = r . step , goal = r . goal , gem = r . gem } } ) ;
}
public void OnAchAll ( )
{
var got = MissionRules . ClaimAllAch ( S . Db , S . Save ) ;
if ( got . Count = = 0 )
{
Root . Toast ( T ( "pop_nothing" ) ) ;
return ;
}
S . Commit ( ) ;
ChainPopup ( got ) ;
}
void ChainPopup ( List < AchClaim > got )
{
int total = 0 ;
foreach ( var g in got ) total + = g . gem ;
// 연쇄 설명 = 한 종류에서 2단계 이상 받은 첫 업적
string chain = null ;
var seen = new Dictionary < string , List < int > > ( ) ;
foreach ( var g in got )
{
List < int > l ;
if ( ! seen . TryGetValue ( g . a . id , out l ) ) seen [ g . a . id ] = l = new List < int > ( ) ;
l . Add ( g . step ) ;
}
foreach ( var kv in seen )
{
if ( kv . Value . Count < 2 ) continue ;
var a = S . Db . Missions . Ach ( kv . Key ) ;
var now = MissionRules . AchOf ( S . Db , S . Save , a ) ;
var steps = new List < string > ( ) ;
foreach ( var s in kv . Value ) steps . Add ( s . ToString ( CultureInfo . InvariantCulture ) ) ;
chain = F ( "pop_ach_chain" , a . nameKo , now . value . ToString ( "N0" , CultureInfo . InvariantCulture ) , string . Join ( "·" , steps . ToArray ( ) ) , now . step . ToString ( CultureInfo . InvariantCulture ) , now . goal . ToString ( "N0" , CultureInfo . InvariantCulture ) ) ;
break ;
}
2026-11-21 04:50:28 +00:00
var pl = V ( "pop_line" , 860f , 96f , 96f , 72f ) ;
var ps = V ( "pop_sum" , 860f , 64f ) ;
float step = pl [ 1 ] + 10f ;
2026-11-20 03:15:36 +00:00
int shown = Mathf . Min ( got . Count , 6 ) ;
2026-11-21 04:50:28 +00:00
float h = 300f + shown * step + ( chain ! = null ? 90f : 0f ) + 70f ;
2026-11-20 03:15:36 +00:00
var content = Popup ( T ( "pop_ach_title" ) , Mathf . Min ( 1500f , h ) , "pop_gold" ) ;
RectTransform list = content ;
if ( got . Count > shown )
{
ScrollRect sr ;
2026-11-21 04:50:28 +00:00
list = UiKit . ScrollGrid ( "Lines" , content , 0f , 0f , 0f , 70f + ( chain ! = null ? 90f : 0f ) , new Vector2 ( pl [ 0 ] , pl [ 1 ] ) , new Vector2 ( 0f , 10f ) , 1 , out sr ) ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
var tc = Col ( "text" , UiKit . Ink ) ;
var dim = Col ( "text_dim" , UiKit . InkSoft ) ;
2026-11-20 03:15:36 +00:00
for ( int i = 0 ; i < got . Count ; i + + )
{
var g = got [ i ] ;
RectTransform line ;
2026-11-21 04:50:28 +00:00
if ( list = = content )
{
line = UiKit . At ( content , "Line" + i , 0f , i * step , pl [ 0 ] , pl [ 1 ] ) ;
UiKit . Skin ( line , "card" , Col ( "row" , UiKit . Dark ) ) ;
}
else line = Cell ( list , "Line" + i , Col ( "row" , UiKit . Dark ) ) ;
Head ( line , new [ ] { pl [ 2 ] , 24f } , pl [ 1 ] , pl [ 0 ] , Col ( "row" , UiKit . Dark ) ) ; // 임무 줄과 같은 크림 쪽지 + 금 띠
RowIcon ( line , Cfg ( "icon." + g . a . counter ) , new [ ] { ( pl [ 2 ] - pl [ 3 ] ) * 0.5f , ( pl [ 1 ] - pl [ 3 ] ) * 0.5f , pl [ 3 ] , 0.92f } ) ;
Txt ( line , "Name" , F ( "pop_ach_line" , g . a . nameKo , g . step . ToString ( CultureInfo . InvariantCulture ) ) , 30 , tc , pl [ 2 ] + 14f , 8f , 540f , 42f , TextAnchor . MiddleLeft , true , false ) ;
Txt ( line , "Desc" , g . a . descKo . Replace ( "{n}" , g . goal . ToString ( "N0" , CultureInfo . InvariantCulture ) ) , 23 , dim , pl [ 2 ] + 14f , 50f , 540f , 34f , TextAnchor . MiddleLeft , false ) ;
float rc = V ( "pop_line_reward" , 72f , 70f ) [ 0 ] ;
RewardCell ( line , "Gem" , "gem" , g . gem , new Vector2 ( 0f , 1f ) , new Vector2 ( pl [ 0 ] - V ( "pop_line_reward" , 72f , 70f ) [ 1 ] , - pl [ 1 ] * 0.5f ) , rc ) ; // 업적 줄과 같은 등급 틀 칸
}
float y = list = = content ? shown * step + 14f : content . rect . height - 70f - ( chain ! = null ? 90f : 0f ) ;
// 합계 = 금 판 한 줄(위 → 아래 그러데이션)
var sum = UiKit . At ( content , "Sum" , ( pl [ 0 ] - ps [ 0 ] ) * 0.5f , y , ps [ 0 ] , ps [ 1 ] ) ;
var plate = UiKit . Skin ( sum , "card" , Color . white ) ;
if ( Cfg ( "color.sum_top" ) . Length > 0 ) UiGradient . Add ( plate , Col ( "sum_top" , UiKit . Coin ) , Col ( "sum_bottom" , UiKit . Coin ) ) ;
var sl = Txt ( sum , "Label" , T ( "pop_ach_sum" ) , 34 , Col ( "sum_text" , UiKit . Ink ) , 250f , ( ps [ 1 ] - 52f ) * 0.5f , 120f , 52f , TextAnchor . MiddleRight , true , false ) ;
sl . horizontalOverflow = HorizontalWrapMode . Overflow ;
var si = UiKit . Icon ( sum , Cfg ( "gem_icon" , "cur_gem" ) , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 410f , - ps [ 1 ] * 0.5f ) , 62f ) ;
if ( si ! = null ) UiKit . DropShadow ( si , 2f ) ;
var st = Txt ( sum , "Total" , F ( "point_plus" , total . ToString ( CultureInfo . InvariantCulture ) ) , 44 , UiKit . White , 450f , ( ps [ 1 ] - 60f ) * 0.5f , 260f , 60f , TextAnchor . MiddleLeft , true , false ) ;
UISkin . Stroke ( st , Col ( "sum_line" , UiKit . Ink ) , 3f ) ;
if ( chain ! = null ) UiKit . Label ( content , chain , 25 , UiKit . InkSoft , TextAnchor . UpperCenter , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0f , - ( y + ps [ 1 ] + 10f ) ) , new Vector2 ( 840f , 86f ) , false ) ;
2026-11-20 03:15:36 +00:00
}
/// <summary>바로가기(mission_screen goto.<낱말> = map · hero · arena:쪽 · domestic:쪽 · trade:쪽 · treasure:쪽).</summary>
public void Go ( string go )
{
var target = Cfg ( "goto." + go ) ;
int colon = target . IndexOf ( ':' ) ;
string scr = colon > 0 ? target . Substring ( 0 , colon ) : target ;
int pg = 0 ;
if ( colon > 0 ) int . TryParse ( target . Substring ( colon + 1 ) , NumberStyles . Integer , CultureInfo . InvariantCulture , out pg ) ;
switch ( scr )
{
case "map" : Root . OpenWorldMap ( ) ; break ;
case "hero" : Root . Show ( Root . HeroList ) ; break ;
case "arena" :
Root . Arena . SetPage ( pg ) ;
Root . Show ( Root . Arena ) ;
break ;
case "domestic" :
Root . Show ( Root . Domestic ) ;
Root . Domestic . SetPage ( pg ) ;
break ;
case "trade" :
Root . Show ( Root . Trade ) ;
Root . Trade . SetPage ( pg ) ;
break ;
case "treasure" :
Root . Show ( Root . Treasures ) ;
Root . Treasures . SetPage ( pg ) ;
break ;
}
}
// ---------- 부품 ----------
RectTransform Popup ( string title , float h , string headColor )
{
LastPopup = title ;
var content = Root . ModalCustom ( title , h , new OutGameRoot . ModalButton ( T ( "pop_ok" ) , UiKit . Col ( "ok" , UiKit . Ok ) , null ) ) ;
var head = content . parent . Find ( "Head" ) ;
if ( head ! = null & & head . GetComponent < Image > ( ) ! = null ) head . GetComponent < Image > ( ) . color = Col ( headColor , UiKit . Header ) ;
return content ;
}
2026-11-21 04:50:28 +00:00
/// <summary>보상 아이콘 줄(가운데 정렬 · 등급 틀(표 reward_frame.<id>) 안 아이콘 + 수량 + 이름).</summary>
public static void RewardRow ( RectTransform p , string reward , float y , float size , bool names , Color ? nameColor = null )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
var nc = nameColor ? ? UiKit . Ink ;
2026-11-20 03:15:36 +00:00
var map = ContentTables . ParseMap ( reward ) ;
float gap = size + 60f ;
float x0 = - ( map . Count - 1 ) * gap * 0.5f ;
int i = 0 ;
foreach ( var kv in map )
{
2026-11-21 04:50:28 +00:00
RewardCell ( p , "Rw_" + kv . Key , kv . Key , Mathf . RoundToInt ( kv . Value ) , new Vector2 ( 0.5f , 1f ) , new Vector2 ( x0 + i * gap , - ( y + size * 0.5f ) ) , size ) ;
2026-11-20 03:15:36 +00:00
if ( names )
2026-11-21 04:50:28 +00:00
UiKit . Label ( p , T ( "reward_" + kv . Key ) , size > = 110f ? 28 : 22 , nc , TextAnchor . MiddleCenter , new Vector2 ( 0.5f , 1f ) , new Vector2 ( 0.5f , 1f ) , new Vector2 ( x0 + i * gap , - ( y + size + 14f ) ) , new Vector2 ( gap , 38f ) ) ;
2026-11-20 03:15:36 +00:00
i + + ;
}
}
2026-11-21 04:50:28 +00:00
/// <summary>보상 칸 1개(등급 틀 스킨 reward_frame.<id> + 틀 안 바탕 + 재화 아이콘 reward_icon.<id> + 수량 칩) — 가운데 = pos(anchor 기준) · 팝업 · 업적 줄 공용.</summary>
public static RectTransform RewardCell ( RectTransform p , string name , string id , int qty , Vector2 anchor , Vector2 pos , float size )
{
var pc = V ( "pop_cell" , 130f , 0.7f , 8f ) ;
var cell = UiKit . Rect ( name , p , anchor , new Vector2 ( 0.5f , 0.5f ) , pos , new Vector2 ( size , size ) ) ;
string frame = Cfg ( "reward_frame." + id , Cfg ( "reward_frame.default" ) ) ; // 등급 칸 틀 = 테마 스킨(frame_<색>)
float inset = pc [ 2 ] * size / Mathf . Max ( 1f , pc [ 0 ] ) ;
if ( frame . Length > 0 & & UISkin . Has ( frame ) )
{
UiKit . Skin ( UiKit . Fill ( "Bg" , cell , inset , inset , inset , inset ) , "soft" , Col ( "pop_cell_bg" , UiKit . Dark ) ) ;
UiKit . Skin ( UiKit . Fill ( "Frame" , cell ) , frame , Color . white ) ;
}
else UiKit . Skin ( cell , "panel12" , Col ( "pop_cell_bg" , UiKit . Dark ) ) ;
var ic = UiKit . Icon ( cell , Cfg ( "reward_icon." + id ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0f , size * 0.03f ) , size * pc [ 1 ] ) ;
if ( ic ! = null ) UiKit . DropShadow ( ic , 3f ) ;
UiKit . QtyChip ( cell , qty . ToString ( "N0" , CultureInfo . InvariantCulture ) , size > = 110f ? 28 : size > = 80f ? 22 : 20 ) ;
return cell ;
}
/// <summary>
/// 게시대 제목 줄(PD 2026-11-21 8차 시안) = 받침(표 list_head_art · 테마 아이콘/스킨 · 비면 없음 · color.list_head) + 왼쪽 탭 이름(글자 키 tab_daily/tab_weekly · color.list_head_text)
/// + 오른쪽 시계 알약(표 list_timer_rect = 폭 | 높이 | 금 테 | 오른쪽에서 | 위에서 · 줄 기준).
/// </summary>
void ListHead ( string kind , float [ ] lh )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
var head = UiKit . At ( page , "ListHead" , lh [ 0 ] , lh [ 1 ] , lh [ 2 ] , lh [ 3 ] ) ;
string art = Cfg ( "list_head_art" ) ;
if ( art . Length > 0 )
{
var bg = GrowthUi . Paint ( UiKit . Fill ( "Plate" , head ) , art , Col ( "list_head" , Color . white ) ) ;
bg . raycastTarget = false ;
}
var t = Txt ( head , "Title" , T ( kind = = MissionDb . Daily ? "tab_daily" : "tab_weekly" ) , ( int ) lh [ 4 ] , Col ( "list_head_text" , UiKit . White ) , lh [ 5 ] , 0f , lh [ 2 ] * 0.5f , lh [ 3 ] , TextAnchor . MiddleLeft , true ) ;
t . name = "Title" ;
Timer ( head , kind , "list_timer_rect" ) ;
}
void Timer ( RectTransform panel , string kind , string rectKey = "timer_rect" )
{
var tr = V ( rectKey , 340f , 54f , 2f , 24f , 14f ) ;
// 9차(PD 2026-11-21 「남은 초기화 시간 UI 도 좀 더 어울리게」) = 받침 그림(표 <rectKey>_art = 그림 | 9 분할 배율 · 현판과 같은 붉은 옻칠 · 금 테 작은 명패) · 없으면 예전 금 테 검은 알약
var art = Cfg ( rectKey + "_art" ) . Split ( '|' ) ;
var ap = V ( rectKey + "_art" , 0f , 1f ) ;
var rt = UiKit . Rect ( "Timer" , panel , new Vector2 ( 1f , 1f ) , new Vector2 ( 1f , 1f ) , new Vector2 ( - tr [ 3 ] , - tr [ 4 ] ) , new Vector2 ( tr [ 0 ] , tr [ 1 ] ) ) ;
var asp = art . Length > 0 & & art [ 0 ] . Length > 0 ? UISkin . Icon ( art [ 0 ] ) : null ;
Image rim ;
Transform chip ;
if ( asp ! = null )
{
rim = rt . gameObject . AddComponent < Image > ( ) ;
rim . sprite = asp ;
rim . type = asp . border ! = Vector4 . zero ? Image . Type . Sliced : Image . Type . Simple ;
rim . pixelsPerUnitMultiplier = Mathf . Max ( 0.01f , ap [ 1 ] ) ; // 큰 판 그림을 작은 칸에 = 테 · 귀 장식을 같은 비율로 줄임
rim . raycastTarget = false ;
chip = rt ;
}
else
{
rim = UiKit . Skin ( rt , "chip" , Col ( "timer_rim" , Col ( "chip" , UiKit . Dark ) ) ) ;
chip = tr [ 2 ] > 0f ? UiKit . Skin ( UiKit . Fill ( "In" , rim . transform , tr [ 2 ] , tr [ 2 ] , tr [ 2 ] , tr [ 2 ] ) , "chip" , Col ( "timer" , UiKit . Dark ) ) . transform : rim . transform ;
}
UiLayer . Nest ( rim . gameObject , UiRate . Event , false ) ; // 1초마다 글자만 바뀜 = 판 캔버스와 따로
var ti = V ( rectKey + "_icon" , 30f , 44f , 60f , 26f ) ; // 아이콘 가운데 x | 크기 | 글자 x | 글자 크기
var tsp = Res ( Cfg ( "timer_sprite" ) ) ;
Image ic ;
if ( tsp ! = null )
{
ic = UiKit . Rect ( "Icon" , chip , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( ti [ 0 ] , 0f ) , new Vector2 ( ti [ 1 ] , ti [ 1 ] ) ) . gameObject . AddComponent < Image > ( ) ;
ic . sprite = tsp ;
ic . preserveAspect = true ;
ic . raycastTarget = false ;
}
else ic = UiKit . Icon ( chip , Cfg ( "timer_icon" , "clock" ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( ti [ 0 ] , 0f ) , ti [ 1 ] ) ;
2026-11-20 03:15:36 +00:00
if ( ic ! = null ) UiKit . DropShadow ( ic , 2f ) ;
2026-11-21 04:50:28 +00:00
var t = UiKit . Title ( UiKit . Label ( chip , "" , ( int ) ti [ 3 ] , Col ( "timer_text" , UiKit . White ) , TextAnchor . MiddleLeft , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( ti [ 2 ] , 1f ) , new Vector2 ( tr [ 0 ] - ti [ 2 ] - 10f , tr [ 1 ] ) ) , true ) ;
2026-11-20 03:15:36 +00:00
t . horizontalOverflow = HorizontalWrapMode . Overflow ;
2026-11-21 04:50:28 +00:00
var mt = rim . gameObject . AddComponent < MissionTimer > ( ) ;
2026-11-20 03:15:36 +00:00
mt . Init ( this , kind , t ) ;
}
/// <summary>남은 시간 글(일일 = 시:분:초 · 주간 = 일 시:분).</summary>
public string ResetText ( string kind )
{
var left = MissionRules . UntilReset ( S . Db . Missions , kind , S . Now ) ;
if ( left < TimeSpan . Zero ) left = TimeSpan . Zero ;
string s = kind = = MissionDb . Daily
? F ( "reset_hms" , ( ( int ) left . TotalHours ) . ToString ( "00" ) , left . Minutes . ToString ( "00" ) , left . Seconds . ToString ( "00" ) )
: F ( "reset_dhm" , left . Days . ToString ( CultureInfo . InvariantCulture ) , left . Hours . ToString ( "00" ) , left . Minutes . ToString ( "00" ) ) ;
return F ( "reset_in" , s ) ;
}
2026-11-21 04:50:28 +00:00
/// <summary>아래 안내(배경 위 = 어두운 알약 판 위 글자 · 표 foot = x | 아래에서 y | 폭 | 높이 | 글자) + 모두 받기(팩 그대로).</summary>
2026-11-20 03:15:36 +00:00
void Bottom ( string foot , Action all )
{
2026-11-21 04:50:28 +00:00
float pageH = PageH ;
var ft = V ( "foot" , 24f , 120f , 632f , 96f , 24f ) ;
var pill = UiKit . Skin ( UiKit . At ( page , "FootPill" , ft [ 0 ] , pageH - ft [ 1 ] , ft [ 2 ] , ft [ 3 ] ) , "chip" , Col ( "foot" , Color . clear ) ) ;
var t = UiKit . Label ( pill . transform , foot , ( int ) ft [ 4 ] , Col ( "foot_text" , UiKit . InkSoft ) , TextAnchor . MiddleLeft , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 22f , 0f ) , new Vector2 ( ft [ 2 ] - 34f , ft [ 3 ] ) , false ) ;
t . name = "Foot" ;
t . lineSpacing = 1.1f ;
2026-11-20 03:15:36 +00:00
var b = UiKit . SkinBtn ( page , "ClaimAll" , "btn_l_yellow" , UiKit . White , T ( "claim_all" ) , 44 , UiKit . Col ( "text_on_yellow" , UiKit . Ink ) , 1056f - 380f , pageH - 122f , 380f , 104f , all ) ;
b . name = "ClaimAll" ;
}
2026-11-21 04:50:28 +00:00
/// <summary>줄 칸(크림 종이 쪽지 · 팩 card 틴트).</summary>
2026-11-20 03:15:36 +00:00
static RectTransform Cell ( RectTransform grid , string name , Color c )
{
var go = new GameObject ( name , typeof ( RectTransform ) ) ;
go . transform . SetParent ( grid , false ) ;
var rt = ( RectTransform ) go . transform ;
2026-11-21 04:50:28 +00:00
UiKit . Skin ( rt , "card" , c , true ) ;
2026-11-20 03:15:36 +00:00
return rt ;
}
2026-11-21 04:50:28 +00:00
/// <summary>줄 왼쪽 금 띠(hd = 띠 폭 | 몸 밑으로 겹칠 폭) — 금 띠 판(팩 card) 위에 크림 몸 판(같은 card)을 x = 띠 폭부터 덮음.
/// 경계 = 몸 판 자기 외곽선 · 위아래 외곽선 · 그림자 턱 = 두 판 모두 스킨 그대로(곧은 네모 도형이 판을 뚫던 것 = QA r1 B1 고침).</summary>
static void Head ( RectTransform row , float [ ] hd , float h , float rowW , Color body )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
float w = hd [ 0 ] ;
if ( w < = 0f ) return ;
float lap = hd . Length > 1 ? hd [ 1 ] : 24f ;
UiKit . Skin ( UiKit . At ( row , "HeadBand" , 0f , 0f , w + lap , h ) , "card" , Col ( "row_head" , UiKit . Coin ) ) ;
UiKit . Skin ( UiKit . At ( row , "Body" , w , 0f , rowW - w , h ) , "card" , body ) ;
}
/// <summary>줄 아이콘(판 없이 · ri = x | y | 칸 | 아이콘 비).</summary>
static void RowIcon ( RectTransform row , string icon , float [ ] ri )
{
var ic = UiKit . Icon ( row , icon , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( ri [ 0 ] + ri [ 2 ] * 0.5f , - ( ri [ 1 ] + ri [ 2 ] * 0.5f ) ) , ri [ 2 ] * ri [ 3 ] ) ;
if ( ic ! = null )
{
ic . name = "Ic" ;
UiKit . DropShadow ( ic , 2f ) ;
}
}
/// <summary>테 선(Resources 9 분할 흰 선 그림 · 틴트) — 그림 경로가 비면 없음.</summary>
static void Line ( RectTransform p , string path , Color c , float pad )
{
var sp = Res ( path ) ;
if ( sp = = null ) return ;
var img = UiKit . Fill ( "Line" , p , pad , pad , pad , pad ) . gameObject . AddComponent < Image > ( ) ;
img . sprite = sp ;
img . type = Image . Type . Sliced ;
img . color = c ;
img . raycastTarget = false ;
}
/// <summary>임무 포인트 아이콘 id — 표 point_icon.<종류>(일일 = 백호 · 주간 = 청룡 · PD 2026-11-21 「타이틀에 사용된 디자인 참고」) · 없으면 point_icon.</summary>
static string PointIcon ( string kind )
{
return Cfg ( "point_icon." + kind , Cfg ( "point_icon" ) ) ;
}
/// <summary>9 분할 판 그림(테마 아이콘 · 경계가 있으면 Sliced) — id 가 비거나 그림이 없으면 null(호출 측이 예전 판).</summary>
static Image SlicedArt ( RectTransform rt , string id )
{
var sp = id . Length > 0 ? UISkin . Icon ( id ) : null ;
if ( sp = = null ) return null ;
var img = rt . gameObject . AddComponent < Image > ( ) ;
img . sprite = sp ;
img . type = sp . border ! = Vector4 . zero ? Image . Type . Sliced : Image . Type . Simple ;
img . raycastTarget = false ;
return img ;
}
/// <summary>
/// 받을 상자 뒤 번짐 빛(표 box_glow · box_glow_size · color.box_glow · box_glow_pulse) — 테마 아이콘이면 덧셈 합성(뽑기 광원 gacha_fx_core ·
/// 붉은 띠 위에서도 보임 · 2026-11-21 알파 섞기 glow_circle 은 거의 안 보임) · 스킨이면 알파 섞기 · 둘 다 없으면 금 원.
/// 깜빡임 = UiPulse(자기 Frame 캔버스) · 누름은 상자 칸이 받음.
/// </summary>
static void ReadyGlow ( RectTransform panel , Vector2 at )
{
float gz = V ( "box_glow_size" , 150f ) [ 0 ] ;
var grt = UiKit . Rect ( "Glow" , panel , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , at , new Vector2 ( gz , gz ) ) ;
string gid = Cfg ( "box_glow" , "glow_circle" ) ;
Image glow ;
var gsp = UISkin . Icon ( gid ) ;
if ( gsp ! = null & & GachaCutscene . AddMat ! = null )
{
glow = grt . gameObject . AddComponent < Image > ( ) ;
glow . sprite = gsp ;
glow . preserveAspect = true ;
glow . material = GachaCutscene . AddMat ;
glow . color = Col ( "box_glow" , UiKit . Coin ) ;
}
else if ( UISkin . Has ( gid ) ) glow = UiKit . Skin ( grt , gid , Col ( "box_glow" , UiKit . Coin ) ) ;
else
{
glow = grt . gameObject . AddComponent < Image > ( ) ;
glow . sprite = UiKit . Circle ;
glow . color = Col ( "box_glow" , UiKit . Coin ) ;
}
glow . raycastTarget = false ;
var pp = V ( "box_glow_pulse" , 0.6f , 0.8f ) ;
if ( pp [ 1 ] < = 0f ) return ;
var pulse = glow . gameObject . AddComponent < UiPulse > ( ) ;
pulse . min = pp [ 0 ] ;
pulse . period = pp [ 1 ] ;
}
/// <summary>구간 상자 접지 그림자(테마 아이콘 box_shadow · box_shadow_rect = 폭 | 높이 | 상자 가운데 아래 y).</summary>
static void Shadow ( RectTransform box , float iconSize )
{
var sp = UISkin . Icon ( Cfg ( "box_shadow" ) ) ;
if ( sp = = null ) return ;
var sr = V ( "box_shadow_rect" , iconSize * 0.9f , 16f , iconSize * 0.42f ) ;
var img = UiKit . Rect ( "Shadow" , box , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 0f , - sr [ 2 ] ) , new Vector2 ( sr [ 0 ] , sr [ 1 ] ) ) . gameObject . AddComponent < Image > ( ) ;
img . sprite = sp ;
img . color = Col ( "box_shadow" , new Color ( 0f , 0f , 0f , 0.3f ) ) ;
img . raycastTarget = false ;
}
/// <summary>받은 상자 탈색(셰이더 표 gray = 경로 | 원색 남김 비 · 없으면 어둡게 곱함).</summary>
static void Gray ( Image icon )
{
if ( grayMat = = null )
{
var sh = Resources . Load < Shader > ( Cfg ( "gray" ) . Split ( '|' ) [ 0 ] ) ;
if ( sh ! = null )
{
grayMat = new Material ( sh ) { name = "MissionGray" , hideFlags = HideFlags . HideAndDontSave } ;
grayMat . SetFloat ( "_Keep" , V ( "gray" , 0f , 0.3f ) [ 1 ] ) ;
}
}
if ( grayMat ! = null ) icon . material = grayMat ;
else icon . color = Col ( "box_got" , new Color ( 0.45f , 0.45f , 0.5f , 1f ) ) ;
}
/// <summary>막대 홈 색(팩 bar_bg 스킨이면 테마 홈 색 대신 표 색).</summary>
static void Track ( RectTransform fill , Color c )
{
var back = fill . parent ! = null & & fill . parent . parent ! = null ? fill . parent . parent . GetComponent < Image > ( ) : null ;
if ( back ! = null ) back . color = c ;
}
/// <summary>
/// 홈 안쪽 색 칸(채움과 같은 bar_fill 모양 · 채움 뒤) — 팩 홈 그림 bar_bg 가 어두워 색을 곱해도 거의 검정(3차 QA r5 M2 실측 #0E0405)이라
/// 옻칠 현판 위 포인트 막대만 이 칸으로 홈 색(color.track_panel)을 보이게 한다.
/// </summary>
static void Groove ( RectTransform fill , Color c )
{
var track = fill . parent as RectTransform ;
if ( track = = null | | ! UISkin . Has ( "bar_fill" ) ) return ;
var g = UiKit . Fill ( "Groove" , track ) ;
g . SetAsFirstSibling ( ) ;
UiKit . Skin ( g , "bar_fill" , c ) . raycastTarget = false ;
2026-11-20 03:15:36 +00:00
}
2026-11-21 04:50:28 +00:00
static void Progress ( RectTransform row , int v , int goal , float x , float y , float w , float h , bool clamp , int size )
2026-11-20 03:15:36 +00:00
{
bool full = v > = goal ;
2026-11-21 04:50:28 +00:00
var fill = UiKit . Bar ( "Bar" , row , new Vector2 ( 0f , 1f ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( x , - y ) , new Vector2 ( w , h ) , Col ( "track" , UiKit . Dark ) , full ? Col ( "bar_full" , UiKit . Coin ) : Col ( "bar_part" , UiKit . Jade ) ) ;
Track ( fill , Col ( "track" , UiKit . Dark ) ) ;
2026-11-20 03:15:36 +00:00
UiKit . SetBar ( fill , goal > 0 ? v / ( float ) goal : 0f ) ;
2026-11-21 04:50:28 +00:00
var t = UiKit . Title ( UiKit . Label ( row , F ( "progress" , ( clamp ? Mathf . Min ( v , goal ) : v ) . ToString ( "N0" , CultureInfo . InvariantCulture ) , goal . ToString ( "N0" , CultureInfo . InvariantCulture ) ) , size , UiKit . White , TextAnchor . MiddleCenter , new Vector2 ( 0f , 1f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( x + w * 0.5f , - y ) , new Vector2 ( w , h + 6f ) ) , true ) ;
2026-11-20 03:15:36 +00:00
t . name = "ProgressText" ;
t . horizontalOverflow = HorizontalWrapMode . Overflow ;
}
2026-11-21 04:50:28 +00:00
static Button RowBtn ( RectTransform row , string skin , Color tint , string label , Color fg , Action onClick , float [ ] bb , float y )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
var b = UiKit . SkinBtn ( row , "Btn" , UISkin . Has ( skin ) ? skin : "button" , tint , label , ( int ) bb [ 4 ] , fg , bb [ 0 ] , y , bb [ 2 ] , bb [ 3 ] , onClick ) ;
2026-11-20 03:15:36 +00:00
return b ;
}
2026-11-21 04:50:28 +00:00
static void DoneBtn ( RectTransform row , string label , float [ ] bb , float y )
2026-11-20 03:15:36 +00:00
{
2026-11-21 04:50:28 +00:00
var b = RowBtn ( row , "btn_s_gray" , UiKit . White , label , UiKit . White , null , bb , y ) ;
2026-11-20 03:15:36 +00:00
b . interactable = false ;
var t = UiKit . LabelOf ( b ) ;
t . rectTransform . offsetMin = new Vector2 ( 46f , t . rectTransform . offsetMin . y ) ;
var ic = UiKit . Icon ( b . transform , Cfg ( "check_icon" , "check" ) , new Vector2 ( 0f , 0.5f ) , new Vector2 ( 0.5f , 0.5f ) , new Vector2 ( 34f , 4f ) , 40f ) ;
if ( ic ! = null ) ic . color = UiKit . Col ( "ok" , UiKit . Ok ) ;
}
2026-11-21 04:50:28 +00:00
/// <summary>글자(title = 제목 글꼴 + 외곽선 · stroke false = 제목 글꼴만(크림 줄 위 고동 글자)).</summary>
static Text Txt ( RectTransform p , string name , string s , int size , Color c , float x , float y , float w , float h , TextAnchor align , bool title , bool stroke = true )
2026-11-20 03:15:36 +00:00
{
var t = UiKit . Label ( p , s , size , c , align , new Vector2 ( 0f , 1f ) , new Vector2 ( 0f , 1f ) , new Vector2 ( x , - y ) , new Vector2 ( w , h ) , title ) ;
t . name = name ;
2026-11-21 04:50:28 +00:00
if ( title ) UiKit . Title ( t , stroke ) ;
2026-11-20 03:15:36 +00:00
t . horizontalOverflow = HorizontalWrapMode . Overflow ;
return t ;
}
static List < string > Split ( string s )
{
var l = new List < string > ( ) ;
foreach ( var p in ( s ? ? "" ) . Split ( ';' ) )
if ( p . Trim ( ) . Length > 0 ) l . Add ( p . Trim ( ) ) ;
return l ;
}
}
/// <summary>초기화 시계 칩 글자(1초마다 · 값이 같으면 Text 가 쓰지 않음).</summary>
public class MissionTimer : MonoBehaviour
{
MissionScreen screen ;
string kind ;
Text text ;
float next ;
public void Init ( MissionScreen s , string k , Text t )
{
screen = s ;
kind = k ;
text = t ;
text . text = s . ResetText ( k ) ;
}
void Update ( )
{
if ( screen = = null | | text = = null | | Time . unscaledTime < next ) return ;
next = Time . unscaledTime + 1f ;
text . text = screen . ResetText ( kind ) ;
}
}
}