123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- 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>();
- PhotoBGData.init_data_ = null;
- PhotoBGData.bg_data_ = new List<PhotoBGData>();
- PhotoBGData.category_list_ = new Dictionary<string, List<PhotoBGData>>();
- PhotoBGData.popup_menu_list_ = new List<KeyValuePair<string, UnityEngine.Object>>();
- HashSet<int> hashSet = new HashSet<int>();
- 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<string, string> saveDataDic = CreativeRoomManager.GetSaveDataDic();
- if (saveDataDic != null)
- {
- foreach (KeyValuePair<string, string> 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<string, List<PhotoBGData>>();
- PhotoBGData.popup_menu_list_ = new List<KeyValuePair<string, UnityEngine.Object>>();
- PhotoBGData.popup_category_term_list = new List<string>();
- HashSet<string> hashSet2 = new HashSet<string>();
- List<PhotoBGData> 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>());
- }
- PhotoBGData.category_list_[data[j].category].Add(data[j]);
- if (!hashSet2.Contains(data[j].category))
- {
- PhotoBGData.popup_menu_list_.Add(new KeyValuePair<string, UnityEngine.Object>(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<PhotoBGData> data
- {
- get
- {
- return PhotoBGData.bg_data_;
- }
- }
- public static PhotoBGData init_data
- {
- get
- {
- return PhotoBGData.init_data_;
- }
- }
- public static Dictionary<string, List<PhotoBGData>> category_list
- {
- get
- {
- return PhotoBGData.category_list_;
- }
- }
- public static List<string> popup_category_term_list { get; private set; }
- public static List<KeyValuePair<string, UnityEngine.Object>> 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<PhotoBGData> bg_data_;
- private static Dictionary<string, List<PhotoBGData>> category_list_;
- private static List<KeyValuePair<string, UnityEngine.Object>> popup_menu_list_;
- }
|