123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using System.Collections.Generic;
- using I2.Loc;
- using UnityEngine;
- public class HairLongWindow : BasePhotoWindow
- {
- public override string windowName
- {
- get
- {
- return "HairLongWindow";
- }
- }
- 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.hairf || SceneEdit.Instance.NowMPN == MPN.hairr || SceneEdit.Instance.NowMPN == MPN.hairs || SceneEdit.Instance.NowMPN == MPN.hairt))
- {
- if (SceneEdit.Instance.maid.IsBusy)
- {
- return;
- }
- if (this.m_mpnBackActive == MPN.null_mpn || this.m_mpnBackActive != SceneEdit.Instance.NowMPN || SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN).nFileNameRID != this.m_nRID)
- {
- this.ClearSliders();
- Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> hairLengthListFromMPN = SceneEdit.Instance.maid.body0.GetHairLengthListFromMPN(SceneEdit.Instance.NowMPN);
- if (hairLengthListFromMPN != null)
- {
- foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> f_kvNameAndHl in hairLengthListFromMPN)
- {
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(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)this.m_listSliders.Count, gameObject.transform.localPosition.z);
- gameObject.transform.localScale = this.m_goDummySlider.transform.localScale;
- gameObject.transform.localRotation = this.m_goDummySlider.transform.localRotation;
- gameObject.SetActive(true);
- this.m_listSliders.Add(new HairLongWindow.EditBone(gameObject, f_kvNameAndHl, SceneEdit.Instance.maid));
- }
- }
- this.WindowSize.y = 120f + (float)(this.m_listSliders.Count - 1) * 64f;
- base.ResizeWindow();
- }
- this.m_nRID = SceneEdit.Instance.maid.GetProp(SceneEdit.Instance.NowMPN).nFileNameRID;
- this.m_mpnBackActive = SceneEdit.Instance.NowMPN;
- }
- else
- {
- this.ClearSliders();
- this.m_nRID = 0;
- 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<HairLongWindow.EditBone> m_listSliders = new List<HairLongWindow.EditBone>();
- private int m_nRID;
- private class EditBone
- {
- public EditBone(GameObject f_goRoot, KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> f_kvNameAndHl, Maid f_maid)
- {
- this.root = f_goRoot;
- this.hl = f_kvNameAndHl.Value;
- this.m_maid = f_maid;
- this.label = this.root.transform.Find("Text").GetComponent<UILabel>();
- this.slider = this.root.GetComponent<PhotoSliderAndInput>();
- this.slider.MinNum = 0f;
- this.slider.MaxNum = 100f;
- this.slider.ResetNum = 50f;
- this.slider.onChangeValue.Add(new Action<float>(this.OnChangeValue));
- string str = string.Empty;
- string str2 = string.Empty;
- int num = f_kvNameAndHl.Key.Length - 1;
- while (0 <= num)
- {
- if ('1' > f_kvNameAndHl.Key[num] || f_kvNameAndHl.Key[num] > '9')
- {
- str = f_kvNameAndHl.Key.Substring(0, num + 1);
- str2 = f_kvNameAndHl.Key.Substring(num + 1, f_kvNameAndHl.Key.Length - (num + 1));
- break;
- }
- num--;
- }
- Localize localize = this.label.gameObject.GetComponent<Localize>();
- if (localize == null)
- {
- localize = this.label.gameObject.AddComponent<Localize>();
- }
- localize.SetTerm("SceneEdit/カテゴリー/サブ/" + str);
- UILabel uilabel = this.label;
- uilabel.text += str2;
- this.slider.value = (this.m_fBackValue = this.hl.GetLengthRate() * 100f);
- }
- public void OnChangeValue(float f_fValue)
- {
- this.hl.SetLengthRate(f_fValue / 100f);
- if (this.m_fBackValue != f_fValue)
- {
- this.m_maid.body0.HairLengthBlend();
- }
- this.m_fBackValue = f_fValue;
- }
- public void Remove()
- {
- UnityEngine.Object.DestroyImmediate(this.root);
- }
- public GameObject root;
- public UILabel label;
- public PhotoSliderAndInput slider;
- public TBodySkin.HairLengthCtrl.HairLength hl;
- private Maid m_maid;
- private float m_fBackValue = 50f;
- }
- }
|