123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using System;
- using UnityEngine;
- namespace CharacterEdit
- {
- public class HighlightSelector : MonoBehaviour
- {
- public HighlightSelector.SelectItem selectItem
- {
- get
- {
- UIWFTabButton selectButtonObject = this.panel.GetSelectButtonObject();
- foreach (HighlightSelector.Data data in this.datas)
- {
- if (selectButtonObject == data.button)
- {
- return data.type;
- }
- }
- return HighlightSelector.SelectItem.Eye;
- }
- set
- {
- foreach (HighlightSelector.Data data in this.datas)
- {
- if (value == data.type)
- {
- if (data.button != this.panel.GetSelectButtonObject())
- {
- this.panel.Select(data.button);
- }
- return;
- }
- }
- }
- }
- public bool visible
- {
- get
- {
- return base.gameObject.activeSelf;
- }
- set
- {
- base.gameObject.SetActive(value);
- }
- }
- private void Awake()
- {
- this.panel.UpdateChildren();
- this.selectItem = HighlightSelector.SelectItem.Eye;
- foreach (HighlightSelector.Data data in this.datas)
- {
- EventDelegate.Add(data.button.onSelect, new EventDelegate.Callback(this.OnClickEvetn));
- }
- }
- private void OnClickEvetn()
- {
- if (!UIWFSelectButton.current.isSelected)
- {
- return;
- }
- if (this.onChangeSelectItem != null)
- {
- this.onChangeSelectItem(this.selectItem);
- }
- }
- [SerializeField]
- private UIWFTabPanel panel;
- [SerializeField]
- private HighlightSelector.Data[] datas;
- public Action<HighlightSelector.SelectItem> onChangeSelectItem;
- public enum SelectItem
- {
- Eye,
- EyeR,
- EyeL
- }
- [Serializable]
- private struct Data
- {
- public MPN[] mpns
- {
- get
- {
- MPN[] result;
- if (this.type == HighlightSelector.SelectItem.Eye)
- {
- MPN[] array = new MPN[2];
- array[0] = MPN.eye_hi;
- result = array;
- array[1] = MPN.eye_hi_r;
- }
- else if (this.type == HighlightSelector.SelectItem.EyeR)
- {
- (result = new MPN[1])[0] = MPN.eye_hi_r;
- }
- else
- {
- (result = new MPN[1])[0] = MPN.eye_hi;
- }
- return result;
- }
- }
- [SerializeField]
- public HighlightSelector.SelectItem type;
- [SerializeField]
- public UIWFTabButton button;
- }
- }
- }
|