예제 #1
0
        public BinderSkill(DataSkill dataSkill, SkillCollection skillCollection, List<BinderSkill> playerListeners)
        {
            this.skillCollection = skillCollection;
            this.playerListeners = playerListeners;

            bindDataSkill(dataSkill);

            skill = new Skill();
            populateSkill(skill);
            bindSkill(skill);
        }
예제 #2
0
        public TabSkills(PlayerDataFile playerDataFile)
            : base()
        {
            this.playerDataFile = playerDataFile;
            Text = "Skills";

            skillList = new SkillCollection(playerDataFile.skills.skillDictionary, playerDataFile.level, playerListeners);

            panel = new TableLayoutPanel();

            panel.Dock = DockStyle.Fill;

            TableLayoutPanel general = new TableLayoutPanel();
            general.Dock = DockStyle.Fill;

            TextBoxPlayerLevel playerLevelBox = new TextBoxPlayerLevel(playerDataFile.level, 1, DataSkill.maxPlayerLevel, playerListeners);
            LabeledBox labeledPlayerLevelBox = new LabeledBox("Player level", playerLevelBox);
            general.Controls.Add(labeledPlayerLevelBox);

            TextBoxInt skillPointsBox = new TextBoxInt(playerDataFile.skillPoints, 0, 10000);
            LabeledBox labeledSkillPointsBox = new LabeledBox("Skill points", skillPointsBox);
            general.Controls.Add(labeledSkillPointsBox);

            panel.Controls.Add(general);

            TableLayoutPanel skillsPanel = new TableLayoutPanel();
            skillsPanel.Dock = DockStyle.Fill;
            skillsPanel.AutoScroll = true;

            List<SlotSkill> skillSlotList = new List<SlotSkill>();

            foreach (BinderSkill binderSkill in skillList.skillList)
            {
                SlotSkill skillSlot = new SlotSkill(binderSkill);

                skillSlotList.Add(skillSlot);
            }

            int count = skillSlotList.Count;
            int perColumn = count / 7;
            int extraColumns = count % 7;
            int done = 0;

            for (int i = 0; i < 7; i++)
            {
                int thisColumn = perColumn;

                if (extraColumns > 0)
                {
                    thisColumn++;
                    extraColumns--;
                }

                for (int j = 0; j < thisColumn; j++)
                {
                    skillsPanel.Controls.Add(skillSlotList[done], i, j);
                    done++;
                }
            }

            panel.Controls.Add(skillsPanel, 0, 1);

            Controls.Add(panel);
        }