ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Boot/SplashBoot.cs

112 lines
4.1 KiB
C#
Raw Normal View History

타이틀 6~11차 — 로고 A4(용호) · Fable 연출(부딪힘 → 박힘·번쩍임 → 장수 쑥) · 하늘 다시 그림 · 타이틀 별도 씬(Splash 회사 CI → CDN 확인 → Title → Battle) (PD 2026-11-16) - 로고 A4 = 로고 A 제목·먹 띠(7차 「기존이 훨씬 좋아」) + 붉은 부제 판 「천지를 까다」 가운데 아래 + 판 끝을 문·짚은 좌청룡·우백호(바둑판·바둑알 삭제) · 부품 Resources/UI/Title/logo(band·title·plate·dragon·tiger·burst) - 연출(10차 · Fable 시안 「용호상박이 현판을 낳는다」): 0.65 s 청룡·백호 가운데 부딪힘 → 판이 펼쳐지며 밀어냄 → 1.05 s 박힘 + 「삼국지」 쾅 + 번쩍임 → 장수 6명 제자리에서 쑥 · TitleScreen 새 움직임 clash · burst · leap:0 · option flash·clash - 배치(8·10차): 유비 왼쪽 위 · 황충·조운 6차 자리 관계 · 제갈량 가운데 아래 · 하늘(9차 욱일기 연상) = 방사 햇살·붉은 해 없는 배경 · rays 줄 삭제 - 별도 씬(11차): Assets/Scenes/Splash.unity(SplashBoot · 회사 CI ci_nerdnavis) → Title.unity(TitleSceneBoot · 이 씬만 Play = 타이틀 시험) → Battle(GameBootstrap = 바로 로비) · 빌드 순서 Splash·Title·Battle · SceneSwitch(씬 사이 검정 페이드) · BootScenesSetup(씬·빌드 순서 만들기) - CDN: CdnDownloader(표 boot_flow.csv cdn 줄 · 목록 파일에 있고 로컬에 없거나 크기 다른 파일만 받음 · 주소 비었거나 목록 없음 = 바로 타이틀) · 지금 CDN 주소 없음 → 확인 건너뜀 · BootFlow.BeginThen - 검증 캡처: Title 씬 · 연출 시계 고정(FixedClock · 30fps 확인 영상) · 캡처 중 입력 무시(IgnoreInput) - 검증: TitleScreenTests + BootFlowTests 16/16(사본 배치 · 새 4 = CDN 3 · Splash → Title → Battle 씬 1) · QA S4 PASS(B 0 · M 3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:17:35 +00:00
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace TKS.OutGame
{
/// <summary>
/// Splash 씬 — 회사 CI 노출(페이드 인 → 유지 → 페이드 아웃) 동안 CDN 확인을 함께 돌리고,
/// 받을 것이 없으면 Title 씬으로 · 있으면 로딩 화면 Download(BootFlow) → 다 받으면 페이드 → Title 씬.
/// </summary>
public class SplashBoot : MonoBehaviour
{
public enum Step
{
Logo,
Check,
Download,
Switch
}
public static SplashBoot Current { get; private set; }
public Step State { get; private set; }
public IResourceDownloader Downloader { get; private set; }
public Image Ci { get; private set; }
/// <summary>CI 가 가장 밝았던 알파(테스트 · 노출 확인).</summary>
public float CiPeak { get; private set; }
Camera cam;
void Awake()
{
Current = this;
}
void OnDestroy()
{
if (Current == this) Current = null;
}
IEnumerator Start()
{
var r = BootScenes.SplashRow;
Color bg = r != null ? r.color : Color.black;
cam = BootScenes.Cam(bg);
var go = new GameObject("SplashUI");
go.transform.SetParent(transform, false);
// P41: CI 알파가 바뀌는 동안만 = Frame · 요소 2개(바탕 · CI)
UiLayer.Root(go, cam, r != null && r.size > 0 ? r.size : 100, 1f, UiLayer.Reference, UiRate.Frame, false);
var back = UiKit.Fill("Bg", go.transform).gameObject.AddComponent<Image>();
back.color = bg;
back.raycastTarget = false;
var ciRt = UiKit.Rect("CI", go.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero,
new Vector2(r != null && r.w > 0f ? r.w : 560f, r != null && r.h > 0f ? r.h : 560f));
Ci = ciRt.gameObject.AddComponent<Image>();
Ci.sprite = r != null ? LoadingTable.Sprite(r.sprite) : null;
Ci.preserveAspect = true;
Ci.raycastTarget = false;
Ci.color = new Color(1f, 1f, 1f, 0f);
// CDN 확인은 CI 가 보이는 동안 함께(기다림 줄임)
Downloader = BootFlow.OverrideDownloader ?? BootFlow.FromTable();
Downloader.Begin();
float last = LoadingScreen.Now;
System.Func<float> dt = () =>
{
float now = LoadingScreen.Now;
float d = Mathf.Max(0f, now - last);
last = now;
Downloader.Tick(d);
return d;
};
State = Step.Logo;
float delay = r != null ? r.phase : 0.2f, fIn = r != null ? r.a : 0.4f, hold = r != null ? r.b : 1.2f, fOut = r != null ? r.c : 0.4f;
for (float t = 0f; t < delay;)
{
yield return null;
t += dt();
}
for (float t = 0f; t < fIn + hold + fOut;)
{
yield return null;
t += dt();
float a = t < fIn ? t / Mathf.Max(0.01f, fIn) : t < fIn + hold ? 1f : 1f - (t - fIn - hold) / Mathf.Max(0.01f, fOut);
a = Mathf.Clamp01(a);
Ci.color = new Color(1f, 1f, 1f, a);
CiPeak = Mathf.Max(CiPeak, a);
}
Ci.color = new Color(1f, 1f, 1f, 0f);
State = Step.Check;
while (!Downloader.Checked)
{
yield return null;
dt();
}
if (!Downloader.Needed)
{
State = Step.Switch;
BootScenes.GoTo(BootScenes.Title);
yield break;
}
// 받기 = 로딩 화면 Download(BootFlow · 진행률·용량 · 실패 = retry) → 페이드 아웃 → Title 씬(검정에서 이어 페이드 인)
State = Step.Download;
BootFlow.BeginThen(cam, () =>
{
State = Step.Switch;
BootScenes.FromBlack(BootScenes.Title);
}, Downloader);
}
}
}