コード例 #1
0
ファイル: Script.cs プロジェクト: JustasUnity/MouseRobot
        /// <summary>
        /// Adds non existant command to script bottom
        /// </summary>
        public Command AddCommand(Command command, Command parentCommand = null)
        {
            Debug.Assert(!Commands.GetAllNodes().Select(n => n.value).Contains(command), "Command should not exist on script");

            m_IsDirty = true;

            var nodeToAddCommand = parentCommand == null ? Commands : Commands.GetNodeFromValue(parentCommand);

            m_CommandGuidMap.AddGuidToMapAndGenerateUniqueIfNeeded(command);


            nodeToAddCommand.AddChild(command);
            CommandAddedToScript?.Invoke(this, parentCommand, command);

            CheckCommandGuidConsistency();
            return(command);
        }
コード例 #2
0
ファイル: Script.cs プロジェクト: JustasUnity/MouseRobot
        /// <summary>
        /// Adds non existant command node to bottom of the script/parent with all its children.
        /// Calls CommandAdded event with root command of the node.
        /// </summary>
        public Command AddCommandNode(TreeNode <Command> commandNode, Command parentCommand = null)
        {
            Debug.Assert(!Commands.GetAllNodes().Contains(commandNode), "Command Node should not exist on script. Did you forget to remove it?");

            m_IsDirty = true;

            foreach (var node in commandNode.GetAllNodes(true))
            {
                m_CommandGuidMap.AddGuidToMapAndGenerateUniqueIfNeeded(node.value);
            }

            var nodeToAddCommand = parentCommand == null ? Commands : Commands.GetNodeFromValue(parentCommand);

            nodeToAddCommand.Join(commandNode);

            CommandAddedToScript?.Invoke(this, parentCommand, commandNode.value);

            CheckCommandGuidConsistency();
            return(commandNode.value);
        }
コード例 #3
0
 private void InvokeCommandAddedToScript(Script script, Command parentCommand, Command command)
 {
     CommandAddedToScript?.Invoke(script, parentCommand, command);
 }