TatooAlphaWindow.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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.SetWindowTitleFromLocalizeTerm((SceneEdit.Instance.NowMPN != MPN.acctatoo) ? ((SceneEdit.Instance.NowMPN != MPN.hokuro) ? "SceneEdit/window/透明度/透明度" : "SceneEdit/window/透明度/ほくろ透明度") : "SceneEdit/window/透明度/タトゥー透明度");
  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. string strMenuName = smenuItem.m_strMenuName;
  100. this.m_listSliders.Add(new TatooAlphaWindow.EditAlpha(gameObject, SceneEdit.Instance.NowMPN, j, strMenuName, sb.fTexMulAlpha, SceneEdit.Instance.maid));
  101. }
  102. }
  103. }
  104. if (flag2)
  105. {
  106. SceneEdit.Instance.maid.body0.MulTexProc();
  107. }
  108. }
  109. this.m_listRID.Clear();
  110. MaidProp prop3 = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN);
  111. if (prop3.listSubProp != null)
  112. {
  113. for (int k = 0; k < prop3.listSubProp.Count; k++)
  114. {
  115. SubProp subProp2 = prop3.listSubProp[k];
  116. if (subProp2 != null)
  117. {
  118. this.m_listRID.Add(new TatooAlphaWindow.RIDS
  119. {
  120. rid = subProp2.nFileNameRID,
  121. alpha = subProp2.fTexMulAlpha
  122. });
  123. }
  124. else
  125. {
  126. this.m_listRID.Add(null);
  127. }
  128. }
  129. }
  130. else
  131. {
  132. this.m_listRID.Clear();
  133. }
  134. this.m_mpnBackActive = SceneEdit.Instance.NowMPN;
  135. }
  136. else
  137. {
  138. this.ClearSliders();
  139. this.m_listRID.Clear();
  140. this.m_mpnBackActive = MPN.null_mpn;
  141. }
  142. if (this.visible != (this.m_listSliders.Count != 0))
  143. {
  144. this.visible = (this.m_listSliders.Count != 0);
  145. }
  146. }
  147. private GameObject m_goParent;
  148. private GameObject m_goDummySlider;
  149. private MPN m_mpnBackActive;
  150. private List<TatooAlphaWindow.EditAlpha> m_listSliders = new List<TatooAlphaWindow.EditAlpha>();
  151. private List<TatooAlphaWindow.RIDS> m_listRID = new List<TatooAlphaWindow.RIDS>();
  152. private class EditAlpha
  153. {
  154. public EditAlpha(GameObject f_goRoot, MPN f_mpn, int f_id, string f_name, float f_fDefVal, Maid f_maid)
  155. {
  156. this.root = f_goRoot;
  157. this.mpn = f_mpn;
  158. this.id = f_id;
  159. this.name = f_name;
  160. this.m_maid = f_maid;
  161. this.label = this.root.transform.Find("Text").GetComponent<UILabel>();
  162. this.slider = this.root.GetComponent<PhotoSliderAndInput>();
  163. this.slider.MinNum = 0f;
  164. this.slider.MaxNum = 100f;
  165. this.slider.ResetNum = 50f;
  166. this.slider.onChangeValue.Add(new Action<float>(this.OnChangeValue));
  167. this.label.text = this.name;
  168. this.slider.value = (this.m_fBackValue = f_fDefVal * 100f);
  169. }
  170. public void OnChangeValue(float f_fValue)
  171. {
  172. this.m_maid.SubPropAlpha(this.mpn, this.id, f_fValue / 100f);
  173. if (this.m_fBackValue != f_fValue)
  174. {
  175. this.m_maid.body0.MulTexProc();
  176. }
  177. this.m_fBackValue = f_fValue;
  178. }
  179. public void Remove()
  180. {
  181. UnityEngine.Object.DestroyImmediate(this.root);
  182. }
  183. public GameObject root;
  184. public UILabel label;
  185. public PhotoSliderAndInput slider;
  186. public MPN mpn;
  187. public int id;
  188. public string name;
  189. private Maid m_maid;
  190. private float m_fBackValue = 100f;
  191. }
  192. private class RIDS
  193. {
  194. public int rid;
  195. public float alpha;
  196. }
  197. }