private void NodeRecursiveAdd(NodeGraphBuilder builder, ISkillNode data)
        {
            if (data.Hide)
            {
                return;
            }

            if (data.IsGroup)
            {
                builder.AddGroup();
                data.GetSortedChildren().ForEach(child => NodeRecursiveAdd(builder, child));

                if (data.GroupEnd != null)
                {
                    builder.EndGroup(data.GroupEnd.DisplayName, data.GroupEnd.Graphic);
                    SetNodeDetails(builder, data.GroupEnd);
                    data.GroupEnd.GetSortedChildren().ForEach(child => NodeRecursiveAdd(builder, child));
                }

                builder.End();
            }
            else
            {
                builder.Add(data.DisplayName, data.Graphic);
                SetNodeDetails(builder, data);

                data.GetSortedChildren().ForEach(child => NodeRecursiveAdd(builder, child));
                builder.End();
            }
        }
Exemple #2
0
        public void interpretEffect(string effect)
        {
            SkillLexer  lex    = new SkillLexer(effect);
            SkillParser parser = new SkillParser(lex);

            this.effect = parser.getTree();
        }
Exemple #3
0
        ISkillNode Brack()
        {
            Eat(SkillType.LBRACKET);
            ISkillNode n = Maths();

            Eat(SkillType.RBRACKET);
            return(n);
        }
 private void SetNodeDetails(NodeGraphBuilder builder, ISkillNode data)
 {
     builder.Description(data.Description)
     .NodeType(data.NodeType)
     .Purchased(data.IsPurchased)
     .IsPurchasable(() => IsPurchasable(data))
     .OnPurchase(() => { ChangePoints(data, -1); })
     .OnRefund(() => { ChangePoints(data, 1); })
     .IsLocked(() => currentLevel < data.RequiredLevel)
     .LockedDescription(() => $"Level {data.RequiredLevel} is required.")
     .OnClickNode((node) => context.Open(node));
 }
Exemple #5
0
        ISkillNode Mult()
        {
            ISkillNode n = Pow();

            while (currentToken.Type == SkillType.MULTI || currentToken.Type == SkillType.DIVIDE)
            {
                Token t = currentToken;
                Eat(t.Type);
                n = new BinOp(n, Pow(), t);
            }
            return(n);
        }
Exemple #6
0
        ISkillNode Add()
        {
            ISkillNode n = Mult();

            while (currentToken.Type == SkillType.PLUS || currentToken.Type == SkillType.MINUS)
            {
                Token t = currentToken;
                Eat(t.Type);
                n = new BinOp(n, Mult(), t);
            }
            return(n);
        }
        private bool IsPurchasable(ISkillNode data)
        {
            switch (data.NodeType)
            {
            case NodeType.Skill:
                return(skillPoints > 0);

            case NodeType.Ability:
                return(abilityPoints > 0);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void ChangePoints(ISkillNode data, int amount)
        {
            switch (data.NodeType)
            {
            case NodeType.Skill:
                skillPoints += amount;
                break;

            case NodeType.Ability:
                abilityPoints += amount;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            UpdatePoints();
        }
Exemple #9
0
 public void AddStatement(ISkillNode s)
 {
     statements.Add(s);
 }
 public SkillAssignment(ISkillNode l, ISkillNode r)
 {
     left  = l as SkillStatNode;
     right = r;
 }
Exemple #11
0
 public BinOp(ISkillNode l, ISkillNode r, Token op)
 {
     left      = l;
     right     = r;
     Operation = op.Type;
 }