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

public class UndressDance_Mgr : PartsMgrBase
{
	public static UndressDance_Mgr Instance { get; private set; }

	public Maid SelectMaid
	{
		get
		{
			return this.m_SelectedMaid;
		}
	}

	protected override void Start()
	{
		UndressDance_Mgr.Instance = this;
		this.m_ItemWindow.transform.localPosition = this.m_DeactiveOffset;
		this.m_ItemWindow.SetActive(false);
		base.Start();
		base.IsActive &= (DanceMain.SelectDanceData != null);
		if (!base.IsActive)
		{
			base.gameObject.SetActive(false);
			return;
		}
		base.transform.parent.gameObject.layer = base.gameObject.layer;
		foreach (UndressDance_Mgr.IconColor iconColor in this.m_IconColData)
		{
			this.m_LevelColPair.Add(iconColor.Level, iconColor.IconCol);
		}
		this.m_TakeEventColl = this.m_TakeEvent.GetComponent<BoxCollider>();
		UIEventTrigger component = this.m_TakeEvent.GetComponent<UIEventTrigger>();
		EventDelegate.Add(component.onHoverOver, new EventDelegate.Callback(this.ShowItemWindow));
		EventDelegate.Add(component.onHoverOut, new EventDelegate.Callback(this.CursorRecet));
		this.m_HoverCheckObj.Add(this.m_ItemWindow.transform.Find("BG").gameObject);
		this.m_HoverCheckObj.Add(this.m_CloseButton.gameObject);
		EventDelegate.Add(this.m_CloseButton.onClick, new EventDelegate.Callback(this.HideItemWindow));
		this.m_ItemGrid = this.m_ItemWindow.transform.Find("ItemGrid").GetComponent<UIGrid>();
		this.m_MaidGrid = this.m_ItemWindow.transform.Find("MaidIcon").GetComponent<UIGrid>();
		this.m_MaidTabPanel = this.m_MaidGrid.gameObject.GetComponent<UIWFTabPanel>();
		KasaiUtility.CsvRead("csv_rhythm_action/undress_parts_data.nei", new Action<CsvParser, int, int>(this.ReadPartsData), 0, 1, null);
		this.m_ItemGrid.repositionNow = true;
		KasaiUtility.CsvRead("csv_rhythm_action/undress_level2_data.nei", new Action<CsvParser, int, int>(this.ReadLevel2Key), 0, 1, null);
		KasaiUtility.CsvRead("csv_rhythm_action/undress_face_data.nei", new Action<CsvParser, int, int>(this.ReadFaceSetting), 0, 1, null);
		this.m_HoverCheckObj.Add(this.m_AlldressButton.gameObject);
		this.m_HoverCheckObj.Add(this.m_AllundressButton.gameObject);
		EventDelegate.Add(this.m_AlldressButton.onClick, new EventDelegate.Callback(this.AllDreass));
		EventDelegate.Add(this.m_AllundressButton.onClick, new EventDelegate.Callback(this.AllUndreass));
		if (GameMain.Instance.VRMode && GameMain.Instance.VRDeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
		{
			AVRControllerButtons controller_buttons = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller_buttons;
			AVRControllerButtons controller_buttons2 = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller_buttons;
			this.m_ControllerInputFlag.Add(controller_buttons, false);
			this.m_ControllerInputFlag.Add(controller_buttons2, false);
		}
		if (GameMain.Instance.VRMode)
		{
			this.ShowItemWindow();
		}
	}

	private void ReadPartsData(CsvParser csv, int cx, int cy)
	{
		switch (cx)
		{
		case 0:
		{
			MPN key = (MPN)Enum.Parse(typeof(MPN), csv.GetCellAsString(cx, cy));
			this.m_MpnPartsData.Add(key, new UndressDance_Mgr.PartsData());
			break;
		}
		case 1:
			foreach (string value in csv.GetCellAsString(cx, cy).Split(new char[]
			{
				','
			}))
			{
				this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.SlotIDlist.Add((TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), value));
			}
			break;
		case 2:
		{
			string text = csv.GetCellAsString(cx, cy);
			if (text.IndexOf(".tex") < 0)
			{
				text += ".tex";
			}
			if (!GameUty.FileSystem.IsExistentFile(text))
			{
				Debug.LogError("アイコンファイル[" + text + "]が見つかりませんでした");
			}
			Texture2D defaultIcon = ImportCM.CreateTexture(text);
			this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.DefaultIcon = defaultIcon;
			break;
		}
		case 3:
			this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Value.SexsualPoint = csv.GetCellAsInteger(cx, cy);
			break;
		}
		if (cx == csv.max_cell_x - 1)
		{
			this.CreatePartsIcon(this.m_MpnPartsData.Last<KeyValuePair<MPN, UndressDance_Mgr.PartsData>>().Key);
		}
	}

