public Tree_View_Card(ref Card_Collection coll)
        {
            _children = new List <Tree_View_Card>();
            _parentId = -1;

            _cardCollection = coll;
        }
        public Tree_View_Card(int id, string name, int parentId, ref Card_Collection coll)
        {
            _children = new List <Tree_View_Card>();
            _id       = id;
            _parentId = parentId;


            _cardCollection = coll;
        }
Beispiel #3
0
        public void CalcInherittableProperties(ref Card_Collection allCardsRef)
        {
            if (_regions.Count >= 1)
            {
                // Outer List is one per region
                // Inner List is per region
                List <Inherittable_Properties>[] properties = new List <Inherittable_Properties> [_regions.Count];

                for (int i = 0; i < _regions.Count; ++i)
                {
                    properties[i] = new List <Inherittable_Properties>();
                }

                if (ParentCard != -1)
                {
                    Card parentCard = allCardsRef.Find_Card_In_Collection(ParentCard);

                    parentCard.CalcInherittableProperties(ref allCardsRef);

                    for (int i = 0; i < _regions.Count; ++i)
                    {
                        foreach (Card_Region j in parentCard._regions)
                        {
                            if (_regions[i].id == j.id)
                            {
                                properties[i].Add(j.RenderInherittableProperties);
                            }
                        }
                    }
                }

                _regions[0].SetRenderInherittableProperties(properties[0]);

                Inherittable_Properties baseCardProperties = _regions[0].RenderInherittableProperties;

                // Don't inherit base card background
                baseCardProperties.ImageProperties.BackgroundImageFillType = IMAGE_OPTIONS.None;

                for (int i = 1; i < _regions.Count; ++i)
                {
                    if (_regions[i].InheritRegionBeforeCard)
                    {
                        properties[i].Add(baseCardProperties);
                    }
                    else
                    {
                        properties[i].Insert(0, baseCardProperties);
                    }

                    _regions[i].SetRenderInherittableProperties(properties[i]);
                }
            }
        }
Beispiel #4
0
        public DrawingGroup Render_Card(Rect location, ref Card_Collection allCardsRef)
        {
            CalcInherittableProperties(ref allCardsRef);

            DrawingGroup card_drawing = new DrawingGroup();

            if (location.Height == 0 || location.Width == 0)
            {
                return(card_drawing);
            }

            Inherittable_Properties renderProperties = new Inherittable_Properties();

            Card parentCard = new Card();

            if (ParentCard != -1)
            {
                parentCard = allCardsRef.Find_Card_In_Collection(ParentCard);
            }

            foreach (Card_Region i in Regions)
            {
                if (ParentCard != -1)
                {
                    foreach (Card_Region j in parentCard.Regions)
                    {
                        if (i.id == j.id)
                        {
                        }
                    }
                }
                Rect draw_location = new Rect
                {
                    X      = location.X + i.ideal_location.X * location.Width,
                    Y      = location.Y + i.ideal_location.Y * location.Height,
                    Width  = location.Width * i.ideal_location.Width,
                    Height = location.Height * i.ideal_location.Height
                };

                card_drawing.Children.Add(i.Draw_Region(draw_location));
            }

            return(card_drawing);
        }
Beispiel #5
0
        public List <Tree_View_Card> Get_Tree_View_Template_Cards(ref Card_Collection coll)
        {
            var onlyTemplateCards = new List <Card>();

            foreach (Card i in _cards)
            {
                if (i.IsTemplateCard)
                {
                    onlyTemplateCards.Add(i);
                }
            }

            List <Tree_View_Card> result = new List <Tree_View_Card>();

            if (onlyTemplateCards.Count >= 1)
            {
                result = Get_Tree_View_Template_Cards_For_Parent(-1, ref coll);
            }
            result.Add(new Tree_View_Card(-2, "<New>", -1, ref coll));

            return(result);
        }
Beispiel #6
0
        private List <Tree_View_Card> Get_Tree_View_Template_Cards_For_Parent(int searchParentId, ref Card_Collection coll)
        {
            List <Tree_View_Card> result = new List <Tree_View_Card>();


            foreach (Card i in _cards)
            {
                if (i.ParentCard == searchParentId)
                {
                    Tree_View_Card tmp = new Tree_View_Card(i.Id, i.Name, i.ParentCard, ref coll);
                    tmp.Children = Get_Tree_View_Template_Cards_For_Parent(i.Id, ref coll);

                    result.Add(tmp);
                }
            }

            return(result);
        }