1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using wf;
- namespace SceneEditWindow
- {
- [AddComponentMenu("SceneEditWindow/VoiceIconWindow")]
- public class VoiceIconWindow : BasePhotoWindow
- {
- public override string windowName
- {
- get
- {
- return "VoiceIconWindow";
- }
- }
- public override void Awake()
- {
- VoiceIconData.Create();
- base.Awake();
- for (int i = 0; i < VoiceIconData.ItemData.EmotionTexFileNames.Length; i++)
- {
- UIWFTabButton uiwftabButton = this.CreateItemObject(this.itemGrit.gameObject, VoiceIconData.ItemData.EmotionTexFileNames[i]);
- uiwftabButton.name = i.ToString();
- EventDelegate.Add(uiwftabButton.onClick, delegate()
- {
- this.OnClickItem((VoiceIconData.ItemData.EmotionType)int.Parse(UIButton.current.name));
- });
- }
- this.pitchInput.onChangeValue.Add(new Action<float>(this.OnChangePitchValue));
- this.UpdateChildren();
- }
- public override void Start()
- {
- base.Start();
- this.pitchInput.value = (float)this.sceneEdit.maid.VoicePitch;
- }
- public void OnChangePitchValue(float value)
- {
- this.sceneEdit.maid.VoicePitch = (int)value;
- }
- protected virtual void OnDestroy()
- {
- foreach (KeyValuePair<string, Texture> keyValuePair in this.texDic)
- {
- UnityEngine.Object.DestroyImmediate(keyValuePair.Value);
- }
- this.texDic.Clear();
- }
- protected void OnClickItem(VoiceIconData.ItemData.EmotionType emotionType)
- {
- if (this.onClickVoiceEvent != null)
- {
- this.onClickVoiceEvent(emotionType);
- }
- }
- protected UIWFTabButton CreateItemObject(GameObject parent, string textFileName)
- {
- GameObject gameObject = Utility.CreatePrefab(parent, "SceneEdit/WindowParts/PoseIconItem", true);
- if (!this.texDic.ContainsKey(textFileName))
- {
- this.texDic.Add(textFileName, ImportCM.CreateTexture(textFileName));
- }
- UITexture component = gameObject.GetComponent<UITexture>();
- component.mainTexture = this.texDic[textFileName];
- return gameObject.GetComponent<UIWFTabButton>();
- }
- [SerializeField]
- public SceneEdit sceneEdit;
- [SerializeField]
- private UIGrid itemGrit;
- [SerializeField]
- private PhotoSliderAndInput pitchInput;
- public Action<VoiceIconData.ItemData.EmotionType> onClickVoiceEvent;
- private Dictionary<string, Texture> texDic = new Dictionary<string, Texture>();
- }
- }
|