コード例 #1
0
        private static ActionView ReadActionView(StageElement ave, QualifierView parent)
        {
            var connectorType = ave.AttributeValueOrDefault <string>(AttributeName.ConnectorType, null);

            ActionView av;

            if (connectorType == ConnectorType.Selector)
            {
                av = new SelectorActionView();
            }
            else if (connectorType == ConnectorType.AILink)
            {
                av = new AILinkActionView();
            }
            else if (connectorType == ConnectorType.Composite)
            {
                av = new CompositeActionView();
            }
            else
            {
                av = new ActionView();
            }

            av.name        = ave.ValueOrDefault <string>(ElementName.Name, null);
            av.description = ave.ValueOrDefault <string>(ElementName.Description, null);
            av.parent      = parent;

            return(av);
        }
コード例 #2
0
ファイル: AIUI.cs プロジェクト: xwf20050250/Apex-Game-Tools
        internal void ReplaceAction(QualifierView qv, IAction replacement, bool recordUndo = true)
        {
            var av = qv.actionView;

            if (av == null)
            {
                return;
            }

            if (recordUndo)
            {
                _undoRedo.Do(new ReplaceActionOperation(this, av.action, replacement, qv));

                //We don't want to clone during undo/redo as the cloning is recorded
                TryClone(av.action, replacement);
            }

            if (av is CompositeActionView && !(replacement is CompositeAction))
            {
                var tmp = new ActionView();
                tmp.parent      = qv;
                tmp.name        = av.name;
                tmp.description = av.description;
                av            = tmp;
                qv.actionView = av;
            }
            else if (!(av is CompositeActionView) && replacement is CompositeAction)
            {
                var tmp = new CompositeActionView();
                tmp.parent      = qv;
                tmp.name        = av.name;
                tmp.description = av.description;
                av            = tmp;
                qv.actionView = av;
            }
            else if (av is IConnectorActionView)
            {
                //For replacement of other connector views we need to reset to a normal ActionView.
                //Since it is not possible to replace an action with a connector, we don't handle the reverse.
                var tmp = new ActionView();
                tmp.parent      = qv;
                tmp.name        = av.name;
                tmp.description = av.description;
                av            = tmp;
                qv.actionView = av;
            }

            av.action           = replacement;
            qv.qualifier.action = replacement;

            //Need to refresh editor
            this.inspectorState.Refresh();

            this.isDirty = true;
        }
コード例 #3
0
ファイル: AIUI.cs プロジェクト: xwf20050250/Apex-Game-Tools
        internal void ResetConnection(CompositeActionView cav, bool recordUndo = true)
        {
            var ca = (CompositeAction)cav.action;

            if (recordUndo)
            {
                _undoRedo.Do(new ConnectCompositeOperation(cav, ca.connectorAction, null));
            }

            ca.connectorAction = null;
            cav.targetView     = null;
        }