TatooAlphaWindow.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TatooAlphaWindow : BasePhotoWindow
  5. {
  6. public override string windowName
  7. {
  8. get
  9. {
  10. return "TatooWindow";
  11. }
  12. }
  13. public override void Start()
  14. {
  15. base.Start();
  16. this.m_goParent = base.transform.Find("Parent").gameObject;
  17. this.m_goDummySlider = base.transform.Find("Parent/ContentParent/GameObject/EditTool/InputScale").gameObject;
  18. this.m_goDummySlider.SetActive(false);
  19. this.visible = false;
  20. this.UpdateChildren();
  21. }
  22. private void ClearSliders()
  23. {
  24. for (int i = 0; i < this.m_listSliders.Count; i++)
  25. {
  26. this.m_listSliders[i].Remove();
  27. }
  28. this.m_listSliders.Clear();
  29. }
  30. public override void Update()
  31. {
  32. if (SceneEdit.Instance != null && SceneEdit.Instance.maid != null && (SceneEdit.Instance.NowMPN == MPN.acctatoo || SceneEdit.Instance.NowMPN == MPN.hokuro))
  33. {
  34. if (SceneEdit.Instance.maid.IsBusy)
  35. {
  36. return;
  37. }
  38. bool flag = this.m_mpnBackActive == MPN.null_mpn || this.m_mpnBackActive != SceneEdit.Instance.NowMPN;
  39. bool flag2 = false;
  40. if (!flag)
  41. {
  42. MaidProp prop = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN);
  43. if (prop.listSubProp == null)
  44. {
  45. if (this.m_listRID.Count != 0)
  46. {
  47. flag = true;
  48. }
  49. }
  50. else if (prop.listSubProp.Count == this.m_listRID.Count)
  51. {
  52. for (int i = 0; i < prop.listSubProp.Count; i++)
  53. {
  54. SubProp subProp = prop.listSubProp[i];
  55. if ((subProp != null) ? (this.m_listRID[i].rid != subProp.nFileNameRID) : (this.m_listRID[i].rid != 0))
  56. {
  57. flag = true;
  58. flag2 = true;
  59. break;
  60. }
  61. }
  62. }
  63. else
  64. {
  65. flag = true;
  66. flag2 = (prop.listSubProp.Count < this.m_listRID.Count);
  67. }
  68. }
  69. if (flag)
  70. {
  71. this.SetWindowTitle((SceneEdit.Instance.NowMPN != MPN.acctatoo) ? ((SceneEdit.Instance.NowMPN != MPN.hokuro) ? "透明度" : "ほくろ透明度") : "タトゥー透明度");
  72. this.ClearSliders();
  73. SceneEdit.SCategory scategory = SceneEdit.Instance.CategoryList.Find((SceneEdit.SCategory a) => a.m_eCategory == ((SceneEdit.Instance.NowMPN != MPN.acctatoo) ? SceneEditInfo.EMenuCategory.頭 : SceneEditInfo.EMenuCategory.身体));
  74. SceneEdit.SPartsType spartsType = scategory.m_listPartsType.Find((SceneEdit.SPartsType a) => a.m_mpn == SceneEdit.Instance.NowMPN);
  75. MaidProp prop2 = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN);
  76. if (prop2.listSubProp != null)
  77. {
  78. for (int j = 0; j < prop2.listSubProp.Count; j++)
  79. {
  80. SubProp sb = prop2.listSubProp[j];
  81. if (sb != null)
  82. {
  83. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goDummySlider);
  84. gameObject.transform.SetParent(this.m_goDummySlider.transform.parent);
  85. gameObject.transform.localPosition = this.m_goDummySlider.transform.localPosition;
  86. gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x, 76f - 64f * (float)j, gameObject.transform.localPosition.z);
  87. gameObject.transform.localScale = this.m_goDummySlider.transform.localScale;
  88. gameObject.transform.localRotation = this.m_goDummySlider.transform.localRotation;
  89. gameObject.SetActive(true);
  90. SceneEdit.SMenuItem smenuItem = spartsType.m_listMenu.Find((SceneEdit.SMenuItem a) => a.m_nMenuFileRID == sb.nFileNameRID);
  91. if (flag2)
  92. {
  93. TatooAlphaWindow.RIDS rids = this.m_listRID.Find((TatooAlphaWindow.RIDS a) => a.rid == sb.nFileNameRID);
  94. if (rids != null)
  95. {
  96. sb.fTexMulAlpha = rids.alpha;
  97. }
  98. }
  99. this.m_listSliders.Add(new TatooAlphaWindow.EditAlpha(gameObject, SceneEdit.Instance.NowMPN, j, smenuItem.m_strMenuName, sb.fTexMulAlpha, SceneEdit.Instance.maid));
  100. }
  101. }
  102. }
  103. if (flag2)
  104. {
  105. SceneEdit.Instance.maid.body0.MulTexProc();
  106. }
  107. }
  108. this.m_listRID.Clear();
  109. MaidProp prop3 = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN);
  110. if (prop3.listSubProp != null)
  111. {
  112. for (int k = 0; k < prop3.listSubProp.Count; k++)
  113. {
  114. SubProp subProp2 = prop3.listSubProp[k];
  115. if (subProp2 != null)
  116. {
  117. this.m_listRID.Add(new TatooAlphaWindow.RIDS
  118. {
  119. rid = subProp2.nFileNameRID,
  120. alpha = subProp2.fTexMulAlpha
  121. });
  122. }
  123. else
  124. {
  125. this.m_listRID.Add(null);
  126. }
  127. }
  128. }
  129. else
  130. {
  131. this.m_listRID.Clear();
  132. }
  133. this.m_mpnBackActive = SceneEdit.Instance.NowMPN;
  134. }
  135. else
  136. {
  137. this.ClearSliders();
  138. this.m_listRID.Clear();
  139. this.m_mpnBackActive = MPN.null_mpn;
  140. }
  141. if (this.visible != (this.m_listSliders.Count != 0))
  142. {
  143. this.visible = (this.m_listSliders.Count != 0);
  144. }
  145. }
  146. private GameObject m_goParent;
  147. private GameObject m_goDummySlider;
  148. private MPN m_mpnBackActive;
  149. private List<TatooAlphaWindow.EditAlpha> m_listSliders = new List<TatooAlphaWindow.EditAlpha>();
  150. private List<TatooAlphaWindow.RIDS> m_listRID = new List<TatooAlphaWindow.RIDS>();
  151. private class EditAlpha
  152. {
  153. public EditAlpha(GameObject f_goRoot, MPN f_mpn, int f_id, string f_name, float f_fDefVal, Maid f_maid)
  154. {
  155. this.root = f_goRoot;
  156. this.mpn = f_mpn;
  157. this.id = f_id;
  158. this.name = f_name;
  159. this.m_maid = f_maid;
  160. this.label = this.root.transform.Find("Text").GetComponent<UILabel>();
  161. this.slider = this.root.GetComponent<PhotoSliderAndInput>();
  162. this.slider.MinNum = 0f;
  163. this.slider.MaxNum = 100f;
  164. this.slider.ResetNum = 50f;
  165. this.slider.onChangeValue.Add(new Action<float>(this.OnChangeValue));
  166. this.label.text = this.name;
  167. this.slider.value = (this.m_fBackValue = f_fDefVal * 100f);
  168. }
  169. public void OnChangeValue(float f_fValue)
  170. {
  171. this.m_maid.SubPropAlpha(this.mpn, this.id, f_fValue / 100f);
  172. if (this.m_fBackValue != f_fValue)
  173. {
  174. this.m_maid.body0.MulTexProc();
  175. }
  176. this.m_fBackValue = f_fValue;
  177. }
  178. public void Remove()
  179. {
  180. UnityEngine.Object.DestroyImmediate(this.root);
  181. }
  182. public GameObject root;
  183. public UILabel label;
  184. public PhotoSliderAndInput slider;
  185. public MPN mpn;
  186. public int id;
  187. public string name;
  188. private Maid m_maid;
  189. private float m_fBackValue = 100f;
  190. }
  191. private class RIDS
  192. {
  193. public int rid;
  194. public float alpha;
  195. }
  196. }