Exemple #1
0
        private void CantCloseBlock(StatementTypes type)
        {
            string error;

            if (type == StatementTypes.LOOP)
            {
                if (currentBlock.parent is BlockFor)
                {
                    error = ERROR_MISSING_ENDIF;
                    CloseParentBlock();
                }
                else
                {
                    error = ERROR_EXTRA_NEXT;
                }
            }
            else
            {
                if (currentBlock.parent is BlockIf)
                {
                    error = ERROR_MISSING_NEXT;
                    CloseParentBlock();
                }
                else
                {
                    error = ERROR_EXTRA_ENDIF;
                }
            }

            errors.Add(error);
        }
Exemple #2
0
 public Statement(Block block, StatementTypes sType, Variable.Object var, Variable.Object val, string note) {
     gBlock = block;
     gAct = gBlock.Actuator;
     gStatementType = sType;
     //gArgs = args;
     gObjVar = var;
     gObjVal = val;
     gszNote = note;
 }
Exemple #3
0
        private void OpenBlock(StatementTypes type)
        {
            if (type == StatementTypes.LOOP)
            {
                currentBlock.child = new BlockFor(currentBlock, null);
            }
            else
            {
                currentBlock.child = new BlockIf(currentBlock, null);
            }

            currentBlock = currentBlock.child;
        }
Exemple #4
0
        private void CloseBlock(StatementTypes type)
        {
            bool hasNoChild      = (currentBlock.child == null);
            bool isExpectedBlock = (type == StatementTypes.LOOP) ? (currentBlock is BlockFor) : (currentBlock is BlockIf);

            if (hasNoChild && isExpectedBlock)
            {
                CloseCurrentBlock();
            }
            else
            {
                CantCloseBlock(type);
            }
        }
Exemple #5
0
        public NewStatementForm(HTNEditorForm parent, List <Variable> variables, StatementTypes type)
        {
            InitializeComponent();
            this.parent                      = parent;
            this.PossibleVariables           = variables;
            variableBindingSource.DataSource = PossibleVariables;
            switch (type)
            {
            case StatementTypes.Condition:
                Text = "New Conditon";
                break;

            case StatementTypes.Effect:
                Text = "New Effect";
                break;

            default:
                break;
            }
        }
Exemple #6
0
 public Statement(string name, StatementTypes type)
 {
     Name = name; this.type = type;
 }