コード例 #1
0
ファイル: SkillBox.cs プロジェクト: Invisi/Blish-HUD
        protected override void Paint(SpriteBatch spriteBatch, Rectangle bounds)
        {
            int VertOffset = 0;
            int HorzOffset = 0;

            if (this.HasDropdown)
            {
                if (this.Direction == SkillBoxDirection.Up)
                {
                    VertOffset = this.BoxScale == SkillBoxSize.Normal ? ARROW_DIMENSIONATSCALE_NORMAL : ARROW_DIMENSIONATSCALE_SMALL;
                }
                else if (this.Direction == SkillBoxDirection.Left)
                {
                    HorzOffset = this.BoxScale == SkillBoxSize.Normal ? ARROW_DIMENSIONATSCALE_NORMAL : ARROW_DIMENSIONATSCALE_SMALL;
                }
            }

            var primaryTileBounds = new Rectangle(HorzOffset, VertOffset, BOX_DIMENSIONSATSCALE_NORMAL, BOX_DIMENSIONSATSCALE_NORMAL).OffsetBy(bounds.Location);

            if (!animPulseLoad.Active)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-blank"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            if (this.Icon != null)
            {
                if (animFlipIcon == null)
                {
                    spriteBatch.Draw(this.Icon, primaryTileBounds.OffsetBy(bounds.Location), new Rectangle(16, 16, 96, 96), Color.White);
                }
                else
                {
                    spriteBatch.Draw(this.Icon, primaryTileBounds.Add(0, animFlipIcon.CurrentValueInt / 2, 0, Math.Max(-animFlipIcon.CurrentValueInt, -primaryTileBounds.Height + 1)).OffsetBy(bounds.Location), new Rectangle(16, 16, 96, 96), Color.White);
                }
            }
            else
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-blank"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            if (animPulseLoad.Active)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion($"skillbox/sb-anim1-f{animPulseLoad.CurrentValueInt}"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-outline"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);

            if (this.MouseOver)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-hover"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            //if (this.Dropped && Items.Count == 0)
            //    spriteBatch.Draw(controlAtlas.GetRegion("skillbox/sb-close"), primaryTileBounds, Color.White * (this.MouseOver ? 0.8f : 1f));
        }
コード例 #2
0
ファイル: Checkbox.cs プロジェクト: Invisi/Blish-HUD
        private static void LoadSprites()
        {
            if (_spritesLoaded)
            {
                return;
            }

            cbRegions = new List <TextureRegion2D>();

            cbRegions.AddRange(new TextureRegion2D[] {
                ControlAtlas.GetRegion("checkbox/cb-unchecked"),
                ControlAtlas.GetRegion("checkbox/cb-unchecked-active"),
                ControlAtlas.GetRegion("checkbox/cb-unchecked-disabled"),
                ControlAtlas.GetRegion("checkbox/cb-checked"),
                ControlAtlas.GetRegion("checkbox/cb-checked-active"),
                ControlAtlas.GetRegion("checkbox/cb-checked-disabled"),
            });

            _spritesLoaded = true;
        }