Пример #1
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]);
                }
            }
        }
Пример #2
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);
        }