	private void CreatePartsIcon(MPN mpn)
	{
		GameObject gameObject = Utility.CreatePrefab(this.m_ItemGrid.gameObject, "SceneDance/Rhythm_Action/Prefab/UndressDance/ItemIcon", true);
		this.m_HoverCheckObj.Add(gameObject);
		UndressItem component = gameObject.GetComponent<UndressItem>();
		component.Init(mpn);
		this.m_ItemUIList.Add(mpn, component);
	}

	private void ReadLevel2Key(CsvParser csv, int cx, int cy)
	{
		if (cx == 1)
		{
			this.m_Level2KeyList.Add(new List<MPN>());
			foreach (string value in csv.GetCellAsString(cx, cy).Split(new char[]
			{
				','
			}))
			{
				this.m_Level2KeyList.Last<List<MPN>>().Add((MPN)Enum.Parse(typeof(MPN), value));
			}
		}
	}

	private void ReadFaceSetting(CsvParser csv, int cx, int cy)
	{
		switch (cx)
		{
		case 0:
		{
			UndressDance_Mgr.UndressLevel undressLevel = (UndressDance_Mgr.UndressLevel)Enum.Parse(typeof(UndressDance_Mgr.UndressLevel), csv.GetCellAsString(cx, cy));
			this.m_FaceSetting.Add(undressLevel, new UndressDance_Mgr.FaceDataBase());
			this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Level = undressLevel;
			break;
		}
		case 1:
			if (csv.IsCellToExistData(cx, cy))
			{
				this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.SexualPoint = csv.GetCellAsInteger(cx, cy);
			}
			break;
		case 2:
			if (csv.IsCellToExistData(cx, cy))
			{
				this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Face = csv.GetCellAsString(cx, cy).Split(new char[]
				{
					','
				}).ToList<string>();
			}
			break;
		case 3:
			this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.FaceBlend = csv.GetCellAsString(cx, cy);
			break;
		case 4:
			if (csv.IsCellToExistData(cx, cy))
			{
				this.m_FaceSetting.Last<KeyValuePair<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>>().Value.Probability = csv.GetCellAsInteger(cx, cy);
			}
			break;
		}
	}

	private void CursorRecet()
	{
		this.m_IsCursorOn = false;
	}

	private void WindowMove(float time)
	{
		this.m_MoveEnd = false;
		this.m_ItemWindow.transform.localPosition = Vector3.Lerp(Vector3.zero, this.m_DeactiveOffset, KasaiUtility.SinRate01(time, this.m_UIShowTime, this.m_IsWindowActive, false));
	}

	private void MoveEnd()
	{
		this.m_MoveEnd = true;
		if (!this.m_IsWindowActive)
		{
			this.m_ItemWindow.SetActive(false);
		}
		else
		{
			this.m_IsCursorOn = true;
		}
		this.m_TakeEventColl.enabled = !this.m_IsWindowActive;
	}

	private void ShowItemWindow()
	{
		if (!this.m_MoveEnd)
		{
			return;
		}
		if (this.m_IsCursorOn)
		{
			return;
		}
		if (!this.m_IsWindowActive)
		{
			this.m_IsWindowActive = true;
			this.m_ItemWindow.SetActive(true);
			base.StartCoroutine(KasaiUtility.TimeCroutine(this.m_UIShowTime, new Action<float>(this.WindowMove), new Action(this.MoveEnd)));
		}
	}

