using System; using System.Collections.Generic; using UnityEngine; 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; } 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) { 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) { this.m_MyIcon.mainTexture = this.m_MyPartsData.DefaultIcon; } 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; 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; } } }