using System;
using System.Collections.Generic;
using UnityEngine;
using wf;

public static class SceneEditInfo
{
	public static Dictionary<string, string> m_dicSliderPartsTypeBtnName { get; private set; }

	public static Dictionary<MPN, SceneEditInfo.CCateNameType> m_dicPartsTypePair
	{
		get
		{
			if (SceneEditInfo.dicPartsTypePair_ == null)
			{
				SceneEditInfo.m_dicSliderPartsTypeBtnName = new Dictionary<string, string>();
				string text = "edit_category_define.nei";
				SceneEditInfo.dicPartsTypePair_ = new Dictionary<MPN, SceneEditInfo.CCateNameType>();
				Dictionary<SceneEditInfo.EMenuCategory, int> dictionary = new Dictionary<SceneEditInfo.EMenuCategory, int>();
				using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
				{
					using (CsvParser csvParser = new CsvParser())
					{
						bool condition = csvParser.Open(afileBase);
						NDebug.Assert(condition, text + "\nopen failed.");
						for (int i = 1; i < csvParser.max_cell_y; i++)
						{
							if (csvParser.IsCellToExistData(0, i))
							{
								int num = 0;
								MPN key = MPN.null_mpn;
								try
								{
									key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e)
								{
									NDebug.AssertParseError("MPN", e);
								}
								SceneEditInfo.CCateNameType ccateNameType = new SceneEditInfo.CCateNameType();
								ccateNameType.m_eMenuCate = SceneEditInfo.EMenuCategory.頭;
								try
								{
									ccateNameType.m_eMenuCate = (SceneEditInfo.EMenuCategory)Enum.Parse(typeof(SceneEditInfo.EMenuCategory), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e2)
								{
									NDebug.AssertParseError("EMenuCategory", e2);
								}
								ccateNameType.m_eType = SceneEditInfo.CCateNameType.EType.Item;
								try
								{
									ccateNameType.m_eType = (SceneEditInfo.CCateNameType.EType)Enum.Parse(typeof(SceneEditInfo.CCateNameType.EType), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e3)
								{
									NDebug.AssertParseError("CCateNameType.EType", e3);
								}
								ccateNameType.m_ePartsType = csvParser.GetCellAsString(num++, i);
								ccateNameType.m_strBtnPartsTypeName = csvParser.GetCellAsString(num++, i);
								if (0 <= ccateNameType.m_ePartsType.IndexOf("slider"))
								{
									string[] array = ccateNameType.m_strBtnPartsTypeName.Split(new char[]
									{
										'/'
									});
									NDebug.Assert(array.Length == 2, text + "の" + i.ToString() + "行目の表示名が不正です");
									if (!SceneEditInfo.m_dicSliderPartsTypeBtnName.ContainsKey(ccateNameType.m_ePartsType))
									{
										SceneEditInfo.m_dicSliderPartsTypeBtnName.Add(ccateNameType.m_ePartsType, array[0]);
									}
									else
									{
										NDebug.Assert(SceneEditInfo.m_dicSliderPartsTypeBtnName[ccateNameType.m_ePartsType] == array[0], text + "の" + i.ToString() + "行目の表示名が不正です");
									}
									ccateNameType.m_strBtnPartsTypeName = array[1];
								}
								NDebug.Assert(!SceneEditInfo.dicPartsTypePair_.ContainsKey(key), "MPN[" + key.ToString() + "]が重複しています");
								if (!dictionary.ContainsKey(ccateNameType.m_eMenuCate))
								{
									dictionary.Add(ccateNameType.m_eMenuCate, 0);
								}
								SceneEditInfo.CCateNameType ccateNameType2 = ccateNameType;
								Dictionary<SceneEditInfo.EMenuCategory, int> dictionary2;
								SceneEditInfo.EMenuCategory eMenuCate;
								int nIdx;
								(dictionary2 = dictionary)[eMenuCate = ccateNameType.m_eMenuCate] = (nIdx = dictionary2[eMenuCate]) + 1;
								ccateNameType2.m_nIdx = nIdx;
								SceneEditInfo.dicPartsTypePair_.Add(key, ccateNameType);
							}
						}
					}
				}
			}
			return SceneEditInfo.dicPartsTypePair_;
		}
	}

	public static Dictionary<MPN, TBody.MaskMode> m_dicPartsTypeWearMode
	{
		get
		{
			if (SceneEditInfo.dicPartsTypeWearMode_ == null)
			{
				string text = "edit_mask_define.nei";
				SceneEditInfo.dicPartsTypeWearMode_ = new Dictionary<MPN, TBody.MaskMode>();
				using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
				{
					using (CsvParser csvParser = new CsvParser())
					{
						bool condition = csvParser.Open(afileBase);
						NDebug.Assert(condition, text + "\nopen failed.");
						for (int i = 1; i < csvParser.max_cell_y; i++)
						{
							if (csvParser.IsCellToExistData(0, i))
							{
								int num = 0;
								MPN key = MPN.null_mpn;
								try
								{
									key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e)
								{
									NDebug.AssertParseError("MPN", e);
								}
								TBody.MaskMode value = TBody.MaskMode.None;
								try
								{
									value = (TBody.MaskMode)Enum.Parse(typeof(TBody.MaskMode), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e2)
								{
									NDebug.AssertParseError("TBody.MaskMode", e2);
								}
								NDebug.Assert(!SceneEditInfo.dicPartsTypeWearMode_.ContainsKey(key), "MPN[" + key.ToString() + "]が重複しています");
								SceneEditInfo.dicPartsTypeWearMode_.Add(key, value);
							}
						}
					}
				}
			}
			return SceneEditInfo.dicPartsTypeWearMode_;
		}
	}

	public static Dictionary<MPN, SceneEditInfo.CamToBone> m_dicPartsTypeCamera
	{
		get
		{
			if (SceneEditInfo.m_dicPartsTypeCamera_ == null)
			{
				string text = "edit_attention_point_define.nei";
				SceneEditInfo.m_dicPartsTypeCamera_ = new Dictionary<MPN, SceneEditInfo.CamToBone>();
				using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
				{
					using (CsvParser csvParser = new CsvParser())
					{
						bool condition = csvParser.Open(afileBase);
						NDebug.Assert(condition, text + "\nopen failed.");
						for (int i = 1; i < csvParser.max_cell_y; i++)
						{
							if (csvParser.IsCellToExistData(0, i))
							{
								SceneEditInfo.CamToBone value = default(SceneEditInfo.CamToBone);
								int num = 0;
								MPN key = MPN.null_mpn;
								try
								{
									key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
								}
								catch (Exception e)
								{
									NDebug.AssertParseError("MPN", e);
								}
								value.bone = csvParser.GetCellAsString(num++, i);
								value.angle = Parse.Vector2(csvParser.GetCellAsString(num++, i));
								value.distance = csvParser.GetCellAsReal(num++, i);
								NDebug.Assert(!SceneEditInfo.m_dicPartsTypeCamera_.ContainsKey(key), "MPN[" + key.ToString() + "]が重複しています");
								SceneEditInfo.m_dicPartsTypeCamera_.Add(key, value);
							}
						}
					}
				}
			}
			return SceneEditInfo.m_dicPartsTypeCamera_;
		}
	}

	private static Dictionary<MPN, SceneEditInfo.CCateNameType> dicPartsTypePair_;

	private static Dictionary<MPN, TBody.MaskMode> dicPartsTypeWearMode_;

	private static Dictionary<MPN, SceneEditInfo.CamToBone> m_dicPartsTypeCamera_;

	public enum EMenuCategory
	{
		頭,
		髪,
		身体,
		服装,
		アクセサリ,
		セット,
		プリセット,
		ランダム,
		プロフィ\u30FCル,
		着衣設定
	}

	public enum ClothesState
	{
		Wear,
		Underwear,
		Nude
	}

	public struct CamToBone
	{
		public string bone;

		public Vector2 angle;

		public float distance;
	}

	public class CCateNameType
	{
		public int m_nIdx;

		public SceneEditInfo.CCateNameType.EType m_eType;

		public SceneEditInfo.EMenuCategory m_eMenuCate;

		public string m_ePartsType;

		public string m_strBtnPartsTypeName;

		public enum EType
		{
			Item,
			Set,
			Slider,
			Color
		}
	}
}