	private void HideItemWindow()
	{
		if (!this.m_MoveEnd)
		{
			return;
		}
		this.m_IsWindowActive = false;
		base.StartCoroutine(KasaiUtility.TimeCroutine(this.m_UIShowTime, new Action<float>(this.WindowMove), new Action(this.MoveEnd)));
	}

	private void MaidSelect()
	{
		Maid maid = this.m_MaidIconList[UIWFTabButton.current];
		if (this.m_SelectedMaid == maid)
		{
			return;
		}
		this.m_SelectedMaid = maid;
		foreach (UndressItem undressItem in this.m_ItemUIList.Values)
		{
			undressItem.UpdateState(maid);
		}
	}

	private void AllDreass()
	{
		if (this.m_ForceLevel2)
		{
			this.SetMaidFace(UndressDance_Mgr.UndressLevel.None);
			this.m_ForceLevel2 = false;
		}
		if (this.m_ItemUIList.Values.All((UndressItem e) => !e.IsUndress))
		{
			return;
		}
		foreach (UndressItem undressItem in this.m_ItemUIList.Values)
		{
			undressItem.SetMaidMask(this.m_SelectedMaid, false);
		}
	}

	private void AllUndreass()
	{
		if (this.m_ItemUIList.Values.All((UndressItem e) => e.IsUndress))
		{
			return;
		}
		this.m_ForceLevel2 = false;
		foreach (UndressItem undressItem in this.m_ItemUIList.Values)
		{
			undressItem.SetMaidMask(this.m_SelectedMaid, true);
		}
		if (this.GetUndressLevel(false) != UndressDance_Mgr.UndressLevel.Level2)
		{
			this.m_ForceLevel2 = true;
			this.SetMaidFace(UndressDance_Mgr.UndressLevel.Level2);
		}
	}

	private UndressDance_Mgr.UndressLevel GetUndressLevel(bool release_force2 = false)
	{
		UndressDance_Mgr.SexsualData sexsualData = this.m_MaidSexsualData[this.SelectMaid];
		UndressDance_Mgr.UndressLevel undressLevel = UndressDance_Mgr.UndressLevel.None;
		int sexsualPoint = sexsualData.SexsualPoint;
		foreach (UndressDance_Mgr.FaceDataBase faceDataBase in this.m_FaceSetting.Values)
		{
			if (faceDataBase.SexualPoint > 0 && sexsualPoint >= faceDataBase.SexualPoint)
			{
				undressLevel = faceDataBase.Level;
			}
		}
		if (undressLevel == UndressDance_Mgr.UndressLevel.Level1)
		{
			if (release_force2)
			{
				this.m_ForceLevel2 = false;
			}
			foreach (List<MPN> list in this.m_Level2KeyList)
			{
				bool flag = true;
				foreach (MPN key in list)
				{
					flag &= this.m_ItemUIList[key].IsUndress;
					if (!flag)
					{
						break;
					}
				}
				if (flag || this.m_ForceLevel2)
				{
					undressLevel = UndressDance_Mgr.UndressLevel.Level2;
					break;
				}
			}
		}
		return undressLevel;
	}

