123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using wf;
- public class UndressingWindow : BaseMaidPhotoWindow
- {
- public override void Awake()
- {
- base.Awake();
- this.noCharaActive = base.GetComponentInChildren<PhotoNoCharaActive>();
- this.scroll_view_ = NGUITools.FindInParents<UIScrollView>(this.Grid.transform);
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_undressing_list.nei"))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool condition = csvParser.Open(afileBase);
- NDebug.Assert(condition, "phot_undressing_list.nei\nopen failed.");
- for (int i = 1; i < csvParser.max_cell_y; i++)
- {
- if (csvParser.IsCellToExistData(0, i))
- {
- GameObject gameObject = Utility.CreatePrefab(this.Grid.gameObject, "ScenePhotoMode/WindowListItemNormalButton", true);
- gameObject.name = csvParser.GetCellAsString(0, i);
- gameObject.GetComponentInChildren<UILabel>().text = gameObject.name;
- UIButton componentInChildren = gameObject.GetComponentInChildren<UIButton>();
- componentInChildren.defaultColor = Color.white;
- componentInChildren.disabledColor = new Color(0.15f, 0.15f, 0.15f);
- this.unit_dic_.Add(gameObject.name, componentInChildren);
- }
- }
- }
- }
- this.UndressingMgr.SetUnitButtonList(this.unit_dic_);
- this.UndressingMgr.onClickEvent = new Action(this.OnStoreDataUpdate);
- NGUITools.FindInParents<UIScrollView>(this.Grid.transform).ResetPosition();
- this.Grid.Reposition();
- this.scroll_view_.ResetPosition();
- this.UpdateChildren();
- }
- public override void Start()
- {
- base.Start();
- this.MekureFront.mgr = (this.MekureBack.mgr = (this.Zurasi.mgr = base.mgr));
- this.MekureFront.onClick.Add(delegate(WFCheckBox check_box)
- {
- this.MekureBack.UpdateGui();
- this.OnStoreDataUpdate();
- });
- this.MekureBack.onClick.Add(delegate(WFCheckBox check_box)
- {
- this.MekureFront.UpdateGui();
- this.OnStoreDataUpdate();
- });
- this.Zurasi.onClick.Add(delegate(WFCheckBox check_box)
- {
- this.OnStoreDataUpdate();
- });
- this.noCharaActive.ChangeMode(true, true);
- }
- public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
- {
- if (maid == null)
- {
- return;
- }
- this.activeMaidList.Add(maid);
- this.noCharaActive.ChangeMode(false, true);
- if (maid.boMAN)
- {
- return;
- }
- maid.body0.SetMaskMode(TBody.MaskMode.None);
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
- HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
- foreach (TBody.SlotID f_eSlot in targetSlotID)
- {
- string key = f_eSlot.ToString();
- if (maidStoreData.ContainsKey(key) && !bool.Parse(maidStoreData[key]))
- {
- maid.body0.SetMask(f_eSlot, false);
- }
- }
- foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
- {
- {
- "check_box_mekure_front",
- this.MekureFront
- },
- {
- "check_box_mekure_back",
- this.MekureBack
- },
- {
- "check_box_zurasi",
- this.Zurasi
- }
- })
- {
- string key2 = keyValuePair.Key;
- WindowPartsMekureCheckBox value = keyValuePair.Value;
- if (!maidStoreData.ContainsKey(key2))
- {
- maidStoreData[key2] = false.ToString();
- }
- if (bool.Parse(maidStoreData[key2]))
- {
- value.SetMaid(maid);
- value.check = true;
- value.Apply();
- value.SetMaid(null);
- }
- }
- this.OnStoreDataUpdate();
- }
- public override void OnMaidRemoveEvent(Maid maid)
- {
- this.activeMaidList.Remove(maid);
- if (this.activeMaidList.Count <= 0)
- {
- this.noCharaActive.ChangeMode(true, true);
- }
- }
- public override void OnMaidChangeEvent(Maid maid)
- {
- base.OnMaidChangeEvent(maid);
- if (maid == null || maid.boMAN)
- {
- maid = null;
- }
- this.UndressingMgr.SetMaid(maid);
- this.MekureFront.SetMaid(maid);
- this.MekureBack.SetMaid(maid);
- this.Zurasi.SetMaid(maid);
- this.OnStoreDataUpdate();
- }
- public void OnStoreDataUpdate()
- {
- Maid select_maid = base.mgr.select_maid;
- if (select_maid == null || select_maid.boMAN)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(select_maid);
- maidStoreData.Clear();
- HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
- foreach (TBody.SlotID f_eSlot in targetSlotID)
- {
- bool mask = select_maid.body0.GetMask(f_eSlot);
- maidStoreData[f_eSlot.ToString()] = mask.ToString();
- }
- foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
- {
- {
- "check_box_mekure_front",
- this.MekureFront
- },
- {
- "check_box_mekure_back",
- this.MekureBack
- },
- {
- "check_box_zurasi",
- this.Zurasi
- }
- })
- {
- string key = keyValuePair.Key;
- WindowPartsMekureCheckBox value = keyValuePair.Value;
- maidStoreData[key] = value.check.ToString();
- }
- }
- public override void OnDeserializeEvent()
- {
- }
- public UIGrid Grid;
- public PhotUndressingManager UndressingMgr;
- public WindowPartsMekureCheckBox MekureFront;
- public WindowPartsMekureCheckBox MekureBack;
- public WindowPartsMekureCheckBox Zurasi;
- private Dictionary<string, UIButton> unit_dic_ = new Dictionary<string, UIButton>();
- private PhotoNoCharaActive noCharaActive;
- private HashSet<Maid> activeMaidList = new HashSet<Maid>();
- private UIScrollView scroll_view_;
- }
|