コード例 #1
0
ファイル: Spirit.cs プロジェクト: rettigcd/spiritisland
    /// <summary>
    /// Checks all elements that are available to spirit.
    /// </summary>
    public virtual bool CouldHaveElements(ElementCounts subset)
    {
        // For normal spirits without Prepared Elements, this is only the normal Elements
        int wildCount = Elements[Element.Any];

        return(wildCount == 0 ? Elements.Contains(subset)              // no 'wild-card' elements, Elements must contain subset
                        : subset.Except(Elements).Count <= wildCount); // Find missing elements and count if they are less than our 'wild-card' elements
    }
コード例 #2
0
        public void DrawFromLayout(Graphics graphics, CachedImageDrawer imageDrawer, ElementCounts activatedElements,
                                   InnatePower[] innateOptions, IDrawableInnateOption[] innateGroupOptions
                                   )
        {
            if (backgroundCache == null)
            {
                this.imageDrawer   = imageDrawer;
                using var boldFont = layout.BuildBoldFont();
                DrawBackgroundImage(boldFont);
                InitOverlayCache(boldFont);
            }

            // Background Layer
            graphics.DrawImage(backgroundCache, layout.Bounds);

            this.graphics = graphics;
            // Middle Layer - Available
            foreach (WrappingText_InnateOptions wrappintText in layout.Options)
            {
                if (activatedElements.Contains(wrappintText.GroupOption.Elements))
                {
                    graphics.FillRectangle(Brushes.PeachPuff, wrappintText.Bounds);
                }
            }

            // Overlay text / images
            graphics.DrawImage(overlayCache, layout.Bounds);

            // Selected Innate Power
            if (innateOptions.Contains(power))
            {
                using Pen highlightPen = new(Color.Red, 2f);
                graphics.DrawRectangle(highlightPen, layout.Bounds);
            }
            // Selected Innat Option Group
            foreach (var x in layout.Options)
            {
                if (innateGroupOptions.Contains(x.GroupOption))
                {
                    using Pen highlightPen = new(Color.Red, 2f);
                    graphics.DrawRectangle(highlightPen, x.Bounds);
                }
            }
        }