	private void SetFaceBlend(UndressDance_Mgr.UndressLevel level)
	{
		string faceBlend = this.m_FaceSetting[level].FaceBlend;
		TMorph.AddBlendType addBlendType = TMorph.AddBlendType.None;
		if (faceBlend.IndexOf("頬１") >= 0 || faceBlend.IndexOf("頬1") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Cheek1;
		}
		if (faceBlend.IndexOf("頬２") >= 0 || faceBlend.IndexOf("頬2") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Cheek2;
		}
		if (faceBlend.IndexOf("頬３") >= 0 || faceBlend.IndexOf("頬3") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Cheek3;
		}
		if (faceBlend.IndexOf("涙１") >= 0 || faceBlend.IndexOf("涙1") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Tear1;
		}
		if (faceBlend.IndexOf("涙２") >= 0 || faceBlend.IndexOf("涙2") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Tear2;
		}
		if (faceBlend.IndexOf("涙３") >= 0 || faceBlend.IndexOf("涙3") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Tear3;
		}
		if (faceBlend.IndexOf("赤面") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Blush;
		}
		if (faceBlend.IndexOf("ショック") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.Shock;
		}
		if (faceBlend.IndexOf("玉涙") >= 0)
		{
			addBlendType |= TMorph.AddBlendType.TearBig;
		}
		this.SelectMaid.body0.Face.morph.SetValueOriginalBlendSet(addBlendType);
		this.SelectMaid.FaceBlend("オリジナル");
	}

