Esempio n. 1
0
        public ViewLayout(TopLevelView view, float windowTop, ScaleSettings scaling)
        {
            _viewRect = view.viewArea;
            _scaling  = scaling;

            _localViewRange = new XRange(scaling.selectorResizeMargin, _viewRect.xMax - _viewRect.xMin - (2f * scaling.selectorResizeMargin));

            var ymin = Mathf.Max(_viewRect.y, windowTop);

            _leftResizeArea  = new Rect(_viewRect.xMin, ymin, scaling.selectorResizeMargin, _viewRect.height);
            _rightResizeArea = new Rect(_viewRect.xMax - scaling.selectorResizeMargin, ymin, scaling.selectorResizeMargin, _viewRect.height);
        }
Esempio n. 2
0
        internal bool RemoveView(TopLevelView view)
        {
            var sv = view as SelectorView;

            if (sv != null)
            {
                return(RemoveSelector(sv));
            }

            var lv = view as AILinkView;

            if (lv != null)
            {
                RemoveAILink(lv);
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        internal void MultiSelectView(TopLevelView view)
        {
            if (!_selectedViews.Contains(view))
            {
                _selectedViews.Add(view);
            }
            else
            {
                _selectedViews.Remove(view);
            }

            if (_selectedViews.Count == 1)
            {
                view             = _selectedViews[0];
                _currentSelector = view as SelectorView;
                _currentAILink   = view as AILinkView;
            }
            else
            {
                ResetSingleSelection(false);
            }

            this.inspectorState.Refresh();
        }
Esempio n. 4
0
        internal bool Connect(QualifierView qv, TopLevelView targetView)
        {
            ActionView av = null;

            var sv = targetView as SelectorView;

            if (sv != null)
            {
                if (sv.selector.IsConnectedTo(qv.parent.selector))
                {
                    EditorUtility.DisplayDialog("Invalid Action", "Circular connections are not allowed.", "Ok");
                    return(false);
                }

                //Composite actions may also act as selectors as the last step
                var cav = qv.actionView as CompositeActionView;
                if (cav != null)
                {
                    var ca           = (CompositeAction)cav.action;
                    var newConnector = new SelectorAction(sv.selector);

                    _undoRedo.Do(new ConnectCompositeOperation(cav, ca.connectorAction, newConnector));
                    ca.connectorAction = newConnector;
                    cav.targetView     = null;
                    return(true);
                }

                av = new SelectorActionView
                {
                    targetSelector = sv,
                    action         = new SelectorAction(sv.selector),
                    parent         = qv
                };
            }

            var lv = targetView as AILinkView;

            if (lv != null)
            {
                var cav = qv.actionView as CompositeActionView;
                if (cav != null)
                {
                    var ca           = (CompositeAction)cav.action;
                    var newConnector = new AILinkAction(lv.aiId);

                    _undoRedo.Do(new ConnectCompositeOperation(cav, ca.connectorAction, newConnector));
                    ca.connectorAction = newConnector;
                    cav.targetView     = null;
                    return(true);
                }

                av = new AILinkActionView
                {
                    targetAI = lv,
                    action   = new AILinkAction(lv.aiId),
                    parent   = qv
                };
            }

            if (av != null)
            {
                SetAction(av, qv);
                return(true);
            }

            return(false);
        }