TatooAlphaWindow.cs 6.7 KB

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