using System; using System.Collections.Generic; using I2.Loc; using UnityEngine; using wf; public class UndressingWindow : BaseMaidPhotoWindow { public override void Awake() { base.Awake(); this.noCharaActive = base.GetComponentInChildren(); this.scroll_view_ = NGUITools.FindInParents(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); UILabel componentInChildren = gameObject.GetComponentInChildren(); Localize component = componentInChildren.GetComponent(); componentInChildren.text = gameObject.name; if (component != null) { component.SetTerm("ScenePhotoMode/脱衣設定/項目/" + gameObject.name); } UIButton componentInChildren2 = gameObject.GetComponentInChildren(); componentInChildren2.defaultColor = Color.white; componentInChildren2.disabledColor = new Color(0.15f, 0.15f, 0.15f); this.unit_dic_.Add(gameObject.name, componentInChildren2); } } } } this.UndressingMgr.SetUnitButtonList(this.unit_dic_); this.UndressingMgr.onClickEvent = new Action(this.OnStoreDataUpdate); NGUITools.FindInParents(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 maidStoreData = base.GetMaidStoreData(maid); HashSet 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 keyValuePair in new Dictionary { { "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 maidStoreData = base.GetMaidStoreData(select_maid); maidStoreData.Clear(); HashSet 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 keyValuePair in new Dictionary { { "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 unit_dic_ = new Dictionary(); private PhotoNoCharaActive noCharaActive; private HashSet activeMaidList = new HashSet(); private UIScrollView scroll_view_; }