コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SkillsForm"/> class.
        /// </summary>
        /// <param name="cooldownManager">The skill cooldown manager.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="knownSkills">The known skills.</param>
        /// <exception cref="ArgumentNullException"><paramref name="knownSkills" /> is <c>null</c>.</exception>
        public SkillsForm(ISkillCooldownManager cooldownManager, Vector2 position, Control parent,
                          KnownSkillsCollection knownSkills) : base(parent, position, new Vector2(32, 32))
        {
            if (knownSkills == null)
            {
                throw new ArgumentNullException("knownSkills");
            }

            _knownSkills = knownSkills;

            IsVisible = false;

            _cooldownManager = cooldownManager;

            var fontLineSpacing = Font.GetLineSpacing();

            // Find the spacing to use between lines
            _lineSpacing = (int)Math.Max(fontLineSpacing, _iconSize.Y);

            // Create all the skills
            var offset = Vector2.Zero;

            foreach (var skillType in EnumHelper <SkillType> .Values)
            {
                CreateSkillEntry(offset, skillType);
                offset += new Vector2(0, _lineSpacing);
            }
        }
コード例 #2
0
            public SkillPictureBox(SkillsForm parent, SkillInfo <SkillType> skillInfo, Vector2 position)
                : base(parent, position, _iconSize)
            {
                _knownSkills = parent.KnownSkills;

                SkillInfo        = skillInfo;
                Sprite           = new Grh(GrhInfo.GetData(SkillInfo.Icon));
                _cooldownManager = parent.CooldownManager;
            }