using System; using System.Collections.Generic; using UnityEngine; namespace Streamingle.Background { /// /// 배경 씬 정보를 담는 데이터 클래스 /// [Serializable] public class BackgroundSceneInfo { public string sceneName; // 씬 파일 이름 (확장자 제외) public string scenePath; // 씬 파일 전체 경로 (Assets/...) public string categoryName; // 카테고리 (폴더명, 예: [공용]농구장) public string thumbnailPath; // 썸네일 이미지 경로 public Texture2D thumbnail; // 로드된 썸네일 (런타임용) public bool excludeFromWeb; // 웹사이트 업로드 제외 여부 public string DisplayName => sceneName; public string Category => ExtractCategory(categoryName); private static string ExtractCategory(string folderName) { // [공용], [야모], [아이시아] 등 카테고리 추출 if (string.IsNullOrEmpty(folderName)) return "기타"; int start = folderName.IndexOf('['); int end = folderName.IndexOf(']'); if (start >= 0 && end > start) { return folderName.Substring(start + 1, end - start - 1); } return "기타"; } } /// /// 배경 씬 데이터를 저장하는 ScriptableObject /// [CreateAssetMenu(fileName = "BackgroundSceneDatabase", menuName = "Streamingle/Background Scene Database")] public class BackgroundSceneDatabase : ScriptableObject { public List scenes = new List(); /// /// 카테고리별로 씬 목록 반환 /// public Dictionary> GetScenesByCategory() { var result = new Dictionary>(); foreach (var scene in scenes) { string category = scene.Category; if (!result.ContainsKey(category)) { result[category] = new List(); } result[category].Add(scene); } return result; } /// /// 씬 이름으로 검색 /// public BackgroundSceneInfo FindByName(string sceneName) { return scenes.Find(s => s.sceneName == sceneName); } /// /// 씬 경로로 검색 /// public BackgroundSceneInfo FindByPath(string scenePath) { return scenes.Find(s => s.scenePath == scenePath); } } }