using System; using System.Collections.Generic; using System.IO; using I2.Loc; using UnityEngine; public class TatooAlphaWindow : BasePhotoWindow { public override string windowName { get { return "TatooWindow"; } } public override void Start() { base.Start(); this.m_goParent = base.transform.Find("Parent").gameObject; this.m_goDummySlider = base.transform.Find("Parent/ContentParent/GameObject/EditTool/InputScale").gameObject; this.m_goDummySlider.SetActive(false); this.visible = false; this.UpdateChildren(); } private void ClearSliders() { for (int i = 0; i < this.m_listSliders.Count; i++) { this.m_listSliders[i].Remove(); } this.m_listSliders.Clear(); } public override void Update() { if (SceneEdit.Instance != null && SceneEdit.Instance.maid != null && (SceneEdit.Instance.NowMPN == MPN.acctatoo || SceneEdit.Instance.NowMPN == MPN.hokuro)) { if (SceneEdit.Instance.maid.IsBusy) { return; } bool flag = this.m_mpnBackActive == MPN.null_mpn || this.m_mpnBackActive != SceneEdit.Instance.NowMPN; bool flag2 = false; if (!flag) { MaidProp prop = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN); if (prop.listSubProp == null) { if (this.m_listRID.Count != 0) { flag = true; } } else if (prop.listSubProp.Count == this.m_listRID.Count) { for (int i = 0; i < prop.listSubProp.Count; i++) { SubProp subProp = prop.listSubProp[i]; if ((subProp != null) ? (this.m_listRID[i].rid != subProp.nFileNameRID) : (this.m_listRID[i].rid != 0)) { flag = true; flag2 = true; break; } } } else { flag = true; flag2 = (prop.listSubProp.Count < this.m_listRID.Count); } } if (flag) { this.SetWindowTitleFromLocalizeTerm((SceneEdit.Instance.NowMPN != MPN.acctatoo) ? ((SceneEdit.Instance.NowMPN != MPN.hokuro) ? "SceneEdit/window/透明度/透明度" : "SceneEdit/window/透明度/ほくろ透明度") : "SceneEdit/window/透明度/タトゥー透明度"); this.ClearSliders(); SceneEdit.SCategory scategory = SceneEdit.Instance.CategoryList.Find((SceneEdit.SCategory a) => a.m_eCategory == ((SceneEdit.Instance.NowMPN != MPN.acctatoo) ? SceneEditInfo.EMenuCategory.頭 : SceneEditInfo.EMenuCategory.身体)); SceneEdit.SPartsType spartsType = scategory.m_listPartsType.Find((SceneEdit.SPartsType a) => a.m_mpn == SceneEdit.Instance.NowMPN); MaidProp prop2 = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN); if (prop2.listSubProp != null) { for (int j = 0; j < prop2.listSubProp.Count; j++) { SubProp sb = prop2.listSubProp[j]; if (sb != null) { GameObject gameObject = UnityEngine.Object.Instantiate(this.m_goDummySlider); gameObject.transform.SetParent(this.m_goDummySlider.transform.parent); gameObject.transform.localPosition = this.m_goDummySlider.transform.localPosition; gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x, 76f - 64f * (float)j, gameObject.transform.localPosition.z); gameObject.transform.localScale = this.m_goDummySlider.transform.localScale; gameObject.transform.localRotation = this.m_goDummySlider.transform.localRotation; gameObject.SetActive(true); SceneEdit.SMenuItem smenuItem = spartsType.m_listMenu.Find((SceneEdit.SMenuItem a) => a.m_nMenuFileRID == sb.nFileNameRID); if (flag2) { TatooAlphaWindow.RIDS rids = this.m_listRID.Find((TatooAlphaWindow.RIDS a) => a.rid == sb.nFileNameRID); if (rids != null) { sb.fTexMulAlpha = rids.alpha; } } string f_name = smenuItem.m_strMenuName; if (Product.systemLanguage != Product.Language.Japanese) { string str = smenuItem.m_strCateName + "/" + Path.GetFileNameWithoutExtension(smenuItem.m_strMenuFileName).ToLower(); string translation = LocalizationManager.GetTranslation(str + "|name", true, 0, true, false, null, null); f_name = ((!string.IsNullOrEmpty(translation)) ? translation.Replace("《改行》", "\n") : smenuItem.m_strMenuName); } this.m_listSliders.Add(new TatooAlphaWindow.EditAlpha(gameObject, SceneEdit.Instance.NowMPN, j, f_name, sb.fTexMulAlpha, SceneEdit.Instance.maid)); } } } if (flag2) { SceneEdit.Instance.maid.body0.MulTexProc(); } } this.m_listRID.Clear(); MaidProp prop3 = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN); if (prop3.listSubProp != null) { for (int k = 0; k < prop3.listSubProp.Count; k++) { SubProp subProp2 = prop3.listSubProp[k]; if (subProp2 != null) { this.m_listRID.Add(new TatooAlphaWindow.RIDS { rid = subProp2.nFileNameRID, alpha = subProp2.fTexMulAlpha }); } else { this.m_listRID.Add(null); } } } else { this.m_listRID.Clear(); } this.m_mpnBackActive = SceneEdit.Instance.NowMPN; } else { this.ClearSliders(); this.m_listRID.Clear(); this.m_mpnBackActive = MPN.null_mpn; } if (this.visible != (this.m_listSliders.Count != 0)) { this.visible = (this.m_listSliders.Count != 0); } } private GameObject m_goParent; private GameObject m_goDummySlider; private MPN m_mpnBackActive; private List m_listSliders = new List(); private List m_listRID = new List(); private class EditAlpha { public EditAlpha(GameObject f_goRoot, MPN f_mpn, int f_id, string f_name, float f_fDefVal, Maid f_maid) { this.root = f_goRoot; this.mpn = f_mpn; this.id = f_id; this.name = f_name; this.m_maid = f_maid; this.label = this.root.transform.Find("Text").GetComponent(); this.slider = this.root.GetComponent(); this.slider.MinNum = 0f; this.slider.MaxNum = 100f; this.slider.ResetNum = 50f; this.slider.onChangeValue.Add(new Action(this.OnChangeValue)); this.label.text = this.name; this.slider.value = (this.m_fBackValue = f_fDefVal * 100f); } public void OnChangeValue(float f_fValue) { this.m_maid.SubPropAlpha(this.mpn, this.id, f_fValue / 100f); if (this.m_fBackValue != f_fValue) { this.m_maid.body0.MulTexProc(); } this.m_fBackValue = f_fValue; } public void Remove() { UnityEngine.Object.DestroyImmediate(this.root); } public GameObject root; public UILabel label; public PhotoSliderAndInput slider; public MPN mpn; public int id; public string name; private Maid m_maid; private float m_fBackValue = 100f; } private class RIDS { public int rid; public float alpha; } }