using System;
using System.Collections.Generic;
using System.Text;
using MaidStatus;
using UnityEngine;
using UnityEngine.EventSystems;

public class KaraokeDataManager : MonoBehaviour
{
	public static bool IsExistKaraokeData(bool isFileSystemOld)
	{
		string format = "karaoke_music_enable_list_{0:000}.nei";
		if (!isFileSystemOld)
		{
			for (int i = 1; i < 101; i++)
			{
				if (GameUty.FileSystem.IsExistentFile(string.Format(format, i)))
				{
					return true;
				}
			}
		}
		else
		{
			for (int j = 1; j < 101; j++)
			{
				if (GameUty.FileSystemOld.IsExistentFile(string.Format(format, j)))
				{
					return true;
				}
			}
		}
		return false;
	}

	private static bool IsExistKaraokeCSV(int number)
	{
		string format = "karaoke_music_enable_list_{0:000}.nei";
		return GameUty.FileSystem.IsExistentFile(string.Format(format, number));
	}

	private void ReadCSV(string fileName, Action<CsvParser> callback)
	{
		if (!GameUty.FileSystem.FileOpen(fileName).IsValid())
		{
			return;
		}
		using (AFileBase afileBase = GameUty.FileSystem.FileOpen(fileName))
		{
			using (CsvParser csvParser = new CsvParser())
			{
				bool condition = csvParser.Open(afileBase);
				NDebug.Assert(condition, fileName + "\nopen failed.");
				callback(csvParser);
			}
		}
		Debug.Log(string.Format("[KaraokeManager]csvファイル「{0}」読み込み完了", fileName));
	}

	private CsvParser GetCSV(string fileName)
	{
		CsvParser csvParser = new CsvParser();
		if (!GameUty.FileSystem.FileOpen(fileName).IsValid())
		{
			return null;
		}
		using (AFileBase afileBase = GameUty.FileSystem.FileOpen(fileName))
		{
			using (csvParser)
			{
				bool condition = csvParser.Open(afileBase);
				NDebug.Assert(condition, fileName + "\nopen failed.");
			}
		}
		return csvParser;
	}

