using System; using System.Collections.Generic; using System.IO; using UnityEngine; using wf; namespace SceneEditWindow { public class BgIconData { public static List itemList { get; private set; } public static BgIconData.ItemData GetItemData(int id) { BgIconData.ItemData result = default(BgIconData.ItemData); foreach (BgIconData.ItemData itemData in BgIconData.itemList) { if (itemData.id == id) { result = itemData; break; } } return result; } public static void Create() { if (BgIconData.itemList != null) { return; } HashSet hashSet = new HashSet(); CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "edit_bg_enabled_list", ref hashSet); HashSet hashSet2 = new HashSet(); BgIconData.itemList = new List(); using (AFileBase afileBase = GameUty.FileSystem.FileOpen("edit_bg.nei")) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, "edit_bg.nei\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { if (csvParser.IsCellToExistData(0, i)) { int num = 0; BgIconData.ItemData item = default(BgIconData.ItemData); item.id = csvParser.GetCellAsInteger(num++, i); if (hashSet.Contains(item.id)) { if (!hashSet2.Contains(item.id)) { hashSet2.Add(item.id); item.iconTexName = Path.ChangeExtension(csvParser.GetCellAsString(num++, i).ToString(), "tex"); item.bgName = csvParser.GetCellAsString(num++, i); item.yotogiStageData = null; string cellAsString = csvParser.GetCellAsString(num++, i); if (!string.IsNullOrEmpty(cellAsString)) { try { item.yotogiStageData = YotogiStage.GetData(cellAsString); } catch (Exception) { item.yotogiStageData = null; goto IL_1D0; } } item.isRefNoon = (csvParser.GetCellAsString(num++, i) == "昼"); item.isLegacyBG = (csvParser.GetCellAsString(num++, i) == "〇"); item.position = Parse.Vector3(csvParser.GetCellAsString(num++, i)); item.rotation_y = float.Parse(csvParser.GetCellAsString(num++, i)); BgIconData.itemList.Add(item); } } } IL_1D0:; } } } BgIconData.itemList.Sort((BgIconData.ItemData a, BgIconData.ItemData b) => a.id - b.id); } public struct ItemData { public bool enabled { get { return this.yotogiStageData == null || (YotogiStage.IsEnabled(this.yotogiStageData.id) && this.yotogiStageData.isYotogiPlayable(GameMain.Instance.CharacterMgr.status.clubGrade, false)); } } public bool Exec() { if (GameMain.Instance == null || GameMain.Instance.BgMgr == null) { return false; } BgMgr bgMgr = GameMain.Instance.BgMgr; if (string.IsNullOrEmpty(this.bgName) && this.yotogiStageData != null) { int num = (!this.isRefNoon) ? 1 : 0; GameMain.Instance.BgMgr.ChangeBg(this.yotogiStageData.prefabName[num]); } else { bgMgr.ChangeBg(this.bgName); } bgMgr.SetPos(this.position); bgMgr.SetRot(new Vector3(0f, this.rotation_y, 0f)); return true; } public int id; public bool isLegacyBG; public YotogiStage.Data yotogiStageData; public bool isRefNoon; public string iconTexName; public string bgName; public Vector3 position; public float rotation_y; } } }