123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- 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<UIButton>();
- this.m_MyIcon = base.GetComponent<UITexture>();
- 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<UIGrid>());
- }
- }
- 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<Maid, UndressItem.MaidInfo> m_MaidPartsiconPair = new Dictionary<Maid, UndressItem.MaidInfo>();
- private class MaidInfo
- {
- public MaidInfo(Texture icon, bool is_undress)
- {
- this.ItemIcon = icon;
- this.IsUndress = is_undress;
- }
- public bool IsUndress;
- public Texture ItemIcon;
- }
- }
- }
|