UndressItem.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Dance
  5. {
  6. public class UndressItem : MonoBehaviour
  7. {
  8. private UndressDance_Mgr.PartsData m_MyPartsData
  9. {
  10. get
  11. {
  12. return UndressDance_Mgr.Instance.GetPartsData(this.m_MyMpn);
  13. }
  14. }
  15. public bool IsUndress
  16. {
  17. get
  18. {
  19. return this.m_MaidPartsiconPair[UndressDance_Mgr.Instance.SelectMaid].IsUndress;
  20. }
  21. }
  22. public bool IsEnable
  23. {
  24. get
  25. {
  26. return this.m_MyButton.isEnabled;
  27. }
  28. }
  29. public void Init(MPN mpn)
  30. {
  31. this.m_MyButton = base.GetComponent<UIButton>();
  32. this.m_MyIcon = base.GetComponent<UITexture>();
  33. this.m_MyMpn = mpn;
  34. this.m_MyIcon.mainTexture = this.m_MyPartsData.DefaultIcon;
  35. EventDelegate.Add(this.m_MyButton.onClick, new EventDelegate.Callback(this.SwitchMask));
  36. }
  37. public void AddMaidData(Maid maid)
  38. {
  39. if (this.m_MaidPartsiconPair.ContainsKey(maid))
  40. {
  41. return;
  42. }
  43. MaidProp prop = maid.GetProp(this.m_MyMpn);
  44. SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem();
  45. SceneEdit.InitMenuItemScript(smenuItem, prop.strFileName, false);
  46. if (smenuItem.m_texIcon)
  47. {
  48. this.m_MaidPartsiconPair.Add(maid, new UndressItem.MaidInfo(smenuItem.m_texIcon, false));
  49. }
  50. }
  51. public void UpdateState(Maid maid)
  52. {
  53. string strFileName = maid.GetProp(this.m_MyMpn).strFileName;
  54. this.m_MyButton.isEnabled = (!string.IsNullOrEmpty(strFileName) && strFileName.IndexOf("_del") < 0 && this.m_MaidPartsiconPair.ContainsKey(maid));
  55. if (!this.m_MyButton.isEnabled)
  56. {
  57. this.m_MyIcon.mainTexture = this.m_MyPartsData.DefaultIcon;
  58. }
  59. else
  60. {
  61. this.m_MyIcon.mainTexture = this.m_MaidPartsiconPair[maid].ItemIcon;
  62. this.m_MyButton.defaultColor = (this.m_MyButton.hover = ((!this.m_MaidPartsiconPair[maid].IsUndress) ? this.m_DefaultColor : this.m_UndressColor));
  63. }
  64. }
  65. public void SetMaidMask(Maid maid, bool is_mask_on)
  66. {
  67. if (!this.IsEnable)
  68. {
  69. return;
  70. }
  71. if (!this.m_MaidPartsiconPair.ContainsKey(maid))
  72. {
  73. return;
  74. }
  75. if (this.m_MaidPartsiconPair[maid].IsUndress == is_mask_on)
  76. {
  77. return;
  78. }
  79. this.m_MaidPartsiconPair[maid].IsUndress = is_mask_on;
  80. foreach (TBody.SlotID f_eSlot in this.m_MyPartsData.SlotIDlist)
  81. {
  82. maid.body0.SetMask(f_eSlot, !is_mask_on);
  83. }
  84. this.UpdateState(maid);
  85. UndressDance_Mgr.Instance.ChangeSexsualPoint(this.m_MyMpn);
  86. }
  87. public void SwitchMask()
  88. {
  89. Maid selectMaid = UndressDance_Mgr.Instance.SelectMaid;
  90. this.SetMaidMask(selectMaid, !this.m_MaidPartsiconPair[selectMaid].IsUndress);
  91. }
  92. [SerializeField]
  93. private Color m_DefaultColor = Color.white;
  94. [SerializeField]
  95. private Color m_UndressColor = Color.white;
  96. private UIButton m_MyButton;
  97. private UITexture m_MyIcon;
  98. private MPN m_MyMpn;
  99. private Dictionary<Maid, UndressItem.MaidInfo> m_MaidPartsiconPair = new Dictionary<Maid, UndressItem.MaidInfo>();
  100. private class MaidInfo
  101. {
  102. public MaidInfo(Texture icon, bool is_undress)
  103. {
  104. this.ItemIcon = icon;
  105. this.IsUndress = is_undress;
  106. }
  107. public bool IsUndress;
  108. public Texture ItemIcon;
  109. }
  110. }
  111. }