	private IEnumerator FaceUpdate(UndressDance_Mgr.UndressLevel level)
	{
		UndressDance_Mgr.FaceDataBase face_data = this.m_FaceSetting[level];
		Maid maid = this.SelectMaid;
		RhythmAction_Mgr.Instance.SetMaidFaceBlendStop(maid, true);
		this.SetFaceBlend(level);
		if (face_data.Face.Count <= 0)
		{
			RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, false);
			yield break;
		}
		RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, true);
		float timer = 0f;
		int face_index = UnityEngine.Random.Range(0, face_data.Face.Count);
		maid.FaceAnime(face_data.Face[face_index], 1f, 0);
		for (;;)
		{
			timer += RhythmAction_Mgr.Instance.DanceDeltaTime;
			if (timer > this.m_FaceChangeTime)
			{
				timer = 0f;
				int num = UnityEngine.Random.Range(0, 100);
				if (num < face_data.Probability)
				{
					face_index = UnityEngine.Random.Range(0, face_data.Face.Count);
					RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, true);
					maid.FaceAnime(face_data.Face[face_index], 1f, 0);
				}
				else
				{
					RhythmAction_Mgr.Instance.SetMaidFaceStop(maid, false);
				}
			}
			yield return null;
		}
		yield break;
	}

	private IEnumerator InputCheck()
	{
		for (;;)
		{
			if (RhythmAction_Mgr.Instance.DanceMaid.Count > 1)
			{
				bool flag = Input.GetKeyDown(KeyCode.RightArrow);
				bool flag2 = Input.GetKeyDown(KeyCode.LeftArrow);
				if (GameMain.Instance.VRMode && !flag2 && !flag && GameMain.Instance.VRDeviceTypeID != GameMain.VRDeviceType.NON)
				{
					AVRController left_controller = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller;
					AVRController right_controller = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller;
					AVRControllerButtons left_input = GameMain.Instance.OvrMgr.ovr_obj.left_controller.controller_buttons;
					AVRControllerButtons right_input = GameMain.Instance.OvrMgr.ovr_obj.right_controller.controller_buttons;
					GameMain.VRDeviceType vrdeviceTypeID = GameMain.Instance.VRDeviceTypeID;
					if (vrdeviceTypeID != GameMain.VRDeviceType.VIVE)
					{
						if (vrdeviceTypeID == GameMain.VRDeviceType.RIFT_TOUCH)
						{
							Func<bool, bool> func = delegate(bool is_right)
							{
								bool flag5 = false;
								if (is_right)
								{
									flag5 |= (left_input.GetAxis().x > 0.5f && !this.m_ControllerInputFlag[left_input] && left_controller.HandDanceMode);
									flag5 |= (right_input.GetAxis().x > 0.5f && !this.m_ControllerInputFlag[right_input] && right_controller.HandDanceMode);
								}
								else
								{
									flag5 |= (left_input.GetAxis().x < -0.5f && !this.m_ControllerInputFlag[left_input] && left_controller.HandDanceMode);
									flag5 |= (right_input.GetAxis().x < -0.5f && !this.m_ControllerInputFlag[right_input] && right_controller.HandDanceMode);
								}
								return flag5;
							};
							flag2 = func(false);
							flag = func(true);
							this.m_ControllerInputFlag[left_input] = (Mathf.Abs(left_input.GetAxis().x) > 0.5f);
							this.m_ControllerInputFlag[right_input] = (Mathf.Abs(right_input.GetAxis().x) > 0.5f);
						}
					}
					else
					{
						Func<bool, bool> func2 = delegate(bool is_right)
						{
							bool flag5 = false;
							if (is_right)
							{
								flag5 |= (left_input.GetAxis().x > 0.5f && left_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && left_controller.HandDanceMode);
								flag5 |= (right_input.GetAxis().x > 0.5f && right_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && right_controller.HandDanceMode);
							}
							else
							{
								flag5 |= (left_input.GetAxis().x < -0.5f && left_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && left_controller.HandDanceMode);
								flag5 |= (right_input.GetAxis().x < -0.5f && right_input.GetPressDown(AVRControllerButtons.BTN.STICK_PAD) && right_controller.HandDanceMode);
							}
							return flag5;
						};
						flag2 = func2(false);
						flag = func2(true);
					}
				}
				if (flag || flag2)
				{
					UIWFTabButton[] array = this.m_MaidIconList.Keys.ToArray<UIWFTabButton>();
					for (int i = 0; i < this.m_MaidIconList.Count; i++)
					{
						if (!(array[i] != this.m_MaidTabPanel.GetSelectButtonObject()))
						{
							bool flag3 = false;
							if (flag)
							{
								flag3 = (i + 1 < this.m_MaidIconList.Count);
							}
							else if (flag2)
							{
								flag3 = (i - 1 >= 0);
							}
							if (flag3)
							{
								int num = (!flag) ? (i - 1) : (i + 1);
								this.m_MaidTabPanel.Select(array[num]);
								if (this.m_IsWindowActive)
								{
									GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
								}
							}
							break;
						}
					}
				}
			}
			if (this.m_IsWindowActive && !GameMain.Instance.VRMode)
			{
				bool flag4 = UICamera.hoveredObject && this.m_HoverCheckObj.Contains(UICamera.hoveredObject);
				if (!flag4 && this.m_WaitCoroutine == null)
				{
					this.m_IsCursorOn = false;
					this.m_WaitCoroutine = KasaiUtility.TimeCroutine(this.m_HidewaitTime, null, new Action(this.HideItemWindow));
					base.StartCoroutine(this.m_WaitCoroutine);
				}
				else if (flag4 && this.m_WaitCoroutine != null)
				{
					this.m_IsCursorOn = true;
					base.StopCoroutine(this.m_WaitCoroutine);
					this.m_WaitCoroutine = null;
				}
				foreach (UndressDance_Mgr.MpnKeyData mpnKeyData in this.m_MpnInputPair)
				{
					if (this.m_ItemUIList.ContainsKey(mpnKeyData.Mpn) && this.m_ItemUIList[mpnKeyData.Mpn].IsEnable)
					{
						if (Input.GetKeyDown(mpnKeyData.InputKey))
						{
							this.m_ItemUIList[mpnKeyData.Mpn].SwitchMask();
							GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Click);
						}
					}
				}
			}
			yield return null;
		}
		yield break;
	}

	private IEnumerator TweeenNull()
	{
		yield return null;
		foreach (UIWFTabButton uiwftabButton in this.m_MaidIconList.Keys)
		{
			uiwftabButton.tweenTarget = null;
		}
		yield break;
	}

	private void SetMaidFace(UndressDance_Mgr.UndressLevel level)
	{
		if (!DanceSetting.Settings.UndressFaceOn)
		{
			return;
		}
		this.m_MaidSexsualData[this.SelectMaid].Level = level;
		if (this.m_FaceCroutine != null)
		{
			base.StopCoroutine(this.m_FaceCroutine);
			this.m_FaceCroutine = null;
		}
		this.m_MaidSexsualData[this.SelectMaid].Icon.color = this.m_LevelColPair[level];
		if (level != UndressDance_Mgr.UndressLevel.None)
		{
			this.m_FaceCroutine = this.FaceUpdate(level);
			base.StartCoroutine(this.m_FaceCroutine);
		}
		else
		{
			RhythmAction_Mgr.Instance.SetMaidFaceStop(this.SelectMaid, false);
			RhythmAction_Mgr.Instance.SetMaidFaceBlendStop(this.SelectMaid, false);
		}
	}

	public override void StartAction()
	{
		List<Maid> list = new List<Maid>(RhythmAction_Mgr.Instance.FactOrderList);
		list.Reverse();
		foreach (Maid maid in list)
		{
			foreach (UndressItem undressItem in this.m_ItemUIList.Values)
			{
				undressItem.AddMaidData(maid);
			}
			GameObject gameObject = Utility.CreatePrefab(this.m_MaidGrid.gameObject, "SceneDance/Rhythm_Action/Prefab/UndressDance/MaidIcon", true);
			Transform transform = gameObject.transform.Find("IconMask/Icon");
			this.m_HoverCheckObj.Add(transform.gameObject);
			transform.GetComponent<UITexture>().mainTexture = maid.GetThumIcon();
			UIWFTabButton component = transform.GetComponent<UIWFTabButton>();
			this.m_MaidIconList.Add(component, maid);
			EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.MaidSelect));
			this.m_MaidSexsualData.Add(maid, new UndressDance_Mgr.SexsualData());
			this.m_MaidSexsualData[maid].Icon = transform.GetComponent<UITexture>();
		}
		this.m_MaidGrid.repositionNow = true;
		this.m_MaidTabPanel.UpdateChildren();
		this.m_MaidTabPanel.Select(this.m_MaidIconList.Last<KeyValuePair<UIWFTabButton, Maid>>().Key);
		base.StartCoroutine(this.InputCheck());
		base.StartCoroutine(this.TweeenNull());
	}

	public override void EndAction()
	{
		foreach (Maid maid in RhythmAction_Mgr.Instance.DanceMaid)
		{
			maid.body0.SetMaskMode(TBody.MaskMode.None);
			maid.FaceBlend("無し");
		}
	}

	public UndressDance_Mgr.PartsData GetPartsData(MPN mpn)
	{
		NDebug.Assert(this.m_MpnPartsData.ContainsKey(mpn), string.Format("UndressDance_Mgr.GetPartsData:リスト内に{0}は存在しません", mpn));
		return this.m_MpnPartsData[mpn];
	}

	public void ChangeSexsualPoint(MPN mpn)
	{
		if (!DanceSetting.Settings.UndressFaceOn)
		{
			return;
		}
		UndressDance_Mgr.UndressLevel level = this.m_MaidSexsualData[this.SelectMaid].Level;
		this.m_MaidSexsualData[this.SelectMaid].SexsualPoint += ((!this.m_ItemUIList[mpn].IsUndress) ? (-this.m_MpnPartsData[mpn].SexsualPoint) : this.m_MpnPartsData[mpn].SexsualPoint);
		if (this.m_MaidSexsualData[this.SelectMaid].SexsualPoint < 0)
		{
			this.m_MaidSexsualData[this.SelectMaid].SexsualPoint = 0;
		}
		UndressDance_Mgr.UndressLevel undressLevel = this.GetUndressLevel(true);
		if (level != undressLevel)
		{
			this.SetMaidFace(undressLevel);
		}
	}

	private const float m_InputBorder = 0.5f;

	[SerializeField]
	[Header("非アクティブ時のウィンドウのオフセット")]
	private Vector3 m_DeactiveOffset;

	[SerializeField]
	private UIButton m_CloseButton;

	[SerializeField]
	private GameObject m_TakeEvent;

	private BoxCollider m_TakeEventColl;

	[SerializeField]
	[Header("アイテムウィンドウ")]
	private GameObject m_ItemWindow;

	private UIGrid m_ItemGrid;

	private UIGrid m_MaidGrid;

	private UIWFTabPanel m_MaidTabPanel;

	[SerializeField]
	[Header("ウィンドウの移動時間")]
	private float m_UIShowTime = 0.5f;

	[SerializeField]
	private float m_HidewaitTime = 2f;

	[SerializeField]
	[Header("全脱衣ボタン")]
	private UIButton m_AllundressButton;

	[SerializeField]
	[Header("全着衣ボタン")]
	private UIButton m_AlldressButton;

	[SerializeField]
	private float m_FaceChangeTime = 5f;

	private IEnumerator m_WaitCoroutine;

	private bool m_IsWindowActive;

	private bool m_MoveEnd = true;

	private List<GameObject> m_HoverCheckObj = new List<GameObject>();

	private Dictionary<MPN, UndressDance_Mgr.PartsData> m_MpnPartsData = new Dictionary<MPN, UndressDance_Mgr.PartsData>();

	private Maid m_SelectedMaid;

	private Dictionary<MPN, UndressItem> m_ItemUIList = new Dictionary<MPN, UndressItem>();

	private Dictionary<UIWFTabButton, Maid> m_MaidIconList = new Dictionary<UIWFTabButton, Maid>();

	private bool m_IsCursorOn;

	[SerializeField]
	[Header("ショートカットキーと各Mpnの割り当て")]
	private List<UndressDance_Mgr.MpnKeyData> m_MpnInputPair = new List<UndressDance_Mgr.MpnKeyData>
	{
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad1),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad2),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad3),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad4),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad5),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad6),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad7),
		new UndressDance_Mgr.MpnKeyData(KeyCode.Keypad8)
	};

	private Dictionary<AVRControllerButtons, bool> m_ControllerInputFlag = new Dictionary<AVRControllerButtons, bool>();

	private List<List<MPN>> m_Level2KeyList = new List<List<MPN>>();

	private Dictionary<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase> m_FaceSetting = new Dictionary<UndressDance_Mgr.UndressLevel, UndressDance_Mgr.FaceDataBase>();

	private Dictionary<Maid, UndressDance_Mgr.SexsualData> m_MaidSexsualData = new Dictionary<Maid, UndressDance_Mgr.SexsualData>();

	private IEnumerator m_FaceCroutine;

	[SerializeField]
	[Header("各レベルのアイコン色")]
	private List<UndressDance_Mgr.IconColor> m_IconColData = new List<UndressDance_Mgr.IconColor>
	{
		new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.None),
		new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level0),
		new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level1),
		new UndressDance_Mgr.IconColor(UndressDance_Mgr.UndressLevel.Level2)
	};

	private Dictionary<UndressDance_Mgr.UndressLevel, Color> m_LevelColPair = new Dictionary<UndressDance_Mgr.UndressLevel, Color>();

	private bool m_ForceLevel2;

	public class PartsData
	{
		public List<TBody.SlotID> SlotIDlist = new List<TBody.SlotID>();

		public Texture DefaultIcon;

		public int SexsualPoint;
	}

	[Serializable]
	private class MpnKeyData
	{
		public MpnKeyData(KeyCode key)
		{
			this.InputKey = key;
		}

		public MPN Mpn;

		public KeyCode InputKey;
	}

	private enum UndressLevel
	{
		None,
		Level0,
		Level1,
		Level2
	}

	private class FaceDataBase
	{
		public int SexualPoint;

		public UndressDance_Mgr.UndressLevel Level;

		public List<string> Face = new List<string>();

		public string FaceBlend = string.Empty;

		public int Probability;
	}

	private class SexsualData
	{
		public int SexsualPoint;

		public UndressDance_Mgr.UndressLevel Level;

		public UITexture Icon;
	}

	[Serializable]
	private class IconColor
	{
		public IconColor(UndressDance_Mgr.UndressLevel level)
		{
			this.Level = level;
		}

		public UndressDance_Mgr.UndressLevel Level;

		public Color IconCol = Color.white;
	}
}
