using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using CharacterEdit;
using I2.Loc;
using Kasizuki;
using MaidStatus;
using SceneEditWindow;
using SceneNPCEdit;
using UnityEngine;
using wf;

public class SceneEdit : MonoBehaviour
{
	public static SceneEdit Instance { get; private set; }

	public static bool compatibilityMode
	{
		get
		{
			return DailyMgr.IsLegacy;
		}
	}

	public CustomViewWindow customViewWindow { get; private set; }

	public PoseIconWindow pauseIconWindow { get; private set; }

	public BgIconWindow bgIconWindow { get; private set; }

	public CustomPartsWindow customPartsWindow { get; private set; }

	public EditItemTextureCache editItemTextureCache { get; private set; }

	public SceneEdit.ModeType modeType { get; private set; }

	public int maidPoint { get; set; }

	public HashSet<MPN> enabledMpns { get; private set; }

	public bool m_bUseGroup
	{
		get
		{
			return GameMain.Instance.CMSystem.EditItemGroup;
		}
		set
		{
			if (value == GameMain.Instance.CMSystem.EditItemGroup || this.m_Panel_PartsType == null)
			{
				return;
			}
			GameMain.Instance.CMSystem.EditItemGroup = value;
			this.UpdateCurrentItemPanel(true);
		}
	}

	public bool m_bUseTouchJump
	{
		get
		{
			return GameMain.Instance.CMSystem.EditTouchJump;
		}
		set
		{
			GameMain.Instance.CMSystem.EditTouchJump = value;
			foreach (CapsuleCollider capsuleCollider in this.touchJumpColliderList)
			{
				capsuleCollider.enabled = value;
			}
		}
	}

	public bool isNewFace
	{
		get
		{
			return this.maid != null && this.maid.body0 != null && CMT.SearchObjName(this.maid.body0.m_trBones, "Ear_L", false) != null;
		}
	}

	public List<SceneEdit.SCategory> CategoryList
	{
		get
		{
			return this.m_listCategory;
		}
	}

	public EditViewReset viewReset
	{
		get
		{
			return this.m_viewreset;
		}
	}

	public Maid maid
	{
		get
		{
			return this.m_maid;
		}
	}

	public bool IsVRComMode
	{
		get
		{
			return this.m_bVRComMode;
		}
	}

	public MPN NowMPN
	{
		get
		{
			return this.m_nNowMPN;
		}
	}

	private static string GetParentMenuFileName(SceneEdit.SMenuItem mi)
	{
		if ((MPN.wear > mi.m_mpn || mi.m_mpn > MPN.onepiece) && (MPN.set_maidwear > mi.m_mpn || mi.m_mpn > MPN.set_body))
		{
			return string.Empty;
		}
		string text = mi.m_strMenuFileName;
		string result = string.Empty;
		text = text.ToLower();
		int num = text.IndexOf("_z");
		if (0 < num)
		{
			int num2 = text.IndexOf('_', num + 1);
			if (num2 == -1)
			{
				num2 = text.IndexOf('.', num + 1);
			}
			if (0 < num2 - num && 0 < text.Length - num2)
			{
				result = text.Substring(0, num) + text.Substring(num2, text.Length - num2);
			}
		}
		return result;
	}

