using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using PlayerStatus;
using UnityEngine;
using wf;

public class GameInShopMain : WfScreenChildren
{
	public override void Awake()
	{
		base.Awake();
		this.camera_move_support_ = base.gameObject.AddComponent<WfCameraMoveSupport>();
		this.trialwear_button_ = UTY.GetChildObject(base.root_obj, "TrialWear", false).GetComponent<UIButton>();
		this.trialwear_reset_button_ = UTY.GetChildObject(base.root_obj, "TrialWearReset", false).GetComponent<UIButton>();
		this.viwe_reset_button_ = UTY.GetChildObject(base.root_obj, "ViweReset", false).GetComponent<UIButton>();
		this.item_info_window_ = UTY.GetChildObject(base.root_obj, "Window-ItemInfo", false).GetComponent<ItemInfoWnd>();
		this.item_info_window_.gameObject.SetActive(true);
		this.ok_button_ = UTY.GetChildObject(base.root_obj, "OK", false).GetComponent<UIButton>();
		this.ok_button_.onClick.Clear();
		EventDelegate.Add(this.ok_button_.onClick, new EventDelegate.Callback(this.OnClickOK));
		this.panel_dic_.Add("メインカテゴリー", new GameInShopMain.PanesSet());
		this.panel_dic_["メインカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
		this.panel_dic_["メインカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content", false).GetComponent<UIScrollView>();
		this.panel_dic_["メインカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
		this.panel_dic_.Add("サブカテゴリー", new GameInShopMain.PanesSet());
		this.panel_dic_["サブカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
		this.panel_dic_["サブカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content", false).GetComponent<UIScrollView>();
		this.panel_dic_["サブカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
		this.panel_dic_.Add("アイテムリスト", new GameInShopMain.PanesSet());
		this.panel_dic_["アイテムリスト"].grid = UTY.GetChildObject(base.root_obj, "ItemList/Content/Parent", false).GetComponent<UIGrid>();
		this.panel_dic_["アイテムリスト"].scroll_view = UTY.GetChildObject(base.root_obj, "ItemList/Content", false).GetComponent<UIScrollView>();
		this.panel_dic_["アイテムリスト"].tab_panel_ = null;
		EventDelegate.Add(this.trialwear_button_.onClick, new EventDelegate.Callback(this.TrialWear));
		EventDelegate.Add(this.trialwear_reset_button_.onClick, new EventDelegate.Callback(this.ResetTrialWear));
		this.lineup_list_.Clear();
		this.access_lineup_dic_.Clear();
		for (int i = 0; i < Shop.category_name_list.Count; i++)
		{
			List<KeyValuePair<string, List<Shop.ItemDataBase>>> list = new List<KeyValuePair<string, List<Shop.ItemDataBase>>>();
			Dictionary<string, List<Shop.ItemDataBase>> dictionary = new Dictionary<string, List<Shop.ItemDataBase>>();
			for (int j = 0; j < Shop.category_name_list[i].Value.Count; j++)
			{
				KeyValuePair<string, List<Shop.ItemDataBase>> item = new KeyValuePair<string, List<Shop.ItemDataBase>>(Shop.category_name_list[i].Value[j], new List<Shop.ItemDataBase>());
				list.Add(item);
				dictionary.Add(Shop.category_name_list[i].Value[j], item.Value);
			}
			this.lineup_list_.Add(new KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>(Shop.category_name_list[i].Key, list));
			this.access_lineup_dic_.Add(Shop.category_name_list[i].Key, dictionary);
		}
		GameObject childObject = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false);
		GameObject childObject2 = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false);
		Func<GameObject, string, UIButton> func = delegate(GameObject parent, string name)
		{
			GameObject gameObject = Utility.CreatePrefab(parent, "SceneShop/Prefab/CategoryButton", true);
			gameObject.name = name;
			UTY.GetChildObject(gameObject, "Label", false).GetComponent<UILabel>().text = gameObject.name;
			return UTY.GetChildObject(gameObject, "Button", false).GetComponent<UIButton>();
		};
		for (int k = 0; k < Shop.category_name_list.Count; k++)
		{
			string key = Shop.category_name_list[k].Key;
			UIButton key2 = func(childObject, key);
			Dictionary<string, UIButton> dictionary2 = new Dictionary<string, UIButton>();
			for (int l = 0; l < Shop.category_name_list[k].Value.Count; l++)
			{
				string text = Shop.category_name_list[k].Value[l];
				UIButton value = func(childObject2, text);
				dictionary2.Add(text, value);
			}
			this.category_button_dic_.Add(key, new KeyValuePair<UIButton, Dictionary<string, UIButton>>(key2, dictionary2));
		}
		this.game_in_shop_ = base.transform.parent.gameObject.GetComponent<GameInShop>();
	}

	protected override void OnCall()
	{
		Shop.CheckClubGradeShopLineup(GameMain.Instance.CharacterMgr.status.clubGrade);
		Shop.CheckBuildingShopLineup();
		this.labelMoney.text = GameMain.Instance.CharacterMgr.status.moneyText;
		this.item_info_window_.transform.localPosition = new Vector3(7f, -600f, 0f);
		this.CheckCardSet();
		this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0);
		if (this.maid_ == null || !this.maid_.status.leader)
		{
			Maid x = null;
			for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
			{
				Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
				if (stockMaid.status.leader)
				{
					x = stockMaid;
					break;
				}
			}
			if (x == null)
			{
				x = GameMain.Instance.CharacterMgr.GetStockMaid(0);
			}
			this.maid_ = x;
			GameMain.Instance.CharacterMgr.SetActiveMaid(this.maid_, 0);
		}
		this.maid_.Visible = true;
		this.maid_.AllProcPropSeqStart();
		this.player_ = GameMain.Instance.CharacterMgr.status;
		foreach (KeyValuePair<string, Dictionary<string, List<Shop.ItemDataBase>>> keyValuePair in this.access_lineup_dic_)
		{
			foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair2 in keyValuePair.Value)
			{
				keyValuePair2.Value.Clear();
			}
		}
		this.trialwear_data_.Clear();
		this.trialwear_button_.isEnabled = false;
		this.trialwear_reset_button_.isEnabled = false;
		this.select_item_id_ = -1;
		this.lineup_list_.Clear();
		Shop.CheckGroupItemData();
		ReadOnlyDictionary<int, ShopItemStatus> shopLineups = this.player_.shopLineups;
		foreach (int key in shopLineups.GetKeyArray())
		{
			if (Shop.item_data_dic.ContainsKey(key))
			{
				Shop.ItemDataBase itemDataBase = Shop.item_data_dic[key];
				NDebug.Assert(this.access_lineup_dic_.ContainsKey(itemDataBase.main_category), string.Concat(new object[]
				{
					"ID[",
					itemDataBase.id,
					"]に設定されているメインカテゴリー[",
					itemDataBase.main_category,
					"]は定義されていません"
				}));
				NDebug.Assert(this.access_lineup_dic_[itemDataBase.main_category].ContainsKey(itemDataBase.sub_category), string.Concat(new object[]
				{
					"ID[",
					itemDataBase.id,
					"]に設定されているサブカテゴリー[",
					itemDataBase.sub_category,
					"]は定義されていません"
				}));
				if (itemDataBase.valid_bg_id_list.Contains(this.game_in_shop_.select_bg_id))
				{
					this.access_lineup_dic_[itemDataBase.main_category][itemDataBase.sub_category].Add(itemDataBase);
				}
			}
		}
		HashSet<string> hashSet = new HashSet<string>();
		foreach (KeyValuePair<string, Dictionary<string, List<Shop.ItemDataBase>>> keyValuePair3 in this.access_lineup_dic_)
		{
			foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair4 in keyValuePair3.Value)
			{
				for (int k = 0; k < keyValuePair4.Value.Count; k++)
				{
					hashSet.Add(keyValuePair4.Value[k].main_category);
				}
			}
		}
		UIWFTabButton uiwftabButton = null;
		foreach (KeyValuePair<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> keyValuePair5 in this.category_button_dic_)
		{
			keyValuePair5.Value.Key.onClick.Clear();
			bool flag = hashSet.Contains(keyValuePair5.Key);
			keyValuePair5.Value.Key.transform.parent.gameObject.SetActive(flag);
			if (flag)
			{
				EventDelegate.Add(keyValuePair5.Value.Key.onClick, new EventDelegate.Callback(this.OnClickFromMainCategoryButton));
				if (uiwftabButton == null)
				{
					uiwftabButton = keyValuePair5.Value.Key.gameObject.GetComponent<UIWFTabButton>();
				}
			}
			foreach (KeyValuePair<string, UIButton> keyValuePair6 in keyValuePair5.Value.Value)
			{
				keyValuePair6.Value.transform.parent.gameObject.SetActive(false);
			}
		}
		this.panel_dic_["メインカテゴリー"].grid.Reposition();
		this.panel_dic_["メインカテゴリー"].scroll_view.ResetPosition();
		this.panel_dic_["メインカテゴリー"].tab_panel_.UpdateChildren();
		if (uiwftabButton != null)
		{
			this.panel_dic_["メインカテゴリー"].tab_panel_.Select(uiwftabButton);
		}
		this.wait_check_time_ = -1;
		this.InitMaidAndCamera(true);
	}

	protected void InitMaidAndCamera(bool is_start)
	{
		GameMain.Instance.MainLight.Reset();
		GameMain.Instance.CharacterMgr.ResetCharaPosAll();
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
		if (!is_start)
		{
			GameMain.Instance.ScriptMgr.StopMotionScript();
			this.maid_.EyeToCamera(Maid.EyeMoveType.無し, 0f);
			this.maid_.Visible = false;
			GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
		}
	}

	protected override bool IsCallFadeIn()
	{
		bool flag = !this.maid_.IsBusy;
		if (flag)
		{
			if (this.wait_check_time_ == -1)
			{
				this.wait_check_time_ = GameMain.tick_count;
				ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
				scriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true);
				this.maid_.FaceAnime("通常", 1f, 0);
				this.maid_.FaceBlend("無し");
				return false;
			}
			if (this.wait_check_time_ + 500 > GameMain.tick_count)
			{
				return false;
			}
			this.maid_.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
			if (Shop.bg_data_dic[this.game_in_shop_.select_bg_id].use_stage_data != null)
			{
				Shop.bg_data_dic[this.game_in_shop_.select_bg_id].ChangeBg(this.maid_);
			}
			else
			{
				GameMain.Instance.BgMgr.ChangeBg(Shop.bg_data_dic[this.game_in_shop_.select_bg_id].bg_prefab_name);
				CameraMain mainCamera = GameMain.Instance.MainCamera;
				Transform bone = this.maid_.body0.GetBone("Bip01 Head");
				mainCamera.SetTargetPos(bone.position - new Vector3(-0.01597595f, 0.224536926f, -0.043105565f), true);
				mainCamera.SetDistance(1.6f, true);
				mainCamera.SetAroundAngle(new Vector2(173.7126f, 9.999997f), true);
			}
			GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 256f * 181f - (float)Screen.width / 2f, 0f, 0f), false);
			this.camera_move_support_.SaveCameraPosition();
			Shop.bg_data_dic[this.game_in_shop_.select_bg_id].PlayBGM(0.5f);
		}
		return flag;
	}

	protected override void OnFinish()
	{
		if (this.trialwear_reset_button_.isEnabled)
		{
			this.trialwear_reset_button_.isEnabled = false;
			this.ResetTrialWear();
		}
	}

	public override void Update()
	{
		base.Update();
		if (base.fade_status == WfScreenChildren.FadeStatus.FadeEnd && !this.maid_.IsBusy)
		{
			this.InitMaidAndCamera(false);
			base.parent_mgr.CallScreen("Move");
		}
	}

	public void OnClickFromMainCategoryButton()
	{
		UIButton current = UIButton.current;
		this.select_main_category_ = current.transform.parent.name;
		GameObject childObject = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Arrow", false);
		HashSet<string> hashSet = new HashSet<string>();
		foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair in this.access_lineup_dic_[this.select_main_category_])
		{
			if (0 < keyValuePair.Value.Count)
			{
				hashSet.Add(keyValuePair.Key);
			}
		}
		foreach (KeyValuePair<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> keyValuePair2 in this.category_button_dic_)
		{
			foreach (KeyValuePair<string, UIButton> keyValuePair3 in keyValuePair2.Value.Value)
			{
				keyValuePair3.Value.onClick.Clear();
				keyValuePair3.Value.gameObject.GetComponent<UIWFTabButton>().SetSelect(false);
				keyValuePair3.Value.transform.parent.gameObject.SetActive(false);
			}
		}
		UIWFTabButton uiwftabButton = null;
		foreach (KeyValuePair<string, UIButton> keyValuePair4 in this.category_button_dic_[this.select_main_category_].Value)
		{
			bool flag = hashSet.Contains(keyValuePair4.Key);
			keyValuePair4.Value.transform.parent.gameObject.SetActive(flag);
			if (flag)
			{
				EventDelegate.Add(keyValuePair4.Value.onClick, new EventDelegate.Callback(this.OnClickFromSubCategoryButton));
				if (uiwftabButton == null)
				{
					uiwftabButton = keyValuePair4.Value.gameObject.GetComponent<UIWFTabButton>();
				}
			}
		}
		if (this.last_click_sub_category_button_.ContainsKey(this.select_main_category_))
		{
			uiwftabButton = this.last_click_sub_category_button_[this.select_main_category_];
		}
		this.panel_dic_["サブカテゴリー"].grid.Reposition();
		this.panel_dic_["サブカテゴリー"].scroll_view.ResetPosition();
		this.panel_dic_["サブカテゴリー"].tab_panel_.UpdateChildren();
		if (uiwftabButton != null)
		{
			this.panel_dic_["サブカテゴリー"].tab_panel_.Select(uiwftabButton);
		}
		Vector3 position = current.transform.TransformPoint(new Vector3(0f, 0f, 0f));
		Vector3 local_pos = childObject.transform.parent.InverseTransformPoint(position);
		local_pos.x = childObject.transform.localPosition.x;
		local_pos.y += 18f;
		Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
		iTween.MoveTo(childObject, args);
	}

	public void OnClickFromSubCategoryButton()
	{
		UIButton current = UIButton.current;
		this.select_sub_category_ = current.transform.parent.name;
		if (Shop.sub_category_dressingbutton_enabled.ContainsKey(this.select_sub_category_))
		{
			bool active = Shop.sub_category_dressingbutton_enabled[this.select_sub_category_];
			this.trialwear_button_.gameObject.SetActive(active);
			this.trialwear_reset_button_.gameObject.SetActive(active);
			this.viwe_reset_button_.gameObject.SetActive(active);
		}
		if (!this.last_click_sub_category_button_.ContainsKey(this.select_main_category_))
		{
			this.last_click_sub_category_button_.Add(this.select_main_category_, null);
		}
		this.last_click_sub_category_button_[this.select_main_category_] = UIWFTabButton.current;
		this.SetItemList(this.select_main_category_, this.select_sub_category_);
		GameObject childObject = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Arrow", false);
		Vector3 position = current.transform.TransformPoint(new Vector3(0f, 0f, 0f));
		Vector3 local_pos = childObject.transform.parent.InverseTransformPoint(position);
		local_pos.x = childObject.transform.localPosition.x;
		local_pos.y += 18f;
		Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
		iTween.MoveTo(childObject, args);
	}

	public void SetItemList(string main_category, string sub_category)
	{
		this.select_item_id_ = -1;
		this.trialwear_button_.isEnabled = false;
		Transform transform = this.panel_dic_["アイテムリスト"].grid.transform;
		for (int i = 0; i < transform.childCount; i++)
		{
			UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
		}
		transform.DetachChildren();
		this.current_item_list_.Clear();
		this.panel_dic_["アイテムリスト"].grid.Reposition();
		this.panel_dic_["アイテムリスト"].scroll_view.ResetPosition();
		if (!this.access_lineup_dic_.ContainsKey(main_category) || !this.access_lineup_dic_[main_category].ContainsKey(sub_category))
		{
			return;
		}
		List<Shop.ItemDataBase> list = this.access_lineup_dic_[main_category][sub_category];
		for (int j = 0; j < list.Count; j++)
		{
			this.current_item_list_.Add(this.CreateShopItem(list[j]));
		}
		this.panel_dic_["アイテムリスト"].grid.Reposition();
		this.panel_dic_["アイテムリスト"].scroll_view.ResetPosition();
	}

	public ShopItem CreateShopItem(Shop.ItemDataBase add_item)
	{
		GameObject gameObject = Utility.CreatePrefab(this.panel_dic_["アイテムリスト"].grid.gameObject, "SceneShop/Prefab/ShopItem", true);
		ShopItem component = gameObject.GetComponent<ShopItem>();
		component.SetData(add_item, this.item_info_window_, new ShopItem.OnClickEvent(this.OnIconClick), new ShopItem.OnClickEvent(this.OnItemClick));
		return component;
	}

	public void TrialWear()
	{
		if (this.select_item_id_ < 0 || !Shop.item_data_dic.ContainsKey(this.select_item_id_))
		{
			return;
		}
		if (this.maid_.IsBusy)
		{
			return;
		}
		this.trialwear_data_.Save(this.maid_);
		this.trialwear_data_.apply_item_id_list.Add(this.select_item_id_);
		Shop.ItemDataBase itemDataBase = Shop.item_data_dic[this.select_item_id_];
		string[] trial_wear_item_menu_array = itemDataBase.trial_wear_item_menu_array;
		for (int i = 0; i < trial_wear_item_menu_array.Length; i++)
		{
			byte[] buffer = null;
			using (AFileBase afileBase = GameUty.FileSystem.FileOpen(trial_wear_item_menu_array[i]))
			{
				NDebug.Assert(afileBase.IsValid(), itemDataBase.name + "\nnot file open.");
				buffer = afileBase.ReadAll();
			}
			BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
			string text = binaryReader.ReadString();
			NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text);
			int num = binaryReader.ReadInt32();
			string text2 = binaryReader.ReadString();
			string text3 = binaryReader.ReadString();
			string text4 = binaryReader.ReadString();
			binaryReader.Close();
			buffer = null;
			this.maid_.SetProp(text4, trial_wear_item_menu_array[i], 0, false, false);
			if (!itemDataBase.enabled_mask_mode)
			{
				MPN key = (MPN)Enum.Parse(typeof(MPN), text4);
				if (SceneEditInfo.m_dicPartsTypeWearMode.ContainsKey(key))
				{
					TBody.MaskMode maskMode = SceneEditInfo.m_dicPartsTypeWearMode[key];
					this.maid_.body0.SetMaskMode(maskMode);
				}
			}
		}
		if (itemDataBase.enabled_mask_mode)
		{
			this.maid_.body0.SetMaskMode(itemDataBase.mask_mode);
		}
		this.maid_.AllProcPropSeqStart();
		this.trialwear_reset_button_.isEnabled = true;
	}

	public void ResetTrialWear()
	{
		if (this.maid_.IsBusy)
		{
			return;
		}
		this.trialwear_reset_button_.isEnabled = false;
		this.trialwear_data_.Load(this.maid_);
		this.trialwear_data_.Clear();
		this.maid_.AllProcPropSeqStart();
		this.maid_.body0.SetMaskMode(TBody.MaskMode.None);
	}

	private void OnIconClick(ShopItem item)
	{
		for (int i = 0; i < this.current_item_list_.Count; i++)
		{
			this.current_item_list_[i].SetFlameVisible(false);
		}
		if (this.select_item_id_ == item.item_data.id)
		{
			item.SetFlameVisible(false);
			this.select_item_id_ = -1;
			this.trialwear_button_.isEnabled = false;
		}
		else
		{
			item.SetFlameVisible(true);
			this.select_item_id_ = item.item_data.id;
			this.trialwear_button_.isEnabled = true;
		}
	}

	private void OnItemClick(ShopItem item)
	{
		GameMain.Instance.SoundMgr.PlaySystem("SE025.ogg");
		this.player_.money += (long)(item.item_data.price * -1);
		this.player_.totalPurchasePrice += (long)item.item_data.price;
		string[] item_menu_array = item.item_data.item_menu_array;
		if (item.item_data.type == Shop.ItemDataBase.Type.Parts)
		{
			if (Shop.item_data_group_dic.ContainsKey(item.item_data.id))
			{
				List<int> need_id_list = Shop.item_data_group_dic[item.item_data.id].need_id_list;
				for (int i = 0; i < need_id_list.Count; i++)
				{
					this.player_.SetShopLineupStatus(need_id_list[i], ShopItemStatus.Purchased);
				}
			}
			this.player_.SetShopLineupStatus(item.item_data.id, ShopItemStatus.Purchased);
			for (int j = 0; j < item_menu_array.Length; j++)
			{
				this.player_.AddHavePartsItem(item_menu_array[j]);
			}
			item.UpdateItemData();
			this.CheckCardSet();
		}
		else
		{
			Shop.ItemDataEvent itemDataEvent = item.item_data as Shop.ItemDataEvent;
			itemDataEvent.ExecBuy();
			item.UpdateItemData();
			if (2 <= itemDataEvent.free_text.Count && itemDataEvent.free_text[0] == "建物強化素材")
			{
				GameMain.Instance.FacilityMgr.SetHavePowerUpMaterial(int.Parse(itemDataEvent.free_text[1].Trim()), true);
			}
		}
		Transform transform = this.panel_dic_["アイテムリスト"].grid.transform;
		for (int k = 0; k < transform.childCount; k++)
		{
			ShopItem component = transform.GetChild(k).GetComponent<ShopItem>();
			component.UpdateItemData();
		}
		this.labelMoney.text = GameMain.Instance.CharacterMgr.status.moneyText;
	}

	private void OnClickOK()
	{
		if (this.maid_.IsBusy)
		{
			return;
		}
		this.Finish();
	}

	public void OnClickViweReset()
	{
		this.camera_move_support_.ResetCamera();
	}

	private void CheckCardSet()
	{
		Status status = GameMain.Instance.CharacterMgr.status;
		List<KeyValuePair<string[], HashSet<int>>> set_card_list = Shop.set_card_list;
		for (int i = 0; i < set_card_list.Count; i++)
		{
			string[] key = set_card_list[i].Key;
			bool flag = true;
			for (int j = 0; j < key.Length; j++)
			{
				if (!status.IsHavePartsItem(key[j]))
				{
					flag = false;
					break;
				}
			}
			if (!flag)
			{
				bool flag2 = true;
				foreach (int num in set_card_list[i].Value)
				{
					if (!status.IsShopLineupItem(num))
					{
						flag2 = false;
						break;
					}
					ShopItemStatus shopItemStatus = status.shopLineups.Get(num);
					if (shopItemStatus != ShopItemStatus.Purchased)
					{
						flag2 = false;
						break;
					}
				}
				if (flag2)
				{
					for (int k = 0; k < key.Length; k++)
					{
						status.AddHavePartsItem(key[k]);
					}
				}
			}
		}
	}

	[SerializeField]
	public UILabel labelMoney;

	private GameInShop game_in_shop_;

	private Maid maid_;

	private WfCameraMoveSupport camera_move_support_;

	private ItemInfoWnd item_info_window_;

	private UIButton trialwear_button_;

	private UIButton trialwear_reset_button_;

	private UIButton viwe_reset_button_;

	private int select_item_id_;

	private Status player_;

	private GameInShopMain.TrialWearData trialwear_data_ = new GameInShopMain.TrialWearData();

	private Dictionary<string, GameInShopMain.PanesSet> panel_dic_ = new Dictionary<string, GameInShopMain.PanesSet>();

	private UIButton ok_button_;

	private int wait_check_time_ = -1;

	private List<ShopItem> current_item_list_ = new List<ShopItem>();

	private string select_main_category_;

	private string select_sub_category_;

	private Dictionary<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> category_button_dic_ = new Dictionary<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>>();

	private Dictionary<string, UIWFTabButton> last_click_sub_category_button_ = new Dictionary<string, UIWFTabButton>();

	private List<KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>> lineup_list_ = new List<KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>>();

	private Dictionary<string, Dictionary<string, List<Shop.ItemDataBase>>> access_lineup_dic_ = new Dictionary<string, Dictionary<string, List<Shop.ItemDataBase>>>();

	private class TrialWearData
	{
		public void Clear()
		{
			this.apply_item_id_list.Clear();
		}

		public void Save(Maid maid)
		{
			if (this.backup_maid_prop_.Count != 0)
			{
				return;
			}
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairf));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairr));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairt));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairs));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.skin));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.underhair));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.lip));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.eye));
			this.backup_maid_prop_.Add(this.CreateData(maid, MPN.eye_hi));
			for (int i = 53; i <= 82; i++)
			{
				this.backup_maid_prop_.Add(this.CreateData(maid, (MPN)i));
			}
			MPN[] array = new MPN[]
			{
				MPN.hairt,
				MPN.hairaho
			};
			this.backup_custom_parts_dic_.Clear();
			foreach (MPN mpn in array)
			{
				List<KeyValuePair<TBody.SlotID, string>> attachPointListFromMPN = maid.body0.GetAttachPointListFromMPN(mpn);
				this.backup_custom_parts_dic_.Add(mpn, attachPointListFromMPN);
				foreach (KeyValuePair<TBody.SlotID, string> keyValuePair in attachPointListFromMPN)
				{
					TBody.SlotID key = keyValuePair.Key;
					string value = keyValuePair.Value;
					maid.body0.CopyAttachPoint(key, value);
				}
			}
			this.hair_length_dic_.Clear();
			MPN[] array3 = new MPN[]
			{
				MPN.hairf,
				MPN.hairr,
				MPN.hairt,
				MPN.hairs,
				MPN.hairaho
			};
			foreach (MPN mpn2 in array3)
			{
				Dictionary<string, float> dictionary = new Dictionary<string, float>();
				Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> hairLengthListFromMPN = maid.body0.GetHairLengthListFromMPN(mpn2);
				if (hairLengthListFromMPN != null)
				{
					foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair2 in hairLengthListFromMPN)
					{
						string key2 = keyValuePair2.Key;
						TBodySkin.HairLengthCtrl.HairLength value2 = keyValuePair2.Value;
						dictionary.Add(key2, value2.GetLengthRate());
					}
				}
				if (dictionary.Count != 0)
				{
					this.hair_length_dic_.Add(mpn2, dictionary);
				}
			}
		}

		public void Load(Maid maid)
		{
			if (this.backup_maid_prop_.Count == 0)
			{
				return;
			}
			for (int i = 0; i < this.backup_maid_prop_.Count; i++)
			{
				maid.SetProp(this.backup_maid_prop_[i].mpn, this.backup_maid_prop_[i].file_name, this.backup_maid_prop_[i].file_name_rid, false, false);
			}
			this.backup_maid_prop_.Clear();
			maid.AllProcProp();
			foreach (KeyValuePair<MPN, List<KeyValuePair<TBody.SlotID, string>>> keyValuePair in this.backup_custom_parts_dic_)
			{
				MPN key = keyValuePair.Key;
				List<KeyValuePair<TBody.SlotID, string>> value = keyValuePair.Value;
				foreach (KeyValuePair<TBody.SlotID, string> keyValuePair2 in value)
				{
					TBody.SlotID key2 = keyValuePair2.Key;
					string value2 = keyValuePair2.Value;
					maid.body0.PasteAttachPoint(key2, value2);
				}
			}
			foreach (KeyValuePair<MPN, Dictionary<string, float>> keyValuePair3 in this.hair_length_dic_)
			{
				MPN key3 = keyValuePair3.Key;
				Dictionary<string, float> value3 = keyValuePair3.Value;
				Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> hairLengthListFromMPN = maid.body0.GetHairLengthListFromMPN(key3);
				if (hairLengthListFromMPN != null)
				{
					foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair4 in hairLengthListFromMPN)
					{
						string key4 = keyValuePair4.Key;
						TBodySkin.HairLengthCtrl.HairLength value4 = keyValuePair4.Value;
						value4.SetLengthRate(value3[key4]);
					}
					maid.body0.HairLengthBlend();
				}
			}
		}

		private GameInShopMain.TrialWearData.MaidPropData CreateData(Maid maid, MPN mpn_num)
		{
			MaidProp prop = maid.GetProp(mpn_num);
			GameInShopMain.TrialWearData.MaidPropData result;
			result.mpn = mpn_num;
			result.file_name = prop.strFileName;
			result.file_name_rid = prop.nTempFileNameRID;
			return result;
		}

		public HashSet<int> apply_item_id_list = new HashSet<int>();

		private List<GameInShopMain.TrialWearData.MaidPropData> backup_maid_prop_ = new List<GameInShopMain.TrialWearData.MaidPropData>();

		private Dictionary<MPN, List<KeyValuePair<TBody.SlotID, string>>> backup_custom_parts_dic_ = new Dictionary<MPN, List<KeyValuePair<TBody.SlotID, string>>>();

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

		private struct MaidPropData
		{
			public MPN mpn;

			public string file_name;

			public int file_name_rid;
		}
	}

	private class PanesSet
	{
		public UIGrid grid;

		public UIScrollView scroll_view;

		public UIWFTabPanel tab_panel_;
	}
}
