using System; using System.Collections.Generic; using UnityEngine; using wf; namespace Dance { public class UndressItem : MonoBehaviour { private UndressDance_Mgr.PartsData m_MyPartsData { get { return UndressDance_Mgr.Instance.GetPartsData(this.m_MyMpn); } } public bool IsUndress { get { return this.m_MaidPartsiconPair[UndressDance_Mgr.Instance.SelectMaid].IsUndress; } } public bool IsEnable { get { return this.m_MyButton.isEnabled; } } public void Init(MPN mpn) { this.m_MyButton = base.GetComponent(); this.m_MyIcon = base.GetComponent(); this.m_MyMpn = mpn; this.m_MyIcon.mainTexture = this.m_MyPartsData.DefaultIcon; EventDelegate.Add(this.m_MyButton.onClick, new EventDelegate.Callback(this.SwitchMask)); } public void AddMaidData(Maid maid) { if (!maid || this.m_MaidPartsiconPair.ContainsKey(maid)) { return; } if (maid.IsCrcBody) { this.m_MaidPartsiconPair[maid] = new UndressItem.MaidInfo(null, false); } else { MaidProp prop = maid.GetProp(this.m_MyMpn); SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem(); SceneEdit.InitMenuItemScript(smenuItem, prop.strFileName, false); if (smenuItem.m_texIconRef) { this.m_MaidPartsiconPair.Add(maid, new UndressItem.MaidInfo(smenuItem.m_texIconRef, false)); } } } public void UpdateState(Maid maid) { if (maid.IsCrcBody) { this.m_MyButton.isEnabled = false; foreach (MPN parentMpn in this.m_MyPartsData.Mpnlist) { if (maid.body0.GetSlotLoaded(parentMpn)) { this.m_MyButton.isEnabled = true; break; } } if (this.m_MyPartsData.Mpnlist.Count <= 0 && this.m_MyButton.gameObject.activeSelf) { this.m_MyButton.gameObject.SetActive(false); Utility.ResetNGUI(this.m_MyButton.transform.parent.GetComponent()); } } else { string strFileName = maid.GetProp(this.m_MyMpn).strFileName; this.m_MyButton.isEnabled = (!string.IsNullOrEmpty(strFileName) && strFileName.IndexOf("_del") < 0 && this.m_MaidPartsiconPair.ContainsKey(maid)); } if (!this.m_MyButton.isEnabled || maid.IsCrcBody) { this.m_MyIcon.mainTexture = this.m_MyPartsData.DefaultIcon; if (maid.IsCrcBody) { this.m_MyButton.defaultColor = (this.m_MyButton.hover = ((!this.m_MaidPartsiconPair[maid].IsUndress) ? this.m_DefaultColor : this.m_UndressColor)); } } else { this.m_MyIcon.mainTexture = this.m_MaidPartsiconPair[maid].ItemIcon; this.m_MyButton.defaultColor = (this.m_MyButton.hover = ((!this.m_MaidPartsiconPair[maid].IsUndress) ? this.m_DefaultColor : this.m_UndressColor)); } } public void SetMaidMask(Maid maid, bool is_mask_on) { if (!this.IsEnable) { return; } if (!this.m_MaidPartsiconPair.ContainsKey(maid)) { return; } if (this.m_MaidPartsiconPair[maid].IsUndress == is_mask_on) { return; } this.m_MaidPartsiconPair[maid].IsUndress = is_mask_on; if (maid.IsCrcBody) { foreach (MPN parentMpn in this.m_MyPartsData.Mpnlist) { maid.body0.SetMask(parentMpn, !is_mask_on); } } else { foreach (TBody.SlotID f_eSlot in this.m_MyPartsData.SlotIDlist) { maid.body0.SetMask(f_eSlot, !is_mask_on); } } this.UpdateState(maid); UndressDance_Mgr.Instance.ChangeSexsualPoint(this.m_MyMpn); } public void SwitchMask() { Maid selectMaid = UndressDance_Mgr.Instance.SelectMaid; this.SetMaidMask(selectMaid, !this.m_MaidPartsiconPair[selectMaid].IsUndress); } [SerializeField] private Color m_DefaultColor = Color.white; [SerializeField] private Color m_UndressColor = Color.white; private UIButton m_MyButton; private UITexture m_MyIcon; private MPN m_MyMpn; private Dictionary m_MaidPartsiconPair = new Dictionary(); private class MaidInfo { public MaidInfo(Texture icon, bool is_undress) { this.ItemIcon = icon; this.IsUndress = is_undress; } public bool IsUndress; public Texture ItemIcon; } } }