	public void Awake()
	{
		this.m_cameraMoveSupport = base.gameObject.AddComponent<WfCameraMoveSupport>();
		this.editItemTextureCache = base.gameObject.AddComponent<EditItemTextureCache>();
		SceneEdit.Instance = this;
		this.modeType = SceneEdit.ModeType.OriginalChara;
		this.enabledMpns = new HashSet<MPN>();
		Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
		string a;
		if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneEdit")
		{
			string strScriptArg;
			if (tag_backup.TryGetValue("label", out strScriptArg))
			{
				this.m_strScriptArg = strScriptArg;
			}
			bool flag = false;
			if (tag_backup.TryGetValue("original", out strScriptArg))
			{
				this.modeType = SceneEdit.ModeType.OriginalChara;
				flag = true;
			}
			else if (tag_backup.TryGetValue("main", out strScriptArg))
			{
				this.modeType = SceneEdit.ModeType.MainChara;
				flag = true;
			}
			else if (tag_backup.TryGetValue("after", out strScriptArg))
			{
				this.modeType = SceneEdit.ModeType.AfterEdit;
				flag = true;
			}
			else if (tag_backup.TryGetValue("facility_costume", out strScriptArg))
			{
				this.modeType = SceneEdit.ModeType.CostumeEdit;
				flag = true;
			}
			else if (tag_backup.TryGetValue("npcedit", out strScriptArg))
			{
				this.modeType = SceneEdit.ModeType.NpcEdit;
				flag = true;
			}
			if (!flag)
			{
				NDebug.Assert("エディットシーンのモード指定がありませんでした。次のうち必ず一つは指定してください[original|main|after|costume]", false);
			}
			if (tag_backup.ContainsKey("vr_mode"))
			{
				this.m_bVRComMode = true;
			}
		}
		this.EditItemGroupSwitch.defaultColor = ((!this.m_bUseGroup) ? new Color(0.4f, 0.4f, 0.4f, 0.85f) : Color.white);
		EventDelegate.Add(this.EditItemGroupSwitch.onClick, new EventDelegate.Callback(this.OnClickEditItemGroup));
		this.EditTouchJumpSwitch.defaultColor = ((!this.m_bUseTouchJump) ? new Color(0.4f, 0.4f, 0.4f, 0.85f) : Color.white);
		EventDelegate.Add(this.EditTouchJumpSwitch.onClick, new EventDelegate.Callback(this.OnClickEditTouchJump));
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
			this.enabledMpns = new HashSet<MPN>(facilityCostumeEnableMPN);
			this.EditTouchJumpSwitch.gameObject.SetActive(false);
		}
	}

	private void Start()
	{
		this.customViewWindow = this.m_goUIRoot.GetComponentInChildren<CustomViewWindow>();
		this.pauseIconWindow = this.m_goUIRoot.GetComponentInChildren<PoseIconWindow>();
		this.pauseIconWindow.onSelectPauseEvent = delegate(PoseIconData.ItemData data)
		{
			if (this.customPartsWindowVisibleButton.visible)
			{
				this.customPartsWindowVisibleButton.windowVisible = false;
			}
			data.ExecScript();
			if (this.m_viewreset.GetVisibleAutoCam())
			{
				if (string.IsNullOrEmpty(data.targetBoneName))
				{
					this.CameraReset(0.5f);
				}
				else
				{
					base.StartCoroutine(this.CoPoseToCam(data.targetBoneName, 0.5f, 0.2f));
				}
			}
		};
		this.bgIconWindow = this.m_goUIRoot.GetComponentInChildren<BgIconWindow>();
		this.bgIconWindow.onSelectBgEvent = delegate(BgIconData.ItemData data)
		{
			data.Exec();
		};
		VoiceIconWindow componentInChildren = this.m_goUIRoot.GetComponentInChildren<VoiceIconWindow>();
		componentInChildren.onClickVoiceEvent = delegate(VoiceIconData.ItemData.EmotionType emotionType)
		{
			if (this.m_maid == null)
			{
				return;
			}
			if (this.customPartsWindowVisibleButton.visible)
			{
				this.customPartsWindowVisibleButton.windowVisible = false;
			}
			VoiceIconData.ItemData.EmotionData emotionData = VoiceIconData.GetEmotionData(this.m_maid, emotionType);
			emotionData.Apply(this.m_maid);
		};
		PresetSaveWindow componentInChildren2 = this.m_goUIRoot.GetComponentInChildren<PresetSaveWindow>();
		componentInChildren2.onClickPresetSaveEvent = delegate(PresetSaveWindow.SaveType type)
		{
			if (this.m_maid == null)
			{
				return;
			}
			PresetButtonCtrl component = UTY.GetChildObject(this.m_goUIRoot, "PresetButtonPanel", false).GetComponent<PresetButtonCtrl>();
			component.PresetSaveType(type);
		};
		UndressWindow componentInChildren3 = this.m_goUIRoot.GetComponentInChildren<UndressWindow>();
		componentInChildren3.onClickUndressEvent = delegate(UndressWindow.UndressType type)
		{
			if (this.m_maid == null)
			{
				return;
			}
			if (type == UndressWindow.UndressType.Dress)
			{
				this.ClothesState(SceneEditInfo.ClothesState.Wear);
			}
			else if (type == UndressWindow.UndressType.Lingerie)
			{
				this.ClothesState(SceneEditInfo.ClothesState.Underwear);
			}
			else if (type == UndressWindow.UndressType.Nude)
			{
				this.ClothesState(SceneEditInfo.ClothesState.Nude);
			}
		};
		this.customPartsWindow = this.m_goUIRoot.GetComponentInChildren<CustomPartsWindow>();
		this.customPartsWindowVisibleButton.visible = false;
		this.colorPaletteMgr.Close();
		CharacterMgr.EditModeLookHaveItem = true;
		GameMain.Instance.CharacterMgr.DeactivateCharaAll();
		this.m_maid = GameMain.Instance.CharacterMgr.GetMaid(0);
		this.maidPoint = GameMain.Instance.CharacterMgr.status.maidPoint;
		this.m_maid.Visible = true;
		if (this.m_bVRComMode)
		{
			GameMain.Instance.SceneActivate("SceneEdit");
		}
		GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
		this.m_EditMod = base.gameObject.AddComponent<EditMod>();
		if (this.m_goUIRoot == null)
		{
			this.m_goUIRoot = GameObject.Find("UI Root");
		}
		NDebug.Assert(this.m_goUIRoot != null, "UI Root がシーン中にありません。");
		NDebug.Assert(this.m_listPanel.Count != 0, "UIPanelリストがありません。");
		for (int i = 0; i < this.m_listPanel.Count; i++)
		{
			if (this.m_listPanel[i] == null)
			{
				NDebug.Assert("UIPanelが外れています.", false);
			}
		}
		GameObject childObject = UTY.GetChildObject(this.m_goUIRoot, "Window-ItemInfo", false);
		childObject.SetActive(true);
		this.m_info = childObject.GetComponent<ItemInfoWnd>();
		GameObject childObject2 = UTY.GetChildObject(this.m_goUIRoot, "OkCancel", false);
		childObject2.SetActive(true);
		this.m_okcancel = childObject2.GetComponent<EditOkCancel>();
		this.m_okcancel.SetOnClickCallBack(new EditOkCancel.OnClick(this.OnEditOk), new EditOkCancel.OnClick(this.OnEditCancel));
		this.m_okcancel.Show(EditOkCancel.TYPE.OK);
		GameObject childObject3 = UTY.GetChildObject(this.m_goUIRoot, "ViewReset", false);
		childObject3.SetActive(true);
		this.m_viewreset = childObject3.GetComponent<EditViewReset>();
		this.m_viewreset.SetOnClickCallBack(new EditViewReset.OnClick(this.OnClickViewReset), new EditViewReset.OnClick(this.OnClickAutoCam), new EditViewReset.OnClick(this.OnClickEyeToCam));
		this.m_viewreset.Show();
		this.m_Panel_Category = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-Category");
		this.m_Panel_PartsType = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-PartsType");
		this.m_Panel_MenuItem = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-MenuItem");
		this.m_Panel_SetItem = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-SetItem");
		this.m_Panel_SliderItem = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-Slider");
		this.m_Panel_ColorSet = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-ColorSet");
		this.m_Panel_GroupSet = new SceneEdit.UIPanelSet(this.m_goUIRoot, "ScrollPanel-GroupSet");
		this.m_CheckBoxMayuDrawPriority = UTY.GetChildObject(this.m_Panel_ColorSet.goMain, "CheckBoxMayuDrawPriority", false).GetComponent<WFCheckBox>();
		this.m_CheckBoxMayuDrawPriority.onClick.Add(delegate(WFCheckBox checkbox)
		{
			this.m_maid.MayuDrawPriority = checkbox.check;
		});
		this.m_Panel_Category.SetActive(true);
		GameObject childObject4 = UTY.GetChildObject(this.m_goUIRoot, "ViewCancel", false);
		this.m_uipViewCancel = childObject4.GetComponent<UIPanel>();
		GameObject childObject5 = UTY.GetChildObject(childObject4, "Cancel", false);
		EventDelegate.Add(childObject5.GetComponentsInChildren<UIButton>(true)[0].onClick, new EventDelegate.Callback(this.FromView));
		childObject4.SetActive(false);
		GameObject childObject6 = UTY.GetChildObject(this.m_goUIRoot, "FFNameDialog", false);
		this.m_FFNameDlg = childObject6.GetComponent<FFNameDialog>();
		this.m_FFNameDlg.Init();
		childObject6.SetActive(false);
		Maid maid = this.m_maid;
		maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
		this.m_viewreset.SetVisibleEyeToCam(true);
		if (!GameMain.Instance.VRMode)
		{
			this.m_viewreset.SetVisibleAutoCam(true);
		}
		else
		{
			this.m_viewreset.SetVisibleAutoCam(false);
		}
		new List<string>
		{
			string.Empty
		}.AddRange(GameUty.PathList);
		Action<string> action = delegate(string strFileName)
		{
			if (!GameUty.FileSystem.IsExistentFile(strFileName))
			{
				return;
			}
			using (AFileBase afileBase = GameUty.FileSystem.FileOpen(strFileName))
			{
				using (CsvParser csvParser = new CsvParser())
				{
					bool condition = csvParser.Open(afileBase);
					NDebug.Assert(condition, strFileName + "\nopen failed.");
					for (int j = 1; j < csvParser.max_cell_y; j++)
					{
						if (csvParser.IsCellToExistData(0, j))
						{
							SceneEdit.VoiceInfo voiceInfo = new SceneEdit.VoiceInfo();
							voiceInfo.strIconName = csvParser.GetCellAsString(1, j);
							string cellAsString = csvParser.GetCellAsString(2, j);
							voiceInfo.personal = Personal.GetData(cellAsString);
							voiceInfo.strVoiceFileName = csvParser.GetCellAsString(3, j);
							voiceInfo.strFace = csvParser.GetCellAsString(4, j);
							voiceInfo.strFace2 = csvParser.GetCellAsString(5, j);
							voiceInfo.texIcon = ImportCM.CreateTexture(voiceInfo.strIconName);
							if (!this.m_dicVoice.ContainsKey(voiceInfo.personal))
							{
								this.m_dicVoice.Add(voiceInfo.personal, new List<SceneEdit.PVBInfo>());
							}
							this.m_dicVoice[voiceInfo.personal].Add(voiceInfo);
						}
					}
				}
			}
		};
		GameMain.Instance.MainLight.Reset();
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
		this.SetCameraOffset(SceneEdit.CAM_OFFS.CENTER);
		GameMain.Instance.MainCamera.SetTargetPos(new Vector3(-0.05539433f, 0.95894f, 0.1269088f), true);
		GameMain.Instance.MainCamera.SetDistance(3f, true);
		GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(-180f, 11.5528f), true);
		this.m_cameraMoveSupport.SaveCameraPosition();
		if (GameMain.Instance.VRMode)
		{
			GameMain.Instance.MainCamera.SetPos(new Vector3(0f, 1.4871f, 1f));
			GameMain.Instance.MainCamera.SetRotation(new Vector3(0f, -180f, 0f));
			if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.FOVE)
			{
				FoveEyeRayMgr.m_TargetMaid = this.m_maid;
			}
		}
		GameMain.Instance.SoundMgr.PlayBGM("BGM005.ogg", 1f, true);
		GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
		GameMain.Instance.LoadIcon.NextLoadIcontImmediatelyDisplay();
		GameMain.Instance.LoadIcon.force_draw_new = true;
		this.m_dicColor.Clear();
		base.StartCoroutine(this.InitMenuNative());
		GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.Edit, false);
		if (PluginData.IsEnabled("GP001"))
		{
			uGUITutorialPanel.OpenTutorial("SceneEditGP01", null, false);
			GameMain.Instance.SysShortcut.strSceneHelpName = "SceneEditGP01";
		}
		else
		{
			GameMain.Instance.SysShortcut.strSceneHelpName = string.Empty;
		}
	}

	private IEnumerator CoLoadWait()
	{
		while (GameMain.Instance.CharacterMgr.IsBusy())
		{
			yield return null;
		}
		GameMain.Instance.CharacterMgr.ResetCharaPosAll();
		if (this.m_bVRComMode)
		{
			if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Night".ToLower())
			{
				this.m_maid.SetPos(new Vector3(-0.29f, 0f, 1.6f));
				this.m_maid.SetRot(new Vector3(0f, -90f, 0f));
				GameMain.Instance.MainCamera.SetRealHeadPos(new Vector3(-1.58508f, 1.601999f, 1.811131f), true);
				GameMain.Instance.MainCamera.SetRealHeadRot(new Vector3(0f, 102f, 0f), true);
				GameMain.Instance.MainLight.SetRotation(new Vector3(40.00004f, 57.29157f, 18f));
			}
			else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_BedRoom_Night".ToLower())
			{
				this.m_maid.SetPos(new Vector3(3.54f, 0f, 1.16f));
				this.m_maid.SetRot(new Vector3(0f, 180f, 0f));
				GameMain.Instance.MainCamera.SetRealHeadPos(new Vector3(3.55631f, 1.601999f, -0.3987116f), true);
				GameMain.Instance.MainCamera.SetRealHeadRot(new Vector3(0f, 358f, 0f), true);
				GameMain.Instance.MainLight.SetRotation(new Vector3(58.94946f, 0f, 198f));
			}
			else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Villa_Farm_Night".ToLower())
			{
				this.m_maid.SetPos(new Vector3(-0.235f, 0f, -1.898f));
				GameMain.Instance.MainCamera.SetRealHeadPos(new Vector3(-0.3528061f, 1.601999f, -0.6961781f), true);
				GameMain.Instance.MainCamera.SetRealHeadRot(new Vector3(0f, 174f, 0f), true);
			}
			else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Sea_VR_Night".ToLower())
			{
				this.m_maid.SetPos(new Vector3(-2.75f, 0f, -11f));
				GameMain.Instance.MainCamera.SetRealHeadPos(new Vector3(-2.685168f, 1.601999f, -9.861251f), true);
				GameMain.Instance.MainCamera.SetRealHeadRot(new Vector3(0f, 180f, 0f), true);
			}
			else if (GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo".ToLower() || GameMain.Instance.BgMgr.GetBGName().ToLower() == "Rotenburo_Night".ToLower())
			{
				this.m_maid.SetPos(new Vector3(-0.235f, 0f, 2.028f));
				GameMain.Instance.MainCamera.SetRealHeadPos(new Vector3(-0.2311308f, 1.601999f, 3.325274f), true);
				GameMain.Instance.MainCamera.SetRealHeadRot(new Vector3(0f, 182f, 0f), true);
			}
			GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
		}
		this.m_maid.boMabataki = true;
		MaidColliderCollect collect = MaidColliderCollect.AddColliderCollect(this.m_maid);
		this.touchJumpColliderList = collect.AddCollider(MaidColliderCollect.ColliderType.Grab);
		if (!GameMain.Instance.VRMode)
		{
			Dictionary<IKManager.BoneType, KeyValuePair<IKManager.BoneSetType, GameObject>> dictionary = IKManager.CreateBoneDic(this.m_maid);
			Dictionary<Transform, SceneEdit.TouchType> dictionary2 = new Dictionary<Transform, SceneEdit.TouchType>();
			dictionary2.Add(dictionary[IKManager.BoneType.Head].Value.transform, SceneEdit.TouchType.Head);
			dictionary2.Add(dictionary[IKManager.BoneType.Spine1].Value.transform, SceneEdit.TouchType.UpperBody);
			dictionary2.Add(dictionary[IKManager.BoneType.Bust_R].Value.transform, SceneEdit.TouchType.Bust);
			dictionary2.Add(dictionary[IKManager.BoneType.Bust_L].Value.transform, SceneEdit.TouchType.Bust);
			dictionary2.Add(dictionary[IKManager.BoneType.Pelvis].Value.transform, SceneEdit.TouchType.LowerBody);
			dictionary2.Add(dictionary[IKManager.BoneType.Thigh_L].Value.transform, SceneEdit.TouchType.Leg);
			dictionary2.Add(dictionary[IKManager.BoneType.Thigh_R].Value.transform, SceneEdit.TouchType.Leg);
			Dictionary<SceneEdit.TouchType, Action> dictionary3 = new Dictionary<SceneEdit.TouchType, Action>();
			dictionary3.Add(SceneEdit.TouchType.Head, delegate
			{
				this.OnTouchJump(SceneEdit.TouchType.Head);
			});
			dictionary3.Add(SceneEdit.TouchType.Bust, delegate
			{
				this.OnTouchJump(SceneEdit.TouchType.Bust);
			});
			dictionary3.Add(SceneEdit.TouchType.UpperBody, delegate
			{
				this.OnTouchJump(SceneEdit.TouchType.UpperBody);
			});
			dictionary3.Add(SceneEdit.TouchType.LowerBody, delegate
			{
				this.OnTouchJump(SceneEdit.TouchType.LowerBody);
			});
			dictionary3.Add(SceneEdit.TouchType.Leg, delegate
			{
				this.OnTouchJump(SceneEdit.TouchType.Leg);
			});
			for (int i = 0; i < this.touchJumpColliderList.Count; i++)
			{
				ColliderEvent colliderEvent = this.touchJumpColliderList[i].gameObject.AddComponent<ColliderEvent>();
				Transform transform = colliderEvent.transform;
				while (transform != null && !dictionary2.ContainsKey(transform))
				{
					transform = transform.parent;
				}
				if (!(transform == null))
				{
					SceneEdit.TouchType key = dictionary2[transform];
					colliderEvent.onMouseDown = dictionary3[key];
				}
			}
		}
		else
		{
			this.touchJumpColliderList.Clear();
		}
		this.m_bUseTouchJump = this.m_bUseTouchJump;
		if (SceneEdit.compatibilityMode)
		{
			foreach (BgIconData.ItemData itemData in BgIconData.itemList)
			{
				if (itemData.isLegacyBG)
				{
					this.bgIconWindow.Exec(itemData.id);
					break;
				}
			}
		}
		else
		{
			foreach (BgIconData.ItemData itemData2 in BgIconData.itemList)
			{
				if (!itemData2.isLegacyBG)
				{
					this.bgIconWindow.Exec(itemData2.id);
					break;
				}
			}
		}
		this.customPartsWindow.Initizalize(this.m_maid);
		int initPoseId = PoseIconData.itemList[0].id;
		Action<PoseIconData.ItemData> backup = this.pauseIconWindow.onSelectPauseEvent;
		this.pauseIconWindow.onSelectPauseEvent = delegate(PoseIconData.ItemData data)
		{
			data.ExecScript();
			Maid maid = this.m_maid;
			Transform bone = maid.body0.GetBone(data.targetBoneName);
			if (bone != null)
			{
				this.m_cameraMoveSupport.SaveCameraPosition(bone.position, 3f, new Vector2(-180f, 11.5528f));
				this.CameraReset(0f);
			}
		};
		this.pauseIconWindow.Exec(initPoseId);
		yield return new WaitForSeconds(0.5f);
		this.pauseIconWindow.Exec(initPoseId);
		this.pauseIconWindow.onSelectPauseEvent = backup;
		this.customViewWindow.Create();
		GameMain.Instance.LoadIcon.force_draw_new = false;
		GameMain.Instance.MainCamera.FadeIn(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color));
		yield break;
	}

	private void OnCompleteFadeIn()
	{
	}

	private IEnumerator InitMenuNative()
	{
		while (GameMain.Instance.CharacterMgr.IsBusy())
		{
			yield return null;
		}
		while (!GameMain.Instance.MenuDataBase.JobFinished())
		{
			yield return null;
		}
		this.InitCategoryList();
		int fileCount = GameMain.Instance.MenuDataBase.GetDataSize();
		List<SceneEdit.SMenuItem> menuList = new List<SceneEdit.SMenuItem>(fileCount);
		this.m_menuRidDic = new Dictionary<int, SceneEdit.SMenuItem>(fileCount);
		Dictionary<int, List<int>> menuGroupMemberDic = new Dictionary<int, List<int>>();
		MenuDataBase menuDataBase = GameMain.Instance.MenuDataBase;
		float time = Time.realtimeSinceStartup;
		for (int i = 0; i < fileCount; i++)
		{
			menuDataBase.SetIndex(i);
			string fileName = menuDataBase.GetMenuFileName();
			string parent_filename = menuDataBase.GetParentMenuFileName();
			if (GameMain.Instance.CharacterMgr.status.IsHavePartsItem(fileName))
			{
				SceneEdit.SMenuItem mi = new SceneEdit.SMenuItem();
				mi.m_strMenuFileName = fileName;
				mi.m_nMenuFileRID = fileName.GetHashCode();
				try
				{
					SceneEdit.ReadMenuItemDataFromNative(mi, i);
				}
				catch (Exception ex)
				{
					Debug.LogError(string.Concat(new string[]
					{
						"ReadMenuItemDataFromNative 例外/",
						fileName,
						"/",
						ex.Message,
						" StackTrace/",
						ex.StackTrace
					}));
				}
				if (!mi.m_bMan && this.editItemTextureCache.IsRegister(mi.m_nMenuFileRID))
				{
					this.AddMenuItemToList(mi);
					menuList.Add(mi);
					if (!this.m_menuRidDic.ContainsKey(mi.m_nMenuFileRID))
					{
						this.m_menuRidDic.Add(mi.m_nMenuFileRID, mi);
					}
					string parentMenuName = SceneEdit.GetParentMenuFileName(mi);
					if (!string.IsNullOrEmpty(parentMenuName))
					{
						int hashCode = parentMenuName.GetHashCode();
						if (!menuGroupMemberDic.ContainsKey(hashCode))
						{
							menuGroupMemberDic.Add(hashCode, new List<int>());
						}
						menuGroupMemberDic[hashCode].Add(mi.m_strMenuFileName.ToLower().GetHashCode());
					}
					else if (mi.m_strCateName.IndexOf("set_") != -1 && mi.m_strMenuFileName.IndexOf("_del") == -1)
					{
						mi.m_bGroupLeader = true;
						mi.m_listMember = new List<SceneEdit.SMenuItem>();
						mi.m_listMember.Add(mi);
					}
					if (0.5f < Time.realtimeSinceStartup - time)
					{
						yield return null;
						time = Time.realtimeSinceStartup;
					}
				}
			}
		}
		foreach (string strFileName in GameUty.ModOnlysMenuFiles)
		{
			SceneEdit.SMenuItem mi2 = new SceneEdit.SMenuItem();
			if (SceneEdit.GetMenuItemSetUP(mi2, strFileName, false))
			{
				if (!mi2.m_bMan && !(mi2.m_texIconRef == null))
				{
					this.AddMenuItemToList(mi2);
					menuList.Add(mi2);
					if (!this.m_menuRidDic.ContainsKey(mi2.m_nMenuFileRID))
					{
						this.m_menuRidDic.Add(mi2.m_nMenuFileRID, mi2);
					}
					string parentMenuName2 = SceneEdit.GetParentMenuFileName(mi2);
					if (!string.IsNullOrEmpty(parentMenuName2))
					{
						int hashCode2 = parentMenuName2.GetHashCode();
						if (!menuGroupMemberDic.ContainsKey(hashCode2))
						{
							menuGroupMemberDic.Add(hashCode2, new List<int>());
						}
						menuGroupMemberDic[hashCode2].Add(mi2.m_strMenuFileName.ToLower().GetHashCode());
					}
					else if (mi2.m_strCateName.IndexOf("set_") != -1 && mi2.m_strMenuFileName.IndexOf("_del") == -1)
					{
						mi2.m_bGroupLeader = true;
						mi2.m_listMember = new List<SceneEdit.SMenuItem>();
						mi2.m_listMember.Add(mi2);
					}
					if (0.5f < Time.realtimeSinceStartup - time)
					{
						yield return null;
						time = Time.realtimeSinceStartup;
					}
				}
			}
		}
		yield return base.StartCoroutine(this.FixedInitMenu(menuList, this.m_menuRidDic, menuGroupMemberDic));
		yield return base.StartCoroutine(this.CoLoadWait());
		yield break;
	}

	private IEnumerator InitMenu()
	{
		this.InitCategoryList();
		string[] files = GameUty.MenuFiles;
		List<SceneEdit.SMenuItem> menuList = new List<SceneEdit.SMenuItem>(files.Length);
		this.m_menuRidDic = new Dictionary<int, SceneEdit.SMenuItem>(menuList.Capacity);
		Dictionary<int, List<int>> menuGroupMemberDic = new Dictionary<int, List<int>>();
		float time = Time.realtimeSinceStartup;
		foreach (string strFileName in files)
		{
			if (!strFileName.ToLower().Contains("/man"))
			{
				if (GameMain.Instance.CharacterMgr.status.IsHavePartsItem(Path.GetFileName(strFileName)))
				{
					SceneEdit.SMenuItem mi = new SceneEdit.SMenuItem();
					if (SceneEdit.GetMenuItemSetUP(mi, strFileName, false))
					{
						if (!mi.m_bMan && !(mi.m_texIconRef == null))
						{
							this.AddMenuItemToList(mi);
							menuList.Add(mi);
							if (!this.m_menuRidDic.ContainsKey(mi.m_nMenuFileRID))
							{
								this.m_menuRidDic.Add(mi.m_nMenuFileRID, mi);
							}
							string parentMenuName = SceneEdit.GetParentMenuFileName(mi);
							if (!string.IsNullOrEmpty(parentMenuName))
							{
								int hashCode = parentMenuName.GetHashCode();
								if (!menuGroupMemberDic.ContainsKey(hashCode))
								{
									menuGroupMemberDic.Add(hashCode, new List<int>());
								}
								menuGroupMemberDic[hashCode].Add(mi.m_strMenuFileName.ToLower().GetHashCode());
							}
							else if (mi.m_strCateName.IndexOf("set_") != -1 && mi.m_strMenuFileName.IndexOf("_del") == -1)
							{
								mi.m_bGroupLeader = true;
								mi.m_listMember = new List<SceneEdit.SMenuItem>();
								mi.m_listMember.Add(mi);
							}
							if (0.5f < Time.realtimeSinceStartup - time)
							{
								yield return null;
								time = Time.realtimeSinceStartup;
							}
						}
					}
				}
			}
		}
		yield return base.StartCoroutine(this.FixedInitMenu(menuList, this.m_menuRidDic, menuGroupMemberDic));
		yield return base.StartCoroutine(this.CoLoadWait());
		yield break;
	}

	private IEnumerator FixedInitMenu(List<SceneEdit.SMenuItem> menuList, Dictionary<int, SceneEdit.SMenuItem> menuRidDic, Dictionary<int, List<int>> menuGroupMemberDic)
	{
		float time = Time.realtimeSinceStartup;
		string[] modfiles = Menu.GetModFiles();
		if (modfiles != null)
		{
			foreach (string strFileName in modfiles)
			{
				SceneEdit.SMenuItem mi2 = new SceneEdit.SMenuItem();
				if (SceneEdit.InitModMenuItemScript(mi2, strFileName))
				{
					this.AddMenuItemToList(mi2);
					menuList.Add(mi2);
					if (!menuRidDic.ContainsKey(mi2.m_nMenuFileRID))
					{
						menuRidDic.Add(mi2.m_nMenuFileRID, mi2);
					}
					else
					{
						menuRidDic[mi2.m_nMenuFileRID] = mi2;
					}
					string parentMenuName = SceneEdit.GetParentMenuFileName(mi2);
					if (!string.IsNullOrEmpty(parentMenuName))
					{
						int hashCode = parentMenuName.GetHashCode();
						if (!menuGroupMemberDic.ContainsKey(hashCode))
						{
							menuGroupMemberDic.Add(hashCode, new List<int>());
						}
						menuGroupMemberDic[hashCode].Add(mi2.m_strMenuFileName.ToLower().GetHashCode());
					}
					else if (mi2.m_strCateName.IndexOf("set_") != -1 && mi2.m_strMenuFileName.IndexOf("_del") == -1)
					{
						mi2.m_bGroupLeader = true;
						mi2.m_listMember = new List<SceneEdit.SMenuItem>();
						mi2.m_listMember.Add(mi2);
					}
					if (0.5f < Time.realtimeSinceStartup - time)
					{
						yield return null;
						time = Time.realtimeSinceStartup;
					}
				}
			}
		}
		foreach (KeyValuePair<int, List<int>> keyValuePair in menuGroupMemberDic)
		{
			if (menuRidDic.ContainsKey(keyValuePair.Key) && keyValuePair.Value.Count >= 1)
			{
				SceneEdit.SMenuItem smenuItem = menuRidDic[keyValuePair.Key];
				smenuItem.m_bGroupLeader = true;
				smenuItem.m_listMember = new List<SceneEdit.SMenuItem>();
				smenuItem.m_listMember.Add(smenuItem);
				for (int n = 0; n < keyValuePair.Value.Count; n++)
				{
					smenuItem.m_listMember.Add(menuRidDic[keyValuePair.Value[n]]);
					smenuItem.m_listMember[smenuItem.m_listMember.Count - 1].m_bMember = true;
					smenuItem.m_listMember[smenuItem.m_listMember.Count - 1].m_leaderMenu = smenuItem;
				}
				smenuItem.m_listMember.Sort(delegate(SceneEdit.SMenuItem x, SceneEdit.SMenuItem y)
				{
					if (x.m_fPriority == y.m_fPriority)
					{
						return 0;
					}
					if (x.m_fPriority < y.m_fPriority)
					{
						return -1;
					}
					if (x.m_fPriority > y.m_fPriority)
					{
						return 1;
					}
					return 0;
				});
				smenuItem.m_listMember.Sort((SceneEdit.SMenuItem x, SceneEdit.SMenuItem y) => x.m_strMenuFileName.CompareTo(y.m_strMenuFileName));
			}
		}
		foreach (KeyValuePair<MPN, SceneEditInfo.CCateNameType> keyValuePair2 in SceneEditInfo.m_dicPartsTypePair)
		{
			if (keyValuePair2.Value.m_eType == SceneEditInfo.CCateNameType.EType.Slider)
			{
				this.AddMenuItemToList(new SceneEdit.SMenuItem
				{
					m_mpn = keyValuePair2.Key,
					m_nSliderValue = 500,
					m_strCateName = keyValuePair2.Key.ToString(),
					m_strMenuName = keyValuePair2.Value.m_strBtnPartsTypeName,
					m_requestNewFace = keyValuePair2.Value.m_requestNewFace
				});
			}
		}
		for (int nM = 0; nM < menuList.Count; nM++)
		{
			SceneEdit.SMenuItem mi = menuList[nM];
			if (mi.m_eColorSetMPN != MPN.null_mpn)
			{
				if (mi.m_strMenuNameInColorSet != null)
				{
					mi.m_strMenuNameInColorSet = mi.m_strMenuNameInColorSet.Replace("*", ".*");
					mi.m_listColorSet = this.m_dicColor[mi.m_eColorSetMPN].FindAll((SceneEdit.SMenuItem i) => new Regex(mi.m_strMenuNameInColorSet).IsMatch(i.m_strMenuFileName));
				}
				else
				{
					mi.m_listColorSet = this.m_dicColor[mi.m_eColorSetMPN];
				}
			}
			if (0.5f < Time.realtimeSinceStartup - time)
			{
				yield return null;
				time = Time.realtimeSinceStartup;
			}
		}
		for (int j = 0; j < this.m_listCategory.Count; j++)
		{
			this.m_listCategory[j].SortPartsType();
		}
		for (int k = 0; k < this.m_listCategory.Count; k++)
		{
			this.m_listCategory[k].SortItem();
		}
		foreach (SceneEdit.SCategory scategory in this.m_listCategory)
		{
			if (scategory.m_eCategory == SceneEditInfo.EMenuCategory.プリセット || scategory.m_eCategory == SceneEditInfo.EMenuCategory.ランダム || scategory.m_eCategory == SceneEditInfo.EMenuCategory.プロフィ\u30FCル || scategory.m_eCategory == SceneEditInfo.EMenuCategory.着衣設定)
			{
				scategory.m_isEnabled = true;
			}
			else
			{
				scategory.m_isEnabled = false;
				foreach (SceneEdit.SPartsType spartsType in scategory.m_listPartsType)
				{
					if (spartsType.m_isEnabled)
					{
						scategory.m_isEnabled = true;
						break;
					}
				}
			}
		}
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			SceneEditInfo.EMenuCategory[] array = new SceneEditInfo.EMenuCategory[]
			{
				SceneEditInfo.EMenuCategory.セット,
				SceneEditInfo.EMenuCategory.プリセット,
				SceneEditInfo.EMenuCategory.ランダム,
				SceneEditInfo.EMenuCategory.プロフィ\u30FCル
			};
			SceneEditInfo.EMenuCategory[] array2 = array;
			for (int l = 0; l < array2.Length; l++)
			{
				SceneEditInfo.EMenuCategory cate = array2[l];
				this.m_listCategory.Find((SceneEdit.SCategory c) => c.m_eCategory == cate).m_isEnabled = false;
			}
		}
		else if (this.maid.status.heroineType == HeroineType.Sub || this.maid.boNPC)
		{
			SceneEditInfo.EMenuCategory[] array3 = new SceneEditInfo.EMenuCategory[]
			{
				SceneEditInfo.EMenuCategory.プロフィ\u30FCル
			};
			SceneEditInfo.EMenuCategory[] array4 = array3;
			for (int m = 0; m < array4.Length; m++)
			{
				SceneEditInfo.EMenuCategory cate = array4[m];
				this.m_listCategory.Find((SceneEdit.SCategory c) => c.m_eCategory == cate).m_isEnabled = false;
			}
		}
		this.UpdatePanel_Category();
		yield break;
	}

	private void InitCategoryList()
	{
		for (int i = 0; i < this.m_listCategory.Count; i++)
		{
			this.m_listCategory[i].Dispose();
		}
		this.m_listCategory.Clear();
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.頭.ToString(), SceneEditInfo.EMenuCategory.頭));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.髪.ToString(), SceneEditInfo.EMenuCategory.髪));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.身体.ToString(), SceneEditInfo.EMenuCategory.身体));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.服装.ToString(), SceneEditInfo.EMenuCategory.服装));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.アクセサリ.ToString(), SceneEditInfo.EMenuCategory.アクセサリ));
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.着衣設定.ToString(), SceneEditInfo.EMenuCategory.着衣設定));
		}
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.セット.ToString(), SceneEditInfo.EMenuCategory.セット));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.プリセット.ToString(), SceneEditInfo.EMenuCategory.プリセット));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.ランダム.ToString(), SceneEditInfo.EMenuCategory.ランダム));
		this.m_listCategory.Add(new SceneEdit.SCategory(SceneEditInfo.EMenuCategory.プロフィ\u30FCル.ToString(), SceneEditInfo.EMenuCategory.プロフィ\u30FCル));
	}

	public static void ReadMenuItemDataFromNative(SceneEdit.SMenuItem mi, int menuDataBaseIndex)
	{
		MenuDataBase menuDataBase = GameMain.Instance.MenuDataBase;
		menuDataBase.SetIndex(menuDataBaseIndex);
		mi.m_strMenuName = menuDataBase.GetMenuName();
		mi.m_strInfo = menuDataBase.GetItemInfoText();
		mi.m_mpn = (MPN)menuDataBase.GetCategoryMpn();
		mi.m_strCateName = menuDataBase.GetCategoryMpnText();
		mi.m_eColorSetMPN = (MPN)menuDataBase.GetColorSetMpn();
		mi.m_strMenuNameInColorSet = menuDataBase.GetMenuNameInColorSet();
		mi.m_pcMultiColorID = (MaidParts.PARTS_COLOR)menuDataBase.GetMultiColorId();
		mi.m_boDelOnly = menuDataBase.GetBoDelOnly();
		mi.m_fPriority = menuDataBase.GetPriority();
		mi.m_bMan = menuDataBase.GetIsMan();
		mi.m_bOld = (menuDataBase.GetVersion() < 2000);
		string iconS = menuDataBase.GetIconS();
		if (!string.IsNullOrEmpty(iconS) && GameUty.FileSystem.IsExistentFile(iconS))
		{
			if (SceneEdit.Instance != null)
			{
				SceneEdit.Instance.editItemTextureCache.PreLoadRegister(mi.m_nMenuFileRID, iconS);
			}
			else
			{
				try
				{
					mi.m_texIcon = ImportCM.CreateTexture(iconS);
				}
				catch (Exception)
				{
					Debug.LogError("Error:");
				}
			}
		}
	}

	public static bool GetMenuItemSetUP(SceneEdit.SMenuItem mi, string f_strMenuFileName, bool f_bMan = false)
	{
		if (f_strMenuFileName.Contains("_zurashi"))
		{
			return false;
		}
		if (f_strMenuFileName.Contains("_mekure"))
		{
			return false;
		}
		f_strMenuFileName = Path.GetFileName(f_strMenuFileName);
		mi.m_strMenuFileName = f_strMenuFileName;
		mi.m_nMenuFileRID = f_strMenuFileName.ToLower().GetHashCode();
		try
		{
			if (!SceneEdit.InitMenuItemScript(mi, f_strMenuFileName, f_bMan))
			{
				NDebug.Assert(false, "メニュースクリプトが読めませんでした。" + f_strMenuFileName);
			}
		}
		catch (Exception ex)
		{
			Debug.LogError(string.Concat(new string[]
			{
				"GetMenuItemSetUP 例外/",
				f_strMenuFileName,
				"/",
				ex.Message,
				" StackTrace/",
				ex.StackTrace
			}));
			return false;
		}
		return true;
	}

	public static bool InitModMenuItemScript(SceneEdit.SMenuItem mi, string f_strModFileName)
	{
		byte[] buffer = null;
		try
		{
			using (FileStream fileStream = new FileStream(f_strModFileName, FileMode.Open))
			{
				if (fileStream == null)
				{
					Debug.LogWarning("MODアイテムメニューファイルが見つかりません。");
					return false;
				}
				buffer = new byte[fileStream.Length];
				fileStream.Read(buffer, 0, (int)fileStream.Length);
			}
		}
		catch (Exception ex)
		{
			Debug.LogError("InitModMenuItemScript MODアイテムメニューファイルが読み込めませんでした。 : " + f_strModFileName + " : " + ex.Message);
			return false;
		}
		BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
		string text = binaryReader.ReadString();
		NDebug.Assert(text == "CM3D2_MOD", "InitModMenuItemScript 例外 : ヘッダーファイルが不正です。" + text);
		int num = binaryReader.ReadInt32();
		string text2 = binaryReader.ReadString();
		string text3 = binaryReader.ReadString();
		string strMenuName = binaryReader.ReadString();
		string strCateName = binaryReader.ReadString();
		string text4 = binaryReader.ReadString();
		string text5 = binaryReader.ReadString();
		MPN mpn = MPN.null_mpn;
		try
		{
			mpn = (MPN)Enum.Parse(typeof(MPN), text5);
		}
		catch
		{
			NDebug.Assert("カテゴリがありません。" + text5, false);
		}
		string text6 = string.Empty;
		if (mpn != MPN.null_mpn)
		{
			text6 = binaryReader.ReadString();
		}
		string s = binaryReader.ReadString();
		int num2 = binaryReader.ReadInt32();
		Dictionary<string, byte[]> dictionary = new Dictionary<string, byte[]>();
		for (int i = 0; i < num2; i++)
		{
			string key = binaryReader.ReadString();
			int count = binaryReader.ReadInt32();
			byte[] value = binaryReader.ReadBytes(count);
			dictionary.Add(key, value);
		}
		binaryReader.Close();
		binaryReader = null;
		mi.m_bMod = true;
		mi.m_strMenuFileName = Path.GetFileName(f_strModFileName);
		mi.m_nMenuFileRID = mi.m_strMenuFileName.ToLower().GetHashCode();
		mi.m_strMenuName = strMenuName;
		mi.m_strInfo = text4.Replace("《改行》", "\n");
		mi.m_strCateName = strCateName;
		try
		{
			mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName);
		}
		catch
		{
			Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName);
			mi.m_mpn = MPN.null_mpn;
		}
		if (mpn != MPN.null_mpn)
		{
			mi.m_eColorSetMPN = mpn;
			if (!string.IsNullOrEmpty(text6))
			{
				mi.m_strMenuNameInColorSet = text6;
			}
		}
		if (!string.IsNullOrEmpty(text2))
		{
			byte[] data = dictionary[text2];
			mi.m_texIcon = new Texture2D(1, 1, TextureFormat.RGBA32, false);
			mi.m_texIcon.LoadImage(data);
		}
		mi.m_fPriority = 999f;
		using (StringReader stringReader = new StringReader(s))
		{
			string empty = string.Empty;
			string text7;
			while ((text7 = stringReader.ReadLine()) != null)
			{
				string[] array = text7.Split(new char[]
				{
					'\t',
					' '
				}, StringSplitOptions.RemoveEmptyEntries);
				if (array[0] == "テクスチャ変更")
				{
					MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
					if (array.Length == 6)
					{
						string text8 = array[5];
						try
						{
							pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text8.ToUpper());
						}
						catch
						{
							NDebug.Assert("無限色IDがありません。" + text8, false);
						}
						mi.m_pcMultiColorID = pcMultiColorID;
					}
				}
			}
		}
		return true;
	}

	private bool AddMenuItemToList(SceneEdit.SMenuItem f_mi)
	{
		MPN mpn = f_mi.m_mpn;
		if (f_mi.m_mpn == MPN.null_mpn)
		{
			Debug.LogWarning("カテゴリがnullの為、メニュー表示しません。" + f_mi.m_strCateName);
			return false;
		}
		SceneEditInfo.CCateNameType cateType;
		if (mpn != MPN.null_mpn && SceneEditInfo.m_dicPartsTypePair.TryGetValue(mpn, out cateType))
		{
			if (cateType.m_eType == SceneEditInfo.CCateNameType.EType.Item || cateType.m_eType == SceneEditInfo.CCateNameType.EType.Set || cateType.m_eType == SceneEditInfo.CCateNameType.EType.Slider)
			{
				SceneEdit.SCategory scategory = this.m_listCategory.Find((SceneEdit.SCategory c) => c.m_eCategory == cateType.m_eMenuCate);
				SceneEdit.SPartsType spartsType = scategory.m_listPartsType.Find((SceneEdit.SPartsType p) => p.m_ePartsType == cateType.m_ePartsType);
				if (spartsType == null)
				{
					string f_strPartsTypeName = string.Empty;
					if (cateType.m_eType == SceneEditInfo.CCateNameType.EType.Slider)
					{
						if (!SceneEditInfo.m_dicSliderPartsTypeBtnName.TryGetValue(cateType.m_ePartsType, out f_strPartsTypeName))
						{
							NDebug.Assert("スライダー群に対するパーツタイプ名がみつかりませんでした。", false);
						}
					}
					else
					{
						f_strPartsTypeName = cateType.m_strBtnPartsTypeName;
					}
					spartsType = new SceneEdit.SPartsType(cateType.m_eType, mpn, f_strPartsTypeName, cateType.m_ePartsType);
					if (this.enabledMpns.Count == 0)
					{
						spartsType.m_isEnabled = true;
					}
					else
					{
						spartsType.m_isEnabled = this.enabledMpns.Contains(spartsType.m_mpn);
					}
					scategory.m_listPartsType.Add(spartsType);
				}
				f_mi.m_ParentPartsType = spartsType;
				if (cateType.m_eType == SceneEditInfo.CCateNameType.EType.Slider)
				{
					f_mi.m_fPriority = (float)cateType.m_nIdx;
				}
				spartsType.m_listMenu.Add(f_mi);
			}
			else if (cateType.m_eType == SceneEditInfo.CCateNameType.EType.Color)
			{
				f_mi.m_bColor = true;
				if (!this.m_dicColor.ContainsKey(f_mi.m_mpn))
				{
					this.m_dicColor.Add(f_mi.m_mpn, new List<SceneEdit.SMenuItem>());
				}
				this.m_dicColor[f_mi.m_mpn].Add(f_mi);
			}
		}
		return true;
	}

	public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, bool f_bMan)
	{
		if (f_strMenuFileName.IndexOf("mod_") == 0)
		{
			string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName);
			return !string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName);
		}
		try
		{
			using (AFileBase afileBase = GameUty.FileOpen(f_strMenuFileName, null))
			{
				NDebug.Assert(afileBase.IsValid(), "メニューファイルが存在しません。 :" + f_strMenuFileName);
				if (SceneEdit.m_byItemFileBuffer == null)
				{
					SceneEdit.m_byItemFileBuffer = new byte[System.Math.Max(500000, afileBase.GetSize())];
				}
				else if (SceneEdit.m_byItemFileBuffer.Length < afileBase.GetSize())
				{
					SceneEdit.m_byItemFileBuffer = new byte[afileBase.GetSize()];
				}
				afileBase.Read(ref SceneEdit.m_byItemFileBuffer, afileBase.GetSize());
			}
		}
		catch (Exception ex)
		{
			Debug.LogError(string.Concat(new string[]
			{
				"メニューファイルがが読み込めませんでした。 : ",
				f_strMenuFileName,
				" : ",
				ex.Message,
				" : StackTrace :\n",
				ex.StackTrace
			}));
			throw ex;
		}
		BinaryReader binaryReader = new BinaryReader(new MemoryStream(SceneEdit.m_byItemFileBuffer), Encoding.UTF8);
		string text = binaryReader.ReadString();
		NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text);
		int num = binaryReader.ReadInt32();
		string path = binaryReader.ReadString();
		string text2 = binaryReader.ReadString();
		string text3 = binaryReader.ReadString();
		string text4 = binaryReader.ReadString();
		long num2 = (long)binaryReader.ReadInt32();
		int num3 = 0;
		string text5 = null;
		string text6 = string.Empty;
		string text7 = string.Empty;
		try
		{
			for (;;)
			{
				int num4 = (int)binaryReader.ReadByte();
				text7 = text6;
				text6 = string.Empty;
				if (num4 == 0)
				{
					break;
				}
				for (int i = 0; i < num4; i++)
				{
					text6 = text6 + "\"" + binaryReader.ReadString() + "\" ";
				}
				if (!(text6 == string.Empty))
				{
					string stringCom = UTY.GetStringCom(text6);
					string[] stringList = UTY.GetStringList(text6);
					if (stringCom == "name")
					{
						string text8 = stringList[1];
						string text9 = string.Empty;
						string arg = string.Empty;
						int j = 0;
						while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ')
						{
							text9 += text8[j];
							j++;
						}
						while (j < text8.Length)
						{
							arg += text8[j];
							j++;
						}
						mi.m_strMenuName = text9;
					}
					else if (stringCom == "setumei")
					{
						mi.m_strInfo = stringList[1];
						mi.m_strInfo = mi.m_strInfo.Replace("《改行》", "\n");
					}
					else if (stringCom == "category")
					{
						string strCateName = stringList[1].ToLower();
						mi.m_strCateName = strCateName;
						try
						{
							mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName);
						}
						catch
						{
							Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName);
							mi.m_mpn = MPN.null_mpn;
						}
					}
					else if (stringCom == "color_set")
					{
						try
						{
							mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower());
						}
						catch
						{
							Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName);
						}
						if (stringList.Length >= 3)
						{
							mi.m_strMenuNameInColorSet = stringList[2].ToLower();
						}
					}
					else if (stringCom == "tex" || stringCom == "テクスチャ変更")
					{
						MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE;
						if (stringList.Length == 6)
						{
							string text10 = stringList[5];
							try
							{
								pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper());
							}
							catch
							{
								NDebug.Assert("無限色IDがありません。" + text10, false);
							}
							mi.m_pcMultiColorID = pcMultiColorID;
						}
					}
					else if (stringCom == "icon" || stringCom == "icons")
					{
						text5 = stringList[1];
					}
					else if (!(stringCom == "iconl"))
					{
						if (!(stringCom == "setstr"))
						{
							if (!(stringCom == "アイテムパラメータ"))
							{
								if (stringCom == "saveitem")
								{
									string text11 = stringList[1];
									if (text11 == string.Empty)
									{
										Debug.LogError("err SaveItem \"" + text11);
									}
									if (text11 == null)
									{
										Debug.LogError("err SaveItem null=\"" + text11);
									}
									if (text11 != string.Empty)
									{
									}
								}
								else if (!(stringCom == "catno"))
								{
									if (stringCom == "additem")
									{
										num3++;
									}
									else if (stringCom == "unsetitem")
									{
										mi.m_boDelOnly = true;
									}
									else if (stringCom == "priority")
									{
										mi.m_fPriority = float.Parse(stringList[1]);
									}
									else if (stringCom == "メニューフォルダ" && stringList[1].ToLower() == "man")
									{
										mi.m_bMan = true;
									}
								}
							}
						}
					}
				}
			}
		}
		catch (Exception ex2)
		{
			Debug.LogError(string.Concat(new string[]
			{
				"Exception ",
				Path.GetFileName(path),
				" 現在処理中だった行 = ",
				text6,
				" 以前の行 = ",
				text7,
				"   ",
				ex2.Message,
				"StackTrace:\n",
				ex2.StackTrace
			}));
			throw ex2;
		}
		if (text5 != null && text5 != string.Empty)
		{
			try
			{
				mi.m_texIcon = ImportCM.CreateTexture(text5);
			}
			catch (Exception)
			{
				Debug.LogError("Error:");
			}
		}
		binaryReader.Close();
		return true;
	}

	private bool UpdatePanel_Category()
	{
		this.m_listNg2Cate.Clear();
		foreach (GameObject obj in this.m_listBtnCate)
		{
			UnityEngine.Object.DestroyImmediate(obj);
		}
		this.m_listBtnCate.Clear();
		for (int i = 0; i < this.m_listCategory.Count; i++)
		{
			SceneEdit.SCategory scategory = this.m_listCategory[i];
			UnityEngine.Object @object = Resources.Load("SceneEdit/MainMenu/Prefab/ButtonCate");
			GameObject gameObject = NGUITools.AddChild(this.m_Panel_Category.goGrid, @object as GameObject);
			UILabel uilabel = gameObject.GetComponentsInChildren<UILabel>(true)[0];
			Localize component = uilabel.gameObject.GetComponent<Localize>();
			if (component != null)
			{
				component.SetTerm("SceneEdit/カテゴリー/" + scategory.m_strCateName);
			}
			ButtonEdit buttonEdit = gameObject.GetComponentsInChildren<ButtonEdit>(true)[0];
			buttonEdit.m_Category = scategory;
			UIButton uibutton = gameObject.GetComponentsInChildren<UIButton>(true)[0];
			uibutton.isEnabled = scategory.m_isEnabled;
			if (uibutton.isEnabled)
			{
				EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.ClickCallback));
			}
			buttonEdit.m_goFrame = gameObject.transform.Find("Frame").gameObject;
			buttonEdit.m_goFrame.transform.GetComponent<UISprite>().enabled = false;
			UIButton component2 = buttonEdit.GetComponent<UIButton>();
			buttonEdit.m_colBtnDefault = component2.defaultColor;
			this.m_listBtnCate.Add(gameObject);
		}
		this.m_Panel_Category.gcScrollView.ResetPosition();
		this.m_Panel_Category.gcUIGrid.Reposition();
		this.m_Panel_PartsType.SetActive(false);
		this.m_Panel_MenuItem.SetActive(false);
		this.m_Panel_SetItem.SetActive(false);
		this.m_Panel_SliderItem.SetActive(false);
		this.m_Panel_ColorSet.SetActive(false);
		this.m_Panel_GroupSet.SetActive(false);
		this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
		if (this.highlightSelector != null)
		{
			this.highlightSelector.visible = true;
			this.highlightSelector.visible = false;
		}
		return true;
	}

	private void UpdatePanel_PartsType(SceneEdit.SCategory f_cate)
	{
		this.SetCameraOffset(SceneEdit.CAM_OFFS.CENTER);
		this.m_info.Close();
		this.m_Panel_PartsType.SetActive(true);
		BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
		this.m_Panel_PartsType.VisibleArrow(false);
		this.m_misDelOnly = null;
		for (int i = 0; i < this.m_listBtnPartsType.Count; i++)
		{
			GameObject obj = this.m_listBtnPartsType[i];
			UnityEngine.Object.DestroyImmediate(obj);
		}
		this.m_listBtnPartsType.Clear();
		for (int j = 0; j < this.m_listSliderItem.Count; j++)
		{
			SceneEdit.SliderItemSet sliderItemSet = this.m_listSliderItem[j];
			sliderItemSet.Clear();
		}
		this.m_listSliderItem.Clear();
		for (int k = 0; k < this.m_listBtnMenuItem.Count; k++)
		{
			SceneEdit.MenuItemSet menuItemSet = this.m_listBtnMenuItem[k];
			menuItemSet.Clear();
		}
		this.m_listBtnMenuItem.Clear();
		for (int l = 0; l < this.m_listBtnColorSet.Count; l++)
		{
			SceneEdit.ColorItemSet colorItemSet = this.m_listBtnColorSet[l];
			colorItemSet.Clear();
		}
		this.m_listBtnColorSet.Clear();
		for (int m = 0; m < this.m_listBtnGroupMember.Count; m++)
		{
			SceneEdit.MenuItemSet menuItemSet2 = this.m_listBtnGroupMember[m];
			menuItemSet2.Clear();
		}
		this.m_listBtnGroupMember.Clear();
		for (int n = 0; n < f_cate.m_listPartsType.Count; n++)
		{
			SceneEdit.SPartsType spartsType = f_cate.m_listPartsType[n];
			if (MPN.EarNone > spartsType.m_mpn || spartsType.m_mpn > MPN.EarScl || PluginData.IsEnabled("GP001"))
			{
				UnityEngine.Object @object = Resources.Load("SceneEdit/MainMenu/Prefab/ButtonCate");
				GameObject gameObject = NGUITools.AddChild(this.m_Panel_PartsType.goGrid, @object as GameObject);
				UILabel uilabel = gameObject.GetComponentsInChildren<UILabel>(true)[0];
				Localize component = uilabel.gameObject.GetComponent<Localize>();
				if (component != null)
				{
					component.SetTerm("SceneEdit/カテゴリー/サブ/" + spartsType.m_strPartsTypeName);
				}
				ButtonEdit buttonEdit = gameObject.GetComponentsInChildren<ButtonEdit>(true)[0];
				buttonEdit.m_PartsType = spartsType;
				UIButton uibutton = gameObject.GetComponentsInChildren<UIButton>(true)[0];
				uibutton.isEnabled = spartsType.m_isEnabled;
				if (uibutton.isEnabled)
				{
					EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.ClickCallback));
				}
				buttonEdit.m_goFrame = gameObject.transform.Find("Frame").gameObject;
				buttonEdit.m_goFrame.transform.GetComponent<UISprite>().enabled = false;
				UIButton component2 = buttonEdit.GetComponent<UIButton>();
				buttonEdit.m_colBtnDefault = component2.defaultColor;
				this.m_listBtnPartsType.Add(gameObject);
			}
		}
		this.m_Panel_PartsType.ResetScrollPos(0.5f);
		this.m_Panel_MenuItem.ResetScrollPos(0f);
		this.m_Panel_SetItem.ResetScrollPos(0f);
		this.m_Panel_SliderItem.ResetScrollPos(0f);
	}

	private void UpdatePanel_MenuItem(SceneEdit.SPartsType f_pt)
	{
		if (f_pt.m_ePartsType == "set_maidwear" || f_pt.m_ePartsType == "set_mywear" || f_pt.m_ePartsType == "set_underwear" || f_pt.m_ePartsType == "set_body")
		{
			this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT_MORE);
		}
		else
		{
			this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT);
		}
		this.m_misDelOnly = null;
		this.m_info.Close();
		BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
		for (int i = 0; i < this.m_listSliderItem.Count; i++)
		{
			SceneEdit.SliderItemSet sliderItemSet = this.m_listSliderItem[i];
			sliderItemSet.Clear();
		}
		this.m_listSliderItem.Clear();
		for (int j = 0; j < this.m_listBtnMenuItem.Count; j++)
		{
			SceneEdit.MenuItemSet menuItemSet = this.m_listBtnMenuItem[j];
			menuItemSet.Clear();
		}
		this.m_listBtnMenuItem.Clear();
		for (int k = 0; k < this.m_listBtnColorSet.Count; k++)
		{
			SceneEdit.ColorItemSet colorItemSet = this.m_listBtnColorSet[k];
			colorItemSet.Clear();
		}
		this.m_listBtnColorSet.Clear();
		for (int l = 0; l < this.m_listBtnGroupMember.Count; l++)
		{
			SceneEdit.MenuItemSet menuItemSet2 = this.m_listBtnGroupMember[l];
			menuItemSet2.Clear();
		}
		this.m_listBtnGroupMember.Clear();
		float num = -1f;
		if (this.highlightSelector != null)
		{
			this.highlightSelector.visible = false;
		}
		if (f_pt.m_eType == SceneEditInfo.CCateNameType.EType.Item || f_pt.m_eType == SceneEditInfo.CCateNameType.EType.Set)
		{
			if (!string.IsNullOrEmpty(this.last_select_category_name_))
			{
				if (this.m_Panel_MenuItem.gcScrollBar.transform.parent.gameObject.activeSelf)
				{
					this.backup_category_scroll_pos_[this.last_select_category_name_] = Mathf.Round(this.m_Panel_MenuItem.gcScrollBar.value * 100f) / 100f;
				}
				if (this.m_Panel_SetItem.gcScrollBar.transform.parent.gameObject.activeSelf)
				{
					this.backup_category_scroll_pos_[this.last_select_category_name_] = Mathf.Round(this.m_Panel_SetItem.gcScrollBar.value * 100f) / 100f;
				}
			}
			if (this.backup_category_scroll_pos_.ContainsKey(f_pt.m_strPartsTypeName))
			{
				num = this.backup_category_scroll_pos_[f_pt.m_strPartsTypeName];
			}
			this.m_Panel_MenuItem.SetActive(false);
			this.m_Panel_SetItem.SetActive(false);
			SceneEdit.UIPanelSet uipanelSet = null;
			string f_strPrefabName = string.Empty;
			bool f_bSelectedFrame = false;
			if (f_pt.m_eType == SceneEditInfo.CCateNameType.EType.Item)
			{
				uipanelSet = this.m_Panel_MenuItem;
				f_strPrefabName = "ButtonItem";
				f_bSelectedFrame = true;
			}
			else if (f_pt.m_eType == SceneEditInfo.CCateNameType.EType.Set)
			{
				uipanelSet = this.m_Panel_SetItem;
				f_strPrefabName = "ButtonSet";
				f_bSelectedFrame = false;
				this.customPartsWindowVisibleButton.windowVisible = false;
				this.customPartsWindowVisibleButton.visible = false;
			}
			this.m_Panel_SliderItem.SetActive(false);
			this.m_Panel_ColorSet.SetActive(false);
			this.m_Panel_GroupSet.SetActive(false);
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
			uipanelSet.SetActive(true);
			for (int m = 0; m < f_pt.m_listMenu.Count; m++)
			{
				SceneEdit.SMenuItem smenuItem = f_pt.m_listMenu[m];
				bool flag = this.m_bUseGroup;
				if (smenuItem.m_mpn == MPN.set_body)
				{
					flag = false;
				}
				if (!flag || !smenuItem.m_bMember)
				{
					SceneEdit.MenuItemSet menuItemSet3 = new SceneEdit.MenuItemSet(uipanelSet.goGrid, smenuItem, f_strPrefabName, f_bSelectedFrame);
					if (smenuItem.m_boDelOnly)
					{
						this.m_misDelOnly = menuItemSet3;
					}
					if (menuItemSet3.mi.m_strCateName.IndexOf("set_") != -1 && menuItemSet3.mi.m_bGroupLeader && flag)
					{
						EventDelegate.Add(menuItemSet3.gcBtn.onClick, new EventDelegate.Callback(this.ClickCallbackFromSetGroup));
					}
					else
					{
						EventDelegate.Add(menuItemSet3.gcBtn.onClick, new EventDelegate.Callback(this.ClickCallback));
					}
					if (smenuItem.m_bGroupLeader && flag)
					{
						EventDelegate.Add(menuItemSet3.gcEvent.onHoverOver, new EventDelegate.Callback(this.HoverOverCallbackOnGroup));
					}
					else
					{
						EventDelegate.Add(menuItemSet3.gcEvent.onHoverOver, new EventDelegate.Callback(this.HoverOverCallback));
					}
					EventDelegate.Add(menuItemSet3.gcEvent.onHoverOut, new EventDelegate.Callback(this.HoverOutCallback));
					this.m_listBtnMenuItem.Add(menuItemSet3);
				}
			}
			uipanelSet.gcUIGrid.GetComponent<UIGrid>().enabled = true;
			if (f_pt.m_mpn == MPN.eye_hi && this.highlightSelector != null && this.isNewFace)
			{
				this.highlightSelector.visible = true;
			}
			this.UpdateSelectedMenuItem(f_pt);
			this.last_select_category_name_ = f_pt.m_strPartsTypeName;
		}
		else if (f_pt.m_eType == SceneEditInfo.CCateNameType.EType.Slider)
		{
			this.customPartsWindowVisibleButton.windowVisible = false;
			this.customPartsWindowVisibleButton.visible = false;
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
			this.m_Panel_MenuItem.SetActive(false);
			this.m_Panel_SetItem.SetActive(false);
			this.m_Panel_ColorSet.SetActive(false);
			this.m_Panel_GroupSet.SetActive(false);
			this.m_Panel_SliderItem.SetActive(true);
			bool flag2 = false;
			foreach (SceneEdit.SMenuItem smenuItem2 in f_pt.m_listMenu)
			{
				if (!smenuItem2.m_requestNewFace || this.isNewFace)
				{
					SceneEdit.SliderItemSet sliderItemSet2;
					if (smenuItem2.m_mpn == MPN.EarNone)
					{
						SceneEdit.SwitchItemSet switchItemSet = new SceneEdit.SwitchItemSet();
						switchItemSet.Create(this.m_Panel_SliderItem.goGrid, smenuItem2);
						switchItemSet.onClickEvent = delegate(bool earNone, SceneEdit.SMenuItem menu)
						{
							int num2 = (!earNone) ? 0 : 1;
							MaidProp prop = this.maid.GetProp(menu.m_strCateName);
							if (prop.value != num2)
							{
								this.maid.SetProp(menu.m_strCateName, num2, false);
								this.UpdateSliders();
								this.maid.AllProcPropSeqStart();
							}
						};
						sliderItemSet2 = switchItemSet;
					}
					else
					{
						sliderItemSet2 = new SceneEdit.SliderItemSet();
						sliderItemSet2.Create(this.m_Panel_SliderItem.goGrid, smenuItem2);
						EventDelegate.Add(sliderItemSet2.gcSlider.onChange, new EventDelegate.Callback(this.SlideCallback));
						flag2 |= (smenuItem2.m_mpn == MPN.MuneYawaraka);
					}
					this.m_listSliderItem.Add(sliderItemSet2);
				}
			}
			BaseMgr<BodyStatusMgr>.Instance.OpenPanel(flag2);
			this.UpdateSliders();
		}
		this.m_Panel_MenuItem.ResetScrollPos(0f);
		this.m_Panel_SetItem.ResetScrollPos(0f);
		this.m_Panel_SliderItem.ResetScrollPos(0f);
		if (num != -1f)
		{
			if (this.m_Panel_MenuItem.gcScrollBar.transform.parent.gameObject.activeSelf)
			{
				this.m_Panel_MenuItem.gcScrollBar.value = num;
			}
			if (this.m_Panel_SetItem.gcScrollBar.transform.parent.gameObject.activeSelf)
			{
				this.m_Panel_SetItem.gcScrollBar.value = num;
			}
		}
	}

	private void UpdateSelectedMenuItem(SceneEdit.SPartsType f_pt)
	{
		Maid maid = this.m_maid;
		MaidProp prop = maid.GetProp(f_pt.m_mpn);
		NDebug.Assert(prop != null, "指定MPNが不正です。");
		SceneEdit.SMenuItem smenuItem = null;
		if (this.m_misDelOnly != null)
		{
			this.m_misDelOnly.Selected(false);
		}
		for (int i = 0; i < this.m_listBtnMenuItem.Count; i++)
		{
			this.m_listBtnMenuItem[i].Selected(false);
		}
		bool flag = false;
		HashSet<int> hashSet = new HashSet<int>();
		foreach (SceneEdit.SubPropMpnData subPropMpnData in this.subPropDatas)
		{
			if (subPropMpnData.mpn == f_pt.m_mpn)
			{
				subPropMpnData.manager.UpdateAllItem();
				flag = true;
				if (subPropMpnData.manager.sloatItems != null)
				{
					foreach (SubSlotEditItem subSlotEditItem in subPropMpnData.manager.sloatItems)
					{
						if (!(subSlotEditItem == null) && subSlotEditItem.menuItem != null)
						{
							if (!hashSet.Contains(subSlotEditItem.menuItem.m_nMenuFileRID))
							{
								hashSet.Add(subSlotEditItem.menuItem.m_nMenuFileRID);
							}
						}
					}
				}
				break;
			}
		}
		bool flag2 = f_pt.m_mpn == MPN.eye_hi && this.isNewFace;
		int num = (this.modeType != SceneEdit.ModeType.CostumeEdit) ? prop.nFileNameRID : prop.nTempFileNameRID;
		int num2 = (!flag2) ? -1 : maid.GetProp(MPN.eye_hi_r).nFileNameRID;
		if (num != 0)
		{
			for (int l = 0; l < this.m_listBtnMenuItem.Count; l++)
			{
				SceneEdit.MenuItemSet menuItemSet = this.m_listBtnMenuItem[l];
				SceneEdit.SMenuItem menuItem = menuItemSet.gcBtnEdit.m_MenuItem;
				if (!menuItem.m_bGroupLeader || !this.m_bUseGroup)
				{
					bool flag3 = menuItem.m_nMenuFileRID == num;
					if (flag && (!flag3 || hashSet.Count != 0))
					{
						flag3 = hashSet.Contains(menuItem.m_nMenuFileRID);
					}
					if (flag3)
					{
						menuItemSet.Selected(true);
						smenuItem = menuItem;
						bool flag4 = this.customPartsWindow.SetItem(menuItem);
						if (this.modeType == SceneEdit.ModeType.CostumeEdit)
						{
							flag4 = false;
						}
						if (!flag4)
						{
							this.customPartsWindowVisibleButton.windowVisible = false;
						}
						this.customPartsWindowVisibleButton.visible = flag4;
					}
					else if (flag2 && menuItem.m_nMenuFileRID == num2)
					{
						menuItemSet.Selected(true);
					}
				}
				else
				{
					NDebug.Assert(hashSet.Count == 0, "SubPropとグループが競合しています");
					bool flag5 = false;
					int num3 = 0;
					while (num3 < menuItem.m_listMember.Count && !flag5)
					{
						flag5 |= (menuItem.m_listMember[num3].m_nMenuFileRID == num);
						num3++;
					}
					if (flag5)
					{
						menuItemSet.Selected(true);
						smenuItem = menuItem;
						bool flag6 = this.customPartsWindow.SetItem(menuItem);
						if (this.modeType == SceneEdit.ModeType.CostumeEdit)
						{
							flag6 = false;
						}
						if (!flag6)
						{
							this.customPartsWindowVisibleButton.windowVisible = false;
						}
						this.customPartsWindowVisibleButton.visible = flag6;
					}
				}
			}
		}
		else
		{
			for (int m = 0; m < this.m_listBtnMenuItem.Count; m++)
			{
				SceneEdit.MenuItemSet menuItemSet2 = this.m_listBtnMenuItem[m];
				if (menuItemSet2.mi.m_listColorSet != null)
				{
					SceneEdit.SMenuItem smenuItem2;
					if (this.modeType == SceneEdit.ModeType.CostumeEdit)
					{
						smenuItem2 = menuItemSet2.mi.m_listColorSet.Find((SceneEdit.SMenuItem c) => c.m_nMenuFileRID == maid.GetProp(c.m_mpn).nTempFileNameRID);
					}
					else
					{
						smenuItem2 = menuItemSet2.mi.m_listColorSet.Find((SceneEdit.SMenuItem c) => c.m_nMenuFileRID == maid.GetProp(c.m_mpn).nFileNameRID);
					}
					if (smenuItem2 != null)
					{
						menuItemSet2.Selected(true);
						smenuItem = menuItemSet2.mi;
					}
				}
			}
		}
		if (smenuItem == null && this.m_misDelOnly != null)
		{
			this.m_misDelOnly.Selected(true);
		}
		this.UpdatePanel_ColorSet(smenuItem);
		foreach (SceneEdit.SubPropMpnData subPropMpnData2 in this.subPropDatas)
		{
			subPropMpnData2.manager.visible = false;
		}
		this.UpdatePanel_GroupSet(smenuItem);
		if (smenuItem != null)
		{
			foreach (SceneEdit.SubPropMpnData subPropMpnData3 in this.subPropDatas)
			{
				if (subPropMpnData3.mpn == smenuItem.m_mpn)
				{
					this.m_Panel_GroupSet.SetActive(true);
					subPropMpnData3.manager.visible = true;
					subPropMpnData3.manager.UpdateAllItem();
					this.m_Panel_GroupSet.gcUIGrid.cellHeight = 100f;
					Vector3 localPosition = this.m_Panel_GroupSet.goMain.transform.localPosition;
					localPosition.x = 23f;
					this.m_Panel_GroupSet.goMain.transform.localPosition = localPosition;
					this.m_Panel_GroupSet.ResetScrollPos(0f);
				}
			}
		}
		if (this.customPartsWindowVisibleButton.visible)
		{
			if (this.m_Panel_GroupSet.goMain.activeInHierarchy)
			{
				this.customPartsWindowVisibleButton.transform.localPosition = new Vector3(119f, 406f, 0f);
			}
			else if (this.m_Panel_ColorSet.goMain.activeInHierarchy)
			{
				this.customPartsWindowVisibleButton.transform.localPosition = new Vector3(60f, 406f, 0f);
			}
			else
			{
				this.customPartsWindowVisibleButton.transform.localPosition = new Vector3(0f, 406f, 0f);
			}
		}
	}

	private void UpdatePanel_GroupSet(SceneEdit.SMenuItem f_miSelected)
	{
		if (f_miSelected == null || f_miSelected.m_mpn == MPN.set_body || !f_miSelected.m_bGroupLeader || !this.m_bUseGroup)
		{
			this.m_Panel_GroupSet.SetActive(false);
			return;
		}
		Maid maid = this.m_maid;
		MaidProp prop = maid.GetProp(f_miSelected.m_mpn);
		this.m_Panel_GroupSet.SetActive(true);
		bool flag = this.m_listBtnGroupMember.Count != f_miSelected.m_listMember.Count;
		if (!flag)
		{
			int num = 0;
			while (num < f_miSelected.m_listMember.Count && !flag)
			{
				if (this.m_listBtnGroupMember[num].mi != f_miSelected.m_listMember[num])
				{
					flag = true;
				}
				num++;
			}
		}
		bool flag2 = f_miSelected.m_strCateName.IndexOf("set_") != -1;
		if (flag)
		{
			for (int i = 0; i < this.m_listBtnGroupMember.Count; i++)
			{
				SceneEdit.MenuItemSet menuItemSet = this.m_listBtnGroupMember[i];
				menuItemSet.Clear();
			}
			this.m_listBtnGroupMember.Clear();
			for (int j = 0; j < f_miSelected.m_listMember.Count; j++)
			{
				SceneEdit.MenuItemSet menuItemSet2 = new SceneEdit.MenuItemSet(this.m_Panel_GroupSet.goGrid, f_miSelected.m_listMember[j], (!flag2) ? "ButtonItem" : "ButtonSet", true);
				if (flag2)
				{
					menuItemSet2.ToSmall();
				}
				EventDelegate.Add(menuItemSet2.gcBtn.onClick, new EventDelegate.Callback(this.ClickCallback));
				EventDelegate.Add(menuItemSet2.gcEvent.onHoverOver, new EventDelegate.Callback(this.HoverOverCallback));
				EventDelegate.Add(menuItemSet2.gcEvent.onHoverOut, new EventDelegate.Callback(this.HoverOutCallback));
				this.m_listBtnGroupMember.Add(menuItemSet2);
				if (!flag2)
				{
					if (this.modeType == SceneEdit.ModeType.CostumeEdit)
					{
						menuItemSet2.Selected(prop != null && prop.nTempFileNameRID == f_miSelected.m_listMember[j].m_nMenuFileRID);
					}
					else
					{
						menuItemSet2.Selected(prop != null && prop.nFileNameRID == f_miSelected.m_listMember[j].m_nMenuFileRID);
					}
				}
			}
			if (flag2)
			{
				this.m_Panel_GroupSet.gcUIGrid.cellHeight = 127f;
				Vector3 localPosition = this.m_Panel_GroupSet.goMain.transform.localPosition;
				localPosition.x = 117f;
				this.m_Panel_GroupSet.goMain.transform.localPosition = localPosition;
			}
			else
			{
				this.m_Panel_GroupSet.gcUIGrid.cellHeight = 100f;
				Vector3 localPosition2 = this.m_Panel_GroupSet.goMain.transform.localPosition;
				localPosition2.x = 23f;
				this.m_Panel_GroupSet.goMain.transform.localPosition = localPosition2;
			}
			this.m_Panel_GroupSet.ResetScrollPos(0f);
		}
		else if (!flag2)
		{
			for (int k = 0; k < this.m_listBtnGroupMember.Count; k++)
			{
				if (this.modeType == SceneEdit.ModeType.CostumeEdit)
				{
					this.m_listBtnGroupMember[k].Selected(prop != null && prop.nTempFileNameRID == this.m_listBtnGroupMember[k].mi.m_nMenuFileRID);
				}
				else
				{
					this.m_listBtnGroupMember[k].Selected(prop != null && prop.nFileNameRID == this.m_listBtnGroupMember[k].mi.m_nMenuFileRID);
				}
			}
		}
	}

	private void UpdatePanel_ColorSet(SceneEdit.SMenuItem f_miSelected)
	{
		this.colorPaletteMgr.Close();
		if (f_miSelected == null || f_miSelected.m_eColorSetMPN == MPN.null_mpn)
		{
			this.m_Panel_ColorSet.SetActive(false);
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
			return;
		}
		if (f_miSelected.m_mpn == MPN.folder_mayu)
		{
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(true);
			this.m_CheckBoxMayuDrawPriority.check = this.m_maid.MayuDrawPriority;
		}
		if (this.modeType != SceneEdit.ModeType.CostumeEdit)
		{
			this.m_Panel_ColorSet.SetActive(true);
		}
		for (int i = 0; i < this.m_listBtnColorSet.Count; i++)
		{
			this.m_listBtnColorSet[i].Clear();
		}
		this.m_listBtnColorSet.Clear();
		for (int j = 0; j < f_miSelected.m_listColorSet.Count; j++)
		{
			SceneEdit.SMenuItem f_mi = f_miSelected.m_listColorSet[j];
			SceneEdit.ColorItemSet colorItemSet = new SceneEdit.ColorItemSet(this.m_Panel_ColorSet.goGrid, f_mi);
			EventDelegate.Add(colorItemSet.gcBtn.onClick, new EventDelegate.Callback(this.ClickCallback));
			EventDelegate.Add(colorItemSet.gcEvent.onHoverOver, new EventDelegate.Callback(this.HoverOverCallback));
			EventDelegate.Add(colorItemSet.gcEvent.onHoverOut, new EventDelegate.Callback(this.HoverOutCallback));
			this.m_listBtnColorSet.Add(colorItemSet);
		}
		this.m_Panel_ColorSet.ResetScrollPos(0f);
		this.UpdateSelected_ColorSet(f_miSelected.m_eColorSetMPN);
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			this.m_Panel_ColorSet.SetActive(false);
		}
	}

	private void UpdateSelected_ColorSet(MPN f_mpn)
	{
		Maid maid = this.m_maid;
		MaidProp prop = maid.GetProp(f_mpn);
		NDebug.Assert(prop != null, "指定MPNが不正です。");
		SceneEdit.SMenuItem smenuItem = null;
		if (prop.nFileNameRID != 0)
		{
			for (int i = 0; i < this.m_listBtnColorSet.Count; i++)
			{
				SceneEdit.ColorItemSet colorItemSet = this.m_listBtnColorSet[i];
				SceneEdit.SMenuItem menuItem = colorItemSet.gcBtnEdit.m_MenuItem;
				colorItemSet.Selected(false);
				if (menuItem.m_nMenuFileRID == prop.nFileNameRID)
				{
					colorItemSet.Selected(true);
					smenuItem = menuItem;
				}
			}
			if (smenuItem != null)
			{
				if (smenuItem.m_pcMultiColorID != MaidParts.PARTS_COLOR.NONE)
				{
					if (this.modeType != SceneEdit.ModeType.CostumeEdit)
					{
						this.colorPaletteMgr.Call(0, smenuItem.m_pcMultiColorID);
					}
				}
				else
				{
					this.colorPaletteMgr.Close();
				}
			}
		}
	}

	public void UpdateSliders()
	{
		for (int i = 0; i < this.m_listSliderItem.Count; i++)
		{
			SceneEdit.SliderItemSet sliderItemSet = this.m_listSliderItem[i];
			Maid maid = this.m_maid;
			MaidProp prop = maid.GetProp(sliderItemSet.gcBtnEdit.m_SliderItem.m_strCateName);
			if (sliderItemSet.gcBtnEdit.m_SliderItem.m_strCateName == "MuneL")
			{
				MaidProp prop2 = maid.GetProp(MPN.MuneS);
				int num;
				if (0 <= prop2.value && prop.value == 0)
				{
					num = (int)System.Math.Round((double)(-30f * ((float)(prop2.value - prop2.min) / (float)(prop2.max - prop2.min))), MidpointRounding.AwayFromZero);
				}
				else
				{
					num = prop.value;
				}
				int num2 = prop.min - 30;
				sliderItemSet.SetValue((float)(num - num2) / (float)(prop.max - num2), num.ToString());
			}
			else
			{
				sliderItemSet.SetValue((float)(prop.value - prop.min) / (float)(prop.max - prop.min), prop.value.ToString());
			}
			if (MPN.EarNone < sliderItemSet.gcBtnEdit.m_SliderItem.m_mpn && sliderItemSet.gcBtnEdit.m_SliderItem.m_mpn <= MPN.EarScl)
			{
				bool isEnabled = maid.GetProp(MPN.EarNone).value == 0;
				sliderItemSet.isEnabled = isEnabled;
			}
		}
		BaseMgr<BodyStatusMgr>.Instance.UpdateBodyStatus();
	}

	public void CategoryUnSelect()
	{
		for (int i = 0; i < this.m_listBtnCate.Count; i++)
		{
			GameObject gameObject = this.m_listBtnCate[i];
			ButtonEdit buttonEdit = gameObject.GetComponentsInChildren<ButtonEdit>(true)[0];
			UISprite component = buttonEdit.m_goFrame.GetComponent<UISprite>();
			component.enabled = false;
			UIButton component2 = buttonEdit.GetComponent<UIButton>();
			component2.defaultColor = buttonEdit.m_colBtnDefault;
		}
		this.m_Panel_Category.VisibleArrow(false);
	}

	public void ProcMenuItem(SceneEdit.SMenuItem f_mi)
	{
	}

	public void PartsTypeWearMode(MPN f_eMpn)
	{
		TBody.MaskMode maskMode;
		if (SceneEditInfo.m_dicPartsTypeWearMode.TryGetValue(f_eMpn, out maskMode))
		{
			Maid maid = this.m_maid;
			maid.body0.SetMaskMode(maskMode);
		}
	}

	public void PartsTypeCamera(MPN f_eMpn)
	{
		SceneEditInfo.CamToBone camToBone;
		if (this.m_viewreset.GetVisibleAutoCam() && SceneEditInfo.m_dicPartsTypeCamera.TryGetValue(f_eMpn, out camToBone))
		{
			Maid maid = this.m_maid;
			if (string.IsNullOrEmpty(camToBone.bone))
			{
				this.CameraMoveTo(this.m_cameraMoveSupport.targetPosition, camToBone.distance, camToBone.angle, 0.5f);
			}
			else
			{
				Transform bone = maid.body0.GetBone(camToBone.bone);
				if (bone != null)
				{
					this.CameraMoveTo(bone.position, camToBone.distance, camToBone.angle, 0.5f);
				}
			}
		}
	}

	public void ClickCallbackFromSetGroup()
	{
		this.m_bOpenSetGroupPanel = true;
		this.ClickCallback();
		this.m_bOpenSetGroupPanel = false;
	}

	public void ClickCallback()
	{
		Maid maid = this.m_maid;
		if (maid.IsBusy)
		{
			return;
		}
		ButtonEdit componentInChildren = UIButton.current.GetComponentInChildren<ButtonEdit>();
		if (componentInChildren.m_MenuItem == null || !componentInChildren.m_MenuItem.m_bColor)
		{
			this.customPartsWindowVisibleButton.windowVisible = false;
		}
		if (componentInChildren.m_Category != null)
		{
			this.customPartsWindowVisibleButton.visible = false;
			this.m_Panel_Category.VisibleArrow(false);
			this.CategoryUnSelect();
			this.colorPaletteMgr.Close();
			UISprite component = componentInChildren.m_goFrame.GetComponent<UISprite>();
			component.enabled = true;
			UIButton component2 = componentInChildren.GetComponent<UIButton>();
			component2.defaultColor = new Color(component2.defaultColor.r, component2.defaultColor.g, component2.defaultColor.b, 1f);
			this.m_maid.OpenMouthLookTooth(false);
			this.m_Panel_PartsType.SetActive(false);
			this.m_Panel_MenuItem.SetActive(false);
			this.m_Panel_SetItem.SetActive(false);
			this.m_Panel_SliderItem.SetActive(false);
			this.m_Panel_ColorSet.SetActive(false);
			this.m_Panel_GroupSet.SetActive(false);
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
			if (this.highlightSelector != null)
			{
				this.highlightSelector.visible = false;
			}
			BaseMgr<RandomPresetMgr>.Instance.CloseRandomPresetPanel();
			BaseMgr<PresetMgr>.Instance.ClosePresetPanel();
			BaseMgr<ProfileMgr>.Instance.CloseProfilePanel();
			BaseMgr<CostumePartsEnabledMgr>.Instance.CloseRandomPresetPanel();
			if (componentInChildren.m_Category.m_eCategory == SceneEditInfo.EMenuCategory.ランダム)
			{
				if (this.m_viewreset.GetVisibleAutoCam())
				{
					this.CameraReset(0.5f);
				}
				maid.body0.SetMaskMode(TBody.MaskMode.None);
				BaseMgr<RandomPresetMgr>.Instance.OpenRandomPresetPanel();
				this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT);
				BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
			}
			else if (componentInChildren.m_Category.m_eCategory == SceneEditInfo.EMenuCategory.プリセット)
			{
				if (this.m_viewreset.GetVisibleAutoCam())
				{
					this.CameraReset(0.5f);
				}
				maid.body0.SetMaskMode(TBody.MaskMode.None);
				BaseMgr<PresetMgr>.Instance.OpenPresetPanel();
				this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT);
				BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
			}
			else if (componentInChildren.m_Category.m_eCategory == SceneEditInfo.EMenuCategory.プロフィ\u30FCル)
			{
				if (this.m_viewreset.GetVisibleAutoCam())
				{
					this.CameraReset(0.5f);
				}
				BaseMgr<ProfileMgr>.Instance.OpenProfilePanel();
				this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT);
				BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
			}
			else if (componentInChildren.m_Category.m_eCategory == SceneEditInfo.EMenuCategory.着衣設定)
			{
				if (this.m_viewreset.GetVisibleAutoCam())
				{
					this.CameraReset(0.5f);
				}
				maid.body0.SetMaskMode(TBody.MaskMode.None);
				BaseMgr<CostumePartsEnabledMgr>.Instance.OpenRandomPresetPanel();
				this.SetCameraOffset(SceneEdit.CAM_OFFS.RIGHT);
				BaseMgr<BodyStatusMgr>.Instance.ClosePanel();
			}
			else
			{
				this.UpdatePanel_PartsType(componentInChildren.m_Category);
			}
			this.m_Panel_Category.VisibleArrow(true);
			this.m_Panel_Category.MoveArrow(componentInChildren.gameObject);
			this.m_nNowMPN = MPN.null_mpn;
		}
		if (componentInChildren.m_PartsType != null)
		{
			for (int k = 0; k < this.m_listBtnPartsType.Count; k++)
			{
				GameObject gameObject = this.m_listBtnPartsType[k];
				ButtonEdit componentInChildren2 = gameObject.GetComponentInChildren<ButtonEdit>();
				UISprite component3 = componentInChildren2.m_goFrame.GetComponent<UISprite>();
				component3.enabled = false;
				UIButton component4 = componentInChildren2.GetComponent<UIButton>();
				component4.defaultColor = componentInChildren2.m_colBtnDefault;
			}
			UISprite component5 = componentInChildren.m_goFrame.GetComponent<UISprite>();
			component5.enabled = true;
			UIButton component6 = componentInChildren.GetComponent<UIButton>();
			component6.defaultColor = new Color(component6.defaultColor.r, component6.defaultColor.g, component6.defaultColor.b, 1f);
			this.colorPaletteMgr.Close();
			this.PartsTypeWearMode(componentInChildren.m_PartsType.m_mpn);
			this.PartsTypeCamera(componentInChildren.m_PartsType.m_mpn);
			if (componentInChildren.m_PartsType.m_mpn == MPN.accha)
			{
				this.m_maid.OpenMouthLookTooth(true);
			}
			else
			{
				this.m_maid.OpenMouthLookTooth(false);
			}
			this.UpdatePanel_MenuItem(componentInChildren.m_PartsType);
			this.m_Panel_PartsType.VisibleArrow(true);
			this.m_Panel_PartsType.MoveArrow(componentInChildren.gameObject);
			this.m_EditMod.m_mpn = componentInChildren.m_PartsType.m_mpn;
			this.m_nNowMPN = componentInChildren.m_PartsType.m_mpn;
		}
		if (componentInChildren.m_MenuItem != null && !maid.boAllProcPropBUSY)
		{
			SceneEdit.SMenuItem smenuItem = null;
			MaidProp prop = maid.GetProp(componentInChildren.m_MenuItem.m_mpn);
			if (this.modeType == SceneEdit.ModeType.CostumeEdit)
			{
				if (prop != null && this.m_menuRidDic.ContainsKey(prop.nTempFileNameRID))
				{
					smenuItem = this.m_menuRidDic[prop.nTempFileNameRID];
				}
			}
			else if (prop != null && this.m_menuRidDic.ContainsKey(prop.nFileNameRID))
			{
				smenuItem = this.m_menuRidDic[prop.nFileNameRID];
			}
			if (!this.m_bOpenSetGroupPanel)
			{
				if (!componentInChildren.m_MenuItem.m_bColor && this.modeType != SceneEdit.ModeType.CostumeEdit)
				{
					this.customPartsWindow.OnExecItemPrev(componentInChildren.m_MenuItem);
				}
				bool flag = false;
				foreach (SceneEdit.SubPropMpnData subPropMpnData in this.subPropDatas)
				{
					if (subPropMpnData.mpn == componentInChildren.m_MenuItem.m_mpn)
					{
						flag = true;
						subPropMpnData.manager.SetItem(componentInChildren.m_MenuItem);
						break;
					}
				}
				if (!flag)
				{
					if (componentInChildren.m_MenuItem.m_mpn == MPN.eye_hi && this.isNewFace)
					{
						if (this.highlightSelector.selectItem == HighlightSelector.SelectItem.EyeR || this.highlightSelector.selectItem == HighlightSelector.SelectItem.Eye)
						{
							maid.SetProp(MPN.eye_hi_r, componentInChildren.m_MenuItem.m_strMenuFileName, componentInChildren.m_MenuItem.m_nMenuFileRID, false, false);
						}
						if (this.highlightSelector.selectItem == HighlightSelector.SelectItem.EyeL || this.highlightSelector.selectItem == HighlightSelector.SelectItem.Eye)
						{
							maid.SetProp(componentInChildren.m_MenuItem.m_strCateName, componentInChildren.m_MenuItem.m_strMenuFileName, componentInChildren.m_MenuItem.m_nMenuFileRID, false, false);
						}
					}
					else if (this.modeType == SceneEdit.ModeType.CostumeEdit)
					{
						maid.SetProp(componentInChildren.m_MenuItem.m_strCateName, componentInChildren.m_MenuItem.m_strMenuFileName, componentInChildren.m_MenuItem.m_nMenuFileRID, true, false);
					}
					else
					{
						maid.SetProp(componentInChildren.m_MenuItem.m_strCateName, componentInChildren.m_MenuItem.m_strMenuFileName, componentInChildren.m_MenuItem.m_nMenuFileRID, false, false);
					}
				}
			}
			if (componentInChildren.m_MenuItem.m_eColorSetMPN != MPN.null_mpn)
			{
				if (componentInChildren.m_MenuItem.m_eColorSetMPN == MPN.haircolor)
				{
					MaidProp prop2 = maid.GetProp(componentInChildren.m_MenuItem.m_eColorSetMPN);
					if (string.IsNullOrEmpty(prop2.strFileName))
					{
						List<SceneEdit.SMenuItem> listColorSet = componentInChildren.m_MenuItem.m_listColorSet;
						if (listColorSet.Count != 0)
						{
							SceneEdit.SMenuItem smenuItem2 = listColorSet.Find((SceneEdit.SMenuItem i) => i.m_pcMultiColorID != MaidParts.PARTS_COLOR.NONE);
							if (smenuItem2 == null)
							{
								smenuItem2 = listColorSet[0];
							}
							if (this.modeType == SceneEdit.ModeType.CostumeEdit)
							{
								maid.SetProp(smenuItem2.m_strCateName, smenuItem2.m_strMenuFileName, smenuItem2.m_nMenuFileRID, true, false);
							}
							else
							{
								maid.SetProp(smenuItem2.m_strCateName, smenuItem2.m_strMenuFileName, smenuItem2.m_nMenuFileRID, false, false);
							}
						}
					}
				}
				else
				{
					bool flag2 = false;
					if (smenuItem != null)
					{
						MaidProp prop3 = maid.GetProp(componentInChildren.m_MenuItem.m_eColorSetMPN);
						int num = 0;
						foreach (SceneEdit.SMenuItem smenuItem3 in smenuItem.m_listColorSet)
						{
							if (smenuItem3.m_nMenuFileRID == prop3.nFileNameRID)
							{
								break;
							}
							num++;
						}
						if (num < componentInChildren.m_MenuItem.m_listColorSet.Count)
						{
							SceneEdit.SMenuItem smenuItem4 = componentInChildren.m_MenuItem.m_listColorSet[num];
							if (this.modeType == SceneEdit.ModeType.CostumeEdit)
							{
								maid.SetProp(smenuItem4.m_strCateName, smenuItem4.m_strMenuFileName, smenuItem4.m_nMenuFileRID, true, false);
							}
							else
							{
								maid.SetProp(smenuItem4.m_strCateName, smenuItem4.m_strMenuFileName, smenuItem4.m_nMenuFileRID, false, false);
							}
							flag2 = true;
						}
					}
					if (!flag2)
					{
						List<SceneEdit.SMenuItem> listColorSet2 = componentInChildren.m_MenuItem.m_listColorSet;
						if (listColorSet2.Count != 0)
						{
							SceneEdit.SMenuItem smenuItem5 = listColorSet2[0];
							if (componentInChildren.m_MenuItem.m_eColorSetMPN != MPN.eye)
							{
								smenuItem5 = listColorSet2.Find((SceneEdit.SMenuItem i) => i.m_pcMultiColorID == MaidParts.PARTS_COLOR.NONE);
								if (smenuItem5 == null)
								{
									smenuItem5 = listColorSet2[0];
								}
							}
							if (this.modeType == SceneEdit.ModeType.CostumeEdit)
							{
								maid.SetProp(smenuItem5.m_strCateName, smenuItem5.m_strMenuFileName, smenuItem5.m_nMenuFileRID, true, false);
							}
							else
							{
								maid.SetProp(smenuItem5.m_strCateName, smenuItem5.m_strMenuFileName, smenuItem5.m_nMenuFileRID, false, false);
							}
						}
					}
				}
			}
			maid.AllProcPropSeqStart();
			if (componentInChildren.m_MenuItem.m_bColor)
			{
				this.UpdateSelected_ColorSet(componentInChildren.m_MenuItem.m_mpn);
			}
			else if (!this.m_bOpenSetGroupPanel)
			{
				this.UpdateSelectedMenuItem(componentInChildren.m_MenuItem.m_ParentPartsType);
			}
			else
			{
				this.UpdatePanel_GroupSet(componentInChildren.m_MenuItem);
			}
		}
	}

	public void HoverOverCallback()
	{
		ButtonEdit componentInChildren = UIEventTrigger.current.GetComponentInChildren<ButtonEdit>();
		SceneEdit.SMenuItem menuItem = componentInChildren.m_MenuItem;
		Vector3 position = UIEventTrigger.current.transform.parent.position;
		this.m_info.Open(position, menuItem.m_texIconRef, menuItem.menuNameCurrentLanguage, menuItem.infoTextCurrentLanguage, 0);
	}

	public void HoverOverCallbackOnGroup()
	{
		ButtonEdit componentInChildren = UIEventTrigger.current.GetComponentInChildren<ButtonEdit>();
		SceneEdit.SMenuItem menuItem = componentInChildren.m_MenuItem;
		Vector3 position = UIEventTrigger.current.transform.parent.position;
		this.m_info.Open(position, menuItem.m_texIconRef, menuItem.menuNameCurrentLanguage, menuItem.infoTextCurrentLanguage, (menuItem.m_listMember == null) ? 0 : menuItem.m_listMember.Count);
	}

	public void HoverOutCallback()
	{
		this.m_info.Close();
	}

	public void OnClickEditItemGroup()
	{
		this.m_bUseGroup = !this.m_bUseGroup;
		this.EditItemGroupSwitch.defaultColor = ((!this.m_bUseGroup) ? new Color(0.4f, 0.4f, 0.4f, 0.85f) : Color.white);
	}

	public void OnClickEditTouchJump()
	{
		this.m_bUseTouchJump = !this.m_bUseTouchJump;
		this.EditTouchJumpSwitch.defaultColor = ((!this.m_bUseTouchJump) ? new Color(0.4f, 0.4f, 0.4f, 0.85f) : Color.white);
	}

	public void SlideCallback()
	{
		Maid maid = this.m_maid;
		ButtonEdit componentInChildren = UIProgressBar.current.GetComponentInChildren<ButtonEdit>();
		MaidProp prop = maid.GetProp(componentInChildren.m_SliderItem.m_strCateName);
		if (componentInChildren.m_SliderItem.m_strCateName == "MuneL")
		{
			int num = prop.min - 30;
			int num2 = (int)System.Math.Round((double)((float)num + (float)(prop.max - num) * UIProgressBar.current.value), MidpointRounding.AwayFromZero);
			if (0 <= num2)
			{
				maid.SetProp(componentInChildren.m_SliderItem.m_strCateName, num2, false);
				maid.SetProp(MPN.MuneS, 0, false);
			}
			else
			{
				maid.SetProp(componentInChildren.m_SliderItem.m_strCateName, 0, false);
				maid.SetProp(MPN.MuneS, (int)(100f * ((float)num2 / -30f) + 0.5f), false);
			}
		}
		else
		{
			int val = (int)((float)prop.min + (float)(prop.max - prop.min) * UIProgressBar.current.value + 0.5f);
			maid.SetProp(componentInChildren.m_SliderItem.m_strCateName, val, false);
		}
		if (componentInChildren.m_SliderItem.m_mpn == MPN.MuneL)
		{
			MaidProp prop2 = maid.GetProp(MPN.MuneL);
			MaidProp prop3 = maid.GetProp(MPN.MuneTare);
			prop3.max = prop2.value;
			if (prop3.max < 1)
			{
				prop3.max = 1;
				prop3.value = 0;
			}
			maid.SetProp(MPN.MuneTare, prop3.value, false);
		}
		maid.AllProcProp();
		this.UpdateSliders();
	}

	public void OpenColorSet(SceneEdit.SMenuItem f_miSelected)
	{
		if (f_miSelected.m_eColorSetMPN == MPN.null_mpn)
		{
			this.m_Panel_ColorSet.SetActive(false);
			this.m_CheckBoxMayuDrawPriority.gameObject.SetActive(false);
			return;
		}
	}

	private IEnumerator CoPoseToCam(string f_lookBone, float f_cameraMoveTime, float f_waitTime = 0.2f)
	{
		if (f_waitTime != 0f)
		{
			yield return new WaitForSeconds(f_waitTime);
		}
		Maid maid = this.m_maid;
		Transform trBone = maid.body0.GetBone(f_lookBone);
		if (trBone != null)
		{
			this.m_cameraMoveSupport.SaveCameraPosition(trBone.position, 3f, new Vector2(-180f, 11.5528f));
			this.CameraReset(f_cameraMoveTime);
		}
		yield break;
	}

	public void Voice(SceneEdit.PVBInfo f_pvb)
	{
		Maid maid = this.m_maid;
		SceneEdit.VoiceInfo voiceInfo = f_pvb as SceneEdit.VoiceInfo;
		maid.AudioMan.LoadPlay(voiceInfo.strVoiceFileName, 0f, false, false);
		maid.FaceAnime(voiceInfo.strFace, 1f, 0);
		if (string.IsNullOrEmpty(voiceInfo.strFace2))
		{
			maid.FaceBlend("無し");
		}
		else
		{
			maid.FaceBlend(voiceInfo.strFace2);
		}
	}

	public void ToView()
	{
		if (GameMain.Instance.VRMode && !Input.GetKey(KeyCode.LeftShift))
		{
			Debug.Log("VRモードではViewモードになりません。");
			return;
		}
		this.m_eCamOffsBack = this.m_eCamOffsNow;
		this.SetCameraOffset(SceneEdit.CAM_OFFS.CENTER);
		for (int i = 0; i < this.m_listPanel.Count; i++)
		{
			this.m_listPanel[i].alpha = 0f;
		}
		this.m_uipViewCancel.gameObject.SetActive(true);
		this.m_uipViewCancel.alpha = 1f;
		this.customViewWindow.mgr.gameObject.SetActive(false);
		this.customPartsWindow.ViewMode(true);
	}

	public void FromView()
	{
		for (int i = 0; i < this.m_listPanel.Count; i++)
		{
			this.m_listPanel[i].alpha = 1f;
		}
		this.m_uipViewCancel.alpha = 0f;
		this.m_uipViewCancel.gameObject.SetActive(false);
		this.SetCameraOffset(this.m_eCamOffsBack);
		this.customViewWindow.mgr.gameObject.SetActive(true);
		this.customPartsWindow.ViewMode(false);
	}

	public void ClothesState(SceneEditInfo.ClothesState f_cs)
	{
		Maid maid = this.m_maid;
		if (f_cs == SceneEditInfo.ClothesState.Nude)
		{
			maid.body0.SetMaskMode(TBody.MaskMode.Nude);
		}
		else if (f_cs == SceneEditInfo.ClothesState.Underwear)
		{
			maid.body0.SetMaskMode(TBody.MaskMode.Underwear);
		}
		if (f_cs == SceneEditInfo.ClothesState.Wear)
		{
			maid.body0.SetMaskMode(TBody.MaskMode.None);
		}
	}

	public void SetCameraOffset(SceneEdit.CAM_OFFS f_eCamOffs)
	{
		if (GameMain.Instance.MainCamera == null)
		{
			return;
		}
		if (f_eCamOffs == SceneEdit.CAM_OFFS.CENTER)
		{
			GameMain.Instance.MainCamera.SetTargetOffset(new Vector3(0f, 0f, 0f), true);
		}
		else if (f_eCamOffs == SceneEdit.CAM_OFFS.RIGHT)
		{
			GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 3f * 2f - (float)Screen.width / 2f, 0f, 0f), true);
		}
		else if (f_eCamOffs == SceneEdit.CAM_OFFS.RIGHT_MORE)
		{
			GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 256f * 183f - (float)Screen.width / 2f, 0f, 0f), true);
		}
		this.m_eCamOffsNow = f_eCamOffs;
	}

	public void CallHowToNameDialog()
	{
		this.m_FFNameDlg.ShowFromLanguageTerm("Dialog/名前と苗字のどちらで呼びますか?", "Dialog/result/苗字で呼ぶ", delegate
		{
			this.m_FFNameDlg.Close();
			this.m_maid.status.isFirstNameCall = false;
		}, "Dialog/result/名前で呼ぶ", delegate
		{
			this.m_FFNameDlg.Close();
			this.m_maid.status.isFirstNameCall = true;
		});
	}

	public void CallSettingNamePanel()
	{
		GameObject childObject = UTY.GetChildObject(this.m_goUIRoot, "NameSettingPanel", false);
		if (childObject != null)
		{
			SceneEditNameSettingPanel component = childObject.GetComponent<SceneEditNameSettingPanel>();
			if (component != null)
			{
				component.gameObject.SetActive(true);
				component.Call();
			}
		}
	}

	public void OnCharaLoadCompleted()
	{
		foreach (SceneEdit.SCategory scategory in this.m_listCategory)
		{
			foreach (SceneEdit.SPartsType spartsType in scategory.m_listPartsType)
			{
				bool flag = 0 < spartsType.m_listMenu.Count;
				if (spartsType.m_eType == SceneEditInfo.CCateNameType.EType.Item)
				{
					flag = SceneEditInfo.m_dicPartsTypePair[spartsType.m_mpn].m_requestNewFace;
				}
				else
				{
					foreach (SceneEdit.SMenuItem smenuItem in spartsType.m_listMenu)
					{
						if (!smenuItem.m_requestNewFace)
						{
							flag = false;
							break;
						}
					}
				}
				if (flag)
				{
					spartsType.m_isEnabled = this.isNewFace;
				}
				if (spartsType.m_mpn == MPN.accmimi)
				{
					spartsType.m_isEnabled = (this.maid.GetProp(MPN.EarNone).value == 0);
					if (!spartsType.m_isEnabled && !this.isNewFace)
					{
						spartsType.m_isEnabled = true;
					}
				}
			}
		}
		foreach (GameObject gameObject in this.m_listBtnPartsType)
		{
			ButtonEdit buttonEdit = gameObject.GetComponentsInChildren<ButtonEdit>(true)[0];
			SceneEdit.SPartsType partsType = buttonEdit.m_PartsType;
			UIButton uibutton = gameObject.GetComponentsInChildren<UIButton>(true)[0];
			uibutton.isEnabled = partsType.m_isEnabled;
			if (uibutton.isEnabled && (uibutton.onClick == null || uibutton.onClick.Count == 0))
			{
				EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.ClickCallback));
			}
		}
		if (this.isNewFace && this.maid.GetProp(MPN.EarNone).value != 0)
		{
			MaidProp prop = this.maid.GetProp(MPN.accmimi);
			if (prop != null && prop.strFileName != CM3.dicDelItem[MPN.accmimi])
			{
				string text = CM3.dicDelItem[MPN.accmimi];
				int hashCode = text.ToLower().GetHashCode();
				this.maid.SetProp(MPN.accmimi, text, hashCode, false, false);
				this.m_maid.AllProcPropSeqStart();
				return;
			}
		}
		this.customViewWindow.UpdateAllItem();
	}

	private void OnEditOk()
	{
		if (GameMain.Instance.SysDlg.IsDecided && !GameMain.Instance.CharacterMgr.IsBusy())
		{
			Maid maid = this.m_maid;
			if (this.customPartsWindowVisibleButton.visible)
			{
				this.customPartsWindowVisibleButton.windowVisible = false;
			}
			maid.body0.SetMaskMode(TBody.MaskMode.None);
			if (this.modeType == SceneEdit.ModeType.OriginalChara || this.modeType == SceneEdit.ModeType.MainChara)
			{
				this.m_FFNameDlg.ShowFromLanguageTerm("Dialog/名前と苗字のどちらで呼びますか?", "Dialog/result/苗字で呼ぶ", new FFNameDialog.OnClick(this.OnFFNameFamily), "Dialog/result/名前で呼ぶ", new FFNameDialog.OnClick(this.OnFFNameFirst));
			}
			else
			{
				this.OnEndDlgOk();
			}
		}
	}

	private void OnFFNameFirst()
	{
		this.m_FFNameDlg.Close();
		this.m_maid.status.isFirstNameCall = true;
		this.Conform();
	}

	private void OnFFNameFamily()
	{
		this.m_FFNameDlg.Close();
		this.m_maid.status.isFirstNameCall = false;
		this.Conform();
	}

	private void Conform()
	{
		this.m_maid.boMabataki = false;
		GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/このメイドにしますか?", null, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.OnEndDlgOk), new SystemDialog.OnClick(this.OnEndDlgCancel));
	}

	private void OnEndDlgOk()
	{
		BaseMgr<ProfileMgr>.Instance.UpdateProfileData(true);
		GameMain.Instance.SysDlg.Close();
		UICamera.InputEnable = false;
		this.m_maid.ThumShotCamMove();
		this.m_maid.body0.trsLookTarget = GameMain.Instance.ThumCamera.transform;
		this.m_maid.boMabataki = false;
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			for (int i = 67; i <= 66; i++)
			{
				this.maid.ResetProp((MPN)i, true);
			}
		}
		base.StartCoroutine(this.CoWaitPutCloth());
	}

	private IEnumerator CoWaitPutCloth()
	{
		if (this.modeType == SceneEdit.ModeType.CostumeEdit || this.modeType == SceneEdit.ModeType.NpcEdit)
		{
			while (GameMain.Instance.CharacterMgr.IsBusy())
			{
				yield return null;
			}
		}
		for (int nF = 0; nF < 90; nF++)
		{
			yield return null;
		}
		GameMain.Instance.SoundMgr.PlaySe("SE022.ogg", false);
		if (this.modeType == SceneEdit.ModeType.CostumeEdit)
		{
			this.m_maid.ThumShotCustom(GameMain.Instance.FacilityMgr.tempSelectFacility.GetFacilityEditCostumeThumbnailName(), true);
		}
		else if (this.modeType == SceneEdit.ModeType.NpcEdit)
		{
			byte[] data = GameMain.Instance.CharacterMgr.PresetSaveNotWriteFile(this.m_maid, CharacterMgr.PresetType.All);
			if (NPCCharaSelect.editTargetNPCData != null)
			{
				SaveData.SetPreset(NPCCharaSelect.editTargetNPCData.id, data);
			}
		}
		else
		{
			this.m_maid.ThumShot();
		}
		this.m_maid.boMabataki = true;
		this.m_maid.body0.trsLookTarget = null;
		this.m_currentScriptFile = GameMain.Instance.ScriptMgr.adv_kag.kag.GetCurrentFileName();
		GameMain.Instance.MainCamera.FadeOut(1f, false, new CameraMain.dgOnCompleteFade(this.CreateKasizukiThumShot), true, default(Color));
		yield break;
	}

	private void OnEndDlgCancel()
	{
		GameMain.Instance.SysDlg.Close();
		this.m_maid.boMabataki = true;
	}

	private void OnEditCancel()
	{
	}

	private void CreateKasizukiThumShot()
	{
		GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		if (this.modeType == SceneEdit.ModeType.CostumeEdit || this.modeType == SceneEdit.ModeType.NpcEdit)
		{
			this.OnEndScene();
			return;
		}
		ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
		scriptMgr.adv_kag.LoadScriptFile("KasizukiThumShot.ks", string.Empty);
		scriptMgr.adv_kag.Exec();
		base.StartCoroutine(this.CoroutineKasizukiThumShot());
	}

	private IEnumerator CoroutineKasizukiThumShot()
	{
		for (int nF = 0; nF < 30; nF++)
		{
			yield return null;
		}
		Camera thumCamera = GameMain.Instance.ThumCamera;
		CameraMain mainCamera = GameMain.Instance.MainCamera;
		thumCamera.transform.position = mainCamera.transform.position;
		thumCamera.transform.rotation = mainCamera.transform.rotation;
		float backup = thumCamera.fieldOfView;
		thumCamera.fieldOfView = mainCamera.camera.fieldOfView;
		this.m_maid.body0.trsLookTarget = thumCamera.transform;
		for (int nF2 = 0; nF2 < 30; nF2++)
		{
			yield return null;
		}
		this.m_maid.ThumShotCustom(KasizukiManager.CreateMaidTmpThumbName(this.m_maid), false);
		thumCamera.fieldOfView = backup;
		this.OnEndScene();
		yield break;
	}

	private void OnEndScene()
	{
		if (GameMain.Instance.VRMode)
		{
			GameMain.Instance.CharacterMgr.ResetCharaPosAll();
		}
		UICamera.InputEnable = true;
		if (!string.IsNullOrEmpty(this.m_strScriptArg))
		{
			Debug.Log("OnEndScene JumpTo " + this.m_strScriptArg);
			GameMain.Instance.ScriptMgr.adv_kag.LoadScriptFile(this.m_currentScriptFile, this.m_strScriptArg);
			GameMain.Instance.ScriptMgr.adv_kag.Exec();
		}
	}

	public bool ClickEmulate(SceneEditInfo.EMenuCategory category, bool forceViewOff = false)
	{
		UIButton current = UIButton.current;
		for (int i = 0; i < this.m_listCategory.Count; i++)
		{
			if (this.m_listCategory[i].m_eCategory == category && i < this.m_listBtnCate.Count)
			{
				UIButton componentInChildren = this.m_listBtnCate[i].GetComponentInChildren<UIButton>();
				if (componentInChildren != null)
				{
					UIButton.current = componentInChildren;
					bool visibleAutoCam = this.m_viewreset.GetVisibleAutoCam();
					if (forceViewOff && visibleAutoCam)
					{
						this.m_viewreset.SetVisibleAutoCam(false);
					}
					this.ClickCallback();
					if (visibleAutoCam != this.m_viewreset.GetVisibleAutoCam())
					{
						this.m_viewreset.SetVisibleAutoCam(false);
					}
					UIButton.current = current;
					return true;
				}
			}
		}
		return false;
	}

	public bool isEnabledButton(MPN mpn)
	{
		switch (mpn)
		{
		case MPN.skin:
			mpn = MPN.folder_skin;
			break;
		default:
			if (mpn == MPN.eyewhite)
			{
				mpn = MPN.folder_eyewhite;
			}
			break;
		case MPN.underhair:
			mpn = MPN.folder_underhair;
			break;
		case MPN.mayu:
			mpn = MPN.folder_mayu;
			break;
		case MPN.eye:
			mpn = MPN.folder_eye;
			break;
		}
		if (!SceneEditInfo.m_dicPartsTypePair.ContainsKey(mpn))
		{
			return false;
		}
		SceneEditInfo.CCateNameType ccateNameType = SceneEditInfo.m_dicPartsTypePair[mpn];
		SceneEditInfo.EMenuCategory eMenuCate = ccateNameType.m_eMenuCate;
		string ePartsType = ccateNameType.m_ePartsType;
		SceneEdit.SCategory scategory = null;
		int num = 0;
		while (num < this.m_listCategory.Count && scategory == null)
		{
			if (this.m_listCategory[num].m_eCategory == eMenuCate)
			{
				scategory = this.m_listCategory[num];
			}
			num++;
		}
		for (int i = 0; i < scategory.m_listPartsType.Count; i++)
		{
			if (scategory.m_listPartsType[i].m_ePartsType == ePartsType)
			{
				return scategory.m_listPartsType[i].m_isEnabled;
			}
		}
		return false;
	}

	public bool ClickEmulate(MPN mpn, bool forceViewOff = false)
	{
		switch (mpn)
		{
		case MPN.skin:
			mpn = MPN.folder_skin;
			break;
		default:
			if (mpn == MPN.eyewhite)
			{
				mpn = MPN.folder_eyewhite;
			}
			break;
		case MPN.underhair:
			mpn = MPN.folder_underhair;
			break;
		case MPN.mayu:
			mpn = MPN.folder_mayu;
			break;
		case MPN.eye:
			mpn = MPN.folder_eye;
			break;
		}
		if (!SceneEditInfo.m_dicPartsTypePair.ContainsKey(mpn))
		{
			return false;
		}
		SceneEditInfo.CCateNameType ccateNameType = SceneEditInfo.m_dicPartsTypePair[mpn];
		return this.ClickEmulate(ccateNameType.m_eMenuCate, ccateNameType.m_ePartsType, forceViewOff);
	}

	public bool ClickEmulate(SceneEditInfo.EMenuCategory category, string partsType, bool forceViewOff = false)
	{
		if (!this.ClickEmulate(category, false) || category == SceneEditInfo.EMenuCategory.プリセット || category == SceneEditInfo.EMenuCategory.ランダム || category == SceneEditInfo.EMenuCategory.プロフィ\u30FCル)
		{
			return false;
		}
		UIButton current = UIButton.current;
		SceneEdit.SCategory scategory = null;
		int num = 0;
		while (num < this.m_listCategory.Count && scategory == null)
		{
			if (this.m_listCategory[num].m_eCategory == category)
			{
				scategory = this.m_listCategory[num];
			}
			num++;
		}
		for (int i = 0; i < scategory.m_listPartsType.Count; i++)
		{
			if (scategory.m_listPartsType[i].m_ePartsType == partsType && i < this.m_listBtnPartsType.Count)
			{
				UIButton componentInChildren = this.m_listBtnPartsType[i].GetComponentInChildren<UIButton>();
				if (componentInChildren != null)
				{
					UIButton.current = componentInChildren;
					bool visibleAutoCam = this.m_viewreset.GetVisibleAutoCam();
					if (forceViewOff && visibleAutoCam)
					{
						this.m_viewreset.SetVisibleAutoCam(false);
					}
					this.ClickCallback();
					if (visibleAutoCam != this.m_viewreset.GetVisibleAutoCam())
					{
						this.m_viewreset.SetVisibleAutoCam(false);
					}
					UIButton.current = current;
					return true;
				}
			}
		}
		return false;
	}

	private void OnClickViewReset()
	{
		this.CameraReset(0.5f);
	}

	private void OnTouchJump(SceneEdit.TouchType type)
	{
		if (GameMain.Instance.VRMode || this.customPartsWindowVisibleButton.windowVisible || this.colorPaletteMgr.gameObject.activeSelf || !UICamera.InputEnable || this.m_uipViewCancel.gameObject.activeSelf)
		{
			return;
		}
		if (UICamera.Raycast(Input.mousePosition))
		{
			return;
		}
		MPN mpn = MPN.HeadX;
		switch (type)
		{
		case SceneEdit.TouchType.Head:
			mpn = MPN.HeadX;
			break;
		case SceneEdit.TouchType.Bust:
			mpn = MPN.MuneL;
			break;
		case SceneEdit.TouchType.UpperBody:
			mpn = MPN.west;
			break;
		case SceneEdit.TouchType.LowerBody:
			mpn = MPN.koshi;
			break;
		case SceneEdit.TouchType.Leg:
			mpn = MPN.DouPer;
			break;
		}
		if (this.isEnabledButton(mpn))
		{
			this.ClickEmulate(mpn, false);
		}
	}

	private void OnClickAutoCam()
	{
		this.m_viewreset.SetVisibleAutoCam(!this.m_viewreset.GetVisibleAutoCam());
	}

	private void OnClickEyeToCam()
	{
		Maid maid = this.m_maid;
		this.m_viewreset.SetVisibleEyeToCam(!this.m_viewreset.GetVisibleEyeToCam());
		if (this.m_viewreset.GetVisibleEyeToCam())
		{
			maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0.8f);
		}
		else
		{
			maid.EyeToCamera(Maid.EyeMoveType.無視する, 0.8f);
		}
	}

	private void CameraReset(float f_fTime = 0.5f)
	{
		this.m_cameraMoveSupport.moveTime = f_fTime;
		this.m_cameraMoveSupport.ResetCamera();
	}

	private void CameraMoveTo(Vector3 f_vTarget, float f_fDistance, Vector2 f_vAngle, float f_fTime = 0.5f)
	{
		this.m_cameraMoveSupport.moveTime = f_fTime;
		this.m_cameraMoveSupport.StartCameraPosition(f_vTarget, f_fDistance, f_vAngle);
	}

	public void OnDestroy()
	{
		if (GameMain.Instance.isQuitting)
		{
			return;
		}
		iTween.Stop(base.gameObject);
		foreach (KeyValuePair<Personal.Data, List<SceneEdit.PVBInfo>> keyValuePair in this.m_dicVoice)
		{
			foreach (SceneEdit.PVBInfo pvbinfo in keyValuePair.Value)
			{
				UnityEngine.Object.Destroy(pvbinfo.texIcon);
			}
		}
		CharacterMgr.EditModeLookHaveItem = false;
		GameMain.Instance.ScriptMgr.StopMotionScript();
		Maid maid = this.m_maid;
		if (maid != null)
		{
			MaidColliderCollect.RemoveColliderAll(maid);
			maid.body0.SetMaskMode(TBody.MaskMode.None);
			maid.OpenMouthLookTooth(false);
			maid.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
			maid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
			maid.Visible = false;
		}
		this.SetCameraOffset(SceneEdit.CAM_OFFS.CENTER);
		if (!this.m_bVRComMode)
		{
			GameMain.Instance.BgMgr.DeleteBg();
		}
		NUty.GCFree();
	}

	public void UpdateCurrentItemPanel(bool resetScrollBar)
	{
		if (this.m_Panel_PartsType.goMain.activeSelf && (this.m_Panel_MenuItem.goMain.activeSelf || this.m_Panel_SetItem.goMain.activeSelf))
		{
			ButtonEdit[] componentsInChildren = this.m_Panel_PartsType.goGrid.GetComponentsInChildren<ButtonEdit>();
			foreach (ButtonEdit buttonEdit in componentsInChildren)
			{
				if (buttonEdit.m_goFrame.GetComponent<UISprite>().enabled)
				{
					if (buttonEdit.m_PartsType != null)
					{
						UIButton component = buttonEdit.GetComponent<UIButton>();
						UIButton current = UIButton.current;
						UIButton.current = component;
						bool visibleAutoCam = this.m_viewreset.GetVisibleAutoCam();
						this.m_viewreset.SetVisibleAutoCam(false);
						this.ClickCallback();
						this.m_viewreset.SetVisibleAutoCam(visibleAutoCam);
						UIButton.current = current;
						if (resetScrollBar && this.m_Panel_MenuItem.goMain.activeSelf)
						{
							this.m_Panel_MenuItem.gcScrollBar.value = 0f;
						}
						else if (resetScrollBar && this.m_Panel_SetItem.goMain.activeSelf)
						{
							this.m_Panel_SetItem.gcScrollBar.value = 0f;
						}
						break;
					}
				}
			}
		}
	}

	public void Update()
	{
		if (GameMain.Instance.VRMode)
		{
			if (!this.m_bVRComMode)
			{
				if (Input.GetKeyUp(KeyCode.B))
				{
					this.bgIconWindow.NextBG();
				}
				if (Input.GetKeyUp(KeyCode.P))
				{
					this.pauseIconWindow.NextPose();
				}
				if (Input.GetKeyUp(KeyCode.F5) || Input.GetKeyUp(KeyCode.R))
				{
					GameMain.Instance.CharacterMgr.ResetCharaPosAll();
				}
			}
			if (Input.GetKey(KeyCode.LeftArrow))
			{
				Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
				if (maid != null)
				{
					maid.gameObject.transform.Rotate(new Vector3(0f, 60f, 0f) * Time.deltaTime);
				}
			}
			if (Input.GetKey(KeyCode.RightArrow))
			{
				Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(0);
				if (maid2 != null)
				{
					maid2.gameObject.transform.Rotate(new Vector3(0f, -60f, 0f) * Time.deltaTime);
				}
			}
		}
		if (GameMain.Instance.CharacterMgr.IsBusy() || this.customViewWindow == null || this.customViewWindow.itemList == null)
		{
			this.updateCustomViewFlag = true;
			return;
		}
		if (this.updateCustomViewFlag)
		{
			this.updateCustomViewFlag = false;
			this.OnCharaLoadCompleted();
		}
	}

	private bool updateCustomViewFlag;

	private List<CapsuleCollider> touchJumpColliderList = new List<CapsuleCollider>();

	private List<SceneEdit.SCategory> m_listCategory = new List<SceneEdit.SCategory>();

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

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

	private List<SceneEdit.MenuItemSet> m_listBtnMenuItem = new List<SceneEdit.MenuItemSet>();

	private List<SceneEdit.SliderItemSet> m_listSliderItem = new List<SceneEdit.SliderItemSet>();

	private List<SceneEdit.ColorItemSet> m_listBtnColorSet = new List<SceneEdit.ColorItemSet>();

	private List<SceneEdit.MenuItemSet> m_listBtnGroupMember = new List<SceneEdit.MenuItemSet>();

	public bool m_bOpenSetGroupPanel;

	public UIButton EditItemGroupSwitch;

	public UIButton EditTouchJumpSwitch;

	[SerializeField]
	public ColorPaletteManager colorPaletteMgr;

	[SerializeField]
	private WindowPartsWindowVisible customPartsWindowVisibleButton;

	[SerializeField]
	[Tooltip("ハイライト選択のゲームオブジェクト")]
	private HighlightSelector highlightSelector;

	[SerializeField]
	public SceneEdit.SubPropMpnData[] subPropDatas;

	private SceneEdit.UIPanelSet m_Panel_Category;

	private SceneEdit.UIPanelSet m_Panel_PartsType;

	private SceneEdit.UIPanelSet m_Panel_MenuItem;

	private SceneEdit.UIPanelSet m_Panel_SetItem;

	private SceneEdit.UIPanelSet m_Panel_SliderItem;

	private SceneEdit.UIPanelSet m_Panel_ColorSet;

	private SceneEdit.UIPanelSet m_Panel_GroupSet;

	private WFCheckBox m_CheckBoxMayuDrawPriority;

	public BetterList<UIKeyNavigation2> m_listNg2Cate = new BetterList<UIKeyNavigation2>();

	public BetterList<UIKeyNavigation2> m_listNg2PartsType = new BetterList<UIKeyNavigation2>();

	public BetterList<UIKeyNavigation2> m_listNg2MenuItem = new BetterList<UIKeyNavigation2>();

	public TextMesh m_tmDebugText;

	private SceneEdit.MenuItemSet m_misDelOnly;

	public Dictionary<MPN, List<SceneEdit.SMenuItem>> m_dicColor = new Dictionary<MPN, List<SceneEdit.SMenuItem>>();

	public Dictionary<int, SceneEdit.SMenuItem> m_menuRidDic;

	public Dictionary<Personal.Data, List<SceneEdit.PVBInfo>> m_dicVoice = new Dictionary<Personal.Data, List<SceneEdit.PVBInfo>>();

	public GameObject m_goUIRoot;

	private ItemInfoWnd m_info;

	private EditOkCancel m_okcancel;

	private EditViewReset m_viewreset;

	public List<UIPanel> m_listPanel = new List<UIPanel>();

	private UIPanel m_uipViewCancel;

	private WfCameraMoveSupport m_cameraMoveSupport;

	private Maid m_maid;

	private string m_strScriptArg;

	private string m_currentScriptFile;

	private bool m_bVRComMode;

	private FFNameDialog m_FFNameDlg;

	private EditMod m_EditMod;

	private string last_select_category_name_ = string.Empty;

	private Dictionary<string, float> backup_category_scroll_pos_ = new Dictionary<string, float>();

	private int m_nDemoBgNo;

	private MPN m_nNowMPN;

	private static byte[] m_byItemFileBuffer;

	private SceneEdit.CAM_OFFS m_eCamOffsNow;

	private SceneEdit.CAM_OFFS m_eCamOffsBack;

	public enum ModeType
	{
		OriginalChara,
		MainChara,
		AfterEdit,
		CostumeEdit,
		NpcEdit
	}

	private enum TouchType
	{
		Head,
		Bust,
		UpperBody,
		LowerBody,
		Leg
	}

	public class SMenuItem : IDisposable
	{
		public string menuNameCurrentLanguage
		{
			get
			{
				return this.m_strMenuName;
			}
		}

		public string infoTextCurrentLanguage
		{
			get
			{
				return this.m_strInfo;
			}
		}

		public Texture2D m_texIconRef
		{
			get
			{
				return (!(this.m_texIcon != null) && !(SceneEdit.Instance == null)) ? SceneEdit.Instance.editItemTextureCache.GetTexter(this.m_nMenuFileRID) : this.m_texIcon;
			}
		}

		public Texture2D m_texIconRandomColorRef
		{
			get
			{
				return this.m_texIconRef;
			}
		}

		public void Dispose()
		{
			UnityEngine.Object.DestroyImmediate(this.m_goButton);
			UnityEngine.Object.DestroyImmediate(this.m_texIcon);
		}

		public void SortColorItem()
		{
			this.m_listColorSet.Sort(delegate(SceneEdit.SMenuItem x, SceneEdit.SMenuItem y)
			{
				if (x.m_fPriority == y.m_fPriority)
				{
					return 0;
				}
				if (x.m_fPriority < y.m_fPriority)
				{
					return -1;
				}
				if (x.m_fPriority > y.m_fPriority)
				{
					return 1;
				}
				return 0;
			});
		}

		public bool Compare(SceneEdit.SMenuItem item)
		{
			bool flag = true;
			flag |= (this.m_strMenuName == item.m_strMenuName);
			flag |= (this.m_strInfo == item.m_strInfo);
			flag |= (this.m_mpn == item.m_mpn);
			flag |= (this.m_strCateName == item.m_strCateName);
			flag |= (this.m_eColorSetMPN == item.m_eColorSetMPN);
			flag |= (this.m_strMenuNameInColorSet == item.m_strMenuNameInColorSet);
			flag |= (this.m_pcMultiColorID == item.m_pcMultiColorID);
			flag |= (this.m_boDelOnly == item.m_boDelOnly);
			flag |= (this.m_fPriority == item.m_fPriority);
			flag |= (this.m_bMan == item.m_bMan);
			return flag | this.m_bOld == item.m_bOld;
		}

		public SceneEdit.SPartsType m_ParentPartsType;

		public string m_strCateName;

		public string m_strMenuName = string.Empty;

		public bool m_requestNewFace;

		public MPN m_mpn;

		public bool m_bColor;

		public MPN m_eColorSetMPN;

		public string m_strMenuNameInColorSet;

		public List<SceneEdit.SMenuItem> m_listColorSet = new List<SceneEdit.SMenuItem>();

		public MaidParts.PARTS_COLOR m_pcMultiColorID = MaidParts.PARTS_COLOR.NONE;

		public float m_fPriority;

		public bool m_bMan;

		public bool m_bOld;

		public bool m_boDelOnly;

		public string m_strInfo = string.Empty;

		public Texture2D m_texIcon;

		public Texture2D m_texIconRandomColor;

		public string m_strMenuFileName;

		public int m_nMenuFileRID;

		public int m_nSliderValue;

		public GameObject m_goButton;

		public bool m_bMod;

		public bool m_bGroupLeader;

		public List<SceneEdit.SMenuItem> m_listMember;

		public bool m_bMember;

		public SceneEdit.SMenuItem m_leaderMenu;
	}

	public class SPartsType : IDisposable
	{
		public SPartsType(SceneEditInfo.CCateNameType.EType f_eType, MPN f_mpn, string f_strPartsTypeName, string f_ePartsType)
		{
			this.m_nIdx = SceneEditInfo.m_dicPartsTypePair[f_mpn].m_nIdx;
			this.m_eType = f_eType;
			this.m_mpn = f_mpn;
			this.m_strPartsTypeName = f_strPartsTypeName;
			this.m_ePartsType = f_ePartsType;
			this.m_isEnabled = true;
		}

		public void Dispose()
		{
			for (int i = 0; i < this.m_listMenu.Count; i++)
			{
				this.m_listMenu[i].Dispose();
			}
			UnityEngine.Object.DestroyImmediate(this.m_goButton);
			UnityEngine.Object.DestroyImmediate(this.m_goPanelMenu);
		}

		public void SortItem()
		{
			this.m_listMenu.Sort(delegate(SceneEdit.SMenuItem x, SceneEdit.SMenuItem y)
			{
				if (x.m_fPriority == y.m_fPriority)
				{
					int num = x.m_strMenuName.CompareTo(y.m_strMenuName);
					if (num == 0)
					{
						return 0;
					}
					if (num > 0)
					{
						return 1;
					}
					if (num < 0)
					{
						return -1;
					}
					return 0;
				}
				else
				{
					if (x.m_fPriority > y.m_fPriority)
					{
						return 1;
					}
					if (x.m_fPriority < y.m_fPriority)
					{
						return -1;
					}
					return 0;
				}
			});
			for (int i = 0; i < this.m_listMenu.Count; i++)
			{
				this.m_listMenu[i].SortColorItem();
			}
		}

		public SceneEditInfo.CCateNameType.EType m_eType;

		public int m_nIdx;

		public string m_strPartsTypeName;

		public MPN m_mpn;

		public string m_ePartsType;

		public bool m_isEnabled;

		public List<SceneEdit.SMenuItem> m_listMenu = new List<SceneEdit.SMenuItem>();

		public GameObject m_goButton;

		public GameObject m_goPanelMenu;
	}

	public class SCategory : IDisposable
	{
		public SCategory(string f_strCateName, SceneEditInfo.EMenuCategory f_eCategory)
		{
			this.m_strCateName = f_strCateName;
			this.m_eCategory = f_eCategory;
			this.m_isEnabled = true;
		}

		public void Dispose()
		{
			foreach (SceneEdit.SPartsType spartsType in this.m_listPartsType)
			{
				spartsType.Dispose();
			}
			UnityEngine.Object.DestroyImmediate(this.m_goButton);
			UnityEngine.Object.DestroyImmediate(this.m_goPanelPartsType);
		}

		public void SortPartsType()
		{
			this.m_listPartsType.Sort(delegate(SceneEdit.SPartsType x, SceneEdit.SPartsType y)
			{
				if (x.m_nIdx == y.m_nIdx)
				{
					return 0;
				}
				if (x.m_nIdx < y.m_nIdx)
				{
					return -1;
				}
				if (x.m_nIdx > y.m_nIdx)
				{
					return 1;
				}
				return 0;
			});
		}

		public void SortItem()
		{
			foreach (SceneEdit.SPartsType spartsType in this.m_listPartsType)
			{
				spartsType.SortItem();
			}
		}

		public SceneEditInfo.EMenuCategory m_eCategory;

		public string m_strCateName;

		public GameObject m_goButton;

		public GameObject m_goPanelPartsType;

		public bool m_isEnabled;

		public List<SceneEdit.SPartsType> m_listPartsType = new List<SceneEdit.SPartsType>();
	}

	private class UIPanelSet
	{
		public UIPanelSet(GameObject f_goUIRoot, string f_strPath)
		{
			this.goMain = UTY.GetChildObject(f_goUIRoot, f_strPath, false);
			GameObject childObject = UTY.GetChildObject(this.goMain, "Scroll View", false);
			this.gcScrollView = childObject.GetComponent<UIScrollView>();
			this.goGrid = UTY.GetChildObject(childObject, "UIGrid", false);
			this.gcUIGrid = this.goGrid.GetComponentsInChildren<UIGrid>(true)[0];
			this.goScrollBar = UTY.GetChildObject(this.goMain, "Scroll Bar", false);
			this.gcScrollBar = this.goScrollBar.GetComponent<UIScrollBar>();
			this.goDragMat = UTY.GetChildObject(this.goMain, "DragMat", false);
			this.goArrow = UTY.GetChildObject(this.goMain, "Arrow", false);
			this.goArrow.SetActive(false);
		}

		public void SetActive(bool f_bActive)
		{
			this.goMain.SetActive(f_bActive);
		}

		public void ResetScrollPos(float f_fPos = 0.5f)
		{
			this.gcUIGrid.Reposition();
			this.gcScrollView.ResetPosition();
			this.gcScrollBar.value = f_fPos;
		}

		public void VisibleArrow(bool f_bActive)
		{
			this.goArrow.SetActive(f_bActive);
		}

		public void MoveArrow(GameObject f_goCurrentBtn)
		{
			if (this.goArrow == null)
			{
				return;
			}
			Transform parent = f_goCurrentBtn.transform.parent;
			Vector3 position = parent.TransformPoint(new Vector3(0f, 0f, 0f));
			Vector3 localPosition = this.goMain.transform.InverseTransformPoint(position);
			localPosition.x = this.goArrow.transform.localPosition.x;
			localPosition.y += 18f;
			this.goArrow.transform.localPosition = localPosition;
		}

		public GameObject goMain;

		public GameObject goGrid;

		public UIGrid gcUIGrid;

		public GameObject goScrollBar;

		public UIScrollView gcScrollView;

		public UIScrollBar gcScrollBar;

		public GameObject goDragMat;

		private GameObject goArrow;
	}

	private class MenuItemSet
	{
		public MenuItemSet(GameObject f_goParentGrid, SceneEdit.SMenuItem f_mi, string f_strPrefabName, bool f_bSelectedFrame)
		{
			this.mi = f_mi;
			this.m_bSelectedFrame = f_bSelectedFrame;
			UnityEngine.Object @object = Resources.Load("SceneEdit/MainMenu/Prefab/" + f_strPrefabName);
			this.goItem = NGUITools.AddChild(f_goParentGrid, @object as GameObject);
			this.gcBtnEdit = this.goItem.GetComponentsInChildren<ButtonEdit>(true)[0];
			this.gcBtnEdit.m_MenuItem = f_mi;
			this.goFrame = UTY.GetChildObject(this.goItem, "Frame", false);
			this.goFrame.SetActive(false);
			this.goOld = UTY.GetChildObject(this.goItem, "Old", false);
			this.goOld.SetActive(f_mi.m_bOld);
			this.gcBtn = this.goItem.GetComponentsInChildren<UIButton>(true)[0];
			this.gcEvent = this.goItem.GetComponentsInChildren<UIEventTrigger>(true)[0];
			if (f_mi.m_texIconRef != null)
			{
				Sprite normalSprite2D = Sprite.Create(f_mi.m_texIconRef, new Rect(0f, 0f, (float)f_mi.m_texIconRef.width, (float)f_mi.m_texIconRef.height), default(Vector2));
				this.gcBtn.normalSprite2D = normalSprite2D;
			}
		}

		public void ToSmall()
		{
			if (this.gcBtnEdit.m_MenuItem.m_texIconRef.width == 138 && this.gcBtnEdit.m_MenuItem.m_texIconRef.height == 200)
			{
				this.gcBtn.GetComponent<UI2DSprite>().SetDimensions(80, 116);
				this.gcBtn.GetComponent<BoxCollider>().size = new Vector3(80f, 116f, 0f);
				this.goOld.GetComponent<UISprite>().ResetAnchors();
			}
		}

		public void Clear()
		{
			if (this.goItem != null)
			{
				UnityEngine.Object.DestroyImmediate(this.goItem);
			}
		}

		public void Selected(bool f_bSelect)
		{
			if (this.m_bSelectedFrame)
			{
				this.goFrame.SetActive(f_bSelect);
			}
		}

		public GameObject goItem;

		public ButtonEdit gcBtnEdit;

		private GameObject goFrame;

		private GameObject goOld;

		public UIButton gcBtn;

		public UIEventTrigger gcEvent;

		public SceneEdit.SMenuItem mi;

		private bool m_bSelectedFrame = true;
	}

	private class ColorItemSet
	{
		public ColorItemSet(GameObject f_goParentGrid, SceneEdit.SMenuItem f_mi)
		{
			this.mi = f_mi;
			UnityEngine.Object @object = Resources.Load("SceneEdit/MainMenu/Prefab/ButtonColor");
			this.goItem = NGUITools.AddChild(f_goParentGrid, @object as GameObject);
			this.goFrame = UTY.GetChildObject(this.goItem, "Frame", false);
			this.gcBtnEdit = this.goItem.GetComponentsInChildren<ButtonEdit>(true)[0];
			this.gcBtnEdit.m_MenuItem = f_mi;
			this.gcBtn = this.goItem.GetComponentsInChildren<UIButton>(true)[0];
			this.gcEvent = this.goItem.GetComponentsInChildren<UIEventTrigger>(true)[0];
			NDebug.Assert(f_mi.m_texIconRef != null, "アイコンテクスチャがありません。" + f_mi.m_strMenuFileName);
			if (f_mi.m_texIconRef != null)
			{
				Sprite normalSprite2D = Sprite.Create(f_mi.m_texIconRef, new Rect(0f, 0f, (float)f_mi.m_texIconRef.width, (float)f_mi.m_texIconRef.height), default(Vector2));
				this.gcBtn.normalSprite2D = normalSprite2D;
			}
		}

		public void Clear()
		{
			if (this.goItem != null)
			{
				UnityEngine.Object.DestroyImmediate(this.goItem);
			}
		}

		public void Selected(bool f_bSelect)
		{
			this.goFrame.SetActive(f_bSelect);
		}

		public GameObject goItem;

		public ButtonEdit gcBtnEdit;

		private GameObject goFrame;

		public UIButton gcBtn;

		public UIEventTrigger gcEvent;

		public SceneEdit.SMenuItem mi;
	}

	private class SliderItemSet
	{
		public virtual bool isEnabled
		{
			set
			{
				this.gcSlider.enabled = value;
				this.gcSlider.GetComponent<UIButton>().isEnabled = value;
				this.gcSlider.thumb.GetComponent<UIButton>().isEnabled = value;
			}
		}

		public virtual void Create(GameObject f_goParentGrid, SceneEdit.SMenuItem f_mi)
		{
			this.mpn = f_mi.m_mpn;
			UnityEngine.Object @object = Resources.Load("SceneEdit/MainMenu/Prefab/Slider");
			this.goMain = NGUITools.AddChild(f_goParentGrid, @object as GameObject);
			this.gcSlider = this.goMain.GetComponentsInChildren<UISlider>(true)[0];
			GameObject childObject = UTY.GetChildObject(this.goMain, "CategoryTitle/Name", false);
			this.gcLabel = childObject.GetComponent<UILabel>();
			Localize localize = this.gcLabel.gameObject.AddComponent<Localize>();
			localize.SetTerm("SceneEdit/カテゴリー/スライダー/" + f_mi.m_strMenuName);
			GameObject childObject2 = UTY.GetChildObject(this.goMain, "CategoryTitle/Number/Value", false);
			this.gcValue = childObject2.GetComponent<UILabel>();
			this.gcValue.text = "000";
			this.goMain.name = this.goMain.name + f_mi.m_strMenuName;
			this.gcBtnEdit = this.goMain.GetComponentsInChildren<ButtonEdit>(true)[0];
			this.gcBtnEdit.m_SliderItem = f_mi;
		}

		public virtual void Clear()
		{
			if (this.goMain != null)
			{
				UnityEngine.Object.DestroyImmediate(this.goMain);
			}
		}

		public virtual void SetValue(float f_fValue, string f_strValue = null)
		{
			this.gcSlider.value = f_fValue;
			if (f_strValue == null)
			{
				this.gcValue.text = f_fValue.ToString();
			}
			else
			{
				this.gcValue.text = f_strValue;
			}
		}

		public GameObject goMain;

		public UISlider gcSlider;

		public UILabel gcLabel;

		public UILabel gcValue;

		public ButtonEdit gcBtnEdit;

		protected MPN mpn;
	}

	private class SwitchItemSet : SceneEdit.SliderItemSet
	{
		public override void Create(GameObject f_goParentGrid, SceneEdit.SMenuItem f_mi)
		{
			this.mpn = f_mi.m_mpn;
			this.goMain = Utility.CreatePrefab(f_goParentGrid, "SceneEdit/MainMenu/Prefab/Switch", true);
			this.gcBtnEdit = this.goMain.GetComponentsInChildren<ButtonEdit>(true)[0];
			this.tabPanel = UTY.GetChildObject(this.goMain, "CategoryBtns", false).GetComponent<UIWFTabPanel>();
			this.buttonAri = UTY.GetChildObject(this.tabPanel.gameObject, "ButtonAri/Button", false).GetComponent<UIWFTabButton>();
			this.buttonNasi = UTY.GetChildObject(this.tabPanel.gameObject, "ButtonNasi/Button", false).GetComponent<UIWFTabButton>();
			this.gcBtnEdit.m_SliderItem = f_mi;
			this.tabPanel.UpdateChildren();
			EventDelegate.Add(this.buttonAri.onClick, delegate()
			{
				if (this.onClickEvent != null)
				{
					this.onClickEvent(false, this.gcBtnEdit.m_SliderItem);
				}
			});
			EventDelegate.Add(this.buttonNasi.onClick, delegate()
			{
				if (this.onClickEvent != null)
				{
					this.onClickEvent(true, this.gcBtnEdit.m_SliderItem);
				}
			});
			GameObject childObject = UTY.GetChildObject(this.goMain, "CategoryTitle/Name", false);
			this.gcLabel = childObject.GetComponent<UILabel>();
			Localize localize = this.gcLabel.gameObject.AddComponent<Localize>();
			localize.SetTerm("SceneEdit/カテゴリー/スライダー/" + f_mi.m_strMenuName);
		}

		public override void SetValue(float f_fValue, string f_strValue = null)
		{
			UIWFTabButton uiwftabButton = (f_fValue != 0f) ? this.buttonNasi : this.buttonAri;
			if (!uiwftabButton.isSelected)
			{
				this.tabPanel.Select(uiwftabButton);
			}
		}

		private UIWFTabPanel tabPanel;

		private UIWFTabButton buttonAri;

		private UIWFTabButton buttonNasi;

		public Action<bool, SceneEdit.SMenuItem> onClickEvent;
	}

	[Serializable]
	public struct SubPropMpnData
	{
		public MPN mpn
		{
			get
			{
				return this.manager.targetMpn;
			}
		}

		public SubSlotEditManager manager;
	}

	public class PVBInfo
	{
		public string strIconName;

		public Texture2D texIcon;
	}

	public class VoiceInfo : SceneEdit.PVBInfo
	{
		public string strVoiceFileName;

		public Personal.Data personal;

		public string strFace;

		public string strFace2;
	}

	public enum CAM_OFFS
	{
		CENTER,
		RIGHT,
		RIGHT_MORE
	}
}