	private void LoadFoodData()
	{
		Dictionary<int, string> enableIDList = new Dictionary<int, string>();
		for (int i = 0; i < 100; i++)
		{
			this.ReadCSV(string.Format("karaoke_food_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
			{
				for (int j = 1; j < csv.max_cell_y; j++)
				{
					if (csv.IsCellToExistData(0, j))
					{
						int cellAsInteger = csv.GetCellAsInteger(0, j);
						string cellAsString = csv.GetCellAsString(1, j);
						if (!enableIDList.ContainsKey(cellAsInteger))
						{
							enableIDList.Add(cellAsInteger, cellAsString);
						}
						else
						{
							enableIDList[cellAsInteger] = cellAsString;
						}
					}
				}
			});
		}
		this.ReadCSV("karaoke_food.nei", delegate(CsvParser csv)
		{
			for (int j = 3; j < csv.max_cell_y; j++)
			{
				if (csv.IsCellToExistData(0, j))
				{
					KaraokeDataManager.FoodData foodData = new KaraokeDataManager.FoodData(csv, enableIDList, j);
					this.m_FoodDataArray.Add(foodData.ID, foodData);
					if (!string.IsNullOrEmpty(foodData.strTempFlagName1) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName1))
					{
						this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName1);
					}
					if (!string.IsNullOrEmpty(foodData.strTempFlagName2) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName2))
					{
						this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName2);
					}
					if (!string.IsNullOrEmpty(foodData.strTempFlagName3) && !this.m_FoodDataTempFlagArray.Contains(foodData.strTempFlagName3))
					{
						this.m_FoodDataTempFlagArray.Add(foodData.strTempFlagName3);
					}
				}
			}
		});
	}

	private void LoadMusicData()
	{
		Dictionary<int, string> enableIDList = new Dictionary<int, string>();
		for (int i = 0; i < 100; i++)
		{
			this.ReadCSV(string.Format("karaoke_music_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
			{
				for (int j = 1; j < csv.max_cell_y; j++)
				{
					if (csv.IsCellToExistData(0, j))
					{
						int cellAsInteger = csv.GetCellAsInteger(0, j);
						string cellAsString = csv.GetCellAsString(1, j);
						if (!enableIDList.ContainsKey(cellAsInteger))
						{
							enableIDList.Add(cellAsInteger, cellAsString);
						}
						else
						{
							enableIDList[cellAsInteger] = cellAsString;
						}
					}
				}
			});
		}
		this.ReadCSV("karaoke_music.nei", delegate(CsvParser csv)
		{
			for (int j = 1; j < csv.max_cell_y; j++)
			{
				if (csv.IsCellToExistData(0, j))
				{
					KaraokeDataManager.MusicData musicData = new KaraokeDataManager.MusicData(csv, enableIDList, j);
					this.m_MusicDataArray.Add(musicData.ID, musicData);
				}
			}
		});
	}

	private void LoadBackgroundData()
	{
		Dictionary<int, string> enableIDList = new Dictionary<int, string>();
		for (int i = 0; i < 100; i++)
		{
			this.ReadCSV(string.Format("karaoke_back_ground_enable_list_{0:000}.nei", i + 1), delegate(CsvParser csv)
			{
				for (int j = 1; j < csv.max_cell_y; j++)
				{
					if (csv.IsCellToExistData(0, j))
					{
						int cellAsInteger = csv.GetCellAsInteger(0, j);
						string cellAsString = csv.GetCellAsString(1, j);
						if (!enableIDList.ContainsKey(cellAsInteger))
						{
							enableIDList.Add(cellAsInteger, cellAsString);
						}
						else
						{
							enableIDList[cellAsInteger] = cellAsString;
						}
					}
				}
			});
		}
		this.ReadCSV("karaoke_back_ground.nei", delegate(CsvParser csv)
		{
			for (int j = 1; j < csv.max_cell_y; j++)
			{
				if (csv.IsCellToExistData(0, j))
				{
					KaraokeDataManager.BackgroundData backgroundData = new KaraokeDataManager.BackgroundData(csv, enableIDList, j);
					this.m_BackgroundDataArray.Add(backgroundData.ID, backgroundData);
				}
			}
		});
	}

	public static bool IsEnablePersonalKaraoke003(Maid maid)
	{
		return KaraokeDataManager.IsEnablePersonalKaraoke003(maid.status.personal.uniqueName);
	}

	public static bool IsEnablePersonalKaraoke004(Maid maid)
	{
		return KaraokeDataManager.IsEnablePersonalKaraoke004(maid.status.personal.uniqueName);
	}

	public static bool IsEnablePersonalKaraoke003(string personalUniqueName)
	{
		List<string> list = new List<string>
		{
			"Muku",
			"Majime",
			"Rindere",
			"Pure",
			"Cool",
			"Pride"
		};
		return list.Contains(personalUniqueName);
	}

	public static bool IsEnablePersonalKaraoke004(string personalUniqueName)
	{
		List<string> list = new List<string>
		{
			"Muku",
			"Majime",
			"Rindere",
			"Pure",
			"Cool",
			"Pride"
		};
		return list.Contains(personalUniqueName);
	}

	public static void GetMaidListAdditional(List<Maid> draw_list)
	{
		List<Maid> list = new List<Maid>();
		List<Maid> list2 = new List<Maid>();
		CharacterSelectManager.DefaultMaidList(list2);
		for (int i = 0; i < list2.Count; i++)
		{
			Maid maid = list2[i];
			if (maid.status.heroineType != HeroineType.Sub)
			{
				if (maid.ActiveSlotNo == -1)
				{
					if (KaraokeDataManager.IsEnablePersonalKaraoke003(maid))
					{
						list.Add(maid);
					}
				}
			}
		}
		draw_list.Clear();
		draw_list.AddRange(list);
	}

	public static void GetMaidListKaraoke(List<Maid> draw_list)
	{
		List<string> list = new List<string>
		{
			"Pure",
			"Cool",
			"Pride",
			"Yandere",
			"Anesan",
			"Genki",
			"Sadist",
			"Muku",
			"Majime",
			"Rindere"
		};
		List<Maid> list2 = new List<Maid>();
		List<Maid> list3 = new List<Maid>();
		CharacterSelectManager.DefaultMaidList(list3);
		for (int i = 0; i < list3.Count; i++)
		{
			Maid maid = list3[i];
			if (maid.status.heroineType != HeroineType.Sub)
			{
				if (list.Contains(maid.status.personal.uniqueName))
				{
					list2.Add(maid);
				}
			}
		}
		draw_list.Clear();
		draw_list.AddRange(list2);
	}

	private void Awake()
	{
		this.LoadMusicData();
		this.LoadFoodData();
		this.LoadBackgroundData();
		if (SceneVRCommunication.Instance && !SceneVRCommunication.Instance.KaraokeMode)
		{
			this.m_NowBGIndex = 1;
			this.m_NowSelectingBGIndex = 1;
		}
	}

	private void Start()
	{
		Action<GameObject, Camera> action = delegate(GameObject targetCanvasObj, Camera targetCamera)
		{
			Canvas component2 = targetCanvasObj.GetComponent<Canvas>();
			if (component2 == null)
			{
				return;
			}
			component2.worldCamera = targetCamera;
		};
		Camera componentInChildren = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
		action(this.m_CanvasVRConfig.gameObject, componentInChildren);
		action(this.m_CanvasKaraokeMainMenu.gameObject, componentInChildren);
		if (VRDialogMenu.CreateDialog())
		{
			action(VRDialogMenu.CreateDialog().gameObject, componentInChildren);
		}
		if (VRSelectorMenu.CreateSelector())
		{
			action(VRSelectorMenu.CreateSelector().gameObject, componentInChildren);
		}
		action(this.m_CanvasDialogMenu.gameObject, componentInChildren);
		action(this.m_CanvasSelectorMenu.gameObject, componentInChildren);
		VRCanvasManagerMini component = VRCanvasManager.Instance.GetComponent<VRCanvasManagerMini>();
		if (component)
		{
			component.AddCanvas(this.m_CanvasKaraokeMainMenu.GetComponent<Canvas>());
			component.AddCanvas(this.m_CanvasVRConfig.GetComponent<Canvas>());
		}
	}

	public KaraokeDataManager.FoodData[] GetFoodDataArray(bool enableDataOnly = true)
	{
		List<KaraokeDataManager.FoodData> list = new List<KaraokeDataManager.FoodData>(this.m_FoodDataArray.Values);
		if (!enableDataOnly)
		{
			return list.ToArray();
		}
		List<KaraokeDataManager.FoodData> list2 = new List<KaraokeDataManager.FoodData>();
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].IsEnable)
			{
				list2.Add(list[i]);
			}
		}
		return list2.ToArray();
	}

	public KaraokeDataManager.MusicData[] GetMusicDataArray(bool enableDataOnly = true)
	{
		List<KaraokeDataManager.MusicData> list = new List<KaraokeDataManager.MusicData>(this.m_MusicDataArray.Values);
		if (!enableDataOnly)
		{
			return list.ToArray();
		}
		List<KaraokeDataManager.MusicData> list2 = new List<KaraokeDataManager.MusicData>();
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].IsEnable)
			{
				list2.Add(list[i]);
			}
		}
		return list2.ToArray();
	}

	public KaraokeDataManager.BackgroundData[] GetBackgroundDataArray(bool enableDataOnly = true)
	{
		List<KaraokeDataManager.BackgroundData> list = new List<KaraokeDataManager.BackgroundData>(this.m_BackgroundDataArray.Values);
		if (!enableDataOnly)
		{
			return list.ToArray();
		}
		List<KaraokeDataManager.BackgroundData> list2 = new List<KaraokeDataManager.BackgroundData>();
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].IsEnable)
			{
				list2.Add(list[i]);
			}
		}
		return list2.ToArray();
	}

	public KaraokeDataManager.MusicData GetMusicData(int id)
	{
		if (!this.m_MusicDataArray.ContainsKey(id))
		{
			return null;
		}
		return this.m_MusicDataArray[id];
	}

	public bool IsExistMusicData(int musicID)
	{
		return this.m_MusicDataArray.ContainsKey(musicID);
	}

	public void StartKaraoke(int musicID)
	{
		if (this.IsExistMusicData(musicID))
		{
			KaraokeDataManager.MusicData musicData = this.m_MusicDataArray[musicID];
			Debug.Log(string.Format("[KaraokeManager]選択された楽曲の情報\r\n楽曲サムネイル:{0}\r\n楽曲シーン名:{1}\r\n音声ファイル名:{2}\r\n", musicData.strThumbnailName, musicData.strSceneName, musicData.strFileNameOgg));
			GameMain.Instance.MainCamera.FadeOut(0.5f, false, delegate
			{
				ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
				KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowSelectingBGIndex];
				if (backgroundData != null)
				{
					string bgname = GameMain.Instance.BgMgr.GetBGName();
					string text = GameMain.Instance.BgMgr.GetBGName();
					if (SceneVRCommunication.Instance.GetNowTime() == SceneVRCommunication.VR_TIME.NIGHT)
					{
						text = backgroundData.strFileNameNight;
					}
					else
					{
						text = backgroundData.strFileName;
					}
					if (bgname != text)
					{
						GameMain.Instance.BgMgr.ChangeBg(text);
					}
					this.m_NowBGIndex = this.m_NowSelectingBGIndex;
					this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
				}
				KaraokeDataManager.FoodData foodData = null;
				if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
				{
					foodData = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
				}
				if (foodData != null)
				{
					this.SetTempFlag(foodData.strTempFlagName4, foodData.tempFlagValue4);
					this.SetTempFlag(foodData.strTempFlagName5, foodData.tempFlagValue5);
					this.SetTempFlag(foodData.strTempFlagName6, foodData.tempFlagValue6);
				}
				this.SetTempFlag("VRカラオケ曲番号", musicData.ID);
				scriptMgr.EvalScript("global.__karaoke_music_file_name = '" + musicData.strFileNameOgg + "';");
				scriptMgr.EvalScript("global.__karaoke_scene_file_name = '" + musicData.strSceneName + "';");
				scriptMgr.LoadAdvScenarioScript("karaoke_start_9999.ks", "*karaoke_start");
				scriptMgr.adv_kag.Exec();
			}, true, default(Color));
		}
		else
		{
			Debug.Log(string.Format("[KaraokeDataManager]カラオケのデータが見つからない\n楽曲データのインデックス:{0}", musicID));
		}
	}

	public void SetBGIndex(int index)
	{
		this.m_NowSelectingBGIndex = index;
	}

	public int GetNowBGIndex()
	{
		return this.m_NowBGIndex;
	}

	public int GetNowSelectingBGIndex()
	{
		return this.m_NowSelectingBGIndex;
	}

	public void SetFoodData(int index)
	{
		KaraokeDataManager.FoodData foodData = this.m_FoodDataArray[index];
		this.AddTempFlag(foodData.strTempFlagName1);
		this.AddTempFlag(foodData.strTempFlagName2);
		this.AddTempFlag(foodData.strTempFlagName3);
		this.ResetTempFlag(new string[]
		{
			foodData.strTempFlagName1,
			foodData.strTempFlagName2,
			foodData.strTempFlagName3
		});
		KaraokeDataManager.BackgroundData backgroundData = this.GetBackgroundDataArray(true)[this.m_NowBGIndex];
		if (backgroundData != null)
		{
			this.SetTempFlag(backgroundData.strFlagName, backgroundData.flagValue);
		}
		else
		{
			this.SetTempFlag("カラオケ_背景", 0);
			Debug.LogWarning("[KaraokeDatamanager]背景が「KaraokeRoom」「Villa」のどちらでもなかったので、「KaraokeRoom」の値に設定します");
		}
		KaraokeDataManager.FoodData foodData2 = null;
		if (this.m_FoodDataArray.ContainsKey(this.m_BeforeSelectedFoodIndex))
		{
			foodData2 = this.m_FoodDataArray[this.m_BeforeSelectedFoodIndex];
		}
		if (foodData2 != null)
		{
			this.SetTempFlag(foodData2.strTempFlagName4, foodData2.tempFlagValue4);
			this.SetTempFlag(foodData2.strTempFlagName5, foodData2.tempFlagValue5);
			this.SetTempFlag(foodData2.strTempFlagName6, foodData2.tempFlagValue6);
		}
		this.m_BeforeSelectedFoodIndex = index;
		string str = this.ReplacePersonal(foodData.strScenarioFile);
		if (string.IsNullOrEmpty(foodData.strScenarioLabel))
		{
			GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", string.Empty);
		}
		else
		{
			GameMain.Instance.ScriptMgr.LoadAdvScenarioScript(str + ".ks", "*" + foodData.strScenarioLabel);
		}
		GameMain.Instance.ScriptMgr.adv_kag.Exec();
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append("[KaraokeDataManager]現在のフラグ\n");
		for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
		{
			string text = this.m_FoodDataTempFlagArray[i];
			int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(text);
			stringBuilder.Append(string.Format("{0}, {1}\n", text, tmpGenericFlag));
		}
		stringBuilder.Append(string.Format("前回の料理, {0}\n", GameMain.Instance.CMSystem.GetTmpGenericFlag("前回の料理")));
		Debug.Log(stringBuilder.ToString());
	}

	public void ButtonExit()
	{
		UICanvasFade mainMenu = this.m_CanvasKaraokeMainMenu;
		mainMenu.FadeOut(mainMenu.fadeTime, mainMenu.isTimeScaling, delegate()
		{
			VRDialogMenu dialog = VRDialogMenu.CreateDialog();
			if (dialog)
			{
				dialog.GetComponent<UICanvasFade>().FadeIn();
				dialog.OpenDialog("カラオケモードを終了しますか?", (VRDialogMenu.TYPE_STYLE)3, delegate(VRDialogMenu.TYPE_STYLE type)
				{
					dialog.CloseDialog();
					if (type != VRDialogMenu.TYPE_STYLE.YES)
					{
						mainMenu.FadeIn();
						return;
					}
					VRCanvasManager instance = VRCanvasManager.Instance;
					if (!instance)
					{
						Debug.LogWarning("[KaraokeDataManager]VRCanvasManagerが見つからなかった");
						return;
					}
					instance.EndKaraokeMode();
					GameMain.Instance.CMSystem.SetTmpGenericFlag("カラオケメイド追加", 0);
				});
			}
		});
	}

	private void AddTempFlag(string tempFlagName)
	{
		if (string.IsNullOrEmpty(tempFlagName))
		{
			return;
		}
		int tmpGenericFlag = GameMain.Instance.CMSystem.GetTmpGenericFlag(tempFlagName);
		GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, tmpGenericFlag + 1);
	}

	private void SetTempFlag(string tempFlagName, int value)
	{
		if (string.IsNullOrEmpty(tempFlagName))
		{
			return;
		}
		GameMain.Instance.CMSystem.SetTmpGenericFlag(tempFlagName, value);
	}

	private void ResetTempFlag(params string[] exclusionTempFlagName)
	{
		for (int i = 0; i < this.m_FoodDataTempFlagArray.Count; i++)
		{
			string text = this.m_FoodDataTempFlagArray[i];
			bool flag = false;
			for (int j = 0; j < exclusionTempFlagName.Length; j++)
			{
				if (!(text != exclusionTempFlagName[j]))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				GameMain.Instance.CMSystem.SetTmpGenericFlag(text, 0);
			}
		}
	}

	private void Update()
	{
		CanvasGroup component = base.GetComponent<CanvasGroup>();
		CanvasGroup parentCanvas = this.m_ParentCanvas;
		if (!GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
		{
			parentCanvas.interactable = false;
			parentCanvas.blocksRaycasts = false;
			parentCanvas.alpha = 0f;
			component.interactable = false;
			component.blocksRaycasts = false;
			component.alpha = 0f;
			return;
		}
		parentCanvas.alpha = 1f;
		component.alpha = 1f;
		bool isFallThrough = GameMain.Instance.OvrMgr.OvrCamera.IsFallThrough;
		if (isFallThrough)
		{
			parentCanvas.interactable = true;
			parentCanvas.blocksRaycasts = true;
			component.interactable = true;
			component.blocksRaycasts = true;
		}
		else
		{
			parentCanvas.interactable = false;
			parentCanvas.blocksRaycasts = false;
			component.interactable = false;
			component.blocksRaycasts = false;
		}
		bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown;
		bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack;
		Vector3 zero = Vector3.zero;
		zero.z = ((!isRotDown) ? 0f : 180f);
		zero.y = ((!isSideBack) ? 0f : 180f);
		zero.x = ((!isSideBack) ? 90f : -90f);
		base.transform.localEulerAngles = zero;
	}

	private void LateUpdate()
	{
		bool isUIShow = GameMain.Instance.OvrMgr.OvrCamera.IsUIShow;
		bool isFreeMode = SceneVRCommunication.Instance.IsFreeMode;
		bool uiNoHomeMode = SceneVRCommunication.Instance.UiNoHomeMode;
		bool flag = GameMain.Instance.MainCamera.IsFadeProc();
		bool flag2 = GameMain.Instance.MainCamera.IsFadeOut();
		bool isEnableSkip = SceneVRCommunication.Instance.IsEnableSkip;
		CanvasGroup parentCanvas = this.m_ParentCanvas;
		if (isUIShow)
		{
			if (uiNoHomeMode)
			{
				parentCanvas.blocksRaycasts = false;
				parentCanvas.alpha = 0f;
			}
			else
			{
				parentCanvas.alpha = 1f;
			}
		}
		if (!isFreeMode || !isUIShow)
		{
			parentCanvas.interactable = false;
			parentCanvas.blocksRaycasts = false;
			parentCanvas.alpha = 0f;
		}
		else if (!uiNoHomeMode)
		{
			parentCanvas.interactable = true;
			parentCanvas.blocksRaycasts = true;
			parentCanvas.alpha = 1f;
		}
		if (flag || flag2)
		{
			parentCanvas.blocksRaycasts = false;
		}
	}

	public void ButtonEventOpenVRConfig()
	{
		UICanvasFade canvasKaraokeMainMenu = this.m_CanvasKaraokeMainMenu;
		canvasKaraokeMainMenu.FadeOut(canvasKaraokeMainMenu.fadeTime, canvasKaraokeMainMenu.isTimeScaling, delegate()
		{
			this.m_CanvasVRConfig.FadeIn();
		});
	}

	public void ButtonEventOpenKaraokeMainMenu()
	{
		UICanvasFade canvasVRConfig = this.m_CanvasVRConfig;
		canvasVRConfig.FadeOut(canvasVRConfig.fadeTime, canvasVRConfig.isTimeScaling, delegate()
		{
			this.m_CanvasKaraokeMainMenu.FadeIn();
		});
	}

	private string ReplacePersonal(string fileName)
	{
		Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		fileName = ((!(maid == null)) ? ScriptManager.ReplacePersonal(maid, fileName) : fileName);
		return fileName;
	}

	public const string STR_MAID_ADD_CALL_FLAG = "カラオケメイド追加";

	private Dictionary<int, KaraokeDataManager.MusicData> m_MusicDataArray = new Dictionary<int, KaraokeDataManager.MusicData>();

	private Dictionary<int, KaraokeDataManager.BackgroundData> m_BackgroundDataArray = new Dictionary<int, KaraokeDataManager.BackgroundData>();

	private Dictionary<int, KaraokeDataManager.FoodData> m_FoodDataArray = new Dictionary<int, KaraokeDataManager.FoodData>();

	private List<string> m_FoodDataTempFlagArray = new List<string>();

	private int m_BeforeSelectedFoodIndex = -1;

	private int m_NowSelectingBGIndex;

	private int m_NowBGIndex;

	[SerializeField]
	private CanvasGroup m_ParentCanvas;

	[SerializeField]
	private UICanvasFade m_CanvasVRConfig;

	[SerializeField]
	private UICanvasFade m_CanvasKaraokeMainMenu;

	[SerializeField]
	private VRDialogMenu m_CanvasDialogMenu;

	[SerializeField]
	private VRSelectorMenu m_CanvasSelectorMenu;

	public class FoodData
	{
		public FoodData(CsvParser csv, Dictionary<int, string> enable_list, int y)
		{
			int num = 0;
			this.ID = csv.GetCellAsInteger(num++, y);
			num++;
			this.strThumbnailName = csv.GetCellAsString(num++, y);
			this.strScenarioFile = csv.GetCellAsString(num++, y);
			this.strScenarioLabel = csv.GetCellAsString(num++, y);
			this.strTempFlagName1 = csv.GetCellAsString(num++, y);
			this.strTempFlagName2 = csv.GetCellAsString(num++, y);
			this.strTempFlagName3 = csv.GetCellAsString(num++, y);
			this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName4, ref this.tempFlagValue4);
			this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName5, ref this.tempFlagValue5);
			this.GetFlagAndValue(csv.GetCellAsString(num++, y), ref this.strTempFlagName6, ref this.tempFlagValue6);
			this.isEnableID = enable_list.ContainsKey(this.ID);
			string text = string.Empty;
			if (this.isEnableID)
			{
				text = enable_list[this.ID];
			}
			if (!string.IsNullOrEmpty(text))
			{
				this.pluginType = text.ToLower();
			}
		}

		private void GetFlagAndValue(string strCellData, ref string strFlag, ref int value)
		{
			if (string.IsNullOrEmpty(strCellData))
			{
				return;
			}
			string[] array = strCellData.Split(new char[]
			{
				','
			});
			strFlag = array[0];
			value = int.Parse(array[1]);
		}

		public bool IsEnable
		{
			get
			{
				bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
				if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
				{
					flag = KaraokeDataManager.IsExistKaraokeCSV(2);
					Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
				}
				return this.isEnableID && flag;
			}
		}

		public int ID;

		public string strThumbnailName = string.Empty;

		public string strScenarioFile = string.Empty;

		public string strScenarioLabel = string.Empty;

		public string strTempFlagName1 = string.Empty;

		public string strTempFlagName2 = string.Empty;

		public string strTempFlagName3 = string.Empty;

		public string strTempFlagName4 = string.Empty;

		public string strTempFlagName5 = string.Empty;

		public string strTempFlagName6 = string.Empty;

		public int tempFlagValue4;

		public int tempFlagValue5;

		public int tempFlagValue6;

		public string pluginType = string.Empty;

		private bool isEnableID;

		public static readonly int ID_BUTTON_MAID_ADDITIONAL = 140;

		public static readonly int ID_BUTTON_MAID_ = 150;
	}

	public class MusicData
	{
		public MusicData(CsvParser csv_default, Dictionary<int, string> enable_list, int y)
		{
			int num = 0;
			this.ID = csv_default.GetCellAsInteger(num++, y);
			num++;
			this.strThumbnailName = csv_default.GetCellAsString(num++, y);
			num++;
			this.strSceneName = csv_default.GetCellAsString(num++, y);
			this.strFileNameOgg = csv_default.GetCellAsString(num++, y);
			this.isEnableID = enable_list.ContainsKey(this.ID);
			string text = string.Empty;
			if (this.isEnableID)
			{
				text = enable_list[this.ID];
			}
			if (!string.IsNullOrEmpty(text))
			{
				this.pluginType = text.ToLower();
			}
		}

		public bool IsEnable
		{
			get
			{
				bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
				if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
				{
					flag = KaraokeDataManager.IsExistKaraokeCSV(2);
					Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
				}
				return this.isEnableID && flag;
			}
		}

		public int ID;

		public string strThumbnailName = string.Empty;

		public string strSceneName = string.Empty;

		public string strFileNameOgg = string.Empty;

		public string pluginType = string.Empty;

		private bool isEnableID;
	}

	public class BackgroundData
	{
		public BackgroundData(CsvParser csv, Dictionary<int, string> enable_list, int y)
		{
			int num = 0;
			this.ID = csv.GetCellAsInteger(num++, y);
			this.strThumbnailName = csv.GetCellAsString(num++, y);
			this.strFileName = csv.GetCellAsString(num++, y);
			this.strFileNameNight = csv.GetCellAsString(num++, y);
			this.strFlagName = csv.GetCellAsString(num++, y);
			this.flagValue = csv.GetCellAsInteger(num++, y);
			this.isEnableID = enable_list.ContainsKey(this.ID);
			string text = string.Empty;
			if (this.isEnableID)
			{
				text = enable_list[this.ID];
			}
			if (!string.IsNullOrEmpty(text))
			{
				this.pluginType = text.ToLower();
			}
		}

		public bool IsEnable
		{
			get
			{
				bool flag = string.IsNullOrEmpty(this.pluginType) || PluginData.IsEnabled(this.pluginType);
				if (this.pluginType == "karaoke002" && this.isEnableID && !flag)
				{
					flag = KaraokeDataManager.IsExistKaraokeCSV(2);
					Debug.Log("カラオケパック002\u3000新ファイルシステム:" + flag);
				}
				return this.isEnableID && flag;
			}
		}

		public int ID;

		public string strThumbnailName = string.Empty;

		public string strFileName = string.Empty;

		public string strFileNameNight = string.Empty;

		public string strFlagName = string.Empty;

		public int flagValue = -1;

		public string pluginType = string.Empty;

		private bool isEnableID;
	}
}