Пример #1
0
            public void Rebuild(AnimationTreeParameter[] source)
            {
                for (int i = 0; i < _Params.Length; i++)
                {
                    string parameter = GetParameter(i);
                    _Params[i].Options.Clear();
                    int value = 0;
                    Skill.Editor.UI.PopupOption selectedOP = null;

                    if (source != null)
                    {
                        foreach (var p in source)
                        {
                            if (p.Type == _ParamType)
                            {
                                Skill.Editor.UI.PopupOption op = new UI.PopupOption(value++, p.Name);
                                this._Params[i].Options.Add(op);
                                if (p.Name == parameter)
                                {
                                    selectedOP = op;
                                }
                            }
                        }
                    }
                    this._Params[i].SelectedOption = selectedOP;
                }
            }
Пример #2
0
            protected override void RefreshData()
            {
                base.RefreshData();

                if (_ClipField == null)
                {
                    foreach (var c in Controls)
                    {
                        if (_ClipField == null && c is Skill.Editor.UI.UntypedObjectField)
                        {
                            if (((Skill.Editor.UI.UntypedObjectField)c).ObjectType == typeof(AudioClip))
                            {
                                _ClipField = (Skill.Editor.UI.UntypedObjectField)c;
                                _ClipField.ObjectChanged += _ClipField_ObjectChanged;
                            }
                        }
                        else if (c is Skill.Editor.UI.FloatField)
                        {
                            Skill.Editor.UI.FloatField ff = (Skill.Editor.UI.FloatField)c;

                            if (ff.Label.text == "Start" || ff.Label.text == "End")
                            {
                                ff.ValueChanged += StartEnd_ValueChanged;
                            }
                        }
                    }
                }

                _BtnPreview.IsPressed = false;
                _BreakPointsEditor.RefreshData();
                _NextStateOptions.Options.Clear();
                AudioStateGraphEditor editor = _Node.FindInParents <AudioStateGraphEditor>();

                AudioStateNode[] states = editor.GetStates();

                Skill.Editor.UI.PopupOption noneOp = new Skill.Editor.UI.PopupOption(-1, " ");
                _NextStateOptions.Options.Add(noneOp);

                Skill.Editor.UI.PopupOption selectedOp = noneOp;
                for (int i = 0; i < states.Length; i++)
                {
                    if (states[i] == _Node)
                    {
                        continue;
                    }
                    Skill.Editor.UI.PopupOption op = new Skill.Editor.UI.PopupOption(i, states[i].StateName);
                    op.UserData = states[i];
                    if (states[i] == _Node.NextState)
                    {
                        selectedOp = op;
                    }
                    _NextStateOptions.Options.Add(op);
                }
                _NextStateOptions.SelectedOption = selectedOp;
            }
Пример #3
0
        private void RebuildComponent()
        {
            _Component.Options.Clear();

            int selectedIndex = -1;

            if (_Object.Object != null)
            {
                Component[] components = _Object.Object.GetComponents <Component>();
                if (components != null)
                {
                    for (int i = 0; i < components.Length; i++)
                    {
                        Component c = components[i];
                        Skill.Editor.UI.PopupOption option = new Skill.Editor.UI.PopupOption(i, GetComponentName(c))
                        {
                            UserData = c
                        };
                        _Component.Options.Add(option);
                        if (((PropertyTrack <V>)base.Item.Track).Component == c)
                        {
                            selectedIndex = i;
                        }
                    }
                }
            }
            else
            {
                ((PropertyTrack <V>)base.Item.Track).Component = null;
            }

            _Component.SelectedIndex = selectedIndex;
            if (_Component.SelectedOption != null)
            {
                ((PropertyTrack <V>)base.Item.Track).Component = (Component)_Component.SelectedOption.UserData;
            }
            else
            {
                ((PropertyTrack <V>)base.Item.Track).Component = null;
            }
            RebuildProperties();
        }
Пример #4
0
        private void RebuildProperties()
        {
            _Property.Options.Clear();
            int selectedIndex = -1;

            if (_Component.SelectedOption != null)
            {
                Component      c             = (Component)_Component.SelectedOption.UserData;
                PropertyInfo[] propertyinfos = c.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);

                int index = 0;
                if (propertyinfos != null)
                {
                    for (int i = 0; i < propertyinfos.Length; i++)
                    {
                        PropertyInfo info = propertyinfos[i];
                        if (info.PropertyType == ((PropertyTrack <V>)base.Item.Track).PropertyType && info.CanWrite)
                        {
                            Skill.Editor.UI.PopupOption option = new Skill.Editor.UI.PopupOption(index, info.Name)
                            {
                                UserData = info.Name
                            };
                            _Property.Options.Add(option);

                            if (((PropertyTrack <V>)base.Item.Track).PropertyName == info.Name)
                            {
                                selectedIndex = index;
                            }
                            index++;
                        }
                    }
                }

                FieldInfo[] fieldInfos = c.GetType().GetFields();

                index = 0;
                if (fieldInfos != null)
                {
                    for (int i = 0; i < fieldInfos.Length; i++)
                    {
                        FieldInfo info = fieldInfos[i];
                        Skill.Editor.UI.PopupOption option = new Skill.Editor.UI.PopupOption(index, info.Name)
                        {
                            UserData = info.Name
                        };
                        _Property.Options.Add(option);

                        if (((PropertyTrack <V>)base.Item.Track).PropertyName == info.Name)
                        {
                            selectedIndex = index;
                        }
                        index++;
                    }
                }
            }
            else
            {
                ((PropertyTrack <V>)base.Item.Track).PropertyName = null;
            }

            _Property.SelectedIndex = selectedIndex;
            if (_Property.SelectedOption != null)
            {
                ((PropertyTrack <V>)base.Item.Track).PropertyName = (string)_Property.SelectedOption.UserData;
            }
            else
            {
                ((PropertyTrack <V>)base.Item.Track).PropertyName = null;
            }
        }