コード例 #1
0
ファイル: UIControlEditor.cs プロジェクト: equalent/FlaxAPI
        private void SetType(Type controlType)
        {
            var uiControls = ParentEditor.Values;

            if (Presenter.Undo != null)
            {
                using (new UndoMultiBlock(Presenter.Undo, uiControls, "Set Control Type"))
                {
                    for (int i = 0; i < uiControls.Count; i++)
                    {
                        var uiControl = (UIControl)uiControls[i];
                        uiControl.Control = (Control)Activator.CreateInstance(controlType);
                    }
                }
            }
            else
            {
                for (int i = 0; i < uiControls.Count; i++)
                {
                    var uiControl = (UIControl)uiControls[i];
                    uiControl.Control = (Control)Activator.CreateInstance(controlType);
                }
            }

            ParentEditor.RebuildLayout();
        }
コード例 #2
0
        /// <inheritdoc />
        public override void Refresh()
        {
            if (Values.Count == 1)
            {
                var scripts = ((Actor)ParentEditor.Values[0]).Scripts;
                if (!Utils.ArraysEqual(scripts, _scripts))
                {
                    ParentEditor.RebuildLayout();
                    return;
                }
            }

            base.Refresh();
        }
コード例 #3
0
        /// <inheritdoc />
        public override void Refresh()
        {
            base.Refresh();

            // Check if type has been modified outside the editor (eg. from code)
            if (Type != _type)
            {
                if (ParentEditor != null)
                {
                    ParentEditor.RebuildLayout();
                }
                else
                {
                    RebuildLayout();
                }
            }
        }
コード例 #4
0
        /// <inheritdoc />
        public override void Refresh()
        {
            if (Values.Count == 1)
            {
                var scripts = ((Actor)ParentEditor.Values[0]).Scripts;
                if (!Utils.ArraysEqual(scripts, _scripts))
                {
                    ParentEditor.RebuildLayout();
                    return;
                }

                for (int i = 0; i < _scriptToggles.Length; i++)
                {
                    if (_scriptToggles[i] != null)
                    {
                        _scriptToggles[i].Checked = scripts[i].Enabled;
                    }
                }
            }

            base.Refresh();
        }