using System; using System.Collections.Generic; using MyRoomCustom; using UnityEngine; using wf; public class PhotoBGData { private PhotoBGData() { } public static void Create() { PhotoBGData.bg_data_ = new List(); PhotoBGData.init_data_ = null; PhotoBGData.bg_data_ = new List(); PhotoBGData.category_list_ = new Dictionary>(); PhotoBGData.popup_menu_list_ = new List>(); HashSet hashSet = new HashSet(); CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "phot_bg_enabled_list", ref hashSet); using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_bg_list.nei")) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, "phot_bg_list.nei\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { if (csvParser.IsCellToExistData(0, i) && hashSet.Contains(csvParser.GetCellAsInteger(0, i))) { int num = 0; PhotoBGData photoBGData = new PhotoBGData(); photoBGData.id = csvParser.GetCellAsInteger(num++, i).ToString(); photoBGData.category = csvParser.GetCellAsString(num++, i); photoBGData.name = csvParser.GetCellAsString(num++, i); photoBGData.create_prefab_name = csvParser.GetCellAsString(num++, i); string cellAsString = csvParser.GetCellAsString(num++, i); if (string.IsNullOrEmpty(cellAsString) || PluginData.IsEnabled(cellAsString)) { PhotoBGData.bg_data_.Add(photoBGData); if (PhotoBGData.init_data_ == null) { PhotoBGData.init_data_ = photoBGData; } } } } } } Dictionary saveDataDic = CreativeRoomManager.GetSaveDataDic(); if (saveDataDic != null) { foreach (KeyValuePair keyValuePair in saveDataDic) { PhotoBGData photoBGData2 = new PhotoBGData(); photoBGData2.id = keyValuePair.Key; photoBGData2.category = "マイルーム"; photoBGData2.name = keyValuePair.Value; photoBGData2.create_prefab_name = string.Empty; PhotoBGData.bg_data_.Add(photoBGData2); } } PhotoBGData.category_list_ = new Dictionary>(); PhotoBGData.popup_menu_list_ = new List>(); PhotoBGData.popup_category_term_list = new List(); HashSet hashSet2 = new HashSet(); List data = PhotoBGData.data; for (int j = 0; j < data.Count; j++) { if (!PhotoBGData.category_list_.ContainsKey(data[j].category)) { PhotoBGData.category_list_.Add(data[j].category, new List()); } PhotoBGData.category_list_[data[j].category].Add(data[j]); if (!hashSet2.Contains(data[j].category)) { PhotoBGData.popup_menu_list_.Add(new KeyValuePair(data[j].category, null)); PhotoBGData.popup_category_term_list.Add("ScenePhotoMode/BG/カテゴリー/" + data[j].category); hashSet2.Add(data[j].category); } } } public string nameTerm { get { return (!(this.category == "マイルーム")) ? ("ScenePhotoMode/BG/" + this.id.ToString() + "/名前") : string.Empty; } } public void Apply() { if (!string.IsNullOrEmpty(this.create_prefab_name)) { GameMain.Instance.BgMgr.ChangeBg(this.create_prefab_name); } else if (CreativeRoomManager.IsExistSaveData(this.id)) { GameMain.Instance.BgMgr.ChangeBgMyRoom(this.id); } } public static List data { get { return PhotoBGData.bg_data_; } } public static PhotoBGData init_data { get { return PhotoBGData.init_data_; } } public static Dictionary> category_list { get { return PhotoBGData.category_list_; } } public static List popup_category_term_list { get; private set; } public static List> popup_category_list { get { return PhotoBGData.popup_menu_list_; } } public static PhotoBGData Get(string id) { for (int i = 0; i < PhotoBGData.bg_data_.Count; i++) { if (PhotoBGData.bg_data_[i].id == id) { return PhotoBGData.bg_data_[i]; } } return null; } public string id; public string category; public string name; public string create_prefab_name; private static PhotoBGData init_data_; private static List bg_data_; private static Dictionary> category_list_; private static List> popup_menu_list_; }