コード例 #1
0
        public Inherittable_Properties Clone()
        {
            Inherittable_Properties result = (Inherittable_Properties)MemberwiseClone();

            result._imageProperties = _imageProperties.Clone();
            result._stringContainer = _stringContainer.Clone();

            return(result);
        }
コード例 #2
0
        public Inherittable_Properties GetInherittedPropertiesMerging(Inherittable_Properties Source)
        {
            Inherittable_Properties result = Clone();

            result.ImageProperties = result._imageProperties.GetInherittedPropertiesMerging(Source._imageProperties);
            result.StringContainer = result._stringContainer.GetInherittedPropertiesMerging(Source._stringContainer);

            return(result);
        }
コード例 #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]);
                }
            }
        }
コード例 #4
0
ファイル: Card_Region.cs プロジェクト: MichalKyle/TCG_Creator
        public void SetRenderInherittableProperties(List <Inherittable_Properties> Properties)
        {
            _renderProperties = _desiredProperties.Clone();

            if (Properties != null)
            {
                foreach (Inherittable_Properties i in Properties)
                {
                    _renderProperties = _renderProperties.GetInherittedPropertiesMerging(i);
                }
            }
        }
コード例 #5
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);
        }