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

96 lines
3.6 KiB
C#

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace TKS.OutGame
{
/// <summary>
/// 시작 씬 구성(PD 2026-11-16 「타이틀 화면은 별도의 씬으로 구성해서 타이틀 화면만 테스트할 수 있도록 분리 · 스플래쉬 화면으로 회사 CI 를 먼저 노출하고,
/// CDN 파일이 존재할 경우 CDN 리소스 체크 후 타이틀 화면으로 전환」) — 씬 이름·스플래시·페이드 값 = 표 Resources/UI/boot_flow.csv(C45).
/// 빌드 순서 = Splash(회사 CI → CDN 확인·받기) → Title(타이틀만 · 이 씬만 열고 Play = 타이틀만 시험) → Battle(본영 로비 · 게임).
/// </summary>
public static class BootScenes
{
static LoadingTable.Row Opt(string id)
{
return LoadingTable.Load(BootFlow.TablePath).Find(x => x.kind == "option" && x.id == id);
}
static string Name(int i, string fallback)
{
var r = Opt("scenes");
var parts = r != null && r.text.Length > 0 ? r.text.Split('|') : new string[0];
return i < parts.Length && parts[i].Trim().Length > 0 ? parts[i].Trim() : fallback;
}
public static string Splash
{
get { return Name(0, "Splash"); }
}
public static string Title
{
get { return Name(1, "Title"); }
}
public static string Game
{
get { return Name(2, "Battle"); }
}
/// <summary>씬 바꿈 페이드 값 = 표 fade 줄(아웃 · 유지 · 인 · 색 · 정렬 순서).</summary>
public static void Fade(out float fOut, out float fHold, out float fIn, out Color color, out int order)
{
var f = Opt("fade");
fOut = f != null ? f.a : 0.35f;
fHold = f != null ? f.b : 0.15f;
fIn = f != null ? f.c : 0.35f;
color = f != null ? f.color : Color.black;
order = f != null && f.size > 0 ? f.size : 950;
}
/// <summary>지금 화면에서 페이드 아웃 → scene.</summary>
public static SceneSwitch GoTo(string scene)
{
float o, h, i;
Color c;
int ord;
Fade(out o, out h, out i, out c, out ord);
return SceneSwitch.Go(scene, o, h, i, c, ord);
}
/// <summary>앞 페이드로 이미 검정인 화면 → scene(타이틀 누름 · 받기 끝).</summary>
public static SceneSwitch FromBlack(string scene)
{
float o, h, i;
Color c;
int ord;
Fade(out o, out h, out i, out c, out ord);
return SceneSwitch.FromBlack(scene, h, i, c, ord);
}
/// <summary>씬마다 쓰는 기본 카메라(없으면 만듦 · 직교 · 단색 바탕).</summary>
public static Camera Cam(Color bg)
{
var cam = Camera.main;
if (cam == null)
{
var go = new GameObject("Main Camera");
go.tag = "MainCamera";
cam = go.AddComponent<Camera>();
}
cam.orthographic = true;
cam.clearFlags = CameraClearFlags.SolidColor;
cam.backgroundColor = bg;
cam.transform.position = new Vector3(0f, 0f, -10f);
return cam;
}
/// <summary>표 splash 줄(회사 CI 그림 · 크기 · 바탕색 · 페이드 인/유지/아웃 · 시작 전 뜸).</summary>
public static LoadingTable.Row SplashRow
{
get { return LoadingTable.Load(BootFlow.TablePath).Find(x => x.kind == "splash"); }
}
}
}